re-integrating branch cdmlib/3.x-unitils-upgrade
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Tue, 28 Feb 2012 14:04:50 +0000 (14:04 +0000)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Tue, 28 Feb 2012 14:04:50 +0000 (14:04 +0000)
1  2 
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/ClassificationServiceImplTest.java
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceImplTest.java
cdmlib-services/src/test/resources/log4j.properties

index 37423244f1715c578a767525f4a9c1a86bba94dc,19dd003cb6d7328b23e1f32bdf34758a5c87563b..98a600cf40e442d6d4d17e7d26373562e50a8107
@@@ -66,10 -67,8 +67,10 @@@ public class ClassificationServiceImplT
      /**
       * Test method for {@link eu.etaxonomy.cdm.api.service.ClassificationServiceImpl#setTaxonNodeComparator(eu.etaxonomy.cdm.model.taxon.ITaxonNodeComparator)}.
       */
-     @Test
//    @Test
      public final void testSetTaxonNodeComparator() {
 +
 +
  //            fail("Not yet implemented");
      }
  
      @Test
      @DataSet
      public final void testTaxonNodeByNameComparator() {
 -      taxonNodeComparator = new TaxonNodeByNameComparator();
 -      Classification classification = service.find(UUID.fromString("6c2bc8d9-ee62-4222-be89-4a8e31770878"));
 +        taxonNodeComparator = new TaxonNodeByNameComparator();
 +        Classification classification = service.find(UUID.fromString("6c2bc8d9-ee62-4222-be89-4a8e31770878"));
  
- //        try {
- //            printDataSet(new FileOutputStream(new File("testTaxonNodeByNameComparator-dump.xml")), new String[] {"DefinedTermBase," +
- //                    "AUDITEVENT", "HIBERNATE_SEQUENCES", "DEFINEDTERMBASE", "DEFINEDTERMBASE_AUD", "DEFINEDTERMBASE_CONTINENT", "DEFINEDTERMBASE_REPRESENTATION",
- //                    "DEFINEDTERMBASE_REPRESENTATION_AUD", "RELATIONSHIPTERMBASE_INVERSEREPRESENTATION", "RELATIONSHIPTERMBASE_INVERSEREPRESENTATION_AUD",
- //                    "REPRESENTATION", "REPRESENTATION_AUD", "TERMVOCABULARY", "TERMVOCABULARY_AUD", "TERMVOCABULARY_REPRESENTATION", "TERMVOCABULARY_REPRESENTATION_AUD" });
- //        } catch (FileNotFoundException e) {
- //            /* IGNORE */
- //        }
+ //            try {
+ //                    printDataSet(new FileOutputStream(new File("testTaxonNodeByNameComparator-dump.xml")), new String[] {"DefinedTermBase"});
+ //            } catch (FileNotFoundException e) {
+ //                    /* IGNORE */
+ //            }
  
 -              //List<TaxonNode> taxonNodes = service.loadRankSpecificRootNodes(classification, Rank.GENUS(), NODE_INIT_STRATEGY);
 +        //List<TaxonNode> taxonNodes = service.loadRankSpecificRootNodes(classification, Rank.GENUS(), NODE_INIT_STRATEGY);
  
 -              List<TaxonNode> taxonNodes = service.getAllNodes();
 -              for (TaxonNode node: taxonNodes){
 -                      taxonNodeService.load(node.getUuid(), NODE_INIT_STRATEGY);
 -              }
 -              TaxonNode nodeGenus = taxonNodeService.find(UUID.fromString("19a4fce2-8be5-4ec7-a6a7-f3974047ba5f"));
 -              int index = taxonNodes.indexOf(nodeGenus);
 -              taxonNodes.remove(index);
 -              Collections.sort(taxonNodes, taxonNodeComparator);
 +        List<TaxonNode> taxonNodes = service.getAllNodes();
 +        for (TaxonNode node: taxonNodes){
 +            taxonNodeService.load(node.getUuid(), NODE_INIT_STRATEGY);
 +        }
 +        TaxonNode nodeGenus = taxonNodeService.find(UUID.fromString("19a4fce2-8be5-4ec7-a6a7-f3974047ba5f"));
 +        int index = taxonNodes.indexOf(nodeGenus);
 +        taxonNodes.remove(index);
 +        Collections.sort(taxonNodes, taxonNodeComparator);
  
-         Assert.assertEquals("Acacia subg. Aculeiferum Pedley", taxonNodes.get(0).getTaxon().getName().getTitleCache());
-         System.err.println();
+               /**
+                * expected order is:
+                *  Acacia subg. Aculeiferum Pedley
+          *  Acacia sect. Botrycephalae Yuji Sasaki
+          *  Acacia subg. Phyllodineae N.Jacobsen, Bastm. & Yuji Sasaki
+          *  Acacia cuspidifolia Maslin
+          *  Acacia mearnsii Benth
+                */
+               logger.setLevel(Level.DEBUG);
+               if(logger.isDebugEnabled()){
+                       logger.debug("-------------");
 -                      for (TaxonNode node: taxonNodes){
 +        for (TaxonNode node: taxonNodes){
-             System.err.println(node.getTaxon().getName().getTitleCache() );
+                               logger.debug(node.getTaxon().getName().getTitleCache() );
 -                      /*for (TaxonNode child : node.getChildNodes()){
 +            /*for (TaxonNode child : node.getChildNodes()){
-                 System.err.println(child.getTaxon().getName().getTitleCache());
+                               logger.debug(child.getTaxon().getName().getTitleCache());
 -                      }*/
 -              }
 +            }*/
 +        }
+               }
+               Assert.assertEquals("Acacia subg. Aculeiferum Pedley", taxonNodes.get(0).getTaxon().getName().getTitleCache());
 -              /*
 -              ((TaxonNodeByNameComparator)taxonNodeComparator).setSortInfraGenericFirst(false);
 -              Collections.sort(taxonNodes, taxonNodeComparator);
 -
 -              Assert.assertEquals("Acacia cuspidifolia Maslin", taxonNodes.get(0).getTaxon().getName().getTitleCache());
 -              System.err.println();
 -              for (TaxonNode node: taxonNodes){
 -              System.err.println(node.getTaxon().getName().getTitleCache() );
 -              /*for (TaxonNode child : node.getChildNodes()){
 -                      System.err.println(child.getTaxon().getName().getTitleCache());
 -              }
 -      }*/
 +        /*
 +        ((TaxonNodeByNameComparator)taxonNodeComparator).setSortInfraGenericFirst(false);
 +        Collections.sort(taxonNodes, taxonNodeComparator);
 +
 +        Assert.assertEquals("Acacia cuspidifolia Maslin", taxonNodes.get(0).getTaxon().getName().getTitleCache());
 +        System.err.println();
 +        for (TaxonNode node: taxonNodes){
 +            System.err.println(node.getTaxon().getName().getTitleCache() );
 +            /*for (TaxonNode child : node.getChildNodes()){
 +                System.err.println(child.getTaxon().getName().getTitleCache());
 +            }
 +        }*/
  //            fail("Not yet implemented");
  
      }
