Project

General

Profile

Download (2.73 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.sdd.in;
11

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

    
15
import java.io.FileNotFoundException;
16
import java.net.URI;
17
import java.net.URISyntaxException;
18
import java.net.URL;
19

    
20
import org.junit.Before;
21
import org.junit.Test;
22
import org.unitils.dbunit.annotation.DataSet;
23
import org.unitils.spring.annotation.SpringBeanByType;
24

    
25
import eu.etaxonomy.cdm.api.service.INameService;
26
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
27

    
28
/**
29
 * @author b.clark
30
 * @since 20.01.2009
31
 * @version 1.0
32
 */
33

    
34
//@Ignore // we ignore this test at the moment because it does not run with maven
35
//org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of eu.etaxonomy.cdm.model.common.Language.protectedTitleCache
36
//...at eu.etaxonomy.cdm.persistence.dao.hibernate.common.DefinedTermDaoImpl.getLanguageByIso(DefinedTermDaoImpl.java:286)
37
public class SDDImportTest extends CdmTransactionalIntegrationTest {
38

    
39
    @SpringBeanByType
40
    SDDImport sddImport;
41

    
42
    @SpringBeanByType
43
    INameService nameService;
44

    
45
    private SDDImportConfigurator configurator;
46

    
47
    @Before
48
    public void setUp() throws URISyntaxException {
49
        //URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/SDDImportTest-input.xml");
50
        //URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/SDDImportTest-input2.xml");
51
        URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/SDD-Test-Simple.xml");
52
		URI uri = url.toURI();
53
//		URI	uri = URI.create("file:///C:/localCopy/Data/xper/Cichorieae-DA2.sdd.xml");
54
		assertNotNull(url);
55
		configurator = SDDImportConfigurator.NewInstance(uri, null);
56
    }
57

    
58
    @Test
59
    public void testInit() {
60
        assertNotNull("sddImport should not be null", sddImport);
61
        assertNotNull("nameService should not be null", nameService);
62
    }
63

    
64
    @Test
65
    @DataSet(/*loadStrategy=CleanSweepInsertLoadStrategy.class, */value="/eu/etaxonomy/cdm/database/BlankDataSet.xml")
66
	public void testDoInvoke() {
67
        sddImport.doInvoke(new SDDImportState(configurator));
68
        this.setComplete();
69
        logger.warn("Name service count: " + (nameService.count(null)));
70

    
71
        this.endTransaction();
72
        assertEquals("Number of TaxonNames should be 1", 1, nameService.count(null));
73
    }
74

    
75
    @Override
76
    public void createTestDataSet() throws FileNotFoundException {}
77

    
78

    
79
}
(5-5/5)