Project

General

Profile

« Previous | Next » 

Revision df390232

Added by Cherian Mathew almost 9 years ago

RemotingSessionAwareTest : added new class which handles pre-config of test classes which require a session
*Test.java : set super class to RemotingSessionAwareTest
*.xml : removed DefinedTermBase entites from datasets so that the terms are not deleted
ServiceInterceptorTest : correction

View differences:

eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java
18 18

  
19 19
import org.apache.log4j.Logger;
20 20
import org.junit.Assert;
21
import org.junit.Before;
22 21
import org.junit.BeforeClass;
23 22
import org.junit.Test;
24 23
import org.unitils.dbunit.annotation.DataSet;
......
33 32
import eu.etaxonomy.cdm.model.description.KeyStatement;
34 33
import eu.etaxonomy.cdm.model.description.PolytomousKey;
35 34
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
36
import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
35
import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
37 36
import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
38
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
39
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
40
import eu.etaxonomy.taxeditor.session.MockSessionOwner;
41 37

  
42 38
/**
43 39
 * @author cmathew
......
45 41
 *
46 42
 */
47 43
@DataSet
48
public class CdmClientCachingTest extends BaseRemotingTest {
44
public class CdmClientCachingTest extends RemotingSessionAwareTest {
49 45

  
50 46
    private static final Logger logger = Logger.getLogger(CdmClientCachingTest.class);
51 47

  
......
61 57
    private final ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
62 58

  
63 59

  
64
	private CdmTransientEntityCacher cacher;
65
    private ICdmEntitySession cdmEntitySession;
66

  
67 60
    private static final List<String> PKEY_DEPTH1_INIT_STRATEGY = Arrays.asList(new String[] {
68 61
			});
69 62

  
......
73 66
    private static final List<String> PKEY_DEPTH3_INIT_STRATEGY = Arrays.asList(new String[] {
74 67
    		"root.statement"});
75 68

  
76
    private ICdmEntitySessionEnabled sessionOwner;
77 69

  
78 70
    @BeforeClass
79 71
    public static void initializePolytomousKeyTest() {
80 72

  
81 73
    }
82 74

  
83
    @Before
84
    public void initializeSession() {
85
    	sessionOwner = new MockSessionOwner();
86
    	cdmEntitySession = cdmEntitySessionManager.newSession(sessionOwner, true);
87
    	cacher = getCacher(sessionOwner);
88
    }
89 75

  
90 76

  
91 77

  
......
154 140
    	// 	|- root : polytomous key node
155 141
    	// in a recursive call
156 142
        PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
143
        KeyStatement ks1 = CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class);
157 144

  
158 145
        CdmTransientEntityCacher cacher = getCacher(sessionOwner);
159 146

  
......
162 149
    	// 	|- root : polytomous key node
163 150
    	//		|- question : KeyStatement
164 151
    	//		|- statement : KeyStatement
165
        PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
152
        PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH3_INIT_STRATEGY),PolytomousKey.class);
166 153

  
154
        KeyStatement ks2 = CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class);
167 155

  
168
        Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement()));
169
        Assert.assertSame(pkey1.getRoot().getStatement(), pkey2.getRoot().getStatement());
170
        Assert.assertSame(cacher.getFromCache(pkey1.getRoot().getStatement()), cacher.getFromCache(pkey2.getRoot().getStatement()));
156
        Assert.assertSame(ks2, cacher.getFromCache(ks2));
157
        Assert.assertSame(cacher.getFromCache(KeyStatement.class, ks1.getId()), cacher.getFromCache(ks2));
171 158

  
172 159
    }
173 160

  

Also available in: Unified diff