Project

General

Profile

Download (2.09 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.taxonx;
11

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

    
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
 * @created 29.01.2009
31
 * @version 1.0
32
 */
33
public class TaxonXImportConfiguratorTest extends CdmTransactionalIntegrationTest {
34
	
35
	@SpringBeanByName
36
	CdmApplicationAwareDefaultImport<?> defaultImport;
37

    
38
	@SpringBeanByType
39
	INameService nameService;
40

    
41
	private IImportConfigurator configurator;
42
	
43
	@Before
44
	public void setUp() {
45
		String inputFile = "/eu/etaxonomy/cdm/io/taxonx/TaxonXImportConfiguratorTest-input.xml";
46
		URL url = this.getClass().getResource(inputFile);
47
		assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
48
		try {
49
			configurator = TaxonXImportConfigurator.NewInstance(url.toURI(), null);
50
		} catch (URISyntaxException e) {
51
			e.printStackTrace();
52
			Assert.fail();
53
		}
54
		assertNotNull("Configurator could not be created", configurator);
55
	}
56
	
57
	@Test
58
	public void testInit() {
59
		assertNotNull("cdmTcsXmlImport should not be null", defaultImport);
60
		assertNotNull("nameService should not be null", nameService);
61
	}
62
	
63
	@Test
64
	public void testDoInvoke() {
65
		boolean result = defaultImport.invoke(configurator);
66
	//	assertTrue("Return value for import.invoke() should be true", result);
67
	//	assertEquals("Number of TaxonNames should be 5", 5, nameService.count());
68
	}
69

    
70
}
    (1-1/1)