Add deproxy of entities in assertSame assertions
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 12 Oct 2015 08:57:50 +0000 (10:57 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 12 Oct 2015 08:57:50 +0000 (10:57 +0200)
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java

index 43f4be96cd91cb907228c85614b45033be0d7e27..db2f094f854769ecb380955f86a17b32bcc5a5d8 100644 (file)
@@ -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);
 
        // 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
         // 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
         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();
        //              |- 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
         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
         // 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
         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);
 
 
        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));
     }
 
        Assert.assertSame(cacher.getFromCache(st), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
     }