/**
* 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");
}
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