1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service;
|
10
|
|
11
|
import static org.junit.Assert.assertEquals;
|
12
|
import static org.junit.Assert.assertNull;
|
13
|
|
14
|
import java.util.List;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import org.apache.log4j.Logger;
|
18
|
import org.junit.Ignore;
|
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;
|
23
|
|
24
|
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
|
25
|
import eu.etaxonomy.cdm.api.service.config.impl.TaxonServiceConfiguratorImpl;
|
26
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
27
|
import eu.etaxonomy.cdm.model.agent.Person;
|
28
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
29
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
30
|
import eu.etaxonomy.cdm.model.name.BotanicalName;
|
31
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
32
|
import eu.etaxonomy.cdm.model.name.Rank;
|
33
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
34
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
35
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
36
|
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
|
37
|
|
38
|
/**
|
39
|
* @author a.mueller
|
40
|
*
|
41
|
*/
|
42
|
public class TaxonServiceImplTest extends CdmIntegrationTest {
|
43
|
private static final Logger logger = Logger.getLogger(TaxonServiceImplTest.class);
|
44
|
|
45
|
@SpringBeanByType
|
46
|
private ITaxonService service;
|
47
|
|
48
|
@SpringBeanByType
|
49
|
private INameService nameService;
|
50
|
|
51
|
/****************** TESTS *****************************/
|
52
|
|
53
|
/**
|
54
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#setDao(eu.etaxonomy.cdm.persistence.dao.taxon.ITaxonDao)}.
|
55
|
*/
|
56
|
@Test
|
57
|
public final void testSetDao() {
|
58
|
logger.warn("Not implemented yet");
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#getTaxonByUuid(java.util.UUID)}.
|
63
|
*/
|
64
|
@Test
|
65
|
public final void testGetTaxonByUuid() {
|
66
|
Taxon expectedTaxon = Taxon.NewInstance(null, null);
|
67
|
UUID uuid = service.saveTaxon(expectedTaxon);
|
68
|
TaxonBase actualTaxon = service.getTaxonByUuid(uuid);
|
69
|
assertEquals(expectedTaxon, actualTaxon);
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#saveTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)}.
|
74
|
*/
|
75
|
@Test
|
76
|
public final void testSaveTaxon() {
|
77
|
Taxon expectedTaxon = Taxon.NewInstance(null, null);
|
78
|
UUID uuid = service.saveTaxon(expectedTaxon);
|
79
|
TaxonBase actualTaxon = service.getTaxonByUuid(uuid);
|
80
|
assertEquals(expectedTaxon, actualTaxon);
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#removeTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)}.
|
85
|
*/
|
86
|
@Test
|
87
|
public final void testRemoveTaxon() {
|
88
|
Taxon taxon = Taxon.NewInstance(BotanicalName.NewInstance(null), null);
|
89
|
UUID uuid = service.saveTaxon(taxon);
|
90
|
service.removeTaxon(taxon);
|
91
|
TaxonBase actualTaxon = service.getTaxonByUuid(uuid);
|
92
|
assertNull(actualTaxon);
|
93
|
}
|
94
|
|
95
|
/**
|
96
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#getRootTaxa(eu.etaxonomy.cdm.model.reference.ReferenceBase)}.
|
97
|
*/
|
98
|
@Test
|
99
|
public final void testGetRootTaxa() {
|
100
|
logger.warn("Not yet implemented"); // TODO
|
101
|
}
|
102
|
}
|