Project

General

Profile

Download (3.04 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.common.URI;
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
 */
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
	private CdmApplicationAwareDefaultImport<?> defaultImport;
38

    
39
	@SpringBeanByType
40
	private INameService nameService;
41

    
42
	@SpringBeanByType
43
	private IOccurrenceService occurrenceService;
44

    
45
	private IImportConfigurator configurator;
46

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

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

    
76
	}
77
*/
78

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