Project

General

Profile

Download (2.13 KB) Statistics
| Branch: | Tag: | Revision:
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.tcsxml;
11

    
12
import static org.junit.Assert.assertNotNull;
13
import static org.junit.Assert.assertTrue;
14

    
15
import java.io.FileNotFoundException;
16
import java.net.URISyntaxException;
17
import java.net.URL;
18

    
19
import org.junit.Before;
20
import org.junit.Test;
21
import org.unitils.spring.annotation.SpringBeanByType;
22

    
23
import eu.etaxonomy.cdm.api.service.INameService;
24
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
25
import eu.etaxonomy.cdm.io.tcsxml.in.CdmTcsXmlImport;
26
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
27
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
28

    
29
/**
30
 * @author a.mueller
31
 * @since 29.01.2009
32
 */
33
public class CdmTcsXmlImportTest extends CdmTransactionalIntegrationTest {
34

    
35
	@SpringBeanByType
36
	CdmTcsXmlImport cdmTcsXmlImport;
37

    
38
	@SpringBeanByType
39
	INameService nameService;
40

    
41
	private IImportConfigurator configurator;
42

    
43
	@Before
44
	public void setUp() throws URISyntaxException {
45
		String inputFile = "/eu/etaxonomy/cdm/io/tcsxml/TcsXmlImportConfiguratorTest-input.xml";
46
		URL url = this.getClass().getResource(inputFile);
47
		assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
48
		configurator = TcsXmlImportConfigurator.NewInstance(url.toURI(), null);
49
		assertNotNull("Configurator could not be created", configurator);
50
	}
51

    
52
	@Test
53
	public void testInit() {
54
		assertNotNull("cdmTcsXmlImport should not be null", cdmTcsXmlImport);
55
		assertNotNull("nameService should not be null", nameService);
56
	}
57

    
58
	@Test
59
	public void testDoInvoke() {
60
		boolean result = cdmTcsXmlImport.invoke(configurator).isSuccess();
61
		assertTrue("Return value for import.invoke should be true", result);
62
		//assertEquals("Number of TaxonNames should be 16", 16, nameService.count(null));
63
	}
64

    
65
    @Override
66
    public void createTestDataSet() throws FileNotFoundException {}
67

    
68
}
(1-1/2)