index b23b646572013cbf1bf4cf8d565faaa04366e336,895d8d4caeea40d5c45a2412bcb01b55581fad03..ec3d0d4a2bb0408e3acba0f2b286d83e5ff09057
@@@ -734,17 -774,16 +777,17 @@@ public class TaxonServiceImplTest exten
          nNames = nameService.count(TaxonNameBase.class);\r
          Assert.assertEquals("There should be 4 names left in the database", 4, nNames);\r
          nRelations = service.countAllRelationships();\r
 -        //may change with better implementation of countAllRelationships (see #2653)\r
 -        Assert.assertEquals("There should be 1 name relationship and no synonym relationship in the database", 1, nRelations);\r
 +        Assert.assertEquals("There should be no taxon or synonym relationship in the database", 0, nRelations);\r
 +        nRelations = nameService.getAllRelationships(1000,0).size();\r
 +        Assert.assertEquals("There should be 1 name relationship in the database", 1, nRelations);\r
  \r
      }\r
-     \r
\r
      @Test\r
      @DataSet("TaxonServiceImplTest.testInferredSynonyms.xml")\r
-    \r
+     \r
      public void testCreateInferredSynonymy(){\r
-       \r
\r
        UUID classificationUuid = UUID.fromString("aeee7448-5298-4991-b724-8d5b75a0a7a9");\r
          Classification tree = classificationService.find(classificationUuid);\r
          UUID taxonUuid = UUID.fromString("bc09aca6-06fd-4905-b1e7-cbf7cc65d783");\r
index 81c96ba065ff160052b43c27924621d932314c09,c4364deec10abc9d5e4babc9258dff9ba964a3cd..a1594b709cf90babbcc13227fe6ffdc5b1c9f477
@@@ -27,11 -27,13 +27,12 @@@ log4j.appender.file.layout.ConversionPa
  
  log4j.rootLogger=warn, stdout, file
  
 -      ### *** CDM *** ###
 +  ### *** CDM *** ###
  
  log4j.logger.eu.etaxonomy.cdm = info
 -log4j.logger.eu.etaxonomy.cdm.database.init = warn
  #
  log4j.logger.eu.etaxonomy.cdm.model.common.init = warn
+ #log4j.logger.eu.etaxonomy.cdm.model.taxon.TaxonNodeByNameComparator=trace
  #
  log4j.logger.eu.etaxonomy.cdm.test.function = info
  log4j.logger.eu.etaxonomy.cdm.test.integration = info