[jboss-cvs] JBossAS SVN: r71533 - projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 1 00:45:34 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-04-01 00:45:33 -0400 (Tue, 01 Apr 2008)
New Revision: 71533
Removed:
projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockCacheItem.java
Modified:
projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContainer.java
projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContext.java
Log:
[EJBTHREE-1026] Simplify mock class hierarchy
Modified: projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContainer.java
===================================================================
--- projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContainer.java 2008-03-31 22:35:37 UTC (rev 71532)
+++ projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContainer.java 2008-04-01 04:45:33 UTC (rev 71533)
@@ -23,6 +23,7 @@
package org.jboss.ejb3.test.cache.mock;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.jboss.ejb3.cache.api.Cache;
@@ -37,6 +38,7 @@
*
*/
public class MockBeanContainer
+ implements StatefulObjectFactory<MockBeanContext>, PassivationManager<MockBeanContext>
{
private static final Logger log = Logger.getLogger(MockBeanContainer.class);
@@ -73,7 +75,7 @@
log.debug("Starting container " + containerName);
StatefulCacheFactory<MockBeanContext> cacheFactory = cacheFactoryRegistry.getCacheFactory(cacheFactoryName);
- cache = cacheFactory.createCache(containerName, objectFactory, passivationManager, cacheConfig);
+ cache = cacheFactory.createCache(containerName, this, this, cacheConfig);
cache.start();
log.debug("Started container " + containerName);
@@ -134,5 +136,41 @@
return passivationManager;
}
+ // -------------------------------------------------- StatefulObjectFactory
+
+
+ public MockBeanContext create(Class<?>[] initTypes, Object[] initValues, Map<Object, Object> sharedState)
+ {
+ return objectFactory.create(initTypes, initValues, sharedState);
+ }
+
+ public void destroy(MockBeanContext obj)
+ {
+ objectFactory.destroy(obj);
+ }
+ // -------------------------------------------------- StatefulObjectFactory
+
+ public void postActivate(MockBeanContext ctx)
+ {
+ passivationManager.postActivate(ctx);
+ }
+
+ public void postReplicate(MockBeanContext ctx)
+ {
+ passivationManager.postReplicate(ctx);
+ }
+
+ public void prePassivate(MockBeanContext ctx)
+ {
+ passivationManager.prePassivate(ctx);
+ }
+
+ public void preReplicate(MockBeanContext ctx)
+ {
+ passivationManager.preReplicate(ctx);
+ }
+
+
+
}
Modified: projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContext.java
===================================================================
--- projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContext.java 2008-03-31 22:35:37 UTC (rev 71532)
+++ projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockBeanContext.java 2008-04-01 04:45:33 UTC (rev 71533)
@@ -25,11 +25,15 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.ejb3.cache.api.CacheItem;
+
/**
* @author Brian Stansberry
*
*/
-public class MockBeanContext extends MockCacheItem
+public class MockBeanContext
+ extends MockIdentifiable
+ implements CacheItem
{
/** The serialVersionUID */
private static final long serialVersionUID = 3209950231614290498L;
@@ -39,6 +43,7 @@
private MockXPC xpc;
private MockEntity entity;
+ private boolean modified;
private int preReplicateCount;
private int prePassivateCount;
private int postReplicateCount;
@@ -54,6 +59,18 @@
this.sharedState = sharedState;
}
+ public boolean isModified()
+ {
+ boolean result = modified;
+ modified = false;
+ return result;
+ }
+
+ public void setModified(boolean modified)
+ {
+ this.modified = modified;
+ }
+
public MockBeanContainer getContainer()
{
return (MockBeanContainer) MockRegistry.get(containerName);
Deleted: projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockCacheItem.java
===================================================================
--- projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockCacheItem.java 2008-03-31 22:35:37 UTC (rev 71532)
+++ projects/ejb3/branches/cluster-dev/cache/src/test/java/org/jboss/ejb3/test/cache/mock/MockCacheItem.java 2008-04-01 04:45:33 UTC (rev 71533)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ejb3.test.cache.mock;
-
-import org.jboss.ejb3.cache.api.CacheItem;
-
-/**
- * Mock implementation of a CacheItem.
- *
- * @author Brian Stansberry
- */
-public class MockCacheItem
- extends MockIdentifiable
- implements CacheItem
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 7660507283782503571L;
-
- private boolean modified;
-
- public MockCacheItem(int id)
- {
- super(id);
- }
-
- public boolean isModified()
- {
- boolean result = modified;
- modified = false;
- return result;
- }
-
- public void setModified(boolean modified)
- {
- this.modified = modified;
- }
-}
More information about the jboss-cvs-commits
mailing list