2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.io
.specimen
.abcd206
.in
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertNotNull
;
14 import static org
.junit
.Assert
.assertTrue
;
16 import java
.io
.FileNotFoundException
;
17 import java
.net
.URISyntaxException
;
20 import org
.junit
.Assert
;
21 import org
.junit
.Before
;
22 import org
.junit
.Ignore
;
23 import org
.junit
.Test
;
24 import org
.unitils
.dbunit
.annotation
.DataSet
;
25 import org
.unitils
.spring
.annotation
.SpringBeanByName
;
26 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
28 import eu
.etaxonomy
.cdm
.api
.service
.ICommonService
;
29 import eu
.etaxonomy
.cdm
.api
.service
.INameService
;
30 import eu
.etaxonomy
.cdm
.api
.service
.IOccurrenceService
;
31 import eu
.etaxonomy
.cdm
.io
.common
.CdmApplicationAwareDefaultImport
;
32 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
;
33 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
34 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
35 import eu
.etaxonomy
.cdm
.test
.integration
.CdmTransactionalIntegrationTest
;
43 public class ABCDImportConfiguratorTestNonEmptyDB
extends CdmTransactionalIntegrationTest
{
46 CdmApplicationAwareDefaultImport
<?
> defaultImport
;
49 INameService nameService
;
52 IOccurrenceService occurrenceService
;
55 ICommonService commonService
;
58 private IImportConfigurator configurator
;
62 String inputFile
= "/eu/etaxonomy/cdm/io/specimen/abcd206/in/ABCDImportTestCalvumPart2.xml";
63 URL url
= this.getClass().getResource(inputFile
);
64 assertNotNull("URL for the test file '" + inputFile
+ "' does not exist", url
);
66 configurator
= Abcd206ImportConfigurator
.NewInstance(url
.toURI(), null,false);
67 } catch (URISyntaxException e
) {
71 assertNotNull("Configurator3 could not be created", configurator
);
76 public void testInit() {
77 assertNotNull("import instance should not be null", defaultImport
);
78 assertNotNull("nameService should not be null", nameService
);
79 assertNotNull("occurence service should not be null", occurrenceService
);
80 assertNotNull("common service should not be null", commonService
);
84 @DataSet( value
="SpecimenImportConfiguratorTest.xml") //loadStrategy=CleanSweepInsertLoadStrategy.class
85 public void testDoInvoke() {
86 boolean result
= defaultImport
.invoke(configurator
);
87 assertTrue("Return value for import.invoke should be true", result
);
88 assertEquals("Number of TaxonNames is incorrect", 2, nameService
.count(TaxonNameBase
.class));
89 assertEquals("Number of specimen is incorrect", 11, occurrenceService
.count(DerivedUnit
.class));
94 * @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
97 public void createTestDataSet() throws FileNotFoundException
{
98 // TODO Auto-generated method stub