Project

General

Profile

Download (2.21 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
package eu.etaxonomy.cdm.io.taxonx;
10

    
11
import static org.junit.Assert.assertNotNull;
12

    
13
import java.io.FileNotFoundException;
14
import java.net.URISyntaxException;
15
import java.net.URL;
16

    
17
import org.junit.Assert;
18
import org.junit.Before;
19
import org.junit.Test;
20
import org.unitils.spring.annotation.SpringBeanByName;
21
import org.unitils.spring.annotation.SpringBeanByType;
22

    
23
import eu.etaxonomy.cdm.api.service.INameService;
24
import eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultImport;
25
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
26
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
27

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

    
34
	@SpringBeanByName
35
	private CdmApplicationAwareDefaultImport<?> defaultImport;
36

    
37
	@SpringBeanByType
38
	private INameService nameService;
39

    
40
	private IImportConfigurator configurator;
41

    
42
	@Before
43
	public void setUp() {
44
		String inputFile = "/eu/etaxonomy/cdm/io/taxonx/TaxonXImportConfiguratorTest-input.xml";
45
		URL url = this.getClass().getResource(inputFile);
46
		assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
47
		try {
48
			configurator = TaxonXImportConfigurator.NewInstance(url.toURI(), null);
49
		} catch (URISyntaxException e) {
50
			e.printStackTrace();
51
			Assert.fail();
52
		}
53
		assertNotNull("Configurator could not be created", configurator);
54
	}
55

    
56
	@Test
57
	public void testInit() {
58
		assertNotNull("cdmTcsXmlImport should not be null", defaultImport);
59
		assertNotNull("nameService should not be null", nameService);
60
	}
61

    
62
	@Test
63
	public void testDoInvoke() {
64
		boolean result = defaultImport.invoke(configurator).isSuccess();
65
	//	assertTrue("Return value for import.invoke() should be true", result);
66
	//	assertEquals("Number of TaxonNames should be 5", 5, nameService.count());
67
	}
68

    
69
    @Override
70
    public void createTestDataSet() throws FileNotFoundException {}
71
}
    (1-1/1)