Revision 9dc896c9
Added by Andreas Müller almost 7 years ago
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/name/TypeDesignationDaoHibernateImplTest.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.name.Rank; |
33 | 33 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
35 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
35 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
36 | 36 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
37 | 37 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
38 | 38 |
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase; |
... | ... | |
87 | 87 |
specTypeDesig = CdmBase.deproxy(typeDesignation,SpecimenTypeDesignation.class); |
88 | 88 |
} |
89 | 89 |
} |
90 |
Set<TaxonNameBase> names = specTypeDesig.getTypifiedNames();
|
|
90 |
Set<TaxonName> names = specTypeDesig.getTypifiedNames(); |
|
91 | 91 |
Assert.assertEquals("There should be exactly 1 typified name for the the specimen type designation", 1, names.size()); |
92 |
TaxonNameBase<?,?> singleName = names.iterator().next();
|
|
92 |
TaxonName singleName = names.iterator().next(); |
|
93 | 93 |
Assert.assertEquals("", UUID.fromString("61b1dcae-8aa6-478a-bcd6-080cf0eb6ad7"), singleName.getUuid()); |
94 | 94 |
} |
95 | 95 |
|
... | ... | |
109 | 109 |
} |
110 | 110 |
} |
111 | 111 |
|
112 |
TaxonNameBase<?,?> newName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
112 |
TaxonName newName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
113 | 113 |
newName.setUuid(UUID.fromString("c16c3bc5-d3d0-4676-91a1-848ebf011e7c")); |
114 | 114 |
newName.setTitleCache("Name used as typified name", true); |
115 | 115 |
newName.addTypeDesignation(specTypeDesig, false); |
... | ... | |
121 | 121 |
specTypeDesig = (SpecimenTypeDesignation)typeDesignationDao.load(specTypeDesig.getUuid()); |
122 | 122 |
Assert.assertNotNull("specimen type designation should exists in db", specTypeDesig); |
123 | 123 |
specTypeDesig.getTypifiedNames().size(); |
124 |
Set<TaxonNameBase> typifiedNames = specTypeDesig.getTypifiedNames();
|
|
124 |
Set<TaxonName> typifiedNames = specTypeDesig.getTypifiedNames(); |
|
125 | 125 |
Assert.assertEquals("There should be 2 typified names for this type designation now", 2, typifiedNames.size()); |
126 | 126 |
|
127 |
// printDataSet(System.out, new String[]{"TaxonNameBase","TaxonNameBase_AUD",
|
|
127 |
// printDataSet(System.out, new String[]{"TaxonName","TaxonName_AUD",
|
|
128 | 128 |
// "HomotypicalGroup","HomotypicalGroup_AUD", |
129 | 129 |
// "TypeDesignationBase","TypeDesignationBase_AUD", |
130 |
// "TaxonNameBase_TypeDesignationBase", "TaxonNameBase_TypeDesignationBase_AUD"
|
|
130 |
// "TaxonName_TypeDesignationBase", "TaxonName_TypeDesignationBase_AUD"
|
|
131 | 131 |
// }); |
132 | 132 |
|
133 | 133 |
} |
... | ... | |
138 | 138 |
SpecimenTypeDesignation desig1 = SpecimenTypeDesignation.NewInstance(); |
139 | 139 |
desig1.setUuid(UUID.fromString("a1b8af89-b724-469b-b0ce-027c2199aadd")); |
140 | 140 |
|
141 |
TaxonNameBase<?,?> name = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
141 |
TaxonName name = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
142 | 142 |
name.setUuid(UUID.fromString("503d78dc-5d4c-4eb6-b682-0ab90fdee02c")); |
143 | 143 |
name.setTitleCache("Name saved via cascade", true); |
144 | 144 |
name.addTypeDesignation(desig1, false); |
... | ... | |
156 | 156 |
// creating new Typedesignation for a new Name: |
157 | 157 |
|
158 | 158 |
// 1. new TaxonName with UUID 8564287e-9654-4b8b-a38c-0ccdd9e885db |
159 |
TaxonNameBase<?,?> name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
159 |
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
160 | 160 |
name1.setTitleCache("Name1", true); |
161 | 161 |
name1.setUuid(UUID.fromString("8564287e-9654-4b8b-a38c-0ccdd9e885db")); |
162 | 162 |
// 2. new TypeDesignation with uuid ceca086e-e8d3-444e-abfb-c47f76835130 |
... | ... | |
173 | 173 |
// System.out.println(desig1.getId()); |
174 | 174 |
// System.out.println(desig1.getUuid()); |
175 | 175 |
|
176 |
// printDataSet(System.err, new String[]{"TaxonNameBase","TaxonNameBase_AUD",
|
|
176 |
// printDataSet(System.err, new String[]{"TaxonName","TaxonName_AUD",
|
|
177 | 177 |
// "HomotypicalGroup","HomotypicalGroup_AUD", |
178 | 178 |
// "TypeDesignationBase","TypeDesignationBase_AUD", |
179 |
// "TaxonNameBase_TypeDesignationBase","TaxonNameBase_TypeDesignationBase_AUD"
|
|
179 |
// "TaxonName_TypeDesignationBase","TaxonName_TypeDesignationBase_AUD"
|
|
180 | 180 |
// }); |
181 | 181 |
|
182 | 182 |
} |
... | ... | |
184 | 184 |
@Test |
185 | 185 |
@ExpectedDataSet |
186 | 186 |
public void testSaveTypeDesignationsCascadeToSpecimen() { |
187 |
TaxonNameBase<?,?> name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
187 |
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
188 | 188 |
name1.setTitleCache("Name1", true); |
189 | 189 |
name1.setUuid(UUID.fromString("eb41f549-4a70-499b-a9a5-f2314880df07")); |
190 | 190 |
|
... | ... | |
202 | 202 |
this.setComplete(); |
203 | 203 |
this.endTransaction(); |
204 | 204 |
|
205 |
// printDataSet(System.out, new String[]{"TaxonNameBase","TaxonNameBase_AUD","TypeDesignationBase","TypeDesignationBase_AUD",
|
|
206 |
// "TaxonNameBase_TypeDesignationBase","TaxonNameBase_TypeDesignationBase_AUD",
|
|
207 |
// "TaxonNameBase_TypeDesignationBase","SpecimenOrObservationBase","SpecimenOrObservationBase_AUD",
|
|
205 |
// printDataSet(System.out, new String[]{"TaxonName","TaxonName_AUD","TypeDesignationBase","TypeDesignationBase_AUD",
|
|
206 |
// "TaxonName_TypeDesignationBase","TaxonName_TypeDesignationBase_AUD",
|
|
207 |
// "TaxonName_TypeDesignationBase","SpecimenOrObservationBase","SpecimenOrObservationBase_AUD", |
|
208 | 208 |
// "HomotypicalGroup","HomotypicalGroup_AUD"}); |
209 | 209 |
|
210 | 210 |
} |
... | ... | |
322 | 322 |
this.endTransaction(); |
323 | 323 |
|
324 | 324 |
|
325 |
// printDataSet(System.out, new String[]{"TaxonNameBase","TaxonNameBase_AUD","TypeDesignationBase","TypeDesignationBase_AUD",
|
|
326 |
// "TaxonNameBase_TypeDesignationBase","TaxonNameBase_TypeDesignationBase_AUD",
|
|
325 |
// printDataSet(System.out, new String[]{"TaxonName","TaxonName_AUD","TypeDesignationBase","TypeDesignationBase_AUD",
|
|
326 |
// "TaxonName_TypeDesignationBase","TaxonName_TypeDesignationBase_AUD",
|
|
327 | 327 |
// "SpecimenOrObservationBase","SpecimenOrObservationBase_AUD", |
328 | 328 |
// "HomotypicalGroup","HomotypicalGroup_AUD"}); |
329 | 329 |
} |
Also available in: Unified diff
fix #6368 rename table and class TaxonNameBase