Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.Configuration


public class ConfigLoaderTest {

  @Test
  public void testEmpty() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-empty.xml");

    assertTrue(config.getDataSources().isEmpty());
    assertTrue(config.getDataSources(1).isEmpty());
    assertTrue(config.getDataSources(2).isEmpty());
    assertEquals(config.getThreshold(), 0.4);
    assertEquals(config.getMaybeThreshold(), 0.0);
    assertTrue(config.getProperties().isEmpty());
  }
View Full Code Here


      "<schema>" +
      "<threshold>0.4</threshold>" +
      "</schema>" +
      "</duke>";

    Configuration config = ConfigLoader.loadFromString(cfg);

    assertTrue(config.getDataSources().isEmpty());
    assertTrue(config.getDataSources(1).isEmpty());
    assertTrue(config.getDataSources(2).isEmpty());
    assertEquals(config.getThreshold(), 0.4);
    assertEquals(config.getMaybeThreshold(), 0.0);
    assertTrue(config.getProperties().isEmpty());
  }
View Full Code Here

    }
  }

  @Test
  public void testDefaultProbs() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-default-probs.xml");
    Property prop = config.getPropertyByName("FIRSTNAME");
    assertEquals(0.5, prop.getHighProbability());
    assertEquals(0.5, prop.getLowProbability());
    assertEquals(Property.Lookup.DEFAULT, prop.getLookupBehaviour());
  }
View Full Code Here

    assertEquals(Property.Lookup.DEFAULT, prop.getLookupBehaviour());
  }

  @Test
  public void testDefaultComparator() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-no-comparator.xml");
    Property prop = config.getPropertyByName("LASTNAME");
    assertEquals(null, prop.getComparator());
    assertEquals(Property.Lookup.DEFAULT, prop.getLookupBehaviour());
  }
View Full Code Here

    assertEquals(Property.Lookup.DEFAULT, prop.getLookupBehaviour());
  }

  @Test
  public void testLookup() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-lookup.xml");

    Property prop = config.getPropertyByName("FIRSTNAME");
    assertEquals(Property.Lookup.REQUIRED, prop.getLookupBehaviour());

    prop = config.getPropertyByName("LASTNAME");
    assertEquals(Property.Lookup.DEFAULT, prop.getLookupBehaviour());
  }
View Full Code Here

    assertEquals(Property.Lookup.DEFAULT, prop.getLookupBehaviour());
  }

  @Test
  public void testDatabase() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-database.xml");
    Database db = config.getDatabase(false);
    LuceneDatabase lucene = (LuceneDatabase) db;
    assertEquals("/tmp/ct-visma-1", lucene.getPath());
  }
View Full Code Here

    }
  }

  @Test
  public void testCustomComparator() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-custom-comparator.xml");

    List<Comparator> comparators = config.getCustomComparators();

    assertEquals(1, comparators.size());
  }
View Full Code Here

    assertEquals(1, comparators.size());
  }

  @Test
  public void testCustomEstimator() throws IOException, SAXException {
    Configuration config = ConfigLoader.load("classpath:config-custom-estimator.xml");

    List<Comparator> comparators = config.getCustomComparators();
    assertEquals(1, comparators.size());

    WeightedLevenshtein wl = (WeightedLevenshtein) comparators.get(0);
    DefaultWeightEstimator est = (DefaultWeightEstimator) wl.getEstimator();
    assertEquals(3.8, est.getDigitWeight());
View Full Code Here

        logger = (Logger) ObjectUtils.instantiate(loggerclass);
        logger.debug("DukeController starting up");
      }

      // loading configuration
      Configuration config = ConfigLoader.load(configfile);
      this.processor = new Processor(config, false);
      this.linkdb = makeLinkDatabase(props);
      processor.addMatchListener(new LinkDatabaseMatchListener(config, linkdb));
      processor.addMatchListener(this);
      batch_size = get(props, "duke.batch-size", 40000);
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.Configuration

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.