2 * Copyright (C) 2015 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.
9 package eu
.etaxonomy
.cdm
.test
.integration
;
11 import java
.io
.FileNotFoundException
;
12 import java
.util
.UUID
;
14 import org
.unitils
.dbunit
.annotation
.DataSet
;
16 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
17 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
19 import eu
.etaxonomy
.cdm
.test
.unitils
.CleanSweepInsertLoadStrategy
;
22 * This is only an example for am implementation of the {@link CdmTransactionalIntegrationTest}
23 * which is never meant to be executed.
25 * @author a.kohlbecker
29 public class CdmTransactionalIntegrationTestExample
extends CdmTransactionalIntegrationTest
{
32 // private ITaxonDao taxonDao;
34 // private IClassificationDao classificationDao;
36 // private IReferenceDao referenceDao;
38 private static final String CLASSIFICATION_UUID
= "2a5ceebb-4830-4524-b330-78461bf8cb6b";
41 * This is an example implementation for {@link CdmTransactionalIntegrationTest#createTestDataSet()}:
46 // @Test // uncomment to write out the test data xml file for this test class
47 @DataSet(loadStrategy
=CleanSweepInsertLoadStrategy
.class, value
="/eu/etaxonomy/cdm/database/ClearDBDataSet.xml")
48 public final void createTestDataSet() throws FileNotFoundException
{
50 // 1. create the entities and save them
51 Classification europeanAbiesClassification
= Classification
.NewInstance("European Abies");
52 europeanAbiesClassification
.setUuid(UUID
.fromString(CLASSIFICATION_UUID
));
53 // classificationDao.save(europeanAbiesClassification);
55 Reference sec
= ReferenceFactory
.newBook();
56 sec
.setTitleCache("Kohlbecker, A., Testcase standart views, 2013", true);
57 Reference sec_sensu
= ReferenceFactory
.newBook();
58 sec_sensu
.setTitleCache("Komarov, V. L., Flora SSSR 29", true);
59 // referenceDao.save(sec);
60 // referenceDao.save(sec_sensu);
62 // 2. end the transaction so that all data is actually written to the db
66 // use the fileNameAppendix if you are creating a data set file which need to be named differently
67 // from the standard name. For example if a single test method needs different data then the other
68 // methods the test class you may want to set the fileNameAppendix when creating the data for this method.
69 String fileNameAppendix
= null;
72 writeDbUnitDataSetFile(new String
[] {
73 "TAXONBASE", "TAXONNAME",
76 "AGENTBASE", "HOMOTYPICALGROUP",
77 "CLASSIFICATION", "TAXONNODE",
78 "HIBERNATE_SEQUENCES" // IMPORTANT!!!
80 fileNameAppendix
, true );