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.
9 package eu
.etaxonomy
.cdm
.persistence
.hibernate
;
11 import static org
.junit
.Assert
.assertNotNull
;
13 import java
.io
.FileNotFoundException
;
14 import java
.util
.UUID
;
16 import org
.apache
.logging
.log4j
.LogManager
;
17 import org
.apache
.logging
.log4j
.Logger
;
18 import org
.junit
.Before
;
19 import org
.junit
.Test
;
20 import org
.springframework
.security
.authentication
.AuthenticationManager
;
21 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
25 import eu
.etaxonomy
.cdm
.persistence
.dao
.permission
.IUserDao
;
26 import eu
.etaxonomy
.cdm
.persistence
.dao
.taxon
.ITaxonDao
;
27 import eu
.etaxonomy
.cdm
.test
.integration
.CdmTransactionalIntegrationTest
;
29 public class Level2ValidationEventListenerTest
extends CdmTransactionalIntegrationTest
{
31 private static final Logger logger
= LogManager
.getLogger();
34 private TaxonBase
<?
> cdmBase
;
37 private ITaxonDao cdmEntityDaoBase
;
40 private AuthenticationManager authenticationManager
;
43 private IUserDao userDao
;
46 public void setUp() throws Exception
{
47 logger
.info("begin setUp()");
48 uuid
= UUID
.fromString("8d77c380-c76a-11dd-ad8b-0800200c9a66");
49 cdmBase
= Taxon
.NewInstance(null, null);
50 cdmBase
.setUuid(UUID
.fromString("e463b270-c76b-11dd-ad8b-0800200c9a66"));
51 logger
.info("end setUp()");
54 /************ TESTS ********************************/
57 public void testCdmEntityDaoBase() throws Exception
{
58 assertNotNull("cdmEntityDaoBase should exist", cdmEntityDaoBase
);
64 public void testSaveOrUpdate(){
65 TaxonBase
<?
> cdmBase
= cdmEntityDaoBase
.findByUuid(uuid
);
66 cdmBase
.setDoubtful(true);
67 cdmEntityDaoBase
.saveOrUpdate(cdmBase
);
74 public void testSave() throws Exception
{
75 cdmEntityDaoBase
.save(cdmBase
);
82 public void testUpdate(){
83 TaxonBase
<?
> cdmBase
= cdmEntityDaoBase
.findByUuid(uuid
);
84 cdmBase
.setDoubtful(true);
85 cdmEntityDaoBase
.update(cdmBase
);
90 //@DataSet("CdmEntityDaoBaseTest.xml")
92 public void testDelete(){
93 TaxonBase
<?
> cdmBase
= cdmEntityDaoBase
.findByUuid(uuid
);
94 assertNotNull(cdmBase
);
95 cdmEntityDaoBase
.delete(cdmBase
);
99 public void createTestDataSet() throws FileNotFoundException
{}