Project

General

Profile

Download (2.99 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.specimen.excel.in;
11

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

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

    
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.api.service.IOccurrenceService;
25
import eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultImport;
26
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
27
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
28

    
29
/**
30
 * @author a.mueller
31
 * @since 29.01.2009
32
 * @version 1.0
33
 */
34
//@Ignore("Test class is just a copy of the ABCD import test. It still needs to be adapted")
35
public class ExcelImportConfiguratorTest extends CdmTransactionalIntegrationTest {
36

    
37
	@SpringBeanByName
38
	CdmApplicationAwareDefaultImport<?> defaultImport;
39

    
40
	@SpringBeanByType
41
	INameService nameService;
42

    
43
	@SpringBeanByType
44
	IOccurrenceService occurrenceService;
45

    
46

    
47
	private IImportConfigurator configurator;
48

    
49
	@Before
50
	public void setUp() throws URISyntaxException {
51
		String inputFile = "/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelImportConfiguratorTest-input.xls";
52
		URL url = this.getClass().getResource(inputFile);
53
		assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
54
		configurator = SpecimenSynthesysExcelImportConfigurator.NewInstance(url.toURI(), null, false);
55
		assertNotNull("Configurator could not be created", configurator);
56
	}
57

    
58
	@Test
59
	public void testInit() {
60
		assertNotNull("import instance should not be null", defaultImport);
61
		assertNotNull("nameService should not be null", nameService);
62
		assertNotNull("occurence service should not be null", occurrenceService);
63
	}
64
/*
65
	@Test
66
    @DataSets({
67
            @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="/eu/etaxonomy/cdm/database/ClearDB_with_Terms_DataSet.xml"),
68
            @DataSet("/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml")
69
    })
70
	public void testDoInvoke() {
71
		boolean result = defaultImport.invoke(configurator);
72
		assertTrue("Return value for import.invoke should be true", result);
73
		assertEquals("Number of TaxonNames should be 3", 3, nameService.count(null));
74
		assertEquals("Number of specimen should be 6", 6, occurrenceService.count(SpecimenOrObservationBase.class));
75
		assertEquals("Number of specimen should be 3", 3, occurrenceService.count(DerivedUnit.class));
76
		assertEquals("Number of specimen should be 3", 3, occurrenceService.count(FieldUnit.class));
77

    
78
	}
79
*/
80

    
81
    @Override
82
    public void createTestDataSet() throws FileNotFoundException {}
83

    
84
}
(1-1/2)