1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.io.redlist.bfnXml;
|
11
|
|
12
|
//
|
13
|
//import java.net.URISyntaxException;
|
14
|
//import java.net.URL;
|
15
|
//
|
16
|
//import org.apache.log4j.Logger;
|
17
|
//import org.aspectj.lang.annotation.Before;
|
18
|
//import org.junit.Test;
|
19
|
//import org.unitils.spring.annotation.SpringBeanByName;
|
20
|
//import org.unitils.spring.annotation.SpringBeanByType;
|
21
|
|
22
|
//import eu.etaxonomy.cdm.api.service.IClassificationService;
|
23
|
//import eu.etaxonomy.cdm.api.service.INameService;
|
24
|
//import eu.etaxonomy.cdm.api.service.ITaxonService;
|
25
|
//import eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultImport;
|
26
|
//import eu.etaxonomy.cdm.io.common.IImportConfigurator;
|
27
|
//import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
|
28
|
|
29
|
/**
|
30
|
* @author a.mueller
|
31
|
* @since 29.01.2009
|
32
|
*/
|
33
|
//public class BfnXmlImportConfiguratorTest extends CdmTransactionalIntegrationTest {
|
34
|
// Logger logger = Logger.getLogger(getClass());
|
35
|
// @SpringBeanByName
|
36
|
// CdmApplicationAwareDefaultImport<?> defaultImport;
|
37
|
//
|
38
|
// @SpringBeanByType
|
39
|
// INameService nameService;
|
40
|
//
|
41
|
// @SpringBeanByType
|
42
|
// ITaxonService taxonService;
|
43
|
//
|
44
|
// @SpringBeanByType
|
45
|
// IClassificationService classificationService;
|
46
|
//
|
47
|
// private IImportConfigurator configurator;
|
48
|
//
|
49
|
// @Before(value = "")
|
50
|
// public void setUp() throws URISyntaxException {
|
51
|
//
|
52
|
// String inputFile = "/eu/etaxonomy/cdm/io/bfnXml/bfnXmlTest-input.xml";
|
53
|
// URL url = this.getClass().getResource(inputFile);
|
54
|
// assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
|
55
|
// configurator = BfnXmlImportConfigurator.NewInstance(url.toURI(), null);
|
56
|
// assertNotNull("Configurator could not be created", configurator);
|
57
|
// }
|
58
|
//
|
59
|
// @Test
|
60
|
// public void testInit() {
|
61
|
// assertNotNull("cdmTcsXmlImport should not be null", defaultImport);
|
62
|
// assertNotNull("nameService should not be null", nameService);
|
63
|
// }
|
64
|
//
|
65
|
// @Test
|
66
|
// public void testDoInvoke() {
|
67
|
// boolean result = defaultImport.invoke(configurator);
|
68
|
// assertTrue("Return value for import.invoke should be true", result);
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
// List<Classification> classificationList = classificationService.list(Classification.class, null, null, null, null);
|
75
|
// if(classificationList != null && !classificationList.isEmpty()){
|
76
|
// for(Classification classification:classificationList){
|
77
|
// Set<TaxonNode> tnSet = classification.getAllNodes();
|
78
|
// for(TaxonNode tn:tnSet){
|
79
|
// logger.info(tn.getTaxon().getTitleCache());
|
80
|
// }
|
81
|
// }
|
82
|
// }else{
|
83
|
// logger.info("classification is empty");
|
84
|
// }
|
85
|
// List<TaxonBase> taxonBaseList = taxonService.list(TaxonBase.class, null, null, null, null);
|
86
|
// for(TaxonBase taxon:taxonBaseList){
|
87
|
//
|
88
|
// if(taxon instanceof Taxon){
|
89
|
// logger.info("Taxon: "+taxon.getTitleCache());
|
90
|
// }
|
91
|
// if(taxon instanceof Synonym){
|
92
|
// logger.info("Synonym: "+taxon.getTitleCache());
|
93
|
// }
|
94
|
// }
|
95
|
// assertEquals("Number of TaxonBase should be 11", 11, nameService.count(null));
|
96
|
// }
|
97
|
|
98
|
//}
|