Examples of IndexingConfig


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

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

     * 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

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

     * 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

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

        //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

Examples of org.infinispan.config.FluentConfiguration.IndexingConfig

         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());

      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
View Full Code Here

Examples of org.infinispan.config.FluentConfiguration.IndexingConfig

         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());

      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
View Full Code Here

Examples of org.infinispan.config.FluentConfiguration.IndexingConfig

         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());
        
      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
        
View Full Code Here

Examples of org.infinispan.config.FluentConfiguration.IndexingConfig

         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());
        
      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
        
View Full Code Here

Examples of org.infinispan.config.FluentConfiguration.IndexingConfig

         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());
        
      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
        
View Full Code Here

Examples of org.infinispan.config.FluentConfiguration.IndexingConfig

         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());

      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.