Project

General

Profile

« Previous | Next » 

Revision ce921df3

Added by Cherian Mathew over 8 years ago

Add deproxy of entities in assertSame assertions

View differences:

eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java
84 84
    	// in a recursive call
85 85
        PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
86 86

  
87

  
88 87
        // checking to make sure the root object is in the session cache
89
        Assert.assertSame(pkey1.getRoot(), cacher.getFromCache(pkey1.getRoot()));
88
        Assert.assertSame(CdmBase.deproxy(pkey1.getRoot(),PolytomousKeyNode.class), cacher.getFromCache(pkey1.getRoot()));
90 89

  
91 90
    }
92 91

  
......
103 102
        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
104 103
        CdmTransientEntityCacher cacher = getCacher(sessionOwner);
105 104
        // checking to make sure the root object is in the session cache
106
        Assert.assertSame(pkey.getRoot(), cacher.getFromCache(pkey.getRoot()));
107
        Assert.assertSame(pkey.getRoot().getStatement(), cacher.getFromCache(pkey.getRoot().getStatement()));
108
        Assert.assertSame(pkey.getRoot().getQuestion(), cacher.getFromCache(pkey.getRoot().getQuestion()));
105
        Assert.assertSame(CdmBase.deproxy(pkey.getRoot(),PolytomousKeyNode.class), cacher.getFromCache(pkey.getRoot()));
106
        Assert.assertSame(CdmBase.deproxy(pkey.getRoot().getStatement(),KeyStatement.class), cacher.getFromCache(pkey.getRoot().getStatement()));
107
        Assert.assertSame(CdmBase.deproxy(pkey.getRoot().getQuestion(),KeyStatement.class), cacher.getFromCache(pkey.getRoot().getQuestion()));
109 108

  
110 109
    }
111 110

  
......
172 171
    	//		|- statement : KeyStatement
173 172
        PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
174 173
        KeyStatement ks1 = pkey1.getRoot().getStatement();
175
        Assert.assertSame(cacher.getFromCache(pkey1.getRoot().getStatement()), pkey1.getRoot().getStatement());
174
        Assert.assertSame(ks1, pkey1.getRoot().getStatement());
176 175
        CdmTransientEntityCacher cacher = getCacher(sessionOwner);
177 176

  
178 177
    	// this call will load into the session cache the graph and update the objects in the sub-graph for a
......
206 205
        // that it exists in the cache and
207 206
        // that both the original object and the
208 207
        // cached object are the same
209
        Assert.assertNotNull(pkey1.getRoot().getStatement());
208
        Assert.assertNotNull(CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class));
210 209
        Assert.assertNotNull(cacher.getFromCache(pkey1.getRoot().getStatement()));
211 210

  
212 211
    	// this call will load into the session cache the graph and update the objects in the sub-graph for a
......
257 256
    	PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
258 257

  
259 258

  
260
    	Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
261
    	Assert.assertSame(st, pkey2.getRoot().getStatement());
259
    	Assert.assertSame(CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
260
    	Assert.assertSame(st, CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class));
262 261
    	Assert.assertSame(cacher.getFromCache(st), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
263 262
    }
264 263

  

Also available in: Unified diff