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
.Iterator
;
14 import java
.util
.List
;
17 import java
.util
.UUID
;
19 import org
.apache
.log4j
.Logger
;
20 import org
.junit
.Assert
;
21 import org
.junit
.BeforeClass
;
22 import org
.junit
.Ignore
;
23 import org
.junit
.Test
;
24 import org
.unitils
.dbunit
.annotation
.DataSet
;
26 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
27 import eu
.etaxonomy
.cdm
.api
.service
.ICommonService
;
28 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyNodeService
;
29 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyService
;
30 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
31 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
32 import eu
.etaxonomy
.cdm
.api
.service
.IUserService
;
33 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
34 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
35 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
36 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
37 import eu
.etaxonomy
.cdm
.model
.common
.Credit
;
38 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
39 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
40 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
41 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
42 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
43 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
44 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
45 import eu
.etaxonomy
.cdm
.model
.description
.KeyStatement
;
46 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
47 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
48 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
49 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
50 import eu
.etaxonomy
.taxeditor
.httpinvoker
.RemotingSessionAwareTest
;
51 import eu
.etaxonomy
.taxeditor
.httpinvoker
.TestThread
;
60 public class CdmEntitySessionAwareTest
extends RemotingSessionAwareTest
{
62 private static final Logger logger
= Logger
.getLogger(CdmEntitySessionAwareTest
.class);
64 UUID polytomousKeyUuid
= UUID
.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
65 UUID subKeyUuid
= UUID
.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01");
66 //UUID polytomousKeyUuid = UUID.fromString("bab66772-2c83-428a-bb6d-655d12ac6097");
67 UUID taxon1Uuid
= UUID
.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
68 UUID personUuid
= UUID
.fromString("945d08f2-eb92-45b6-9252-6275ea6d338b");
72 IPolytomousKeyService polytomousKeyService
= getRemoteApplicationController().getPolytomousKeyService();
73 IPolytomousKeyNodeService polytomousKeyNodeService
= getRemoteApplicationController().getPolytomousKeyNodeService();
74 ICommonService commonService
= getRemoteApplicationController().getCommonService();
75 ITaxonService taxonService
= getRemoteApplicationController().getTaxonService();
76 IVocabularyService vocabularyService
= getRemoteApplicationController().getVocabularyService();
77 ITermService termService
= getRemoteApplicationController().getTermService();
78 IUserService userService
= getRemoteApplicationController().getUserService();
80 //Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
85 public static void initializePolytomousKeyTest() {
91 public void readAllPolytomousKeys() {
92 List
<PolytomousKey
> pKeys
= polytomousKeyService
.list(PolytomousKey
.class, null, null, null, null);
93 Iterator
<PolytomousKey
> pKeysItr
= pKeys
.iterator();
94 Assert
.assertEquals(pKeysItr
.next().getUuid(),UUID
.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01"));
95 Assert
.assertEquals(pKeysItr
.next().getUuid(),UUID
.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66"));
100 //@DataSet("PolytomousKeyTest.readPolytmousKeyData.xml")
101 public void readPolytmousKeyData() {
102 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
103 Set
<Taxon
> taxonomicScope
= pKey
.getTaxonomicScope();
104 Iterator
<Taxon
> tsItr
= taxonomicScope
.iterator();
105 Taxon taxon
= tsItr
.next();
107 Assert
.assertEquals("Achillea sec. Cyprus", taxon
.getTitleCache());
108 Assert
.assertEquals(tsItr
.hasNext(), false);
110 List
<Credit
> credits
= pKey
.getCredits();
111 AgentBase agent
= credits
.get(0).getAgent();
112 Assert
.assertEquals(agent
.getId(),4809);
113 Assert
.assertEquals(agent
.getTitleCache(),"R. A. Graham");
114 Assert
.assertEquals(credits
.get(0).getText(),"Credits Text Test");
116 Set
<Extension
> exts
= pKey
.getExtensions();
117 Iterator
<Extension
> extItr
= exts
.iterator();
118 Extension ext
= extItr
.next();
119 Assert
.assertEquals(ext
.getValue(), "http://test.com");
121 Set
<Rights
> rights
= pKey
.getRights();
122 Iterator
<Rights
> rightsItr
= rights
.iterator();
123 Rights right
= rightsItr
.next();
124 Assert
.assertEquals(right
.getText(),"Rights Text Test");
126 Set
<IdentifiableSource
> sources
= pKey
.getSources();
127 Iterator
<IdentifiableSource
> sourcesItr
= sources
.iterator();
128 IdentifiableSource source
= sourcesItr
.next();
129 Assert
.assertEquals(source
.getId(), 23710);
130 source
= sourcesItr
.next();
131 Assert
.assertEquals(source
.getId(), 23711);
133 // TO DO : Added tests for Annotations , Markers
139 public void readPolytomousKeyDataFromNodes() {
140 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
141 PolytomousKeyNode rootNode
= pKey
.getRoot();
144 Assert
.assertEquals(rootNode
.getId(), 2750);
146 Assert
.assertEquals(rootNode
.getChildAt(0).getId(), 2751);
147 Assert
.assertEquals(rootNode
.getChildAt(0).getParent().getId(), rootNode
.getId());
148 Assert
.assertEquals(rootNode
.getKey().getId(), pKey
.getId());
149 Integer sortIndex
= (Integer
)getFieldValueViaReflection(rootNode
.getChildAt(0), "sortIndex");
150 Assert
.assertEquals(sortIndex
, new Integer(0));
151 String statement
= "Capitula without ligulate ray-florets; leaves entire or subentire";
152 Assert
.assertEquals(rootNode
.getChildAt(0).getStatement().getLabelText(Language
.ENGLISH()), statement
);
154 Assert
.assertEquals(rootNode
.getChildAt(1).getId(), 2753);
155 Assert
.assertEquals(rootNode
.getChildAt(1).getParent().getId(), rootNode
.getId());
156 Assert
.assertEquals(rootNode
.getChildAt(1).getKey().getId(), pKey
.getId());
157 sortIndex
= (Integer
)getFieldValueViaReflection(rootNode
.getChildAt(1), "sortIndex");
158 Assert
.assertEquals(sortIndex
, new Integer(1));
159 statement
= "Capitula with ligulate ray-florets; leaves pinnatisect";
160 Assert
.assertEquals(rootNode
.getChildAt(1).getStatement().getLabelText(Language
.ENGLISH()), statement
);
162 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getId(), 2754);
163 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getParent().getId(), rootNode
.getChildAt(1).getId());
164 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getKey().getId(), pKey
.getId());
165 sortIndex
= (Integer
)getFieldValueViaReflection(rootNode
.getChildAt(1).getChildAt(0), "sortIndex");
166 Assert
.assertEquals(sortIndex
, new Integer(0));
167 statement
= "Ray-florets yellow";
168 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getStatement().getLabelText(Language
.ENGLISH()), statement
);
169 Assert
.assertEquals(rootNode
.getChildAt(1).getChildAt(0).getChildAt(0).getTaxon().getTitleCache(), "Achillea arabica Kotschy sec. Cyprus");
173 public void addGrandChildPolytomousKeyNode() {
175 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
176 PolytomousKeyNode rootChildNode
= pKey
.getRoot().getChildAt(0);
177 PolytomousKeyNode grandChildNode
= PolytomousKeyNode
.NewInstance();
178 rootChildNode
.addChild(grandChildNode
);
180 polytomousKeyService
.merge(pKey
, true);
181 grandChildNode
= pKey
.getRoot().getChildAt(0).getChildAt(0);
182 Assert
.assertTrue(0 != grandChildNode
.getId());
183 KeyStatement ks
= KeyStatement
.NewInstance("test");
184 grandChildNode
.setStatement(ks
);
185 polytomousKeyService
.merge(pKey
, true);
187 //grandChildNode = pKey.getRoot().getChildAt(0).getChildAt(0);
188 //KeyStatement ks = grandChildNode.getStatement();
189 Assert
.assertTrue(0 != ks
.getId());
194 public void addGreatGrandChildPolytomousKeyNode() {
196 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
197 PolytomousKeyNode rootChildNode
= pKey
.getRoot().getChildAt(0);
198 PolytomousKeyNode grandChildNode
= PolytomousKeyNode
.NewInstance();
199 rootChildNode
.addChild(grandChildNode
);
202 polytomousKeyNodeService
.merge(grandChildNode
);
205 Assert
.assertFalse(pKey
.getRoot().getChildAt(0).getChildAt(0).getId() == 0);
209 public void savePolytomousKeyNodeData() {
210 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
212 PolytomousKeyNode pkeynode
= pkey
.getRoot();
213 String newQuestion
= "New Question";
214 String newStatement
= "New Statement";
216 Assert
.assertEquals("Question 1",pkeynode
.getQuestion().getLabel().get(Language
.ENGLISH()).getText());
217 for(PolytomousKeyNode node
: pkeynode
.getChildren()) {
219 node
.setQuestion(null);
220 node
.setStatement(null);
222 //FIXME:Remoting Add tests for feature after fixing problem
224 //Feature feature = pkeynode.getFeature();
225 //Assert.assertEquals(feature.getTitleCache(),"Systematics");
226 //pkeynode.setFeature(null);
228 Assert
.assertEquals(pkeynode
.getChildAt(0).getModifyingText().get(Language
.ENGLISH()).getText(),"Modifying Text 1a");
229 String modifyingText
= "Modifying Text 1a updated";
231 //pkeynode.getChildAt(0).putModifyingText(Language.ENGLISH(), modifyingText);
233 Assert
.assertEquals(pkeynode
.getChildAt(0).getSubkey().getId(),751);
234 Assert
.assertEquals("Asphodeline", pkeynode
.getChildAt(0).getSubkey().getTitleCache());
235 Assert
.assertNull(pkeynode
.getChildAt(1).getTaxon());
236 Taxon taxon
= CdmBase
.deproxy(taxonService
.find(taxon1Uuid
),Taxon
.class);
237 pkeynode
.getChildAt(1).setTaxon(taxon
);
239 polytomousKeyService
.merge(pkey
);
241 pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
244 pkeynode
= pkey
.getRoot();
245 for(PolytomousKeyNode node
: pkeynode
.getChildren()) {
246 Assert
.assertNull(node
.getQuestion());
247 node
.setQuestion(KeyStatement
.NewInstance(Language
.ENGLISH(),newQuestion
));
248 Assert
.assertNull(node
.getStatement());
249 node
.setStatement(KeyStatement
.NewInstance(Language
.ENGLISH(),newStatement
));
252 Assert
.assertEquals(pkeynode
.getChildAt(1).getTaxon(), taxon
);
254 polytomousKeyService
.merge(pkey
);
256 pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
258 pkeynode
= pkey
.getRoot();
259 for(PolytomousKeyNode node
: pkeynode
.getChildren()) {
260 Assert
.assertNotNull(node
.getQuestion());
261 Map
<Language
, LanguageString
> label
= node
.getQuestion().getLabel();
262 Assert
.assertEquals(newQuestion
, label
.get(Language
.ENGLISH()).getText());
263 Assert
.assertNotNull(node
.getStatement());
264 Assert
.assertEquals(newStatement
, node
.getStatement().getLabel(Language
.ENGLISH()).getText());
266 //Assert.assertEquals(pkeynode.getFeature().getId(), feature.getId());
272 public void savePolytomousKeyNodeDataWithSameSubKey() {
274 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
277 PolytomousKeyNode pkeynode
= pkey
.getRoot();
279 PolytomousKey subkey1
= CdmBase
.deproxy(pkeynode
.getChildAt(0).getSubkey(), PolytomousKey
.class);
280 String subkey1title
= subkey1
.getTitleCache();
281 subkey1
.setTitleCache(subkey1title
+ "test", true);
284 PolytomousKey subkey2
= CdmBase
.deproxy(pkeynode
.getChildAt(1).getChildAt(0).getSubkey(), PolytomousKey
.class);
285 String subkey2title
= subkey2
.getTitleCache();
286 subkey2
.setTitleCache(subkey2title
+ "test", true);
288 Assert
.assertSame(subkey1
, subkey2
);
290 polytomousKeyService
.merge(pkey
);
294 public void savePolytomousKeyNodeDataWithSameSubKeyUsingService() {
296 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
299 PolytomousKeyNode pkeynode
= pkey
.getRoot();
300 //because of the check for null values in getChildren it isn't a persistent list anymore
301 // PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
302 PolytomousKeyNode childNode0
= (PolytomousKeyNode
)commonService
.get(pkeynode
.getUuid(), "children", 0);
303 PolytomousKey subkey1
= CdmBase
.deproxy(childNode0
.getSubkey(),PolytomousKey
.class);
304 String subkey1title
= subkey1
.getTitleCache();
305 subkey1
.setTitleCache(subkey1title
+ "test", true);
307 PolytomousKeyNode childNode1
= (PolytomousKeyNode
)commonService
.get(pkeynode
.getUuid(), "children", 1);
308 PolytomousKey subkey2
= CdmBase
.deproxy(childNode1
.getSubkey(),PolytomousKey
.class);
309 String subkey2title
= subkey2
.getTitleCache();
310 subkey2
.setTitleCache(subkey2title
+ "test", true);
312 Assert
.assertNotSame(childNode0
, childNode1
);
314 Assert
.assertSame(subkey1
, subkey2
);
316 polytomousKeyService
.merge(pkey
);
322 public void savePolytomousKeyNodeDataWithSameLanguageInLabel() {
324 PolytomousKey pkey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
325 PolytomousKeyNode pkeynode
= pkey
.getRoot();
327 Map
<Language
, LanguageString
> label1
= pkeynode
.getQuestion().getLabel();
331 Map
<Language
, LanguageString
> label2
= pkeynode
.getChildAt(0).getStatement().getLabel();
335 polytomousKeyService
.merge(pkey
);
339 public void deleteSubKeyInPolytomousSubKeyWithoutInitializing() {
340 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
343 PolytomousKeyNode rootNode
= pKey
.getRoot();
344 PolytomousKeyNode child
= rootNode
.getChildAt(0);
345 PolytomousKey subKey
= child
.getSubkey();
347 polytomousKeyService
.delete(subKey
.getUuid());
349 // retrieving subkey shows its null
350 subKey
= CdmBase
.deproxy(polytomousKeyService
.find(subKeyUuid
),PolytomousKey
.class);
351 Assert
.assertNull(subKey
);
353 pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
356 rootNode
= pKey
.getRoot();
357 child
= rootNode
.getChildAt(0);
358 subKey
= child
.getSubkey();
359 // subkey will not be null, because the delete functionality of the subkey
360 // does not currently delete it from a polytomous key node
362 // FIXME: With the new delete functionality this should be null, shouldn't it ?
363 Assert
.assertNotNull(subKey
);
368 public void deleteSubKeyInPolytomousNode() {
369 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
372 PolytomousKeyNode rootNode
= pKey
.getRoot();
373 List
<PolytomousKeyNode
> children
= rootNode
.getChildren();
374 PolytomousKeyNode child
= rootNode
.getChildAt(0);
375 polytomousKeyNodeService
.delete(child
.getUuid(), true);
377 pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
379 rootNode
= pKey
.getRoot();
380 children
= rootNode
.getChildren();
381 Assert
.assertFalse(children
.contains(child
));
385 public void deleteSubKeyInPolytomousSubKeyAfterInitializing() {
386 PolytomousKey pKey
= CdmBase
.deproxy(polytomousKeyService
.find(polytomousKeyUuid
),PolytomousKey
.class);
389 PolytomousKeyNode rootNode
= pKey
.getRoot();
390 PolytomousKeyNode child
= rootNode
.getChildAt(0);
391 PolytomousKey subKey
= child
.getSubkey();
392 // this call initializes the subkey
395 polytomousKeyService
.delete(subKey
);
397 // since subKey was initialized before the delete, it will be
398 // accesible even after the delete. This behaviour is similar
399 // to hibernate session delete where the deleted object is
400 // made transient, but not deleted from the object graph
402 PolytomousKeyNode subKeyRootNode
= subKey
.getRoot();
403 Assert
.assertNotNull(subKey
);
407 public void saveNewTermVocabulary() {
408 TermVocabulary termVocabulary
=
409 TermVocabulary
.NewInstance(TermType
.Feature
,
415 List
<TermVocabulary
<DefinedTermBase
>> vocabularies
= vocabularyService
.findByTermType(TermType
.Feature
);
417 for(TermVocabulary vocab
: vocabularies
) {
418 vocab
.getTermsOrderedByLabels(Language
.ENGLISH());
421 termVocabulary
= vocabularyService
.merge(termVocabulary
);
422 vocabularies
.add(termVocabulary
);
423 termVocabulary
.setLabel("Test");
424 vocabularyService
.merge(new ArrayList
<TermVocabulary
>(vocabularies
));
426 vocabularyService
.delete(termVocabulary
);
431 public void saveNewTerm() {
432 UUID vocNameFeatureUuid
= UUID
.fromString("fa7ca3eef-4092-49e1-beec-ed5096193e5e");
433 UUID vocFeatureUuid
= UUID
.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");
434 DefinedTermBase newTerm
= TermType
.Feature
.getEmptyDefinedTermBase();
435 newTerm
.setLabel("CreateTest");
439 Assert
.assertNotNull(newTerm
);
440 TermVocabulary vocNameFeature
= vocabularyService
.find(vocNameFeatureUuid
);
441 TermVocabulary vocFeature
= vocabularyService
.find(vocFeatureUuid
);
443 List
<TermVocabulary
> vocs
= new ArrayList
<TermVocabulary
>();
445 vocs
.add(vocNameFeature
);
446 vocs
.add(vocFeature
);
448 vocNameFeature
.addTerm(newTerm
);
450 vocs
= vocabularyService
.merge(vocs
);
451 for(TermVocabulary voc
: vocs
) {
452 if(voc
.getUuid().equals(vocNameFeatureUuid
)) {
453 vocNameFeature
= voc
;
457 Assert
.assertTrue(vocNameFeature
.getTerms().contains(newTerm
));
459 for(Object obj
: vocNameFeature
.getTerms()) {
460 DefinedTermBase dtb
= (DefinedTermBase
)obj
;
461 if("CreateTest".equals(dtb
.getLabel())) {
463 Assert
.assertNotNull(dtb
.getCreatedBy());
464 Assert
.assertNotNull(dtb
.getCreated());
466 Assert
.assertNull(dtb
.getCreatedBy());
469 newTerm
.setLabel("UpdateTest");
470 newTerm
= termService
.merge(newTerm
);
471 Assert
.assertNotNull(newTerm
.getUpdatedBy());
472 Assert
.assertNotNull(newTerm
.getUpdated());
474 Assert
.assertNull(vocNameFeature
.getCreatedBy());
475 Assert
.assertNull(vocFeature
.getCreatedBy());
477 if(termService
.find(newTerm
.getUuid()) != null) {
478 termService
.delete(newTerm
.getUuid());
485 public void updatePerson() {
487 Person person
= (Person
) CdmApplicationState
.getCurrentAppConfig().getAgentService().load(personUuid
);
488 person
.setFirstname("Me");
489 CdmApplicationState
.getCurrentAppConfig().getAgentService().merge(person
);
494 public void createPerson() {
496 Person person
= Person
.NewInstance();
497 person
= (Person
) CdmApplicationState
.getCurrentAppConfig().getAgentService().merge(person
);
498 person
= (Person
) CdmApplicationState
.getCurrentAppConfig().getAgentService().load(person
.getUuid());
499 person
.setFirstname("Some");
500 CdmApplicationState
.getCurrentAppConfig().getAgentService().merge(person
);
504 public void testThreadLocalActiveSession() throws InterruptedException
{
505 MockSessionOwner
<CdmBase
> so1
= new MockSessionOwner
<CdmBase
>();
506 final ICdmEntitySession activeSession
= getCdmEntitySessionManager().newSession(so1
, true);
507 TestThread thread
= new TestThread(true) {
509 public void doRun() throws InterruptedException
{
510 ICdmEntitySession threadLocalActiveSession
= getCdmEntitySessionManager().getActiveSession();
511 Assert
.assertEquals(threadLocalActiveSession
, activeSession
);
514 invokeThread(thread
);
515 MockSessionOwner
<CdmBase
> so2
= new MockSessionOwner
<CdmBase
>();
516 ICdmEntitySession newActiveSession
= getCdmEntitySessionManager().newSession(so2
, true);
517 Assert
.assertFalse(activeSession
.equals(newActiveSession
));