re-integrating branch cdmlib/3.x-unitils-upgrade
[cdmlib.git] / cdmlib-services / src / test / java / eu / etaxonomy / cdm / api / service / ClassificationServiceImplTest.java
index 19dd003cb6d7328b23e1f32bdf34758a5c87563b..98a600cf40e442d6d4d17e7d26373562e50a8107 100644 (file)
@@ -54,12 +54,12 @@ public class ClassificationServiceImplTest extends CdmIntegrationTest{
     @SpringBeanByType
     ITaxonNodeService taxonNodeService;
     private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
-               "childNodes",
-               "childNodes.taxon",
-               "childNodes.taxon.name",
-                       "taxon.sec",
-                       "taxon.name.*"
-                       });
+            "childNodes",
+            "childNodes.taxon",
+            "childNodes.taxon.name",
+            "taxon.sec",
+            "taxon.name.*"
+            });
 
     private Comparator<? super TaxonNode> taxonNodeComparator;
 
@@ -69,6 +69,8 @@ public class ClassificationServiceImplTest extends CdmIntegrationTest{
      */
 //    @Test
     public final void testSetTaxonNodeComparator() {
+
+
 //             fail("Not yet implemented");
     }
 
@@ -92,8 +94,8 @@ public class ClassificationServiceImplTest extends CdmIntegrationTest{
     @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"});
@@ -101,16 +103,16 @@ public class ClassificationServiceImplTest extends CdmIntegrationTest{
 //                     /* 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);
 
                /**
                 * expected order is:
@@ -124,28 +126,28 @@ public class ClassificationServiceImplTest extends CdmIntegrationTest{
                logger.setLevel(Level.DEBUG);
                if(logger.isDebugEnabled()){
                        logger.debug("-------------");
-                       for (TaxonNode node: taxonNodes){
+        for (TaxonNode node: taxonNodes){
                                logger.debug(node.getTaxon().getName().getTitleCache() );
-                       /*for (TaxonNode child : node.getChildNodes()){
+            /*for (TaxonNode child : node.getChildNodes()){
                                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");
 
     }
@@ -158,10 +160,10 @@ public class ClassificationServiceImplTest extends CdmIntegrationTest{
     @DataSet
     @Ignore
     public final void testloadRankSpecificRootNodes(){
-       Classification classification = service.find(UUID.fromString("6c2bc8d9-ee62-4222-be89-4a8e31770878"));
+        Classification classification = service.find(UUID.fromString("6c2bc8d9-ee62-4222-be89-4a8e31770878"));
 
-               List<TaxonNode> taxonNodes = service.loadRankSpecificRootNodes(classification, Rank.SECTION_BOTANY(), NODE_INIT_STRATEGY);
-               Assert.assertEquals(2, taxonNodes.size());
+        List<TaxonNode> taxonNodes = service.loadRankSpecificRootNodes(classification, Rank.SECTION_BOTANY(), NODE_INIT_STRATEGY);
+        Assert.assertEquals(2, taxonNodes.size());
 
     }