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
package eu.etaxonomy.cdm.io.specimen.excel.in;
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.Before;
18
import org.junit.Test;
19
import org.unitils.spring.annotation.SpringBeanByName;
20
import org.unitils.spring.annotation.SpringBeanByType;
21

    
22
import eu.etaxonomy.cdm.api.service.INameService;
23
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
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
//@Ignore("Test class is just a copy of the ABCD import test. It still needs to be adapted")
33
public class ExcelImportConfiguratorTest extends CdmTransactionalIntegrationTest {
34

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

    
38
	@SpringBeanByType
39
	private INameService nameService;
40

    
41
	@SpringBeanByType
42
	private IOccurrenceService occurrenceService;
43

    
44
	private IImportConfigurator configurator;
45

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

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

    
75
	}
76
*/
77

    
78
    @Override
79
    public void createTestDataSet() throws FileNotFoundException {}
80
}
(1-1/2)