??
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 23 Jun 2015 09:48:47 +0000 (11:48 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 30 Jun 2015 07:49:13 +0000 (09:49 +0200)
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/Abcd206ImportState.java
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/AbcdGgbnImportTest.java

index 5a431305279cbc8c301eea8dbf04600554b1b36d..5cbf9fdf08629281f91535055d230967e341a4b7 100644 (file)
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.cdm.io.specimen.abcd206.in;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.springframework.transaction.TransactionStatus;
-
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.io.common.CdmImportBase;
-import eu.etaxonomy.cdm.io.common.ImportStateBase;
-import eu.etaxonomy.cdm.model.common.OriginalSourceBase;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-
-/**
- * @author a.mueller
- * @created 11.05.2009
- * @version 1.0
- */
-public class Abcd206ImportState extends ImportStateBase<Abcd206ImportConfigurator, CdmImportBase<Abcd206ImportConfigurator,Abcd206ImportState>>{
-       @SuppressWarnings("unused")
-       private static final Logger logger = Logger.getLogger(Abcd206ImportState.class);
-
-       private TransactionStatus tx;
-
-       private ICdmApplicationConfiguration cdmRepository;
-
-        private Classification classification = null;
-        private Classification defaultClassification = null;
-        private Reference<?> ref = null;
-
-        private Abcd206DataHolder dataHolder;
-        private DerivedUnit derivedUnitBase;
-        private FieldUnit fieldUnit;
-
-        private List<OriginalSourceBase<?>> associationRefs = new ArrayList<OriginalSourceBase<?>>();
-        private boolean associationSourcesSet=false;
-        private List<OriginalSourceBase<?>> descriptionRefs = new ArrayList<OriginalSourceBase<?>>();
-        private boolean descriptionSourcesSet=false;
-        private List<OriginalSourceBase<?>> derivedUnitSources = new ArrayList<OriginalSourceBase<?>>();
-        private boolean derivedUnitSourcesSet=false;
-        private boolean descriptionGroupSet = false;
-        private TaxonDescription descriptionGroup = null;
-
-//****************** CONSTRUCTOR ***************************************************/
-
-       public Abcd206ImportState(Abcd206ImportConfigurator config) {
-               super(config);
-       }
-
-//************************ GETTER / SETTER *****************************************/
-
-       public TransactionStatus getTx() {
-               return tx;
-       }
-
-       public void setTx(TransactionStatus tx) {
-               this.tx = tx;
-       }
-
-       public ICdmApplicationConfiguration getCdmRepository() {
-               return cdmRepository;
-       }
-
-       public void setCdmRepository(ICdmApplicationConfiguration cdmRepository) {
-               this.cdmRepository = cdmRepository;
-       }
-
-    public Classification getClassification() {
-        return classification;
-    }
-
-    public void setClassification(Classification classification) {
-        this.classification = classification;
-    }
-
-    public Classification getDefaultClassification() {
-        return defaultClassification;
-    }
-
-    public void setDefaultClassification(Classification defaultClassification) {
-        this.defaultClassification = defaultClassification;
-    }
-
-    public Reference<?> getRef() {
-        return ref;
-    }
-
-    public void setRef(Reference<?> ref) {
-        this.ref = ref;
-    }
-
-    public Abcd206DataHolder getDataHolder() {
-        return dataHolder;
-    }
-
-    public void setDataHolder(Abcd206DataHolder dataHolder) {
-        this.dataHolder = dataHolder;
-    }
-
-    public DerivedUnit getDerivedUnitBase() {
-        return derivedUnitBase;
-    }
-
-    public void setDerivedUnitBase(DerivedUnit derivedUnitBase) {
-        this.derivedUnitBase = derivedUnitBase;
-    }
-
-    public FieldUnit getFieldUnit() {
-        return fieldUnit;
-    }
-
-    public void setFieldUnit(FieldUnit fieldUnit) {
-        this.fieldUnit = fieldUnit;
-    }
-
-    public List<OriginalSourceBase<?>> getAssociationRefs() {
-        return associationRefs;
-    }
-
-    public void setAssociationRefs(List<OriginalSourceBase<?>> associationRefs) {
-        this.associationRefs = associationRefs;
-    }
-
-    public boolean isAssociationSourcesSet() {
-        return associationSourcesSet;
-    }
-
-    public void setAssociationSourcesSet(boolean associationSourcesSet) {
-        this.associationSourcesSet = associationSourcesSet;
-    }
-
-    public List<OriginalSourceBase<?>> getDescriptionRefs() {
-        return descriptionRefs;
-    }
-
-    public void setDescriptionRefs(List<OriginalSourceBase<?>> descriptionRefs) {
-        this.descriptionRefs = descriptionRefs;
-    }
-
-    public boolean isDescriptionSourcesSet() {
-        return descriptionSourcesSet;
-    }
-
-    public void setDescriptionSourcesSet(boolean descriptionSourcesSet) {
-        this.descriptionSourcesSet = descriptionSourcesSet;
-    }
-
-    public List<OriginalSourceBase<?>> getDerivedUnitSources() {
-        return derivedUnitSources;
-    }
-
-    public void setDerivedUnitSources(List<OriginalSourceBase<?>> derivedUnitSources) {
-        this.derivedUnitSources = derivedUnitSources;
-    }
-
-    public boolean isDerivedUnitSourcesSet() {
-        return derivedUnitSourcesSet;
-    }
-
-    public void setDerivedUnitSourcesSet(boolean derivedUnitSourcesSet) {
-        this.derivedUnitSourcesSet = derivedUnitSourcesSet;
-    }
-
-    public boolean isDescriptionGroupSet() {
-        return descriptionGroupSet;
-    }
-
-    public void setDescriptionGroupSet(boolean descriptionGroupSet) {
-        this.descriptionGroupSet = descriptionGroupSet;
-    }
-
-    public TaxonDescription getDescriptionGroup() {
-        return descriptionGroup;
-    }
-
-    public void setDescriptionGroup(TaxonDescription descriptionGroup) {
-        this.descriptionGroup = descriptionGroup;
-    }
-
-
-
-}
+// $Id$\r
+/**\r
+* Copyright (C) 2007 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+\r
+package eu.etaxonomy.cdm.io.specimen.abcd206.in;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.apache.log4j.Logger;\r
+import org.springframework.transaction.TransactionStatus;\r
+\r
+import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;\r
+import eu.etaxonomy.cdm.io.common.CdmImportBase;\r
+import eu.etaxonomy.cdm.io.common.ImportStateBase;\r
+import eu.etaxonomy.cdm.model.common.OriginalSourceBase;\r
+import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;\r
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;\r
+import eu.etaxonomy.cdm.model.reference.Reference;\r
+import eu.etaxonomy.cdm.model.taxon.Classification;\r
+\r
+/**\r
+ * @author a.mueller\r
+ * @created 11.05.2009\r
+ * @version 1.0\r
+ */\r
+public class Abcd206ImportState extends ImportStateBase<Abcd206ImportConfigurator, CdmImportBase<Abcd206ImportConfigurator,Abcd206ImportState>>{\r
+       @SuppressWarnings("unused")\r
+       private static final Logger logger = Logger.getLogger(Abcd206ImportState.class);\r
+\r
+       private TransactionStatus tx;\r
+\r
+       private ICdmApplicationConfiguration cdmRepository;\r
+\r
+        private Classification classification = null;\r
+        private Classification defaultClassification = null;\r
+        private Reference<?> ref = null;\r
+\r
+        private Abcd206DataHolder dataHolder;\r
+        private DerivedUnit derivedUnitBase;\r
+        private FieldUnit fieldUnit;\r
+\r
+        private List<OriginalSourceBase<?>> associationRefs = new ArrayList<OriginalSourceBase<?>>();\r
+        private boolean associationSourcesSet=false;\r
+        private List<OriginalSourceBase<?>> descriptionRefs = new ArrayList<OriginalSourceBase<?>>();\r
+        private boolean descriptionSourcesSet=false;\r
+        private List<OriginalSourceBase<?>> derivedUnitSources = new ArrayList<OriginalSourceBase<?>>();\r
+        private boolean derivedUnitSourcesSet=false;\r
+        private boolean descriptionGroupSet = false;\r
+        private TaxonDescription descriptionGroup = null;\r
+\r
+//****************** CONSTRUCTOR ***************************************************/\r
+\r
+       public Abcd206ImportState(Abcd206ImportConfigurator config) {\r
+               super(config);\r
+       }\r
+\r
+//************************ GETTER / SETTER *****************************************/\r
+\r
+       public TransactionStatus getTx() {\r
+               return tx;\r
+       }\r
+\r
+       public void setTx(TransactionStatus tx) {\r
+               this.tx = tx;\r
+       }\r
+\r
+       public ICdmApplicationConfiguration getCdmRepository() {\r
+               return cdmRepository;\r
+       }\r
+\r
+       public void setCdmRepository(ICdmApplicationConfiguration cdmRepository) {\r
+               this.cdmRepository = cdmRepository;\r
+       }\r
+\r
+    public Classification getClassification() {\r
+        return classification;\r
+    }\r
+\r
+    public void setClassification(Classification classification) {\r
+        this.classification = classification;\r
+    }\r
+\r
+    public Classification getDefaultClassification() {\r
+        return defaultClassification;\r
+    }\r
+\r
+    public void setDefaultClassification(Classification defaultClassification) {\r
+        this.defaultClassification = defaultClassification;\r
+    }\r
+\r
+    public Reference<?> getRef() {\r
+        return ref;\r
+    }\r
+\r
+    public void setRef(Reference<?> ref) {\r
+        this.ref = ref;\r
+    }\r
+\r
+    public Abcd206DataHolder getDataHolder() {\r
+        return dataHolder;\r
+    }\r
+\r
+    public void setDataHolder(Abcd206DataHolder dataHolder) {\r
+        this.dataHolder = dataHolder;\r
+    }\r
+\r
+    public DerivedUnit getDerivedUnitBase() {\r
+        return derivedUnitBase;\r
+    }\r
+\r
+    public void setDerivedUnitBase(DerivedUnit derivedUnitBase) {\r
+        this.derivedUnitBase = derivedUnitBase;\r
+    }\r
+\r
+    public FieldUnit getFieldUnit() {\r
+        return fieldUnit;\r
+    }\r
+\r
+    public void setFieldUnit(FieldUnit fieldUnit) {\r
+        this.fieldUnit = fieldUnit;\r
+    }\r
+\r
+    public List<OriginalSourceBase<?>> getAssociationRefs() {\r
+        return associationRefs;\r
+    }\r
+\r
+    public void setAssociationRefs(List<OriginalSourceBase<?>> associationRefs) {\r
+        this.associationRefs = associationRefs;\r
+    }\r
+\r
+    public boolean isAssociationSourcesSet() {\r
+        return associationSourcesSet;\r
+    }\r
+\r
+    public void setAssociationSourcesSet(boolean associationSourcesSet) {\r
+        this.associationSourcesSet = associationSourcesSet;\r
+    }\r
+\r
+    public List<OriginalSourceBase<?>> getDescriptionRefs() {\r
+        return descriptionRefs;\r
+    }\r
+\r
+    public void setDescriptionRefs(List<OriginalSourceBase<?>> descriptionRefs) {\r
+        this.descriptionRefs = descriptionRefs;\r
+    }\r
+\r
+    public boolean isDescriptionSourcesSet() {\r
+        return descriptionSourcesSet;\r
+    }\r
+\r
+    public void setDescriptionSourcesSet(boolean descriptionSourcesSet) {\r
+        this.descriptionSourcesSet = descriptionSourcesSet;\r
+    }\r
+\r
+    public List<OriginalSourceBase<?>> getDerivedUnitSources() {\r
+        return derivedUnitSources;\r
+    }\r
+\r
+    public void setDerivedUnitSources(List<OriginalSourceBase<?>> derivedUnitSources) {\r
+        this.derivedUnitSources = derivedUnitSources;\r
+    }\r
+\r
+    public boolean isDerivedUnitSourcesSet() {\r
+        return derivedUnitSourcesSet;\r
+    }\r
+\r
+    public void setDerivedUnitSourcesSet(boolean derivedUnitSourcesSet) {\r
+        this.derivedUnitSourcesSet = derivedUnitSourcesSet;\r
+    }\r
+\r
+    public boolean isDescriptionGroupSet() {\r
+        return descriptionGroupSet;\r
+    }\r
+\r
+    public void setDescriptionGroupSet(boolean descriptionGroupSet) {\r
+        this.descriptionGroupSet = descriptionGroupSet;\r
+    }\r
+\r
+    public TaxonDescription getDescriptionGroup() {\r
+        return descriptionGroup;\r
+    }\r
+\r
+    public void setDescriptionGroup(TaxonDescription descriptionGroup) {\r
+        this.descriptionGroup = descriptionGroup;\r
+    }\r
+\r
+\r
+\r
+}\r
index f826646daf6c38d625d0b29f16c03e0c36767e52..c04cf78620feaec865aadc230b580a19b2f63190 100644 (file)
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.cdm.io.specimen.abcd206.in;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.text.ParseException;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.joda.time.DateTime;
-import org.junit.Assert;
-import org.junit.Test;
-import org.unitils.dbunit.annotation.DataSet;
-import org.unitils.spring.annotation.SpringBeanByName;
-import org.unitils.spring.annotation.SpringBeanByType;
-
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.IReferenceService;
-import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
-import eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultImport;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.media.MediaUtils;
-import eu.etaxonomy.cdm.model.molecular.Amplification;
-import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
-import eu.etaxonomy.cdm.model.molecular.DnaQuality;
-import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.cdm.model.molecular.Primer;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.cdm.model.molecular.SequenceDirection;
-import eu.etaxonomy.cdm.model.molecular.SequenceString;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
-import eu.etaxonomy.cdm.test.unitils.CleanSweepInsertLoadStrategy;
-
-/**
- * @author a.mueller
- * @created 29.01.2009
- */
-public class AbcdGgbnImportTest extends CdmTransactionalIntegrationTest {
-
-       @SpringBeanByName
-       private CdmApplicationAwareDefaultImport<?> defaultImport;
-
-       @SpringBeanByType
-       private IOccurrenceService occurrenceService;
-
-       @SpringBeanByType
-       private IReferenceService referenceService;
-
-       /**
-        * Tests import import of DNA unit and all its parameters
-        * and sub derivatives (sequence, amplification, etc.)
-        * @throws ParseException
-        */
-       @Test
-    @DataSet( value="../../../BlankDataSet.xml", loadStrategy=CleanSweepInsertLoadStrategy.class)
-    public void testImportGgbn() throws ParseException {
-        String inputFile = "/eu/etaxonomy/cdm/io/specimen/abcd206/in/db6.xml";
-        URL url = this.getClass().getResource(inputFile);
-        assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
-
-        Abcd206ImportConfigurator importConfigurator = null;
-        try {
-            importConfigurator = Abcd206ImportConfigurator.NewInstance(url.toURI(), null,false);
-        } catch (URISyntaxException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-        assertNotNull("Configurator could not be created", importConfigurator);
-
-        boolean result = defaultImport.invoke(importConfigurator);
-        assertTrue("Return value for import.invoke should be true", result);
-        assertEquals("Number of derived units is incorrect", 1, occurrenceService.count(DerivedUnit.class));
-        assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));
-        assertEquals("Number of field units is incorrect", 1, occurrenceService.count(FieldUnit.class));
-
-        //associated specimen
-        FindOccurrencesConfigurator config = new FindOccurrencesConfigurator();
-        config.setSignificantIdentifier("B 10 0066577");
-        List<SpecimenOrObservationBase> records = occurrenceService.findByTitle(config).getRecords();
-        assertEquals(1, records.size());
-        SpecimenOrObservationBase derivedUnitSpecimen = records.iterator().next();
-        assertEquals(DerivedUnit.class, derivedUnitSpecimen.getClass());
-        DerivedUnit specimen = (DerivedUnit) derivedUnitSpecimen;
-        assertEquals("Herbarium Berolinense", specimen.getCollection().getName());
-        assertTrue(SpecimenOrObservationType.DnaSample!=specimen.getRecordBasis());
-
-        //dna sample
-        FindOccurrencesConfigurator dnaConfig = new FindOccurrencesConfigurator();
-        dnaConfig.setSignificantIdentifier("DB 6");
-        List<SpecimenOrObservationBase> dnaRecords = occurrenceService.findByTitle(dnaConfig).getRecords();
-        assertEquals(1, dnaRecords.size());
-        SpecimenOrObservationBase dnaSpecimen = dnaRecords.iterator().next();
-        assertEquals(DnaSample.class, dnaSpecimen.getClass());
-        DnaSample dnaSample = (DnaSample) dnaSpecimen;
-        DerivationEvent derivedFrom = dnaSample.getDerivedFrom();
-        assertNotNull(derivedFrom);
-        assertEquals("Wrong derivation type!", DerivationEventType.DNA_EXTRACTION(), derivedFrom.getType());
-        assertEquals("Wrong number of originals", 1, derivedFrom.getOriginals().size());
-        assertEquals("DNA Bank", dnaSample.getCollection().getCode());
-        assertEquals(SpecimenOrObservationType.DnaSample, dnaSample.getRecordBasis());
-        //preservation/preparation
-        assertNotNull(derivedFrom.getActor());
-        assertEquals("Bansemer, Jana", derivedFrom.getActor().getTitleCache());
-        assertNotNull(derivedFrom.getTimeperiod());
-        assertEquals((Integer)2002,derivedFrom.getTimeperiod().getStartYear());
-        assertEquals((Integer)8,derivedFrom.getTimeperiod().getStartMonth());
-        assertEquals((Integer)13,derivedFrom.getTimeperiod().getStartDay());
-        assertNotNull(dnaSample.getPreservation());
-
-
-        //dna quality
-        DnaQuality dnaQuality = dnaSample.getDnaQuality();
-        assertNotNull("Dna quality is null", dnaQuality!=null);
-        assertEquals(new Double("0.77"),dnaQuality.getRatioOfAbsorbance260_230());
-        assertEquals(new Double("1.38"),dnaQuality.getRatioOfAbsorbance260_280());
-        assertEquals(new DateTime(2008, 4, 15, 0, 0),dnaQuality.getQualityCheckDate());
-//        assertEquals(MeasurementUnit.NewInstance(, label, labelAbbrev)DateTime(2008, 4, 15, 0, 0),dnaQuality.getQualityCheckDate());
-
-        //amplifications
-        Set<AmplificationResult> amplificationResults = dnaSample.getAmplificationResults();
-        assertNotNull(amplificationResults);
-        assertEquals(1,  amplificationResults.size());
-        AmplificationResult amplificationResult = amplificationResults.iterator().next();
-        Amplification amplification = amplificationResult.getAmplification();
-        assertNotNull("Amplification is null", amplification);
-        DefinedTerm dnaMarker = amplification.getDnaMarker();
-        assertNotNull(dnaMarker);
-        assertEquals("ITS (ITS1, 5.8S rRNA, ITS2)", dnaMarker.getLabel());
-
-        //amplification primers
-        Primer forwardPrimer = amplification.getForwardPrimer();
-        assertNotNull(forwardPrimer);
-        assertEquals("PIpetB1411F", forwardPrimer.getLabel());
-        assertEquals("5´-GCCGTMTTTATGTTAATGC-3´", forwardPrimer.getSequence().getString());
-        assertNotNull(forwardPrimer.getPublishedIn());
-        assertEquals("Löhne & Borsch 2005", forwardPrimer.getPublishedIn().getTitle());
-
-        Primer reversePrimer = amplification.getReversePrimer();
-        assertNotNull(reversePrimer);
-        assertEquals("PIpetD738R", reversePrimer.getLabel());
-        assertEquals("5´-AATTTAGCYCTTAATACAGG-3´", reversePrimer.getSequence().getString());
-
-        //sequencing
-        Set<Sequence> sequences = dnaSample.getSequences();
-        assertNotNull(sequences);
-        assertEquals(1, sequences.size());
-        Sequence sequence = sequences.iterator().next();
-        SequenceString consensusSequence = sequence.getConsensusSequence();
-        assertNotNull(consensusSequence);
-        assertEquals(
-                "TTTCGGGTCC TTTATAGTGA AGATATAGCA TAGATAGTTG TAATCCATTA" +
-                       " TGTATCATTG GGGAAGGAAG GAGAATATTT TTTTGATAGA ATACAAGTAT" +
-                       " GGATTATTGA AACTAATACG CCATGTATTT GGATATTTCC CTTGAACTGC" +
-                       " ATAATATTCT TTATTTTCCA TGAATAGTGT AAGGGAATTT TTCGAAGAGA" +
-                       " AAATGGATTA TGGGAGTGTG TGACTTGAGC TATTGATTGG TCTGTGCAGA" +
-                       " TACGGGCTTT TATCTATCTG CCACATTGTA ATTCACAAAC CAATGTGTCT" +
-                       " TTGTTCCAAC CATCGCGTAA GCCCCATACA GAAGATAGGC TGGTTCGCTT" +
-                       " GAAGAGAATC TTTTCTATGA TCAGATCCGA ATTATGTCGT ACATGAGCAG" +
-                       " GCTCCGTAAG ATCTAGTTGA CTTAAGTCAA ACTTCAATAG TATAAAAATG" +
-                       " CACTCATTTC CTCTGCATTG ACACGAGCTA TGAGACTATC GGAGTGAAAG" +
-                       " AAAGGGTCTA AAGAAGAAGA AAGCTTGGGC TAGATTAGTA ACAAGTAAAT" +
-                       " CCTTTGTGTG TGTGTTTGTA ATTAGTAAAT GGGCTCTCAA TATTTTGGGG" +
-                       " CTAATTACTG ATCCTAAGGT TTGAGACGAC CCAGAAAGCA CTTGATCATA" +
-                       " TCACGATTGA CTTTGTAAGC CTACTTGGGT ATTGAGTATT TACTTGTAAG" +
-                       " AACCGAATTC TTTGGGGGAT AGTTGCAAAA AGAATCCAGT CAATTGTTCT" +
-                       " TACGTAAAAC CATTCATATC TCGTATATGG ATATGTCTAG ATAGGCTATC" +
-                       " GATTTTCGAT GGATTCGTTT GGTTCTTTTG ATTATTGCTC GAGCTGGATG" +
-                       " ATGAAAAATT ATCATGTCCG GTTCCTTCG",consensusSequence.getString());
-//        assertEquals((Integer)912, consensusSequence.getLength());
-        assertNotNull(sequence.getContigFile());
-        assertEquals(URI.create("http://ww2.biocase.org/websvn/filedetails.php?repname=campanula&path=%2FCAM385_Campa_drabifolia.pde"), MediaUtils.getFirstMediaRepresentationPart(sequence.getContigFile()).getUri());
-        assertEquals(1, sequence.getCitations().size());
-        Reference<?> reference = sequence.getCitations().iterator().next();
-        assertEquals("Gemeinholzer,B., Bachmann,K. (2005): Examining morphological "
-                + "and molecular diagnostic character states in "
-                + "Cichorium intybus L. (Asteraceae) and Cichorium spinosum L."
-                + " Plant Systematics and Evolution 253 (1-3): 105-123.", reference.getTitle());
-
-        //single reads
-        Set<SingleRead> singleReads = sequence.getSingleReads();
-        assertNotNull(singleReads);
-        assertEquals(2, singleReads.size());
-        for (SingleRead singleRead : singleReads) {
-            if(singleRead.getDirection().equals(SequenceDirection.Forward)){
-                assertNotNull(singleRead.getPherogram());
-                assertEquals(URI.create("http://ww2.biocase.org/websvn/filedetails.php?repname=campanula&path=%2FCAM385_GM312-petD_F.ab1"), MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri());
-            }
-            else{
-                assertNotNull(singleRead.getPherogram());
-                assertEquals(URI.create("http://ww2.biocase.org/websvn/filedetails.php?repname=campanula&path=%2FCAM385_GM312-petD_R.ab1"), MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri());
-            }
-        }
-        assertNotNull(amplificationResult.getSingleReads());
-        assertEquals(amplificationResult.getSingleReads(), singleReads);
-
-
-       }
-
-       /**
-        * Tests import of DNA unit and attaching it to an existing specimen to which
-        * it has a UnitAssociation.
-        */
-       @Test
-       @DataSet( value="AbcdGgbnImportTest.testAttachDnaSampleToDerivedUnit.xml", loadStrategy=CleanSweepInsertLoadStrategy.class)
-       public void testAttachDnaSampleToDerivedUnit(){
-           UUID derivedUnit1Uuid = UUID.fromString("eb40cb0f-efb2-4985-819e-a9168f6d61fe");
-
-//        DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.Fossil);
-//        derivedUnit.setAccessionNumber("B 10 0066577");
-//        derivedUnit.setTitleCache("testUnit1", true);
-//
-//        derivedUnit.setUuid(derivedUnit1Uuid );
-//
-//        occurrenceService.save(derivedUnit);
-//
-//        commitAndStartNewTransaction(null);
-//
-//        setComplete();
-//        endTransaction();
-//
-//
-//        try {
-//            writeDbUnitDataSetFile(new String[] {
-//                    "SpecimenOrObservationBase",
-//            }, "testAttachDnaSampleToDerivedUnit");
-//        } catch (FileNotFoundException e) {
-//            e.printStackTrace();
-//        }
-
-
-           String inputFile = "/eu/etaxonomy/cdm/io/specimen/abcd206/in/db6.xml";
-           URL url = this.getClass().getResource(inputFile);
-           assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
-
-           Abcd206ImportConfigurator importConfigurator = null;
-           try {
-               importConfigurator = Abcd206ImportConfigurator.NewInstance(url.toURI(), null,false);
-           } catch (URISyntaxException e) {
-               e.printStackTrace();
-               Assert.fail();
-           }
-           assertNotNull("Configurator could not be created", importConfigurator);
-
-           boolean result = defaultImport.invoke(importConfigurator);
-           assertTrue("Return value for import.invoke should be true", result);
-           assertEquals("Number of derived units is incorrect", 2, occurrenceService.count(DerivedUnit.class));
-           List<DerivedUnit> derivedUnits = occurrenceService.list(DerivedUnit.class, null, null, null, null);
-           assertEquals("Number of derived units is incorrect", 2, derivedUnits.size());
-           assertEquals("Number of field units is incorrect", 1, occurrenceService.count(FieldUnit.class));
-           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));
-
-           DerivedUnit derivedUnit = (DerivedUnit) occurrenceService.load(derivedUnit1Uuid);
-           assertTrue(derivedUnits.contains(derivedUnit));
-
-           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));
-           DnaSample dnaSample = occurrenceService.list(DnaSample.class, null, null, null, null).get(0);
-           assertEquals("Wrong derivation type!", DerivationEventType.DNA_EXTRACTION(), dnaSample.getDerivedFrom().getType());
-
-           assertEquals("Wrong number of originals", 1, dnaSample.getDerivedFrom().getOriginals().size());
-
-       }
-
-       /**
-        * Tests importing of DNA unit without attaching it to an existing specimen.
-        * Creates a FieldUnit with an attached DnaSample.
-        */
-       @Test
-       @DataSet( value="AbcdGgbnImportTest.testNoAttachDnaSampleToDerivedUnit.xml", loadStrategy=CleanSweepInsertLoadStrategy.class)
-       public void testNoAttachDnaSampleToDerivedUnit(){
-           UUID derivedUnit1Uuid = UUID.fromString("eb40cb0f-efb2-4985-819e-a9168f6d61fe");
-
-//        DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.Fossil);
-//        derivedUnit.setAccessionNumber("B 10 0066577");
-//        derivedUnit.setTitleCache("testUnit1", true);
-//
-//        derivedUnit.setUuid(derivedUnit1Uuid );
-//
-//        occurrenceService.save(derivedUnit);
-//
-//        commitAndStartNewTransaction(null);
-//
-//        setComplete();
-//        endTransaction();
-//
-//
-//        try {
-//            writeDbUnitDataSetFile(new String[] {
-//                    "SpecimenOrObservationBase",
-//            }, "testAttachDnaSampleToDerivedUnit");
-//        } catch (FileNotFoundException e) {
-//            e.printStackTrace();
-//        }
-
-
-           String inputFile = "/eu/etaxonomy/cdm/io/specimen/abcd206/in/db6.xml";
-           URL url = this.getClass().getResource(inputFile);
-           assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
-
-           Abcd206ImportConfigurator importConfigurator = null;
-           try {
-               importConfigurator = Abcd206ImportConfigurator.NewInstance(url.toURI(), null,false);
-           } catch (URISyntaxException e) {
-               e.printStackTrace();
-               Assert.fail();
-           }
-           assertNotNull("Configurator could not be created", importConfigurator);
-
-           assertEquals("Number of derived units is incorrect", 1, occurrenceService.count(DerivedUnit.class));
-           boolean result = defaultImport.invoke(importConfigurator);
-           assertTrue("Return value for import.invoke should be true", result);
-           assertEquals("Number of derived units is incorrect", 3, occurrenceService.count(DerivedUnit.class));
-           List<DerivedUnit> derivedUnits = occurrenceService.list(DerivedUnit.class, null, null, null, null);
-           assertEquals("Number of derived units is incorrect", 3, derivedUnits.size());
-           assertEquals("Number of field units is incorrect", 1, occurrenceService.count(FieldUnit.class));
-           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));
-
-           DerivedUnit derivedUnit = (DerivedUnit) occurrenceService.load(derivedUnit1Uuid);
-           assertTrue(derivedUnits.contains(derivedUnit));
-
-           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));
-           DnaSample dnaSample = occurrenceService.list(DnaSample.class, null, null, null, null).get(0);
-           assertEquals("Wrong derivation type!", DerivationEventType.DNA_EXTRACTION(), dnaSample.getDerivedFrom().getType());
-
-           assertEquals("Wrong number of originals", 1, dnaSample.getDerivedFrom().getOriginals().size());
-
-       }
-
-    @Override
-    public void createTestDataSet() throws FileNotFoundException {
-        UUID derivedUnit1Uuid = UUID.fromString("eb40cb0f-efb2-4985-819e-a9168f6d61fe");
-
-        DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.Fossil);
-        derivedUnit.setAccessionNumber("B 10 0066577");
-        derivedUnit.setTitleCache("testUnit1", true);
-
-        derivedUnit.setUuid(derivedUnit1Uuid );
-
-        occurrenceService.save(derivedUnit);
-
-        commitAndStartNewTransaction(null);
-
-        setComplete();
-        endTransaction();
-
-
-        try {
-            writeDbUnitDataSetFile(new String[] {
-                    "SpecimenOrObservationBase",
-            }, "testAttachDnaSampleToDerivedUnit");
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        }
-    }
-
-}
+/**\r
+* Copyright (C) 2007 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+\r
+package eu.etaxonomy.cdm.io.specimen.abcd206.in;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.net.URI;\r
+import java.net.URISyntaxException;\r
+import java.net.URL;\r
+import java.text.ParseException;\r
+import java.util.List;\r
+import java.util.Set;\r
+import java.util.UUID;\r
+\r
+import org.joda.time.DateTime;\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.unitils.dbunit.annotation.DataSet;\r
+import org.unitils.spring.annotation.SpringBeanByName;\r
+import org.unitils.spring.annotation.SpringBeanByType;\r
+\r
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;\r
+import eu.etaxonomy.cdm.api.service.IReferenceService;\r
+import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;\r
+import eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultImport;\r
+import eu.etaxonomy.cdm.model.common.DefinedTerm;\r
+import eu.etaxonomy.cdm.model.media.MediaUtils;\r
+import eu.etaxonomy.cdm.model.molecular.Amplification;\r
+import eu.etaxonomy.cdm.model.molecular.AmplificationResult;\r
+import eu.etaxonomy.cdm.model.molecular.DnaQuality;\r
+import eu.etaxonomy.cdm.model.molecular.DnaSample;\r
+import eu.etaxonomy.cdm.model.molecular.Primer;\r
+import eu.etaxonomy.cdm.model.molecular.Sequence;\r
+import eu.etaxonomy.cdm.model.molecular.SequenceDirection;\r
+import eu.etaxonomy.cdm.model.molecular.SequenceString;\r
+import eu.etaxonomy.cdm.model.molecular.SingleRead;\r
+import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;\r
+import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;\r
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;\r
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;\r
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;\r
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;\r
+import eu.etaxonomy.cdm.model.reference.Reference;\r
+import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;\r
+import eu.etaxonomy.cdm.test.unitils.CleanSweepInsertLoadStrategy;\r
+\r
+/**\r
+ * @author a.mueller\r
+ * @created 29.01.2009\r
+ */\r
+public class AbcdGgbnImportTest extends CdmTransactionalIntegrationTest {\r
+\r
+       @SpringBeanByName\r
+       private CdmApplicationAwareDefaultImport<?> defaultImport;\r
+\r
+       @SpringBeanByType\r
+       private IOccurrenceService occurrenceService;\r
+\r
+       @SpringBeanByType\r
+       private IReferenceService referenceService;\r
+\r
+       /**\r
+        * Tests import import of DNA unit and all its parameters\r
+        * and sub derivatives (sequence, amplification, etc.)\r
+        * @throws ParseException\r
+        */\r
+       @Test\r
+    @DataSet( value="../../../BlankDataSet.xml", loadStrategy=CleanSweepInsertLoadStrategy.class)\r
+    public void testImportGgbn() throws ParseException {\r
+        String inputFile = "/eu/etaxonomy/cdm/io/specimen/abcd206/in/db6.xml";\r
+        URL url = this.getClass().getResource(inputFile);\r
+        assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);\r
+\r
+        Abcd206ImportConfigurator importConfigurator = null;\r
+        try {\r
+            importConfigurator = Abcd206ImportConfigurator.NewInstance(url.toURI(), null,false);\r
+        } catch (URISyntaxException e) {\r
+            e.printStackTrace();\r
+            Assert.fail();\r
+        }\r
+        assertNotNull("Configurator could not be created", importConfigurator);\r
+\r
+        boolean result = defaultImport.invoke(importConfigurator);\r
+        assertTrue("Return value for import.invoke should be true", result);\r
+        assertEquals("Number of derived units is incorrect", 1, occurrenceService.count(DerivedUnit.class));\r
+        assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));\r
+        assertEquals("Number of field units is incorrect", 1, occurrenceService.count(FieldUnit.class));\r
+\r
+        //associated specimen\r
+        FindOccurrencesConfigurator config = new FindOccurrencesConfigurator();\r
+        config.setSignificantIdentifier("B 10 0066577");\r
+        List<SpecimenOrObservationBase> records = occurrenceService.findByTitle(config).getRecords();\r
+        assertEquals(1, records.size());\r
+        SpecimenOrObservationBase derivedUnitSpecimen = records.iterator().next();\r
+        assertEquals(DerivedUnit.class, derivedUnitSpecimen.getClass());\r
+        DerivedUnit specimen = (DerivedUnit) derivedUnitSpecimen;\r
+        assertEquals("Herbarium Berolinense", specimen.getCollection().getName());\r
+        assertTrue(SpecimenOrObservationType.DnaSample!=specimen.getRecordBasis());\r
+\r
+        //dna sample\r
+        FindOccurrencesConfigurator dnaConfig = new FindOccurrencesConfigurator();\r
+        dnaConfig.setSignificantIdentifier("DB 6");\r
+        List<SpecimenOrObservationBase> dnaRecords = occurrenceService.findByTitle(dnaConfig).getRecords();\r
+        assertEquals(1, dnaRecords.size());\r
+        SpecimenOrObservationBase dnaSpecimen = dnaRecords.iterator().next();\r
+        assertEquals(DnaSample.class, dnaSpecimen.getClass());\r
+        DnaSample dnaSample = (DnaSample) dnaSpecimen;\r
+        DerivationEvent derivedFrom = dnaSample.getDerivedFrom();\r
+        assertNotNull(derivedFrom);\r
+        assertEquals("Wrong derivation type!", DerivationEventType.DNA_EXTRACTION(), derivedFrom.getType());\r
+        assertEquals("Wrong number of originals", 1, derivedFrom.getOriginals().size());\r
+        assertEquals("DNA Bank", dnaSample.getCollection().getCode());\r
+        assertEquals(SpecimenOrObservationType.DnaSample, dnaSample.getRecordBasis());\r
+        //preservation/preparation\r
+        assertNotNull(derivedFrom.getActor());\r
+        assertEquals("Bansemer, Jana", derivedFrom.getActor().getTitleCache());\r
+        assertNotNull(derivedFrom.getTimeperiod());\r
+        assertEquals((Integer)2002,derivedFrom.getTimeperiod().getStartYear());\r
+        assertEquals((Integer)8,derivedFrom.getTimeperiod().getStartMonth());\r
+        assertEquals((Integer)13,derivedFrom.getTimeperiod().getStartDay());\r
+        assertNotNull(dnaSample.getPreservation());\r
+\r
+\r
+        //dna quality\r
+        DnaQuality dnaQuality = dnaSample.getDnaQuality();\r
+        assertNotNull("Dna quality is null", dnaQuality!=null);\r
+        assertEquals(new Double("0.77"),dnaQuality.getRatioOfAbsorbance260_230());\r
+        assertEquals(new Double("1.38"),dnaQuality.getRatioOfAbsorbance260_280());\r
+        assertEquals(new DateTime(2008, 4, 15, 0, 0),dnaQuality.getQualityCheckDate());\r
+//        assertEquals(MeasurementUnit.NewInstance(, label, labelAbbrev)DateTime(2008, 4, 15, 0, 0),dnaQuality.getQualityCheckDate());\r
+\r
+        //amplifications\r
+        Set<AmplificationResult> amplificationResults = dnaSample.getAmplificationResults();\r
+        assertNotNull(amplificationResults);\r
+        assertEquals(1,  amplificationResults.size());\r
+        AmplificationResult amplificationResult = amplificationResults.iterator().next();\r
+        Amplification amplification = amplificationResult.getAmplification();\r
+        assertNotNull("Amplification is null", amplification);\r
+        DefinedTerm dnaMarker = amplification.getDnaMarker();\r
+        assertNotNull(dnaMarker);\r
+        assertEquals("ITS (ITS1, 5.8S rRNA, ITS2)", dnaMarker.getLabel());\r
+\r
+        //amplification primers\r
+        Primer forwardPrimer = amplification.getForwardPrimer();\r
+        assertNotNull(forwardPrimer);\r
+        assertEquals("PIpetB1411F", forwardPrimer.getLabel());\r
+        assertEquals("5´-GCCGTMTTTATGTTAATGC-3´", forwardPrimer.getSequence().getString());\r
+        assertNotNull(forwardPrimer.getPublishedIn());\r
+        assertEquals("Löhne & Borsch 2005", forwardPrimer.getPublishedIn().getTitle());\r
+\r
+        Primer reversePrimer = amplification.getReversePrimer();\r
+        assertNotNull(reversePrimer);\r
+        assertEquals("PIpetD738R", reversePrimer.getLabel());\r
+        assertEquals("5´-AATTTAGCYCTTAATACAGG-3´", reversePrimer.getSequence().getString());\r
+\r
+        //sequencing\r
+        Set<Sequence> sequences = dnaSample.getSequences();\r
+        assertNotNull(sequences);\r
+        assertEquals(1, sequences.size());\r
+        Sequence sequence = sequences.iterator().next();\r
+        SequenceString consensusSequence = sequence.getConsensusSequence();\r
+        assertNotNull(consensusSequence);\r
+        assertEquals(\r
+                "TTTCGGGTCC TTTATAGTGA AGATATAGCA TAGATAGTTG TAATCCATTA" +\r
+                       " TGTATCATTG GGGAAGGAAG GAGAATATTT TTTTGATAGA ATACAAGTAT" +\r
+                       " GGATTATTGA AACTAATACG CCATGTATTT GGATATTTCC CTTGAACTGC" +\r
+                       " ATAATATTCT TTATTTTCCA TGAATAGTGT AAGGGAATTT TTCGAAGAGA" +\r
+                       " AAATGGATTA TGGGAGTGTG TGACTTGAGC TATTGATTGG TCTGTGCAGA" +\r
+                       " TACGGGCTTT TATCTATCTG CCACATTGTA ATTCACAAAC CAATGTGTCT" +\r
+                       " TTGTTCCAAC CATCGCGTAA GCCCCATACA GAAGATAGGC TGGTTCGCTT" +\r
+                       " GAAGAGAATC TTTTCTATGA TCAGATCCGA ATTATGTCGT ACATGAGCAG" +\r
+                       " GCTCCGTAAG ATCTAGTTGA CTTAAGTCAA ACTTCAATAG TATAAAAATG" +\r
+                       " CACTCATTTC CTCTGCATTG ACACGAGCTA TGAGACTATC GGAGTGAAAG" +\r
+                       " AAAGGGTCTA AAGAAGAAGA AAGCTTGGGC TAGATTAGTA ACAAGTAAAT" +\r
+                       " CCTTTGTGTG TGTGTTTGTA ATTAGTAAAT GGGCTCTCAA TATTTTGGGG" +\r
+                       " CTAATTACTG ATCCTAAGGT TTGAGACGAC CCAGAAAGCA CTTGATCATA" +\r
+                       " TCACGATTGA CTTTGTAAGC CTACTTGGGT ATTGAGTATT TACTTGTAAG" +\r
+                       " AACCGAATTC TTTGGGGGAT AGTTGCAAAA AGAATCCAGT CAATTGTTCT" +\r
+                       " TACGTAAAAC CATTCATATC TCGTATATGG ATATGTCTAG ATAGGCTATC" +\r
+                       " GATTTTCGAT GGATTCGTTT GGTTCTTTTG ATTATTGCTC GAGCTGGATG" +\r
+                       " ATGAAAAATT ATCATGTCCG GTTCCTTCG",consensusSequence.getString());\r
+//        assertEquals((Integer)912, consensusSequence.getLength());\r
+        assertNotNull(sequence.getContigFile());\r
+        assertEquals(URI.create("http://ww2.biocase.org/websvn/filedetails.php?repname=campanula&path=%2FCAM385_Campa_drabifolia.pde"), MediaUtils.getFirstMediaRepresentationPart(sequence.getContigFile()).getUri());\r
+        assertEquals(1, sequence.getCitations().size());\r
+        Reference<?> reference = sequence.getCitations().iterator().next();\r
+        assertEquals("Gemeinholzer,B., Bachmann,K. (2005): Examining morphological "\r
+                + "and molecular diagnostic character states in "\r
+                + "Cichorium intybus L. (Asteraceae) and Cichorium spinosum L."\r
+                + " Plant Systematics and Evolution 253 (1-3): 105-123.", reference.getTitle());\r
+\r
+        //single reads\r
+        Set<SingleRead> singleReads = sequence.getSingleReads();\r
+        assertNotNull(singleReads);\r
+        assertEquals(2, singleReads.size());\r
+        for (SingleRead singleRead : singleReads) {\r
+            if(singleRead.getDirection().equals(SequenceDirection.Forward)){\r
+                assertNotNull(singleRead.getPherogram());\r
+                assertEquals(URI.create("http://ww2.biocase.org/websvn/filedetails.php?repname=campanula&path=%2FCAM385_GM312-petD_F.ab1"), MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri());\r
+            }\r
+            else{\r
+                assertNotNull(singleRead.getPherogram());\r
+                assertEquals(URI.create("http://ww2.biocase.org/websvn/filedetails.php?repname=campanula&path=%2FCAM385_GM312-petD_R.ab1"), MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri());\r
+            }\r
+        }\r
+        assertNotNull(amplificationResult.getSingleReads());\r
+        assertEquals(amplificationResult.getSingleReads(), singleReads);\r
+\r
+\r
+       }\r
+\r
+       /**\r
+        * Tests import of DNA unit and attaching it to an existing specimen to which\r
+        * it has a UnitAssociation.\r
+        */\r
+       @Test\r
+       @DataSet( value="AbcdGgbnImportTest.testAttachDnaSampleToDerivedUnit.xml", loadStrategy=CleanSweepInsertLoadStrategy.class)\r
+       public void testAttachDnaSampleToDerivedUnit(){\r
+           UUID derivedUnit1Uuid = UUID.fromString("eb40cb0f-efb2-4985-819e-a9168f6d61fe");\r
+\r
+//        DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.Fossil);\r
+//        derivedUnit.setAccessionNumber("B 10 0066577");\r
+//        derivedUnit.setTitleCache("testUnit1", true);\r
+//\r
+//        derivedUnit.setUuid(derivedUnit1Uuid );\r
+//\r
+//        occurrenceService.save(derivedUnit);\r
+//\r
+//        commitAndStartNewTransaction(null);\r
+//\r
+//        setComplete();\r
+//        endTransaction();\r
+//\r
+//\r
+//        try {\r
+//            writeDbUnitDataSetFile(new String[] {\r
+//                    "SpecimenOrObservationBase",\r
+//            }, "testAttachDnaSampleToDerivedUnit");\r
+//        } catch (FileNotFoundException e) {\r
+//            e.printStackTrace();\r
+//        }\r
+\r
+\r
+           String inputFile = "/eu/etaxonomy/cdm/io/specimen/abcd206/in/db6.xml";\r
+           URL url = this.getClass().getResource(inputFile);\r
+           assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);\r
+\r
+           Abcd206ImportConfigurator importConfigurator = null;\r
+           try {\r
+               importConfigurator = Abcd206ImportConfigurator.NewInstance(url.toURI(), null,false);\r
+           } catch (URISyntaxException e) {\r
+               e.printStackTrace();\r
+               Assert.fail();\r
+           }\r
+           assertNotNull("Configurator could not be created", importConfigurator);\r
+\r
+           boolean result = defaultImport.invoke(importConfigurator);\r
+           assertTrue("Return value for import.invoke should be true", result);\r
+           assertEquals("Number of derived units is incorrect", 2, occurrenceService.count(DerivedUnit.class));\r
+           List<DerivedUnit> derivedUnits = occurrenceService.list(DerivedUnit.class, null, null, null, null);\r
+           assertEquals("Number of derived units is incorrect", 2, derivedUnits.size());\r
+           assertEquals("Number of field units is incorrect", 1, occurrenceService.count(FieldUnit.class));\r
+           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));\r
+\r
+           DerivedUnit derivedUnit = (DerivedUnit) occurrenceService.load(derivedUnit1Uuid);\r
+           assertTrue(derivedUnits.contains(derivedUnit));\r
+\r
+           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));\r
+           DnaSample dnaSample = occurrenceService.list(DnaSample.class, null, null, null, null).get(0);\r
+           assertEquals("Wrong derivation type!", DerivationEventType.DNA_EXTRACTION(), dnaSample.getDerivedFrom().getType());\r
+\r
+           assertEquals("Wrong number of originals", 1, dnaSample.getDerivedFrom().getOriginals().size());\r
+\r
+       }\r
+\r
+       /**\r
+        * Tests importing of DNA unit without attaching it to an existing specimen.\r
+        * Creates a FieldUnit with an attached DnaSample.\r
+        */\r
+       @Test\r
+       @DataSet( value="AbcdGgbnImportTest.testNoAttachDnaSampleToDerivedUnit.xml", loadStrategy=CleanSweepInsertLoadStrategy.class)\r
+       public void testNoAttachDnaSampleToDerivedUnit(){\r
+           UUID derivedUnit1Uuid = UUID.fromString("eb40cb0f-efb2-4985-819e-a9168f6d61fe");\r
+\r
+//        DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.Fossil);\r
+//        derivedUnit.setAccessionNumber("B 10 0066577");\r
+//        derivedUnit.setTitleCache("testUnit1", true);\r
+//\r
+//        derivedUnit.setUuid(derivedUnit1Uuid );\r
+//\r
+//        occurrenceService.save(derivedUnit);\r
+//\r
+//        commitAndStartNewTransaction(null);\r
+//\r
+//        setComplete();\r
+//        endTransaction();\r
+//\r
+//\r
+//        try {\r
+//            writeDbUnitDataSetFile(new String[] {\r
+//                    "SpecimenOrObservationBase",\r
+//            }, "testAttachDnaSampleToDerivedUnit");\r
+//        } catch (FileNotFoundException e) {\r
+//            e.printStackTrace();\r
+//        }\r
+\r
+\r
+           String inputFile = "/eu/etaxonomy/cdm/io/specimen/abcd206/in/db6.xml";\r
+           URL url = this.getClass().getResource(inputFile);\r
+           assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);\r
+\r
+           Abcd206ImportConfigurator importConfigurator = null;\r
+           try {\r
+               importConfigurator = Abcd206ImportConfigurator.NewInstance(url.toURI(), null,false);\r
+           } catch (URISyntaxException e) {\r
+               e.printStackTrace();\r
+               Assert.fail();\r
+           }\r
+           assertNotNull("Configurator could not be created", importConfigurator);\r
+\r
+           assertEquals("Number of derived units is incorrect", 1, occurrenceService.count(DerivedUnit.class));\r
+           boolean result = defaultImport.invoke(importConfigurator);\r
+           assertTrue("Return value for import.invoke should be true", result);\r
+           assertEquals("Number of derived units is incorrect", 3, occurrenceService.count(DerivedUnit.class));\r
+           List<DerivedUnit> derivedUnits = occurrenceService.list(DerivedUnit.class, null, null, null, null);\r
+           assertEquals("Number of derived units is incorrect", 3, derivedUnits.size());\r
+           assertEquals("Number of field units is incorrect", 1, occurrenceService.count(FieldUnit.class));\r
+           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));\r
+\r
+           DerivedUnit derivedUnit = (DerivedUnit) occurrenceService.load(derivedUnit1Uuid);\r
+           assertTrue(derivedUnits.contains(derivedUnit));\r
+\r
+           assertEquals("Number of dna samples is incorrect", 1, occurrenceService.count(DnaSample.class));\r
+           DnaSample dnaSample = occurrenceService.list(DnaSample.class, null, null, null, null).get(0);\r
+           assertEquals("Wrong derivation type!", DerivationEventType.DNA_EXTRACTION(), dnaSample.getDerivedFrom().getType());\r
+\r
+           assertEquals("Wrong number of originals", 1, dnaSample.getDerivedFrom().getOriginals().size());\r
+\r
+       }\r
+\r
+    @Override\r
+    public void createTestDataSet() throws FileNotFoundException {\r
+        UUID derivedUnit1Uuid = UUID.fromString("eb40cb0f-efb2-4985-819e-a9168f6d61fe");\r
+\r
+        DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.Fossil);\r
+        derivedUnit.setAccessionNumber("B 10 0066577");\r
+        derivedUnit.setTitleCache("testUnit1", true);\r
+\r
+        derivedUnit.setUuid(derivedUnit1Uuid );\r
+\r
+        occurrenceService.save(derivedUnit);\r
+\r
+        commitAndStartNewTransaction(null);\r
+\r
+        setComplete();\r
+        endTransaction();\r
+\r
+\r
+        try {\r
+            writeDbUnitDataSetFile(new String[] {\r
+                    "SpecimenOrObservationBase",\r
+            }, "testAttachDnaSampleToDerivedUnit");\r
+        } catch (FileNotFoundException e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+}\r