[jboss-cvs] JBossAS SVN: r60695 - in branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity: classloader and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 20 00:06:40 EST 2007
Author: bstansberry at jboss.com
Date: 2007-02-20 00:06:40 -0500 (Tue, 20 Feb 2007)
New Revision: 60695
Modified:
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTest.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
Log:
Choose the cache to integrate with based on whether optimistic locking is being tested
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTest.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTest.java 2007-02-20 05:05:24 UTC (rev 60694)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTest.java 2007-02-20 05:06:40 UTC (rev 60695)
@@ -31,6 +31,8 @@
*/
public interface EntityTest
{
+ void getCache(boolean optimistic);
+
Customer createCustomer();
Customer findByCustomerId(Integer id);
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2007-02-20 05:05:24 UTC (rev 60694)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2007-02-20 05:06:40 UTC (rev 60695)
@@ -54,10 +54,21 @@
@PersistenceContext
private EntityManager manager;
+ private String cacheObjectName;
+
static MyListener listener;
public EntityTestBean()
{
+ }
+
+ public void getCache(boolean optimistic)
+ {
+ if (optimistic)
+ cacheObjectName = "jboss.cache:service=OptimisticEJB3EntityTreeCache";
+ else
+ cacheObjectName = "jboss.cache:service=EJB3EntityTreeCache";
+
try
{
//Just to initialise the cache with a listener
@@ -202,10 +213,11 @@
}
}
+
private TreeCache getCache() throws Exception
{
MBeanServer server = MBeanServerLocator.locateJBoss();
- TreeCacheMBean proxy = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, new ObjectName("jboss.cache:service=EJB3EntityTreeCache"), server);
+ TreeCacheMBean proxy = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, new ObjectName(cacheObjectName), server);
TreeCache cache = proxy.getInstance();
return cache;
@@ -227,10 +239,13 @@
String name = fqn.toString();
String token = ".clusteredentity.";
int index = name.indexOf(token);
- index += token.length();
- name = name.substring(index);
- System.out.println(name);
- visited.add(name);
+ if (index > -1)
+ {
+ index += token.length();
+ name = name.substring(index);
+ System.out.println("MyListener - recording visit to " + name);
+ visited.add(name);
+ }
}
}
}
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java 2007-02-20 05:05:24 UTC (rev 60694)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java 2007-02-20 05:06:40 UTC (rev 60695)
@@ -1,7 +1,35 @@
+/*
+ * 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.clusteredentity.classloader;
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
public interface EntityQueryTest
{
+ public abstract void getCache(boolean optimistic);
// public abstract void createAccountHolder(AccountHolderPK pk, String postCode);
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java 2007-02-20 05:05:24 UTC (rev 60694)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java 2007-02-20 05:06:40 UTC (rev 60695)
@@ -1,3 +1,24 @@
+/*
+ * 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.clusteredentity.classloader;
import java.util.HashSet;
@@ -17,13 +38,17 @@
import org.jboss.cache.AbstractTreeCacheListener;
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheListener;
import org.jboss.cache.TreeCacheMBean;
import org.jboss.logging.Logger;
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jgroups.View;
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
@Stateful
@Remote(EntityQueryTest.class)
public class EntityQueryTestBean implements EntityQueryTest
@@ -33,10 +58,21 @@
@PersistenceContext
private EntityManager manager;
+ private String cacheObjectName;
+
private MyListener listener;
public EntityQueryTestBean()
+ {
+ }
+
+ public void getCache(boolean optimistic)
{
+ if (optimistic)
+ cacheObjectName = "jboss.cache:service=OptimisticEJB3EntityTreeCache";
+ else
+ cacheObjectName = "jboss.cache:service=EJB3EntityTreeCache";
+
try
{
//Just to initialise the cache with a listener
@@ -240,7 +276,7 @@
private TreeCache getCache() throws Exception
{
MBeanServer server = MBeanServerLocator.locateJBoss();
- TreeCacheMBean proxy = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, new ObjectName("jboss.cache:service=EJB3EntityTreeCache"), server);
+ TreeCacheMBean proxy = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, new ObjectName(cacheObjectName), server);
TreeCache cache = proxy.getInstance();
return cache;
More information about the jboss-cvs-commits
mailing list