From ce921df338b6d6917e0107d0d2d40c79aa20094a Mon Sep 17 00:00:00 2001 From: Cherian Mathew Date: Mon, 12 Oct 2015 10:57:50 +0200 Subject: [PATCH] Add deproxy of entities in assertSame assertions --- .../cdm/api/cache/CdmClientCachingTest.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java index 43f4be96c..db2f094f8 100644 --- a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java +++ b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java @@ -84,9 +84,8 @@ public class CdmClientCachingTest extends RemotingSessionAwareTest { // in a recursive call PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class); - // checking to make sure the root object is in the session cache - Assert.assertSame(pkey1.getRoot(), cacher.getFromCache(pkey1.getRoot())); + Assert.assertSame(CdmBase.deproxy(pkey1.getRoot(),PolytomousKeyNode.class), cacher.getFromCache(pkey1.getRoot())); } @@ -103,9 +102,9 @@ public class CdmClientCachingTest extends RemotingSessionAwareTest { PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class); CdmTransientEntityCacher cacher = getCacher(sessionOwner); // checking to make sure the root object is in the session cache - Assert.assertSame(pkey.getRoot(), cacher.getFromCache(pkey.getRoot())); - Assert.assertSame(pkey.getRoot().getStatement(), cacher.getFromCache(pkey.getRoot().getStatement())); - Assert.assertSame(pkey.getRoot().getQuestion(), cacher.getFromCache(pkey.getRoot().getQuestion())); + Assert.assertSame(CdmBase.deproxy(pkey.getRoot(),PolytomousKeyNode.class), cacher.getFromCache(pkey.getRoot())); + Assert.assertSame(CdmBase.deproxy(pkey.getRoot().getStatement(),KeyStatement.class), cacher.getFromCache(pkey.getRoot().getStatement())); + Assert.assertSame(CdmBase.deproxy(pkey.getRoot().getQuestion(),KeyStatement.class), cacher.getFromCache(pkey.getRoot().getQuestion())); } @@ -172,7 +171,7 @@ public class CdmClientCachingTest extends RemotingSessionAwareTest { // |- statement : KeyStatement PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class); KeyStatement ks1 = pkey1.getRoot().getStatement(); - Assert.assertSame(cacher.getFromCache(pkey1.getRoot().getStatement()), pkey1.getRoot().getStatement()); + Assert.assertSame(ks1, pkey1.getRoot().getStatement()); CdmTransientEntityCacher cacher = getCacher(sessionOwner); // this call will load into the session cache the graph and update the objects in the sub-graph for a @@ -206,7 +205,7 @@ public class CdmClientCachingTest extends RemotingSessionAwareTest { // that it exists in the cache and // that both the original object and the // cached object are the same - Assert.assertNotNull(pkey1.getRoot().getStatement()); + Assert.assertNotNull(CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class)); Assert.assertNotNull(cacher.getFromCache(pkey1.getRoot().getStatement())); // this call will load into the session cache the graph and update the objects in the sub-graph for a @@ -257,8 +256,8 @@ public class CdmClientCachingTest extends RemotingSessionAwareTest { PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class); - Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class)); - Assert.assertSame(st, pkey2.getRoot().getStatement()); + Assert.assertSame(CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class)); + Assert.assertSame(st, CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class)); Assert.assertSame(cacher.getFromCache(st), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class)); } -- 2.34.1