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
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertNotNull
;
14 import static org
.junit
.Assert
.assertTrue
;
18 import org
.junit
.Before
;
19 import org
.junit
.Ignore
;
20 import org
.junit
.Test
;
21 import org
.unitils
.spring
.annotation
.SpringBeanByName
;
22 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
24 import eu
.etaxonomy
.cdm
.api
.service
.INameService
;
25 import eu
.etaxonomy
.cdm
.io
.common
.CdmApplicationAwareDefaultImport
;
26 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
;
27 import eu
.etaxonomy
.cdm
.io
.specimen
.abcd206
.in
.Abcd206ImportConfigurator
;
28 import eu
.etaxonomy
.cdm
.test
.integration
.CdmTransactionalIntegrationTest
;
36 public class SpecimenImportConfiguratorTest
extends CdmTransactionalIntegrationTest
{
39 CdmApplicationAwareDefaultImport
<?
> defaultImport
;
42 INameService nameService
;
44 private IImportConfigurator configurator
;
48 String inputFile
= "/eu/etaxonomy/cdm/io/specimen/abcd206/in/SpecimenImportConfiguratorTest-input.xml";
49 URL url
= this.getClass().getResource(inputFile
);
50 assertNotNull("URL for the test file '" + inputFile
+ "' does not exist", url
);
51 configurator
= Abcd206ImportConfigurator
.NewInstance(url
.toString(), null);
52 assertNotNull("Configurator could not be created", configurator
);
56 public void testInit() {
57 assertNotNull("cdmTcsXmlImport should not be null", defaultImport
);
58 assertNotNull("nameService should not be null", nameService
);
62 public void testDoInvoke() {
63 boolean result
= defaultImport
.invoke(configurator
);
64 assertTrue("Return value for import.invoke should be true", result
);
65 assertEquals("Number of TaxonNames should be 10", 10, nameService
.count(null));