Пример #1
0
 public void testLoadPlain() {
   try {
     Scenario scenario = UtilityTest.loadScenarioFromResources(References.bookPublisher_plain);
     Assert.assertNotNull(scenario);
     Assert.assertNotNull(scenario.getSource());
     Assert.assertEquals(4, scenario.getSource().getTableNames().size());
     Assert.assertTrue(scenario.getSource().getTableNames().contains("IBDBookSet"));
     Assert.assertTrue(scenario.getSource().getTableNames().contains("IBLBookSet"));
     Assert.assertTrue(scenario.getSource().getTableNames().contains("IBLPublisherSet"));
     Assert.assertTrue(scenario.getSource().getTableNames().contains("LOCSet"));
     Assert.assertEquals(3, UtilityTest.getSize(scenario.getSource().getTable("IBDBookSet")));
     Assert.assertEquals(2, UtilityTest.getSize(scenario.getSource().getTable("LOCSet")));
     Assert.assertEquals(2, UtilityTest.getSize(scenario.getSource().getTable("IBLBookSet")));
     Assert.assertEquals(2, UtilityTest.getSize(scenario.getSource().getTable("IBLPublisherSet")));
     Assert.assertNotNull(scenario.getTarget());
     Assert.assertEquals(2, scenario.getTarget().getTableNames().size());
     Assert.assertEquals(0, UtilityTest.getSize(scenario.getTarget().getTable("BookSet")));
     Assert.assertEquals(0, UtilityTest.getSize(scenario.getTarget().getTable("PublisherSet")));
     Assert.assertNotNull(scenario.getPartialOrder());
     if (logger.isDebugEnabled()) logger.debug(scenario.toString());
   } catch (Exception ex) {
     ex.printStackTrace();
     Assert.fail(ex.getLocalizedMessage());
   }
 }
Пример #2
0
 public void testLoadFunction() {
   try {
     Scenario scenario = UtilityTest.loadScenarioFromResources(References.employees_rew);
     Assert.assertNotNull(scenario);
     Assert.assertNotNull(scenario.getSource());
     Assert.assertEquals(1, scenario.getSource().getTableNames().size());
     Assert.assertTrue(scenario.getSource().getTableNames().contains("S_Employee"));
     Assert.assertEquals(8, UtilityTest.getSize(scenario.getSource().getTable("S_Employee")));
     Assert.assertNotNull(scenario.getTarget());
     Assert.assertEquals(1, scenario.getTarget().getTableNames().size());
     Assert.assertEquals(0, UtilityTest.getSize(scenario.getTarget().getTable("T_Employee")));
     Assert.assertNotNull(scenario.getPartialOrder());
     if (logger.isDebugEnabled()) logger.debug(scenario.toString());
   } catch (Exception ex) {
     ex.printStackTrace();
     Assert.fail(ex.getLocalizedMessage());
   }
 }
Пример #3
0
 public void testLoadOnlyTarget() {
   try {
     Scenario scenario = UtilityTest.loadScenarioFromResources(References.expenseDB);
     Assert.assertNotNull(scenario);
     Assert.assertNotNull(scenario.getSource());
     Assert.assertEquals(0, scenario.getSource().getTableNames().size());
     Assert.assertNotNull(scenario.getTarget());
     Assert.assertEquals(3, scenario.getTarget().getTableNames().size());
     Assert.assertEquals(3, UtilityTest.getSize(scenario.getTarget().getTable("companies")));
     Assert.assertEquals(3, UtilityTest.getSize(scenario.getTarget().getTable("projects")));
     Assert.assertEquals(4, UtilityTest.getSize(scenario.getTarget().getTable("grants")));
     Assert.assertNotNull(scenario.getPartialOrder());
     if (logger.isDebugEnabled()) logger.debug(scenario.toString());
   } catch (Exception ex) {
     ex.printStackTrace();
     Assert.fail(ex.getLocalizedMessage());
   }
 }
Пример #4
0
 public void testLoadNegation() {
   try {
     Scenario scenario = UtilityTest.loadScenarioFromResources(References.companies_rew);
     Assert.assertNotNull(scenario);
     Assert.assertNotNull(scenario.getSource());
     Assert.assertEquals(5, scenario.getSource().getTableNames().size());
     Assert.assertNotNull(scenario.getTarget());
     Assert.assertEquals(2, scenario.getTarget().getTableNames().size());
     Assert.assertNotNull(scenario.getPartialOrder());
     if (logger.isDebugEnabled()) logger.debug(scenario.toString());
   } catch (Exception ex) {
     ex.printStackTrace();
     Assert.fail(ex.getLocalizedMessage());
   }
 }
Пример #5
0
 public void test07() throws Exception {
   String scenarioName = "persons-deps-07";
   Scenario scenario =
       UtilityTest.loadScenarioFromResources(References.persons_deps_07_dbms, true);
   if (logger.isDebugEnabled()) logger.debug(scenario.toString());
   setConfigurationForTest(scenario);
   scenario.getCostManagerConfiguration().setType(LunaticConstants.COST_MANAGER_SIMILARITY);
   scenario.getCostManagerConfiguration().setDoPermutations(false);
   scenario.getConfiguration().setRemoveDuplicates(false);
   DeltaChaseStep result = ChaserFactory.getChaser(scenario).doChase(scenario);
   if (logger.isDebugEnabled()) logger.debug("Scenario " + scenarioName);
   if (logger.isDebugEnabled()) logger.debug(result.toStringWithSort());
   if (logger.isDebugEnabled())
     logger.debug("Number of solutions: " + resultSizer.getPotentialSolutions(result));
   if (logger.isDebugEnabled())
     logger.debug("Number of duplicate solutions: " + resultSizer.getDuplicates(result));
   Assert.assertEquals(1, resultSizer.getPotentialSolutions(result));
   checkSolutions(result);
   //        exportResults("/Temp/expected-" + scenarioName, result);
   checkExpectedSolutions("expected-" + scenarioName, result);
 }