Revision c27ecf00
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java | ||
---|---|---|
18 | 18 |
import org.apache.log4j.Logger; |
19 | 19 |
import org.eclipse.core.commands.ExecutionException; |
20 | 20 |
import org.junit.Assert; |
21 |
import org.junit.Ignore; |
|
21 | 22 |
import org.junit.Test; |
22 | 23 |
import org.unitils.dbunit.annotation.DataSet; |
23 | 24 |
|
... | ... | |
25 | 26 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
26 | 27 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
27 | 28 |
import eu.etaxonomy.cdm.model.common.Language; |
29 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
|
30 |
import eu.etaxonomy.cdm.model.description.DescriptionElementSource; |
|
31 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
32 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
33 |
import eu.etaxonomy.cdm.model.description.TextData; |
|
28 | 34 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
29 | 35 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
30 | 36 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
... | ... | |
33 | 39 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
34 | 40 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
35 | 41 |
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation; |
42 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
36 | 43 |
|
37 | 44 |
/** |
38 | 45 |
* @author cmathew |
... | ... | |
151 | 158 |
taxonService.merge(taxon); |
152 | 159 |
} |
153 | 160 |
|
161 |
@Ignore |
|
162 |
@Test |
|
163 |
public void addDescription() { |
|
164 |
UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985"); |
|
165 |
|
|
166 |
TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid); |
|
167 |
Taxon taxon = taxonNode.getTaxon(); |
|
168 |
TaxonDescription description = TaxonDescription.NewInstance(taxon); |
|
169 |
|
|
170 |
|
|
171 |
TextData textData = TextData.NewInstance(); |
|
172 |
|
|
173 |
textData.setFeature(Feature.ECOLOGY()); |
|
174 |
description.addElement(textData); |
|
175 |
|
|
176 |
DescriptionElementSource descriptionElementSource = DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource); |
|
177 |
textData.addSource(descriptionElementSource); |
|
178 |
|
|
179 |
|
|
180 |
CdmStore.getService(ITaxonNodeService.class).merge(taxonNode); |
|
181 |
|
|
182 |
description.getId(); |
|
183 |
} |
|
184 |
|
|
185 |
|
|
186 |
@Test |
|
187 |
public void addTaxonNodeCascadeProblem() { |
|
188 |
UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985"); |
|
189 |
|
|
190 |
TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid); |
|
191 |
Taxon childTaxon = Taxon.NewInstance(null, null); |
|
192 |
TaxonNode childTaxonNode = taxonNode.addChildTaxon(childTaxon, null, null); |
|
193 |
Taxon grandChildTaxon = Taxon.NewInstance(null, null); |
|
194 |
TaxonNode grandChildTaxonNode = childTaxonNode.addChildTaxon(grandChildTaxon, null, null); |
|
195 |
|
|
196 |
CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true); |
|
197 |
|
|
198 |
Assert.assertEquals(taxonNode.getChildNodes().get(0).getId(), childTaxonNode.getId()); |
|
199 |
Assert.assertEquals(taxonNode.getChildNodes().get(0).getTaxon().getId(), childTaxon.getId()); |
|
200 |
Assert.assertEquals(taxonNode.getChildNodes().get(0).getChildNodes().get(0).getId(), grandChildTaxonNode.getId()); |
|
201 |
Assert.assertEquals(taxonNode.getChildNodes().get(0).getChildNodes().get(0).getTaxon().getId(), grandChildTaxon.getId()); |
|
202 |
} |
|
203 |
|
|
154 | 204 |
} |
155 | 205 |
|
Also available in: Unified diff
#5299 Handle session caching of new entities