2 * Copyright (C) 2009 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
.persistence
.dao
.hibernate
.taxon
;
12 import static org
.junit
.Assert
.assertNotNull
;
14 import java
.util
.UUID
;
16 import org
.junit
.After
;
17 import org
.junit
.Before
;
18 import org
.junit
.Test
;
19 import org
.unitils
.dbunit
.annotation
.DataSet
;
20 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
23 import eu
.etaxonomy
.cdm
.model
.view
.AuditEvent
;
24 import eu
.etaxonomy
.cdm
.model
.view
.context
.AuditEventContextHolder
;
25 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IDefinedTermDao
;
26 import eu
.etaxonomy
.cdm
.persistence
.dao
.reference
.IReferenceDao
;
27 import eu
.etaxonomy
.cdm
.persistence
.dao
.taxon
.IClassificationDao
;
28 import eu
.etaxonomy
.cdm
.persistence
.dao
.taxon
.ITaxonDao
;
29 import eu
.etaxonomy
.cdm
.test
.integration
.CdmTransactionalIntegrationTest
;
36 public class TaxonDaoHibernateImplBenchmark
extends CdmTransactionalIntegrationTest
{
39 // public MethodRule benchmarkRun = new BenchmarkRule();
42 private ITaxonDao taxonDao
;
45 private IClassificationDao classificationDao
;
48 private IReferenceDao referenceDao
;
51 IDefinedTermDao definedTermDao
;
54 private UUID sphingidae
;
55 private UUID acherontia
;
58 private UUID retheraSecCdmtest
;
59 private UUID atroposAgassiz
;
60 private UUID atroposLeach
;
61 private UUID acherontiaLachesis
;
62 private AuditEvent previousAuditEvent
;
63 private AuditEvent mostRecentAuditEvent
;
65 private UUID northernAmericaUuid
;
66 private UUID southernAmericaUuid
;
67 private UUID antarcticaUuid
;
69 private UUID classificationUuid
;
71 private Taxon taxonAcherontia
;
77 uuid
= UUID
.fromString("496b1325-be50-4b0a-9aa2-3ecd610215f2");
78 sphingidae
= UUID
.fromString("54e767ee-894e-4540-a758-f906ecb4e2d9");
79 acherontia
= UUID
.fromString("c5cc8674-4242-49a4-aada-72d63194f5fa");
80 acherontiaLachesis
= UUID
.fromString("b04cc9cb-2b4a-4cc4-a94a-3c93a2158b06");
81 atroposAgassiz
= UUID
.fromString("d75b2e3d-7394-4ada-b6a5-93175b8751c1");
82 atroposLeach
= UUID
.fromString("3da4ab34-6c50-4586-801e-732615899b07");
83 rethera
= UUID
.fromString("a9f42927-e507-4fda-9629-62073a908aae");
84 retheraSecCdmtest
= UUID
.fromString("a9f42927-e507-433a-9629-62073a908aae");
87 mimas
= UUID
.fromString("900052b7-b69c-4e26-a8f0-01c215214c40");
88 previousAuditEvent
= new AuditEvent();
89 previousAuditEvent
.setRevisionNumber(1025);
90 previousAuditEvent
.setUuid(UUID
.fromString("a680fab4-365e-4765-b49e-768f2ee30cda"));
91 mostRecentAuditEvent
= new AuditEvent();
92 mostRecentAuditEvent
.setRevisionNumber(1026);
93 mostRecentAuditEvent
.setUuid(UUID
.fromString("afe8e761-8545-497b-9134-6a6791fc0b0d"));
94 AuditEventContextHolder
.clearContext(); // By default we're in the current view (i.e. view == null)
96 northernAmericaUuid
= UUID
.fromString("2757e726-d897-4546-93bd-7951d203bf6f");
97 southernAmericaUuid
= UUID
.fromString("6310b3ba-96f4-4855-bb5b-326e7af188ea");
98 antarcticaUuid
= UUID
.fromString("791b3aa0-54dd-4bed-9b68-56b4680aad0c");
100 classificationUuid
= UUID
.fromString("aeee7448-5298-4991-b724-8d5b75a0a7a9");
102 taxonAcherontia
= (Taxon
)taxonDao
.findByUuid(acherontia
);
106 public void tearDown() {
107 AuditEventContextHolder
.clearContext();
111 * Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.taxon.TaxonDaoHibernateImpl#TaxonDaoHibernateImpl()}.
114 @DataSet(value
="TaxonDaoHibernateImplTest.xml")
115 public void testInit() {
116 logger
.warn("testInit()");
117 assertNotNull("Instance of ITaxonDao expected",taxonDao
);
118 assertNotNull("Instance of IReferenceDao expected",referenceDao
);
123 @DataSet(value
="TaxonDaoHibernateImplTest.xml")
124 public void testDelete() {
125 assert taxonAcherontia
!= null : "taxon must exist";
126 taxonDao
.delete(taxonAcherontia
);
132 @DataSet(value
="TaxonDaoHibernateImplTest.xml")
133 public void testAddTaxon() {
134 assert taxonAcherontia
!= null : "taxon must exist";
135 taxonDao
.delete(taxonAcherontia
);