Project

General

Profile

Revision 65e3bf45

ID65e3bf4529d457b23da348712ce5a6d9d9c5621d
Parent aa05eb6f
Child 0d2d1f78

Added by Cherian Mathew over 5 years ago

Add access to service cacher

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
36 36

  
37 37
    private SecurityContext securityContext;
38 38

  
39
    private static CdmServiceCacher cdmServiceCacher;
40

  
39 41

  
40 42
    public static CdmApplicationState getInstance() {
41 43
        if(cdmApplicationState == null) {
42 44
            cdmApplicationState = new CdmApplicationState();
43
            new CdmServiceCacher();
45
            cdmServiceCacher = new CdmServiceCacher();
44 46
        }
47

  
45 48
        return cdmApplicationState;
46 49
    }
47 50

  
......
117 120
        getInstance().setCurrentDataChangeService(null);
118 121
        getInstance().setAppConfig(null);
119 122
        getInstance().setSecurityContext(null);
123
        cdmApplicationState = null;
124
        cdmServiceCacher = null;
120 125
    }
121 126

  
122 127

  
......
183 188

  
184 189
    }
185 190

  
191
    public static CdmServiceCacher getCdmServiceCacher() {
192

  
193
        return cdmServiceCacher;
194
    }
195

  
186 196
}
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmServiceCacherTest.java
4 4
import org.junit.Assert;
5 5
import org.junit.Test;
6 6

  
7
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
7 8
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
8 9
import eu.etaxonomy.cdm.model.common.Language;
9 10
import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
......
13 14
	private static final Logger logger = Logger.getLogger(CdmServiceCacherTest.class);
14 15

  
15 16

  
16
	private static CdmServiceCacher cdmServiceCacher = (CdmServiceCacher)getRemoteApplicationController().getBean("cdmServiceCacher");
17
	private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
17 18

  
18 19
	@Test
19 20
	public void testLanguageCache() {
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceInterceptorTest.java
7 7
import org.junit.Assert;
8 8
import org.junit.Test;
9 9

  
10
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
10 11
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
11 12
import eu.etaxonomy.cdm.api.service.ITermService;
12 13
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
......
18 19

  
19 20
	 private static final Logger logger = Logger.getLogger(ServiceInterceptorTest.class);
20 21
	 private final ITermService termService = getRemoteApplicationController().getTermService();
21
	 private final CdmServiceCacher cdmServiceCacher = (CdmServiceCacher)getRemoteApplicationController().getBean("cdmServiceCacher");
22
	 private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
22 23

  
23 24

  
24 25
	    @Test

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)