[jboss-cvs] JBossAS SVN: r67965 - in trunk/ejb3/src/test/org/jboss/ejb3/test: ejbthree1136 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 5 16:26:01 EST 2007
Author: bdecoste
Date: 2007-12-05 16:26:00 -0500 (Wed, 05 Dec 2007)
New Revision: 67965
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingRemote.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/unit/ClusteredCacheCleanStartUnitTestCase.java
Log:
[EJBTHREE-1120] merged tests from Branch_4_2
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingBean.java 2007-12-05 21:26:00 UTC (rev 67965)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejbthree1136;
+
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.Clustered;
+
+/**
+ * A meaningless bean, just so we can deploy a clustered SFSB and
+ * check the state of the SFSB cache thereafter.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60635 $
+ */
+ at Stateful
+ at Clustered
+public class DoNothingBean implements DoNothingRemote
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ public void doNothing()
+ {
+ // TODO Auto-generated method stub
+ }
+
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingRemote.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/DoNothingRemote.java 2007-12-05 21:26:00 UTC (rev 67965)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejbthree1136;
+
+import javax.ejb.Remote;
+
+/**
+ * A meaningless interface, just so we can deploy a clustered SFSB and
+ * check the state of the SFSB cache thereafter.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
+ at Remote
+public interface DoNothingRemote
+{
+ void doNothing();
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulator.java 2007-12-05 21:26:00 UTC (rev 67965)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1136;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCacheViewMBean;
+import org.jboss.cache.config.Option;
+
+/**
+ * MBean that stores a key/value in a cache during start
+ * and then allows a caller to check if the value is still there.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class SFSBCacheManipulator implements SFSBCacheManipulatorMBean
+{
+ public static final String VALUE = "VALUE";
+
+ private Cache clusteredBeanCache;
+ private String regionRoot;
+
+ public Cache getClusteredBeanCache()
+ {
+ return clusteredBeanCache;
+ }
+
+ public void setClusteredBeanCache(Cache clusteredBeanCache)
+ {
+ this.clusteredBeanCache = clusteredBeanCache;
+ }
+
+ public String getRegionRoot()
+ {
+ return regionRoot;
+ }
+
+ public void setRegionRoot(String regionRoot)
+ {
+ this.regionRoot = regionRoot;
+ }
+
+ public Fqn getTestFqn()
+ {
+ Fqn base = Fqn.fromString(regionRoot);
+ return new Fqn(base, "test");
+ }
+
+ public void start() throws Exception
+ {
+ Option opt = new Option();
+ opt.setCacheModeLocal(true);
+ Fqn fqn = getTestFqn();
+ clusteredBeanCache.put(fqn, "key", opt);
+ // "Passivate" the data
+ clusteredBeanCache.evict(fqn, true);
+ }
+
+ public void stop() throws Exception
+ {
+ Option opt = new Option();
+ opt.setCacheModeLocal(true);
+ clusteredBeanCache.remove(getTestFqn(), opt);
+ }
+
+ public Object getFromBeanCache() throws CacheException
+ {
+ Fqn fqn = getTestFqn();
+ Object obj = clusteredBeanCache.get(fqn, "key");
+ // "Re-Passivate" the data
+ clusteredBeanCache.evict(fqn, true);
+ return obj;
+ }
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/SFSBCacheManipulatorMBean.java 2007-12-05 21:26:00 UTC (rev 67965)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1136;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+
+/**
+ * MBean that stores a key/value in a cache during start
+ * and then allows a caller to check if the value is still there.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public interface SFSBCacheManipulatorMBean
+{
+ Cache getClusteredBeanCache();
+
+ void setClusteredBeanCache(Cache clusteredBeanCache);
+
+ String getRegionRoot();
+
+ void setRegionRoot(String regionRoot);
+
+ Fqn getTestFqn();
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+
+ Object getFromBeanCache() throws CacheException;
+
+}
\ No newline at end of file
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/unit/ClusteredCacheCleanStartUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/unit/ClusteredCacheCleanStartUnitTestCase.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1136/unit/ClusteredCacheCleanStartUnitTestCase.java 2007-12-05 21:26:00 UTC (rev 67965)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejbthree1136.unit;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1136.SFSBCacheManipulator;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Tests that StatefulTreeCache properly cleans up state when initializing.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClusteredCacheCleanStartUnitTestCase extends JBossTestCase
+{
+ /**
+ * Create a new ClusteredCacheCleanupTestCase.
+ *
+ * @param name
+ */
+ public ClusteredCacheCleanStartUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(ClusteredCacheCleanStartUnitTestCase.class, "ejbthree1136.sar");
+ }
+
+ public void testClusteredCacheCleanStart() throws Exception
+ {
+ assertEquals("Extraneous data present before deploy", SFSBCacheManipulator.VALUE, getExtraneousData());
+
+ deploy("ejbthree1136.jar");
+
+ assertEquals("Extraneous data removed", null, getExtraneousData());
+ }
+
+ private Object getExtraneousData() throws Exception
+ {
+ ObjectName on = new ObjectName("jboss.test:service=Ejb3SFSBCacheManipulator");
+ return invoke(on, "getFromBeanCache", new Object[]{}, new String[]{});
+ }
+}
More information about the jboss-cvs-commits
mailing list