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
.persistence
.hibernate
;
13 import static org
.junit
.Assert
.assertNotNull
;
15 import java
.util
.UUID
;
17 import org
.apache
.log4j
.Logger
;
18 import org
.junit
.Before
;
19 import org
.junit
.Test
;
20 import org
.unitils
.dbunit
.annotation
.DataSet
;
21 import org
.unitils
.dbunit
.annotation
.ExpectedDataSet
;
22 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
24 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
27 import eu
.etaxonomy
.cdm
.persistence
.dao
.name
.ITaxonNameDao
;
28 import eu
.etaxonomy
.cdm
.test
.integration
.CdmIntegrationTest
;
35 public class CacheStrategyGeneratorTest
extends CdmIntegrationTest
{
36 @SuppressWarnings("unused")
37 private static Logger logger
= Logger
.getLogger(CacheStrategyGeneratorTest
.class);
40 private TaxonBase cdmBase
;
43 private ITaxonNameDao cdmEntityDaoBase
;
47 * @throws java.lang.Exception
50 public void setUp() throws Exception
{
51 uuid
= UUID
.fromString("8d77c380-c76a-11dd-ad8b-0800200c9a66");
52 cdmBase
= Taxon
.NewInstance(null, null);
53 cdmBase
.setUuid(UUID
.fromString("e463b270-c76b-11dd-ad8b-0800200c9a66"));
57 * Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#CdmEntityDaoBase(java.lang.Class)}.
61 public void testCdmEntityDaoBase() throws Exception
{
62 assertNotNull("cdmEntityDaoBase should exist",cdmEntityDaoBase
);
66 * Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#saveOrUpdate(eu.etaxonomy.cdm.model.common.CdmBase)}.
69 @DataSet("CacheStrategyGeneratorTest.xml")
71 public void testOnSaveOrUpdate() {
72 BotanicalName name
= (BotanicalName
)cdmEntityDaoBase
.findByUuid(UUID
.fromString("a49a3963-c4ea-4047-8588-2f8f15352730"));;
73 name
.setTitleCache(null, false);
74 name
.setNameCache(null, false);
75 name
.setGenusOrUninomial("Abies");
76 name
.setAuthorshipCache("Mill.", true);
77 cdmEntityDaoBase
.saveOrUpdate(name
);