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