#5181 Fix incorrect load of CdmServiceCacher when connecting via Datasource view
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 2 Sep 2015 09:03:19 +0000 (11:03 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 2 Sep 2015 09:03:19 +0000 (11:03 +0200)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java

index 07dfa81afb40f441eaa6cd3f5b86d927c68fe52d..2c90c55b7fac2e52dd5cfe3000d8ccf23e795b91 100644 (file)
@@ -43,7 +43,6 @@ public class CdmApplicationState {
     public static CdmApplicationState getInstance() {
         if(cdmApplicationState == null) {
             cdmApplicationState = new CdmApplicationState();
-            cdmServiceCacher = new CdmServiceCacher();
         }
 
         return cdmApplicationState;
@@ -201,5 +200,9 @@ public class CdmApplicationState {
         return cdmServiceCacher;
     }
 
+    public static void setCdmServiceCacher(CdmServiceCacher cacher) {
+        cdmServiceCacher = cacher;
+    }
+
 
 }
index a2c621990a48d59f3d3d8c56ce99fa6c6c493deb..3ce13bdd7686ce59bb18f1372570dcda193690e0 100644 (file)
@@ -26,6 +26,7 @@ import eu.etaxonomy.cdm.api.application.CdmApplicationException;
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.IService;
@@ -241,6 +242,9 @@ public class CdmStore {
     static void setInstance(ICdmApplicationConfiguration applicationController,
             ICdmSource cdmSource) {
         instance = new CdmStore(applicationController, cdmSource);
+        if(getCurrentSessionManager().isRemoting()) {
+            CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+        }
     }
 
     private CdmStore(ICdmApplicationConfiguration applicationController,
index 18d151ac034becbfbb2a73eced6136b587ebd4f5..694d80e57e2f7830ea1834dd4dbaa11fde34ac65 100644 (file)
@@ -39,6 +39,7 @@ import org.unitils.spring.annotation.SpringApplicationContext;
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
@@ -161,6 +162,7 @@ public abstract class BaseRemotingTest extends UnitilsJUnit4 {
                         null,
                         null);
         CdmApplicationState.setCurrentAppConfig(remoteApplicationController);
+        CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
         try {
             remotePersistentSource = CdmPersistentRemoteSource.NewInstance(sourceName);
         } catch (CdmRemoteSourceException e) {