Package org.apache.stanbol.entityhub.indexing.core.config

Examples of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig


    @Test(expected=IllegalArgumentException.class)
    public void missingConfig(){
        //this should create the specified folder and than throw an
        //illegalArgumentException because the indexing.properties file can not
        //be found in the classpath under
        new IndexingConfig(CONFIG_ROOT+"noConfig",CONFIG_ROOT+"noConfig"){};
    }
View Full Code Here


     * In this case the config exists in the classpath, but is not valid because
     * the required indexing.properties is missing
     */
    @Test(expected=IllegalArgumentException.class)
    public void missingConfigDir(){
        new IndexingConfig(CONFIG_ROOT+"missingconfig",CONFIG_ROOT+"missingconfig"){};
    }
View Full Code Here

     * parsing of configuration files
     */
    @Test
    public void loadSimpleConfigDir() throws IOException {
        String name = CONFIG_ROOT+"simple";
        IndexingConfig config = new IndexingConfig(name,name){};
        //assert that this directory exists (is created)
        File expectedRoot = new File(testRoot,name);
        expectedRoot = new File(expectedRoot,"indexing");
        assertTrue("Root Dir not created",expectedRoot.isDirectory());
        assertEquals("Root dir other the expected ",
            expectedRoot.getCanonicalPath(),config.getIndexingFolder().getCanonicalPath());
        assertTrue(config.getConfigFolder().isDirectory());
        assertTrue(config.getSourceFolder().isDirectory());
        assertTrue(config.getDestinationFolder().isDirectory());
        assertTrue(config.getDistributionFolder().isDirectory());
        //test the name
        assertEquals(config.getName(),"simple");
        assertEquals(config.getDescription(), "Simple Configuration");
        //test if the normaliser configuration was parsed correctly!
        final ScoreNormaliser normaliser = config.getNormaliser();
        //test if the config files where copied form the classpath to the
        //config directory.
        assertTrue("Config File for the RangeNormaliser not copied",
            new File(config.getConfigFolder(),"range.properties").isFile());
        assertTrue("Config File for the MinScoreNormalizer not copied",
            new File(config.getConfigFolder(),"minscore.properties").isFile());
        //now test if the configuration was parsed correctly
        ScoreNormaliser testNormaliser = normaliser;
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), RangeNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), NaturalLogNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), MinScoreNormalizer.class);
        EntityIterator entityIterator = config.getEntityIdIterator();
        assertNotNull(entityIterator);
        assertEquals(entityIterator.getClass(), LineBasedEntityIterator.class);
        if(entityIterator.needsInitialisation()){
            entityIterator.initialise();
        }
        Map<String,Float> entityIds = new HashMap<String,Float>();
        //the values test if the normaliser configuration was readed correctly
        //the keys if the configured entiyScore file was configured correctly
        float boost = 10f/(float)Math.log1p(100);
        entityIds.put("http://www.example.org/entity/test", Float.valueOf(10));
        entityIds.put("http://www.example.org/entity/test2", Float.valueOf((float)(Math.log1p(10)*boost)));
        entityIds.put("http://www.example.org/entity/test3", Float.valueOf(-1));
        while(entityIterator.hasNext()){
            EntityIterator.EntityScore entityScore = entityIterator.next();
            Float expectedScore = entityIds.remove(entityScore.id);
            assertNotNull("Entity with ID "+entityScore.id+" not found!",expectedScore);
            Float score = normaliser.normalise(entityScore.score);
            assertTrue("Entity score "+score+" is not the expected "+expectedScore,expectedScore.compareTo(score)==0);
        }
        assertTrue(entityIds.isEmpty());
        List<EntityProcessor> processors = config.getEntityProcessors();
        assertNotNull(processors);
    }
View Full Code Here

        //instance needs to be created
        StandaloneManagedSolrServer.shutdownManagedServer();
    }
    @Test(expected=IllegalArgumentException.class)
    public void testMissingBoostConfig(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"missingBoostConfig",CONFIG_ROOT+"missingBoostConfig"){};
        config.getIndexingDestination();
    }
View Full Code Here

        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"missingBoostConfig",CONFIG_ROOT+"missingBoostConfig"){};
        config.getIndexingDestination();
    }
    @Test(expected=IllegalArgumentException.class)
    public void testInvalidBoostConfig(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"invalidBoostConfig",CONFIG_ROOT+"invalidBoostConfig"){};
        config.getIndexingDestination();
    }
View Full Code Here

     * Tests that the Solr configuration is required, but the name of the config
     * file is the default. The referenced directory is missing
     */
    @Test(expected=IllegalArgumentException.class)
    public void testMissingDefaultSolrSchemaConfig(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"missingDefaultSolrConf",CONFIG_ROOT+"missingDefaultSolrConf"){};
        config.getIndexingDestination();
    }
View Full Code Here

     * Tests that the Solr configuration is required and the name of the config
     * file is specified. The referenced directory is missing
     */
    @Test(expected=IllegalArgumentException.class)
    public void testMissingSolrSchemaConfig(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"missingSolrConf",CONFIG_ROOT+"missingSolrConf"){};
        config.getIndexingDestination();
    }
View Full Code Here

        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"missingSolrConf",CONFIG_ROOT+"missingSolrConf"){};
        config.getIndexingDestination();
    }
    @Test
    public void testSimple() throws YardException, IOException {
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"simple",CONFIG_ROOT+"simple"){};
        validateSolrDestination(config);
    }
View Full Code Here

        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"simple",CONFIG_ROOT+"simple"){};
        validateSolrDestination(config);
    }
    @Test
    public void testWithSolrConf() throws YardException, IOException {
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"withSolrConf",CONFIG_ROOT+"withSolrConf"){};
        validateSolrDestination(config);
    }
View Full Code Here

    public static void cleanup(){
        System.setProperty("user.dir", userDir);
    }
    @Test
    public void testEntityDataIterable(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"iterable",CONFIG_ROOT+"iterable"){};
        EntityDataIterable iterable = config.getDataInterable();
        assertNotNull(iterable);
        assertEquals(iterable.getClass(), RdfIndexingSource.class);
        assertTrue(iterable.needsInitialisation());
        iterable.initialise();
        EntityDataIterator it = iterable.entityDataIterator();
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.