1
|
package testJar;
|
2
|
|
3
|
//import eu.etaxonomy.cdm.api.application.CdmApplicationController;
|
4
|
//import eu.etaxonomy.cdm.api.service.*;
|
5
|
import java.io.File;
|
6
|
import java.io.IOException;
|
7
|
import java.io.InputStream;
|
8
|
|
9
|
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
|
10
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
11
|
import eu.etaxonomy.cdm.common.XmlHelp;
|
12
|
import eu.etaxonomy.cdm.database.CdmDataSource;
|
13
|
import eu.etaxonomy.cdm.model.name.*;
|
14
|
|
15
|
|
16
|
import org.apache.log4j.Level;
|
17
|
import org.apache.log4j.Logger;
|
18
|
import org.jdom.Element;
|
19
|
|
20
|
|
21
|
|
22
|
public class TestJarMain {
|
23
|
static Logger logger = Logger.getLogger(TestJarMain.class);
|
24
|
|
25
|
/**
|
26
|
* @param args
|
27
|
*/
|
28
|
public static void main(String[] args) {
|
29
|
// TestAspect ta = new TestAspect();
|
30
|
// ta.testAppController();
|
31
|
test();
|
32
|
testDirectory();
|
33
|
}
|
34
|
|
35
|
private static void testDirectory(){
|
36
|
System.out.println("Start testDirectory ...");
|
37
|
InputStream is2;
|
38
|
File f = new File("C:/Dokumente und Einstellungen/a.mueller/.cdmLibrary/writableResources/applicationContext.xml");
|
39
|
System.out.println(f.exists());
|
40
|
|
41
|
try {
|
42
|
String strFile = "terms/Language.csv";
|
43
|
logger.info(CdmUtils.getReadableResourceStream(strFile));
|
44
|
//test directory
|
45
|
is2 = CdmUtils.getReadableResourceStream(CdmDataSource.DATASOURCE_FILE_NAME);
|
46
|
Element el = XmlHelp.getRoot(is2);
|
47
|
System.out.println(el);
|
48
|
|
49
|
//CdmDataSource dataSource = CdmDataSource.NewInstance("testPostgre");
|
50
|
CdmApplicationController app = new CdmApplicationController();
|
51
|
logger.info(app.getNameService());
|
52
|
app.close();
|
53
|
} catch (Exception e) {
|
54
|
logger.error("Exception: " + e.getMessage());
|
55
|
}
|
56
|
System.out.println("End testDirectory ...");
|
57
|
}
|
58
|
|
59
|
private static void test(){
|
60
|
NonViralName tn;
|
61
|
System.out.println("Start Test ...");
|
62
|
Logger.getRootLogger().setLevel(Level.WARN);
|
63
|
//INameService ns = new CdmApplicationController().getNameService();
|
64
|
//tn = (TaxonName)ns.getAllNames().get(0);
|
65
|
tn = new NonViralName(null);
|
66
|
logger.setLevel(Level.DEBUG);
|
67
|
System.out.println("****************");
|
68
|
tn.setUninomial("TestUninomialName");
|
69
|
logger.info(tn.getUninomial());
|
70
|
if (tn != null){
|
71
|
logger.info("Uuid for TaxonName(1): " + tn.getUuid());
|
72
|
}else{
|
73
|
logger.warn("No name with id = 1");
|
74
|
}
|
75
|
System.out.println("End Test (successful");
|
76
|
}
|
77
|
|
78
|
}
|