Revision c7d830cc
Added by Cherian Mathew about 9 years ago
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/PolytomousKeyTest.java | ||
---|---|---|
44 | 44 |
import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest; |
45 | 45 |
import eu.etaxonomy.taxeditor.httpinvoker.CDMServer; |
46 | 46 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher; |
47 |
import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult; |
|
47 | 48 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
48 | 49 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
49 | 50 |
import eu.etaxonomy.taxeditor.session.MockSessionOwner; |
... | ... | |
182 | 183 |
@Test |
183 | 184 |
public void savePolytomousKeyNodeData() { |
184 | 185 |
PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
185 |
//pkey = cdmEntitySession.load(pkey); |
|
186 |
|
|
186 | 187 |
PolytomousKeyNode pkeynode = pkey.getRoot(); |
187 | 188 |
String newQuestion = "New Question"; |
188 | 189 |
String newStatement = "New Statement"; |
... | ... | |
210 | 211 |
Taxon taxon = CdmBase.deproxy(taxonService.find(taxon1Uuid),Taxon.class); |
211 | 212 |
pkeynode.getChildAt(1).setTaxon(taxon); |
212 | 213 |
|
214 |
EntityCacherDebugResult debugResult = cacher.debug(pkey, true); |
|
215 |
debugResult.print(); |
|
213 | 216 |
polytomousKeyService.merge(pkey); |
214 | 217 |
|
215 | 218 |
pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
216 | 219 |
sessionOwner = new MockSessionOwner(); |
217 |
pkey = cdmEntitySession.load(pkey); |
|
220 |
|
|
218 | 221 |
|
219 | 222 |
pkeynode = pkey.getRoot(); |
220 | 223 |
for(PolytomousKeyNode node : pkeynode.getChildren()) { |
... | ... | |
231 | 234 |
|
232 | 235 |
pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
233 | 236 |
sessionOwner = new MockSessionOwner(); |
234 |
pkey = cdmEntitySession.load(pkey); |
|
237 |
|
|
235 | 238 |
|
236 | 239 |
pkeynode = pkey.getRoot(); |
237 | 240 |
for(PolytomousKeyNode node : pkeynode.getChildren()) { |
... | ... | |
251 | 254 |
ICdmEntitySessionEnabled sessionOwner = new MockSessionOwner(); |
252 | 255 |
cdmEntitySessionManager.bind(sessionOwner); |
253 | 256 |
PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
254 |
pkey = cdmEntitySession.load(pkey); |
|
257 |
|
|
255 | 258 |
|
256 | 259 |
PolytomousKeyNode pkeynode = pkey.getRoot(); |
257 | 260 |
|
... | ... | |
273 | 276 |
public void savePolytomousKeyNodeDataWithSameSubKeyUsingService() { |
274 | 277 |
|
275 | 278 |
PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
276 |
pkey = cdmEntitySession.load(pkey); |
|
279 |
|
|
277 | 280 |
|
278 | 281 |
PolytomousKeyNode pkeynode = pkey.getRoot(); |
279 | 282 |
|
... | ... | |
315 | 318 |
@Test |
316 | 319 |
public void deleteSubKeyInPolytomousSubKeyWithoutInitializing() { |
317 | 320 |
PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
318 |
pKey = cdmEntitySession.load(pKey); |
|
321 |
|
|
319 | 322 |
|
320 | 323 |
PolytomousKeyNode rootNode = pKey.getRoot(); |
321 | 324 |
PolytomousKeyNode child = rootNode.getChildAt(0); |
... | ... | |
336 | 339 |
Assert.assertNull(subKey); |
337 | 340 |
|
338 | 341 |
pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
339 |
pKey = cdmEntitySession.load(pKey); |
|
342 |
|
|
340 | 343 |
|
341 | 344 |
rootNode = pKey.getRoot(); |
342 | 345 |
child = rootNode.getChildAt(0); |
... | ... | |
357 | 360 |
@Test |
358 | 361 |
public void deleteSubKeyInPolytomousNode() { |
359 | 362 |
PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
360 |
pKey = cdmEntitySession.load(pKey); |
|
363 |
|
|
361 | 364 |
|
362 | 365 |
PolytomousKeyNode rootNode = pKey.getRoot(); |
363 | 366 |
List<PolytomousKeyNode> children = rootNode.getChildren(); |
364 | 367 |
PolytomousKeyNode child = rootNode.getChildAt(0); |
365 |
polytomousKeyNodeService.delete(child, true, true);
|
|
368 |
polytomousKeyNodeService.delete(child.getUuid(), true);
|
|
366 | 369 |
|
367 | 370 |
pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
368 | 371 |
|
... | ... | |
374 | 377 |
@Test |
375 | 378 |
public void deleteSubKeyInPolytomousSubKeyAfterInitializing() { |
376 | 379 |
PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class); |
377 |
pKey = cdmEntitySession.load(pKey); |
|
380 |
|
|
378 | 381 |
|
379 | 382 |
PolytomousKeyNode rootNode = pKey.getRoot(); |
380 | 383 |
PolytomousKeyNode child = rootNode.getChildAt(0); |
Also available in: Unified diff
CdmModelCacher : added recursive search in super classes
CdmTransientEntityCacher : corrected caching
EntityCacherDebugResult : new debug result object
CdmEntitySession, ICdmEntitySession, MockCdmEntitySession : added debug method
CdmEntitySessionInput : new super class for editor input objects
TaxonEditorInput : refactored and made sub class of CdmEntitySessionInput
DeleteNodeOperation : using new uuid service methods
TaxonNameEditor : removed unnecessary service call to retrieve taxon
TaxonLinkHelper : removed unnecessary second call to initialise input
AbstractCdmViewPart : now implements ISessionEnabled