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.sdd.in;
|
11
|
|
12
|
import static org.junit.Assert.assertEquals;
|
13
|
import static org.junit.Assert.assertNotNull;
|
14
|
|
15
|
import java.net.MalformedURLException;
|
16
|
import java.net.URI;
|
17
|
import java.net.URISyntaxException;
|
18
|
import java.net.URL;
|
19
|
|
20
|
import junit.framework.Assert;
|
21
|
|
22
|
import org.junit.Before;
|
23
|
import org.junit.Ignore;
|
24
|
import org.junit.Test;
|
25
|
import org.unitils.spring.annotation.SpringBeanByType;
|
26
|
|
27
|
import eu.etaxonomy.cdm.api.service.INameService;
|
28
|
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
|
29
|
|
30
|
/**
|
31
|
* @author b.clark
|
32
|
* @created 20.01.2009
|
33
|
* @version 1.0
|
34
|
*/
|
35
|
|
36
|
//@Ignore // we ignore this test at the moment because it does not run with maven
|
37
|
public class SDDImportTest extends CdmTransactionalIntegrationTest {
|
38
|
|
39
|
@SpringBeanByType
|
40
|
SDDImport sddImport;
|
41
|
|
42
|
@SpringBeanByType
|
43
|
INameService nameService;
|
44
|
|
45
|
private SDDImportConfigurator configurator;
|
46
|
|
47
|
@Before
|
48
|
public void setUp() throws URISyntaxException {
|
49
|
URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/SDDImportTest-input.xml");
|
50
|
// URI uri = url.toURI();
|
51
|
URI uri = URI.create("file:///C:/localCopy/Data/xper/Cichorieae-DA2.sdd.xml");
|
52
|
Assert.assertNotNull(url);
|
53
|
configurator = SDDImportConfigurator.NewInstance(uri, null);
|
54
|
}
|
55
|
|
56
|
@Test
|
57
|
public void testInit() {
|
58
|
assertNotNull("sddImport should not be null", sddImport);
|
59
|
assertNotNull("nameService should not be null", nameService);
|
60
|
}
|
61
|
|
62
|
@Test
|
63
|
public void testDoInvoke() {
|
64
|
sddImport.doInvoke(new SDDImportState(configurator));
|
65
|
this.setComplete();
|
66
|
this.endTransaction();
|
67
|
assertEquals("Number of TaxonNames should be 1", 1, nameService.count(null));
|
68
|
}
|
69
|
|
70
|
}
|