3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.session
;
12 import java
.util
.ArrayList
;
13 import java
.util
.HashSet
;
14 import java
.util
.Iterator
;
15 import java
.util
.List
;
18 import java
.util
.UUID
;
20 import org
.apache
.log4j
.Logger
;
21 import org
.junit
.Assert
;
22 import org
.junit
.BeforeClass
;
23 import org
.junit
.Ignore
;
24 import org
.junit
.Test
;
25 import org
.unitils
.dbunit
.annotation
.DataSet
;
27 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
28 import eu
.etaxonomy
.cdm
.api
.service
.DeleteResult
;
29 import eu
.etaxonomy
.cdm
.api
.service
.ICommonService
;
30 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyNodeService
;
31 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyService
;
32 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
33 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
34 import eu
.etaxonomy
.cdm
.api
.service
.IUserService
;
35 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
36 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
37 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
38 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
39 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
40 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
41 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
42 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
43 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
44 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
45 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
46 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
47 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
48 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
49 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
50 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
51 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
53 import eu
.etaxonomy
.taxeditor
.httpinvoker
.RemotingSessionAwareTest
;
54 import eu
.etaxonomy
.taxeditor
.httpinvoker
.TestThread
;
63 public class CdmEntitySessionAwareTest
extends RemotingSessionAwareTest
{
65 private static final Logger logger
= Logger
.getLogger(CdmEntitySessionAwareTest
.class);
67 UUID polytomousKeyUuid
= UUID
.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
68 UUID subKeyUuid
= UUID
.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01");
69 //UUID polytomousKeyUuid = UUID.fromString("bab66772-2c83-428a-bb6d-655d12ac6097");
70 UUID taxon1Uuid
= UUID
.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
71 UUID personUuid
= UUID
.fromString("945d08f2-eb92-45b6-9252-6275ea6d338b");
75 IPolytomousKeyService polytomousKeyService
= getRemoteApplicationController().getPolytomousKeyService();
76 IPolytomousKeyNodeService polytomousKeyNodeService
= getRemoteApplicationController().getPolytomousKeyNodeService();
77 ICommonService commonService
= getRemoteApplicationController().getCommonService();
78 ITaxonService taxonService
= getRemoteApplicationController().getTaxonService();
79 IVocabularyService vocabularyService
= getRemoteApplicationController().getVocabularyService();
80 ITermService termService
= getRemoteApplicationController().getTermService();
81 IUserService userService
= getRemoteApplicationController().getUserService();
83 //Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
88 public static void initializePolytomousKeyTest() {
94 public void readAllPolytomousKeys() {
95 List
<PolytomousKey
> pKeys
= polytomousKeyService
.list(PolytomousKey
.class, null, null, null, null);
96 Iterator
<PolytomousKey
> pKeysItr
= pKeys
.iterator();
97 Assert
.assertEquals(pKeysItr
.next().getUuid(),UUID
.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01"));
98 Assert
.assertEquals(pKeysItr
.next().getUuid(),UUID
.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66"));
103 //@DataSet("PolytomousKeyTest.readPolytmousKeyData.xml")
104 public void readPolytmousKeyData() {
105 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
106 Set
<Taxon
> taxonomicScope
= pKey
.getTaxonomicScope();
107 Iterator
<Taxon
> tsItr
= taxonomicScope
.iterator();
108 Taxon taxon
= tsItr
.next();
110 Assert
.assertEquals("Achillea sec. Cyprus", taxon
.getTitleCache());
111 Assert
.assertEquals(tsItr
.hasNext(), false);
113 List
<Credit
> credits
= pKey
.getCredits();
114 AgentBase agent
= credits
.get(0).getAgent();
115 Assert
.assertEquals(agent
.getId(),4809);
116 Assert
.assertEquals(agent
.getTitleCache(),"R. A. Graham");
117 Assert
.assertEquals(credits
.get(0).getText(),"Credits Text Test");
119 Set
<Extension
> exts
= pKey
.getExtensions();
120 Iterator
<Extension
> extItr
= exts
.iterator();
121 Extension ext
= extItr
.next();
122 Assert
.assertEquals(ext
.getValue(), "http://test.com");
124 Set
<Rights
> rights
= pKey
.getRights();
125 Iterator
<Rights
> rightsItr
= rights
.iterator();
126 Rights right
= rightsItr
.next();
127 Assert
.assertEquals(right
.getText(),"Rights Text Test");
129 Set
<IdentifiableSource
> sources
= pKey
.getSources();
130 Iterator
<IdentifiableSource
> sourcesItr
= sources
.iterator();
131 IdentifiableSource source
= sourcesItr
.next();
132 Assert
.assertEquals(source
.getId(), 23710);
133 source
= sourcesItr
.next();
134 Assert
.assertEquals(source
.getId(), 23711);
136 // TO DO : Added tests for Annotations , Markers
142 public void readPolytomousKeyDataFromNodes() {
143 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
144 PolytomousKeyNode rootNode
= pKey
.getRoot();
147 Assert
.assertEquals(rootNode
.getId(), 2750);
149 Assert
.assertEquals(rootNode
.getChildAt(0).getId(), 2751);
150 Assert
.assertEquals(rootNode
.getChildAt(0).getParent().getId(), rootNode
.getId());
151 Assert
.assertEquals(rootNode
.getKey().getId(), pKey
.getId());
152 Integer sortIndex
= (Integer
)getFieldValueViaReflection(rootNode
.getChildAt(0), "sortIndex");
153 Assert
.assertEquals(sortIndex
, new Integer(0));
154 String statement
= "Capitula without ligulate ray-florets; leaves entire or subentire";
155 Assert
.assertEquals(rootNode
.getChildAt(0).getStatement().getLabelText(Language
.ENGLISH()), statement
);
157 Assert
.assertEquals(rootNode
.getChildAt(1).getId(), 2753);
158 Assert
.assertEquals(rootNode
.getChildAt(1).getParent().getId(), rootNode
.getId());
159 Assert
.assertEquals(rootNode
.getChildAt(1).getKey().getId(), pKey
.getId());
160 sortIndex
= (Integer
)getFieldValueViaReflection(rootNode
.getChildAt(1), "sortIndex");
161 Assert
.assertEquals(sortIndex
, new Integer(1));
162 statement
= "Capitula with ligulate ray-florets; leaves pinnatisect";
163 Assert
.assertEquals(rootNode
.getChildAt(1).getStatement().getLabelText(Language
.ENGLISH()), statement
);
165 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getId(), 2754);
166 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getParent().getId(), rootNode
.getChildAt(1).getId());
167 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getKey().getId(), pKey
.getId());
168 sortIndex
= (Integer
)getFieldValueViaReflection(rootNode
.getChildAt(1).getChildAt(0), "sortIndex");
169 Assert
.assertEquals(sortIndex
, new Integer(0));
170 statement
= "Ray-florets yellow";
171 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getStatement().getLabelText(Language
.ENGLISH()), statement
);
172 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getChildAt(0).getTaxon().getTitleCache(), "Achillea arabica Kotschy sec. Cyprus");
176 public void addGrandChildPolytomousKeyNode() {
178 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
179 PolytomousKeyNode rootChildNode
= pKey
.getRoot().getChildAt(0);
180 PolytomousKeyNode grandChildNode
= PolytomousKeyNode
.NewInstance();
181 rootChildNode
.addChild(grandChildNode
);
183 polytomousKeyService
.merge(pKey
, true);
184 grandChildNode
= pKey
.getRoot().getChildAt(0).getChildAt(0);
185 Assert
.assertTrue(0 != grandChildNode
.getId());
186 KeyStatement ks
= KeyStatement
.NewInstance("test");
187 grandChildNode
.setStatement(ks
);
188 polytomousKeyService
.merge(pKey
, true);
190 //grandChildNode = pKey.getRoot().getChildAt(0).getChildAt(0);
191 //KeyStatement ks = grandChildNode.getStatement();
192 Assert
.assertTrue(0 != ks
.getId());
197 public void addGreatGrandChildPolytomousKeyNode() {
199 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
200 PolytomousKeyNode rootChildNode
= pKey
.getRoot().getChildAt(0);
201 PolytomousKeyNode grandChildNode
= PolytomousKeyNode
.NewInstance();
202 rootChildNode
.addChild(grandChildNode
);
205 polytomousKeyNodeService
.merge(grandChildNode
);
208 Assert
.assertFalse(pKey
.getRoot().getChildAt(0).getChildAt(0).getId() == 0);
212 public void savePolytomousKeyNodeData() {
213 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
215 PolytomousKeyNode pkeynode
= pkey
.getRoot();
216 String newQuestion
= "New Question";
217 String newStatement
= "New Statement";
219 Assert
.assertEquals("Question 1",pkeynode
.getQuestion().getLabel().get(Language
.ENGLISH()).getText());
220 for(PolytomousKeyNode node
: pkeynode
.getChildren()) {
222 node
.setQuestion(null);
223 node
.setStatement(null);
225 //FIXME:Remoting Add tests for feature after fixing problem
227 //Feature feature = pkeynode.getFeature();
228 //Assert.assertEquals(feature.getTitleCache(),"Systematics");
229 //pkeynode.setFeature(null);
231 Assert
.assertEquals(pkeynode
.getChildAt(0).getModifyingText().get(Language
.ENGLISH()).getText(),"Modifying Text 1a");
232 String modifyingText
= "Modifying Text 1a updated";
234 //pkeynode.getChildAt(0).putModifyingText(Language.ENGLISH(), modifyingText);
236 Assert
.assertEquals(pkeynode
.getChildAt(0).getSubkey().getId(),751);
237 Assert
.assertEquals("Asphodeline", pkeynode
.getChildAt(0).getSubkey().getTitleCache());
238 Assert
.assertNull(pkeynode
.getChildAt(1).getTaxon());
239 Taxon taxon
= CdmBase
.deproxy(taxonService
.find(taxon1Uuid
),Taxon
.class);
240 pkeynode
.getChildAt(1).setTaxon(taxon
);
242 polytomousKeyService
.merge(pkey
);
244 pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
247 pkeynode
= pkey
.getRoot();
248 for(PolytomousKeyNode node
: pkeynode
.getChildren()) {
249 Assert
.assertNull(node
.getQuestion());
250 node
.setQuestion(KeyStatement
.NewInstance(Language
.ENGLISH(),newQuestion
));
251 Assert
.assertNull(node
.getStatement());
252 node
.setStatement(KeyStatement
.NewInstance(Language
.ENGLISH(),newStatement
));
255 Assert
.assertEquals(pkeynode
.getChildAt(1).getTaxon(), taxon
);
257 polytomousKeyService
.merge(pkey
);
259 pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
261 pkeynode
= pkey
.getRoot();
262 for(PolytomousKeyNode node
: pkeynode
.getChildren()) {
263 Assert
.assertNotNull(node
.getQuestion());
264 Map
<Language
, LanguageString
> label
= node
.getQuestion().getLabel();
265 Assert
.assertEquals(newQuestion
, label
.get(Language
.ENGLISH()).getText());
266 Assert
.assertNotNull(node
.getStatement());
267 Assert
.assertEquals(newStatement
, node
.getStatement().getLabel(Language
.ENGLISH()).getText());
269 //Assert.assertEquals(pkeynode.getFeature().getId(), feature.getId());
275 public void savePolytomousKeyNodeDataWithSameSubKey() {
277 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
280 PolytomousKeyNode pkeynode
= pkey
.getRoot();
282 PolytomousKey subkey1
= CdmBase
.deproxy(pkeynode
.getChildAt(0).getSubkey(), PolytomousKey
.class);
283 String subkey1title
= subkey1
.getTitleCache();
284 subkey1
.setTitleCache(subkey1title
+ "test", true);
287 PolytomousKey subkey2
= CdmBase
.deproxy(pkeynode
.getChildAt(1).getChildAt(0).getSubkey(), PolytomousKey
.class);
288 String subkey2title
= subkey2
.getTitleCache();
289 subkey2
.setTitleCache(subkey2title
+ "test", true);
291 Assert
.assertSame(subkey1
, subkey2
);
293 polytomousKeyService
.merge(pkey
);
297 public void savePolytomousKeyNodeDataWithSameSubKeyUsingService() {
299 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
302 PolytomousKeyNode pkeynode
= pkey
.getRoot();
303 //because of the check for null values in getChildren it isn't a persistent list anymore
304 // PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
305 PolytomousKeyNode childNode0
= (PolytomousKeyNode
)commonService
.get(pkeynode
.getUuid(), "children", 0);
306 PolytomousKey subkey1
= CdmBase
.deproxy(childNode0
.getSubkey(),PolytomousKey
.class);
307 String subkey1title
= subkey1
.getTitleCache();
308 subkey1
.setTitleCache(subkey1title
+ "test", true);
310 PolytomousKeyNode childNode1
= (PolytomousKeyNode
)commonService
.get(pkeynode
.getUuid(), "children", 1);
311 PolytomousKey subkey2
= CdmBase
.deproxy(childNode1
.getSubkey(),PolytomousKey
.class);
312 String subkey2title
= subkey2
.getTitleCache();
313 subkey2
.setTitleCache(subkey2title
+ "test", true);
315 Assert
.assertNotSame(childNode0
, childNode1
);
317 Assert
.assertSame(subkey1
, subkey2
);
319 polytomousKeyService
.merge(pkey
);
325 public void savePolytomousKeyNodeDataWithSameLanguageInLabel() {
327 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
328 PolytomousKeyNode pkeynode
= pkey
.getRoot();
330 Map
<Language
, LanguageString
> label1
= pkeynode
.getQuestion().getLabel();
334 Map
<Language
, LanguageString
> label2
= pkeynode
.getChildAt(0).getStatement().getLabel();
338 polytomousKeyService
.merge(pkey
);
342 public void deleteSubKeyInPolytomousSubKeyWithoutInitializing() {
343 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
346 PolytomousKeyNode rootNode
= pKey
.getRoot();
348 PolytomousKeyNode childNode
= rootNode
.getChildAt(0);
349 PolytomousKey subKey
= HibernateProxyHelper
.deproxy( childNode
.getSubkey(), PolytomousKey
.class);;
352 DeleteResult result
= polytomousKeyService
.delete(subKey
.getUuid());
353 //A used subKey can't be deleted
359 Set
<Integer
> ids
= new HashSet
<Integer
>();
363 List
<PolytomousKeyNode
> nodes
= polytomousKeyNodeService
.findById(ids
);
364 for (PolytomousKeyNode child
:nodes
){
365 child
.setSubkey(null);
366 // polytomousKeyNodeService.merge(child);
368 polytomousKeyNodeService
.merge(nodes
, true);
369 result
= polytomousKeyService
.delete(subKey
.getUuid());
377 // retrieving subkey shows its null
378 subKey
= CdmBase
.deproxy(polytomousKeyService
.find(subKeyUuid
),PolytomousKey
.class);
379 Assert
.assertNull(subKey
);
381 pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
388 public void deleteSubKeyInPolytomousNode() {
389 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
392 PolytomousKeyNode rootNode
= pKey
.getRoot();
393 List
<PolytomousKeyNode
> children
= rootNode
.getChildren();
394 PolytomousKeyNode child
= rootNode
.getChildAt(0);
395 polytomousKeyNodeService
.delete(child
.getUuid(), true);
397 pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
399 rootNode
= pKey
.getRoot();
400 children
= rootNode
.getChildren();
401 Assert
.assertFalse(children
.contains(child
));
405 public void deleteSubKeyInPolytomousSubKeyAfterInitializing() {
406 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
409 PolytomousKeyNode rootNode
= pKey
.getRoot();
410 PolytomousKeyNode child
= rootNode
.getChildAt(0);
411 PolytomousKey subKey
= child
.getSubkey();
412 // this call initializes the subkey
415 polytomousKeyService
.delete(subKey
);
417 // since subKey was initialized before the delete, it will be
418 // accesible even after the delete. This behaviour is similar
419 // to hibernate session delete where the deleted object is
420 // made transient, but not deleted from the object graph
422 PolytomousKeyNode subKeyRootNode
= subKey
.getRoot();
423 Assert
.assertNotNull(subKey
);
427 public void saveNewTermVocabulary() {
428 TermVocabulary termVocabulary
=
429 TermVocabulary
.NewInstance(TermType
.Feature
,
435 List
<TermVocabulary
<DefinedTermBase
>> vocabularies
= vocabularyService
.findByTermType(TermType
.Feature
);
437 for(TermVocabulary vocab
: vocabularies
) {
438 vocab
.getTermsOrderedByLabels(Language
.ENGLISH());
441 termVocabulary
= vocabularyService
.merge(termVocabulary
);
442 vocabularies
.add(termVocabulary
);
443 termVocabulary
.setLabel("Test");
444 vocabularyService
.merge(new ArrayList
<TermVocabulary
>(vocabularies
));
446 vocabularyService
.delete(termVocabulary
);
451 public void saveNewTerm() {
452 UUID vocNameFeatureUuid
= UUID
.fromString("fa7ca3eef-4092-49e1-beec-ed5096193e5e");
453 UUID vocFeatureUuid
= UUID
.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");
454 DefinedTermBase newTerm
= TermType
.Feature
.getEmptyDefinedTermBase();
455 newTerm
.setLabel("CreateTest");
459 Assert
.assertNotNull(newTerm
);
460 TermVocabulary vocNameFeature
= vocabularyService
.find(vocNameFeatureUuid
);
461 TermVocabulary vocFeature
= vocabularyService
.find(vocFeatureUuid
);
463 List
<TermVocabulary
> vocs
= new ArrayList
<TermVocabulary
>();
465 vocs
.add(vocNameFeature
);
466 vocs
.add(vocFeature
);
468 vocNameFeature
.addTerm(newTerm
);
470 vocs
= vocabularyService
.merge(vocs
);
471 for(TermVocabulary voc
: vocs
) {
472 if(voc
.getUuid().equals(vocNameFeatureUuid
)) {
473 vocNameFeature
= voc
;
477 Assert
.assertTrue(vocNameFeature
.getTerms().contains(newTerm
));
479 for(Object obj
: vocNameFeature
.getTerms()) {
480 DefinedTermBase dtb
= (DefinedTermBase
)obj
;
481 if("CreateTest".equals(dtb
.getLabel())) {
483 Assert
.assertNotNull(dtb
.getCreatedBy());
484 Assert
.assertNotNull(dtb
.getCreated());
486 Assert
.assertNull(dtb
.getCreatedBy());
489 newTerm
.setLabel("UpdateTest");
490 newTerm
= termService
.merge(newTerm
);
491 Assert
.assertNotNull(newTerm
.getUpdatedBy());
492 Assert
.assertNotNull(newTerm
.getUpdated());
494 Assert
.assertNull(vocNameFeature
.getCreatedBy());
495 Assert
.assertNull(vocFeature
.getCreatedBy());
497 if(termService
.find(newTerm
.getUuid()) != null) {
498 termService
.delete(newTerm
.getUuid());
505 public void updatePerson() {
507 Person person
= (Person
) CdmApplicationState
.getCurrentAppConfig().getAgentService().load(personUuid
);
508 person
.setFirstname("Me");
509 CdmApplicationState
.getCurrentAppConfig().getAgentService().merge(person
);
514 public void createPerson() {
516 Person person
= Person
.NewInstance();
517 person
= (Person
) CdmApplicationState
.getCurrentAppConfig().getAgentService().merge(person
);
518 person
= (Person
) CdmApplicationState
.getCurrentAppConfig().getAgentService().load(person
.getUuid());
519 person
.setFirstname("Some");
520 CdmApplicationState
.getCurrentAppConfig().getAgentService().merge(person
);
524 public void testThreadLocalActiveSession() throws InterruptedException
{
525 MockSessionOwner
<CdmBase
> so1
= new MockSessionOwner
<CdmBase
>();
526 final ICdmEntitySession activeSession
= getCdmEntitySessionManager().newSession(so1
, true);
527 TestThread thread
= new TestThread(true) {
529 public void doRun() throws InterruptedException
{
530 ICdmEntitySession threadLocalActiveSession
= getCdmEntitySessionManager().getActiveSession();
531 Assert
.assertEquals(threadLocalActiveSession
, activeSession
);
534 invokeThread(thread
);
535 MockSessionOwner
<CdmBase
> so2
= new MockSessionOwner
<CdmBase
>();
536 ICdmEntitySession newActiveSession
= getCdmEntitySessionManager().newSession(so2
, true);
537 Assert
.assertFalse(activeSession
.equals(newActiveSession
));