3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.test
.integration
;
12 import java
.io
.FileNotFoundException
;
13 import java
.util
.UUID
;
15 import org
.unitils
.dbunit
.annotation
.DataSet
;
17 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
18 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
20 import eu
.etaxonomy
.cdm
.test
.unitils
.CleanSweepInsertLoadStrategy
;
23 * This is only an example for am implementation of the {@link CdmTransactionalIntegrationTest}
24 * which is never meant to be executed.
26 * @author a.kohlbecker
30 public class CdmTransactionalIntegrationTestExample
extends CdmTransactionalIntegrationTest
{
33 // private ITaxonDao taxonDao;
35 // private IClassificationDao classificationDao;
37 // private IReferenceDao referenceDao;
39 private static final String CLASSIFICATION_UUID
= "2a5ceebb-4830-4524-b330-78461bf8cb6b";
42 * This is an example implementation for {@link CdmTransactionalIntegrationTest#createTestDataSet()}:
47 // @Test // uncomment to write out the test data xml file for this test class
48 @DataSet(loadStrategy
=CleanSweepInsertLoadStrategy
.class, value
="/eu/etaxonomy/cdm/database/ClearDBDataSet.xml")
49 public final void createTestDataSet() throws FileNotFoundException
{
51 // 1. create the entities and save them
52 Classification europeanAbiesClassification
= Classification
.NewInstance("European Abies");
53 europeanAbiesClassification
.setUuid(UUID
.fromString(CLASSIFICATION_UUID
));
54 // classificationDao.save(europeanAbiesClassification);
56 Reference sec
= ReferenceFactory
.newBook();
57 sec
.setTitleCache("Kohlbecker, A., Testcase standart views, 2013", true);
58 Reference sec_sensu
= ReferenceFactory
.newBook();
59 sec_sensu
.setTitleCache("Komarov, V. L., Flora SSSR 29", true);
60 // referenceDao.save(sec);
61 // referenceDao.save(sec_sensu);
63 // 2. end the transaction so that all data is actually written to the db
67 // use the fileNameAppendix if you are creating a data set file which need to be named differently
68 // from the standard name. For example if a single test method needs different data then the other
69 // methods the test class you may want to set the fileNameAppendix when creating the data for this method.
70 String fileNameAppendix
= null;
73 writeDbUnitDataSetFile(new String
[] {
74 "TAXONBASE", "TAXONNAMEBASE",
77 "AGENTBASE", "HOMOTYPICALGROUP",
78 "CLASSIFICATION", "TAXONNODE",
79 "HIBERNATE_SEQUENCES" // IMPORTANT!!!