[jboss-cvs] JBossAS SVN: r107095 - in projects/cluster/ha-server-cache-ispn/trunk/src: test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 26 20:45:27 EDT 2010


Author: pferraro
Date: 2010-07-26 20:45:27 -0400 (Mon, 26 Jul 2010)
New Revision: 107095

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java
Log:
Can't inject CacheContainerRegistry - factory needs default constructor.

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java	2010-07-27 00:44:50 UTC (rev 107094)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java	2010-07-27 00:45:27 UTC (rev 107095)
@@ -21,8 +21,6 @@
  */
 package org.jboss.ha.web.tomcat.service.session.distributedcache.impl;
 
-import org.infinispan.manager.CacheContainer;
-import org.jboss.ha.ispn.CacheContainerRegistry;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
@@ -34,21 +32,17 @@
  */
 public class DistributedCacheManagerFactoryImpl implements DistributedCacheManagerFactory
 {
-   private final CacheContainerRegistry registry;
    private final SessionAttributeStorageFactory storageFactory;
    private final SessionAttributeMarshallerFactory marshallerFactory;
    private final CacheInvoker invoker;
    
-   private volatile String cacheContainerName;
-   
-   public DistributedCacheManagerFactoryImpl(CacheContainerRegistry registry)
+   public DistributedCacheManagerFactoryImpl()
    {
-      this(registry, new SessionAttributeStorageFactoryImpl(), new SessionAttributeMarshallerFactoryImpl(), new RetryingCacheInvoker(10, 100));
+      this(new SessionAttributeStorageFactoryImpl(), new SessionAttributeMarshallerFactoryImpl(), new RetryingCacheInvoker(10, 100));
    }
    
-   public DistributedCacheManagerFactoryImpl(CacheContainerRegistry registry, SessionAttributeStorageFactory storageFactory, SessionAttributeMarshallerFactory marshallerFactory, CacheInvoker invoker)
+   public DistributedCacheManagerFactoryImpl(SessionAttributeStorageFactory storageFactory, SessionAttributeMarshallerFactory marshallerFactory, CacheInvoker invoker)
    {
-      this.registry = registry;
       this.storageFactory = storageFactory;
       this.marshallerFactory = marshallerFactory;
       this.invoker = invoker;
@@ -57,20 +51,9 @@
    @Override
    public <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager)
    {
-      CacheContainer container = this.registry.getCacheContainer(this.cacheContainerName);
       SessionAttributeMarshaller marshaller = this.marshallerFactory.createMarshaller(manager);
       SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), marshaller);
       
-      return new DistributedCacheManagerImpl<T>(manager, container, storage, this.invoker);
+      return new DistributedCacheManagerImpl<T>(manager, storage, this.invoker);
    }
-   
-   public String getCacheContainerName()
-   {
-      return this.cacheContainerName;
-   }
-   
-   public void setCacheContainerName(String cacheContainerName)
-   {
-      this.cacheContainerName = cacheContainerName;
-   }
 }

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java	2010-07-27 00:44:50 UTC (rev 107094)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java	2010-07-27 00:45:27 UTC (rev 107095)
@@ -21,11 +21,8 @@
  */
 package org.jboss.ha.web.tomcat.service.session.distributedcache.impl;
 
-import org.infinispan.manager.CacheContainer;
-import org.junit.Assert;
-
 import org.easymock.EasyMock;
-import org.jboss.ha.ispn.CacheContainerRegistry;
+import org.infinispan.manager.CacheContainer;
 import org.jboss.metadata.web.jboss.ReplicationConfig;
 import org.jboss.metadata.web.jboss.ReplicationGranularity;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
@@ -33,6 +30,7 @@
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
+import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -41,7 +39,6 @@
  */
 public class DistributedCacheManagerFactoryTest
 {
-   private CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
    private SessionAttributeStorageFactory storageFactory = EasyMock.createStrictMock(SessionAttributeStorageFactory.class);
    private SessionAttributeMarshallerFactory marshallerFactory = EasyMock.createStrictMock(SessionAttributeMarshallerFactory.class);
    private CacheInvoker invoker = EasyMock.createStrictMock(CacheInvoker.class);
@@ -54,53 +51,25 @@
    @Test
    public void testDefaultCacheContainer() throws ClusteringNotSupportedException
    {
-      DistributedCacheManagerFactory factory = new DistributedCacheManagerFactoryImpl(this.registry, this.storageFactory, this.marshallerFactory, this.invoker);
+      DistributedCacheManagerFactory factory = new DistributedCacheManagerFactoryImpl(this.storageFactory, this.marshallerFactory, this.invoker);
       
       ReplicationConfig config = new ReplicationConfig();
       ReplicationGranularity granularity = ReplicationGranularity.SESSION;
       config.setReplicationGranularity(granularity);
       
-      EasyMock.expect(this.registry.getCacheContainer(null)).andReturn(this.container);
       EasyMock.expect(this.marshallerFactory.createMarshaller(this.manager)).andReturn(this.marshaller);
       EasyMock.expect(this.manager.getReplicationConfig()).andReturn(config);
       EasyMock.expect(this.storageFactory.createStorage(granularity, this.marshaller)).andReturn(this.storage);
       
-      EasyMock.replay(this.registry, this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
+      EasyMock.replay(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
       
       DistributedCacheManager<?> result = factory.getDistributedCacheManager(this.manager);
       
-      EasyMock.verify(this.registry, this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
+      EasyMock.verify(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
       
       Assert.assertNotNull(result);
       Assert.assertTrue(result instanceof DistributedCacheManagerImpl);
       
-      EasyMock.reset(this.registry, this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
+      EasyMock.reset(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
    }
-   
-   @Test
-   public void testSpecificCacheContainer() throws ClusteringNotSupportedException
-   {
-      DistributedCacheManagerFactoryImpl factory = new DistributedCacheManagerFactoryImpl(this.registry, this.storageFactory, this.marshallerFactory, this.invoker);
-      factory.setCacheContainerName("mycontainer");
-      
-      ReplicationConfig config = new ReplicationConfig();
-      ReplicationGranularity granularity = ReplicationGranularity.SESSION;
-      config.setReplicationGranularity(granularity);
-      
-      EasyMock.expect(this.registry.getCacheContainer("mycontainer")).andReturn(this.container);
-      EasyMock.expect(this.marshallerFactory.createMarshaller(this.manager)).andReturn(this.marshaller);
-      EasyMock.expect(this.manager.getReplicationConfig()).andReturn(config);
-      EasyMock.expect(this.storageFactory.createStorage(granularity, this.marshaller)).andReturn(this.storage);
-      
-      EasyMock.replay(this.registry, this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
-      
-      DistributedCacheManager<?> result = factory.getDistributedCacheManager(this.manager);
-      
-      EasyMock.verify(this.registry, this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
-      
-      Assert.assertNotNull(result);
-      Assert.assertTrue(result instanceof DistributedCacheManagerImpl);
-      
-      EasyMock.reset(this.registry, this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.container, this.storage, this.marshaller);
-   }
 }



More information about the jboss-cvs-commits mailing list