Project

General

Profile

Download (3.12 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
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
 * @created 29.01.2009
31
 * @version 1.0
32
 */
33
//@Ignore("Test class is just a copy of the ABCD import test. It still needs to be adapted")
34
public class ExcelImportConfiguratorTest extends CdmTransactionalIntegrationTest {
35

    
36
	@SpringBeanByName
37
	CdmApplicationAwareDefaultImport<?> defaultImport;
38

    
39
	@SpringBeanByType
40
	INameService nameService;
41

    
42
	@SpringBeanByType
43
	IOccurrenceService occurrenceService;
44

    
45

    
46
	private IImportConfigurator configurator;
47

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

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

    
77
	}
78
*/
79
    /* (non-Javadoc)
80
     * @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
81
     */
82
    @Override
83
    public void createTestDataSet() throws FileNotFoundException {
84
        // TODO Auto-generated method stub
85

    
86
    }
87

    
88
}
(1-1/2)