Revision 9dc896c9
Added by Andreas Müller almost 7 years ago
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/name/TaxonNameDaoHibernateImplTest.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.Rank; |
35 | 35 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
36 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
37 | 37 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
38 | 38 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
... | ... | |
92 | 92 |
|
93 | 93 |
@Test |
94 | 94 |
public void testGetNameRelationships() { |
95 |
TaxonNameBase acherontia = taxonNameDao.findByUuid(acherontiaUuid);
|
|
95 |
TaxonName acherontia = taxonNameDao.findByUuid(acherontiaUuid); |
|
96 | 96 |
assert acherontia != null : "name must exist"; |
97 | 97 |
|
98 | 98 |
List<NameRelationship> result = taxonNameDao.getNameRelationships(acherontia, NameRelationship.Direction.relatedFrom, null, null,null,null, null); |
... | ... | |
102 | 102 |
assertEquals("getRelatedNames should return 1 NameRelationship instance",1,result.size()); |
103 | 103 |
|
104 | 104 |
// testing inverted direction |
105 |
TaxonNameBase atropos = taxonNameDao.findByUuid(atroposUuid);
|
|
105 |
TaxonName atropos = taxonNameDao.findByUuid(atroposUuid); |
|
106 | 106 |
assert atropos != null : "name must exist"; |
107 | 107 |
|
108 | 108 |
result = taxonNameDao.getNameRelationships(atropos, NameRelationship.Direction.relatedTo, null, null,null,null, null); |
... | ... | |
120 | 120 |
|
121 | 121 |
@Test |
122 | 122 |
public void testCountNameRelationships() { |
123 |
TaxonNameBase acherontia = taxonNameDao.findByUuid(acherontiaUuid);
|
|
123 |
TaxonName acherontia = taxonNameDao.findByUuid(acherontiaUuid); |
|
124 | 124 |
assert acherontia != null : "name must exist"; |
125 | 125 |
|
126 | 126 |
int count = taxonNameDao.countNameRelationships(acherontia, NameRelationship.Direction.relatedFrom, null); |
... | ... | |
128 | 128 |
assertEquals("countRelatedNames should return 1",1,count); |
129 | 129 |
|
130 | 130 |
// testing inverted direction |
131 |
TaxonNameBase atropos = taxonNameDao.findByUuid(atroposUuid);
|
|
131 |
TaxonName atropos = taxonNameDao.findByUuid(atroposUuid); |
|
132 | 132 |
assert atropos != null : "name must exist"; |
133 | 133 |
|
134 | 134 |
count = taxonNameDao.countNameRelationships(atropos, NameRelationship.Direction.relatedTo, null); |
... | ... | |
138 | 138 |
|
139 | 139 |
@Test |
140 | 140 |
public void testGetTypeDesignations() { |
141 |
TaxonNameBase acherontiaLachesis = taxonNameDao.findByUuid(acherontiaLachesisUuid);
|
|
141 |
TaxonName acherontiaLachesis = taxonNameDao.findByUuid(acherontiaLachesisUuid); |
|
142 | 142 |
assert acherontiaLachesis != null : "name must exist"; |
143 | 143 |
|
144 | 144 |
List<TypeDesignationBase> result1 = taxonNameDao.getTypeDesignations(acherontiaLachesis, null, null, null, null, null); |
... | ... | |
156 | 156 |
|
157 | 157 |
@Test |
158 | 158 |
public void testCountTypeDesignations() { |
159 |
TaxonNameBase acherontiaLachesis = taxonNameDao.findByUuid(acherontiaLachesisUuid);
|
|
159 |
TaxonName acherontiaLachesis = taxonNameDao.findByUuid(acherontiaLachesisUuid); |
|
160 | 160 |
assert acherontiaLachesis != null : "name must exist"; |
161 | 161 |
|
162 | 162 |
int count = taxonNameDao.countTypeDesignations(acherontiaLachesis, null); |
... | ... | |
166 | 166 |
|
167 | 167 |
@Test |
168 | 168 |
public void testSearchNames() { |
169 |
List<TaxonNameBase> result = taxonNameDao.searchNames("Atropos", null, null, null, Rank.GENUS(), null, null, null, null);
|
|
169 |
List<TaxonName> result = taxonNameDao.searchNames("Atropos", null, null, null, Rank.GENUS(), null, null, null, null); |
|
170 | 170 |
|
171 | 171 |
assertNotNull("searcNames should return a list",result); |
172 | 172 |
assertFalse("the list should not be empty", result.isEmpty()); |
173 |
assertEquals("searchNames should return 3 TaxonNameBase instances",3,result.size());
|
|
173 |
assertEquals("searchNames should return 3 TaxonName instances",3,result.size()); |
|
174 | 174 |
} |
175 | 175 |
|
176 | 176 |
@Test |
... | ... | |
182 | 182 |
|
183 | 183 |
@Test |
184 | 184 |
public void testCountNamesByExample() { |
185 |
TaxonNameBase<?,?> zoologicalName = TaxonNameFactory.NewZoologicalInstance(Rank.GENUS());
|
|
185 |
TaxonName zoologicalName = TaxonNameFactory.NewZoologicalInstance(Rank.GENUS()); |
|
186 | 186 |
zoologicalName.setGenusOrUninomial("Atropos"); |
187 | 187 |
Set<String> includedProperties = new HashSet<String>(); |
188 | 188 |
includedProperties.add("genusOrUninomial"); |
... | ... | |
200 | 200 |
* has no order index (=0) |
201 | 201 |
*/ |
202 | 202 |
public void testMissingRankOrderIndex() { |
203 |
TaxonNameBase acherontiaLachesis = taxonNameDao.findByUuid(acherontiaLachesisUuid);
|
|
203 |
TaxonName acherontiaLachesis = taxonNameDao.findByUuid(acherontiaLachesisUuid); |
|
204 | 204 |
Rank rank = null; |
205 | 205 |
try { |
206 | 206 |
rank = Rank.getRankByName(acherontiaLachesis.getRank().getLabel()); |
... | ... | |
214 | 214 |
|
215 | 215 |
@Test |
216 | 216 |
public void testDeleteTaxon(){ |
217 |
TaxonNameBase acherontiaLachesis = taxonNameDao.findByUuid(UUID.fromString("497a9955-5c5a-4f2b-b08c-2135d336d633"));
|
|
218 |
HibernateProxyHelper.deproxy(acherontiaLachesis, TaxonNameBase.class);
|
|
217 |
TaxonName acherontiaLachesis = taxonNameDao.findByUuid(UUID.fromString("497a9955-5c5a-4f2b-b08c-2135d336d633")); |
|
218 |
HibernateProxyHelper.deproxy(acherontiaLachesis, TaxonName.class); |
|
219 | 219 |
Set<TaxonBase> taxonBases = acherontiaLachesis.getTaxonBases(); |
220 | 220 |
HomotypicalGroup group = acherontiaLachesis.getHomotypicalGroup(); |
221 | 221 |
UUID groupUuid = group.getUuid(); |
Also available in: Unified diff
fix #6368 rename table and class TaxonNameBase