[jboss-cvs] JBossAS SVN: r58785 - in branches/Branch_4_0/ejb3: . src/resources/test/clusteredentity/classloader src/resources/test/clusteredentity/classloader/META-INF src/test/org/jboss/ejb3/test/clusteredentity/classloader src/test/org/jboss/ejb3/test/clusteredentity/unit
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 30 18:14:58 EST 2006
Author: bstansberry at jboss.com
Date: 2006-11-30 18:14:54 -0500 (Thu, 30 Nov 2006)
New Revision: 58785
Added:
branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/application.xml
branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/jboss-app.xml
branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/persistence.xml
branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/clusteredentity-ds.xml
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/Account.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/AccountHolderPK.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java
branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java
Modified:
branches/Branch_4_0/ejb3/build-test.xml
Log:
[EJBTHREE-796] Add tests of entity replication with scoped classloader
Modified: branches/Branch_4_0/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_0/ejb3/build-test.xml 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/build-test.xml 2006-11-30 23:14:54 UTC (rev 58785)
@@ -143,6 +143,7 @@
<path refid="quartz.quartz.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
+ <path refid="hsqldb.hsqldb.classpath"/>
</path>
<!-- ======= -->
@@ -2574,6 +2575,29 @@
<include name="META-INF/persistence.xml"/>
</fileset>
</jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-classloader-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/ejb3/test/clusteredentity/classloader/*.class"/>
+ </fileset>
+ <fileset dir="${resources}/test/clusteredentity/classloader">
+ <include name="META-INF/persistence.xml"/>
+ <!--include name="META-INF/jboss.xml"/-->
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-classloader-test.ear">
+ <fileset dir="${build.lib}">
+ <include name="clusteredentity-classloader-test.jar"/>
+ </fileset>
+ <fileset dir="${resources}/test/clusteredentity/classloader">
+ <include name="META-INF/application.xml"/>
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ </jar>
+
+
</target>
<target name="clusteredsession"
@@ -2698,6 +2722,9 @@
<!-- EJBTHREE-485 needs javassist -->
<path refid="javassist.classpath"/>
+
+ <!-- For clustered entities -->
+ <path refid="hsqldb.hsqldb.classpath"/>
</classpath>
<formatter type="plain" usefile="true"/>
Added: branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/application.xml
===================================================================
--- branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/application.xml 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/application.xml 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application>
+ <display-name>Clustered entity with scoped classloader test ear</display-name>
+ <module>
+ <ejb>clusteredentity-classloader-test.jar</ejb>
+ </module>
+</application>
\ No newline at end of file
Added: branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/jboss-app.xml
===================================================================
--- branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/jboss-app.xml 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/jboss-app.xml 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jboss-app>
+ <loader-repository>
+ jboss.test:ear=clusteredentity-classloader-test.ear
+ <!--
+ <loader-repository-config>
+ java2ParentDelegation=false
+ </loader-repository-config>
+ -->
+ </loader-repository>
+ <module>
+ <service>clusteredentity-ds.xml</service>
+ </module>
+</jboss-app>
\ No newline at end of file
Added: branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/persistence.xml
===================================================================
--- branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/persistence.xml 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/META-INF/persistence.xml 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+ <persistence-unit name="tempdb">
+ <jta-data-source>java:/ClusteredEntityTestDS</jta-data-source>
+ <properties>
+ <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
+ <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>
+ <!-- Must use "update" here as we do a test of redeployment and don't want to drop the db -->
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.cache.use_query_cache" value="true"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/clusteredentity-ds.xml
===================================================================
--- branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/clusteredentity-ds.xml 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/resources/test/clusteredentity/classloader/clusteredentity-ds.xml 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>ClusteredEntityTestDS</jndi-name>
+
+ <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ <min-pool-size>1</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <idle-timeout-minutes>0</idle-timeout-minutes>
+ <track-statements/>
+ </local-tx-datasource>
+</datasources>
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/Account.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/Account.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/Account.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,91 @@
+package org.jboss.ejb3.test.clusteredentity.classloader;
+
+import java.io.Serializable;
+
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.QueryHint;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+ at Entity
+ at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
+ at NamedQueries({
+ @NamedQuery(name="account.totalbalance.default",query="select account.balance from Account as account where account.accountHolder = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
+ @NamedQuery(name="account.totalbalance.namedregion",query="select account.balance from Account as account where account.accountHolder = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheRegion",value="AccountRegion"),
+ @QueryHint(name="org.hibernate.cacheable",value="true")
+ }),
+ @NamedQuery(name="account.branch.default",query="select account.branch from Account as account where account.accountHolder = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
+ @NamedQuery(name="account.branch.namedregion",query="select account.branch from Account as account where account.accountHolder = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheRegion",value="AccountRegion"),
+ @QueryHint(name="org.hibernate.cacheable",value="true")
+ }),
+ @NamedQuery(name="account.bybranch.default",query="select account from Account as account where account.branch = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
+ @NamedQuery(name="account.bybranch.namedregion",query="select account from Account as account where account.branch = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheRegion",value="AccountRegion"),
+ @QueryHint(name="org.hibernate.cacheable",value="true")
+ })
+})
+public class Account implements Serializable
+{
+
+ private static final long serialVersionUID = 1L;
+
+ private Integer id;
+ private AccountHolderPK accountHolder;
+ private Integer balance;
+ private String branch;
+
+ @Id
+ public Integer getId()
+ {
+ return id;
+ }
+ public void setId(Integer id)
+ {
+ this.id = id;
+ }
+
+// @Embedded
+ @Lob
+ public AccountHolderPK getAccountHolder()
+ {
+ return accountHolder;
+ }
+ public void setAccountHolder(AccountHolderPK accountHolder)
+ {
+ this.accountHolder = accountHolder;
+ }
+
+ public Integer getBalance()
+ {
+ return balance;
+ }
+ public void setBalance(Integer balance)
+ {
+ this.balance = balance;
+ }
+ public String getBranch()
+ {
+ return branch;
+ }
+ public void setBranch(String branch)
+ {
+ this.branch = branch;
+ }
+
+
+
+
+
+}
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/AccountHolderPK.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/AccountHolderPK.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/AccountHolderPK.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,69 @@
+package org.jboss.ejb3.test.clusteredentity.classloader;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+import javax.persistence.Embeddable;
+
+//@Embeddable
+public class AccountHolderPK implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String lastName;
+ private String ssn;
+ private transient boolean deserialized;
+
+ public AccountHolderPK( ) {}
+
+ public AccountHolderPK(String lastName, String ssn)
+ {
+ this.lastName = lastName;
+ this.ssn = ssn;
+ }
+
+ public String getLastName( ) { return this.lastName; }
+ public void setLastName(String lastName) { this.lastName = lastName; }
+
+ public String getSsn( ) { return ssn; }
+ public void setSsn(String ssn) { this.ssn = ssn; }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this) return true;
+ if (!(obj instanceof AccountHolderPK)) return false;
+ AccountHolderPK pk = (AccountHolderPK)obj;
+ if (!lastName.equals(pk.lastName)) return false;
+ if (!ssn.equals(pk.ssn)) return false;
+ return true;
+ }
+
+ public int hashCode( )
+ {
+ int result = 17;
+ result = result * 31 + lastName.hashCode();
+ result = result * 31 + ssn.hashCode();
+ return result;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(getClass().getName());
+ sb.append("[lastName=");
+ sb.append(lastName);
+ sb.append(",ssn=");
+ sb.append(ssn);
+ sb.append(",deserialized=");
+ sb.append(deserialized);
+ sb.append("]");
+ return sb.toString();
+ }
+
+ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
+ {
+ ois.defaultReadObject();
+ deserialized = true;
+ }
+
+}
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTest.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,29 @@
+package org.jboss.ejb3.test.clusteredentity.classloader;
+
+public interface EntityQueryTest
+{
+
+// public abstract void createAccountHolder(AccountHolderPK pk, String postCode);
+
+ public abstract void updateAccountBranch(Integer id, String branch);
+
+ public abstract void createAccount(AccountHolderPK pk, Integer id, Integer openingBalance, String branch);
+
+ public abstract void updateAccountBalance(Integer id, Integer newBalance);
+
+
+ public abstract int getCountForBranch(String branch, boolean useNamed, boolean useRegion);
+
+ public abstract String getBranch(AccountHolderPK pk, boolean useNamed, boolean useRegion);
+
+ public abstract int getTotalBalance(AccountHolderPK pk, boolean useNamed, boolean useRegion);
+
+ public abstract boolean getSawRegionModification(String regionName);
+
+ public abstract boolean getSawRegionAccess(String regionName);
+
+ public abstract void cleanup();
+
+ public abstract void remove();
+
+}
\ No newline at end of file
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,277 @@
+package org.jboss.ejb3.test.clusteredentity.classloader;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.jboss.cache.AbstractTreeCacheListener;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.TreeCacheMBean;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxyExt;
+import org.jboss.mx.util.MBeanServerLocator;
+
+ at Stateful
+ at Remote(EntityQueryTest.class)
+public class EntityQueryTestBean implements EntityQueryTest
+{
+ private static final Logger log = Logger.getLogger(EntityQueryTestBean.class);
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ private MyListener listener;
+
+ public EntityQueryTestBean()
+ {
+ try
+ {
+ //Just to initialise the cache with a listener
+ TreeCache cache = getCache();
+ listener = new MyListener();
+ cache.addTreeCacheListener(listener);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void updateAccountBranch(Integer id, String branch)
+ {
+ Account account = (Account) manager.find(Account.class, id);
+ account.setBranch(branch);
+ }
+
+ public int getCountForBranch(String branch, boolean useNamed, boolean useRegion)
+ {
+ if (useNamed)
+ return getCountForBranchViaNamedQuery(branch, useRegion);
+ else
+ return getCountForBranchViaLocalQuery(branch, useRegion);
+ }
+
+ private int getCountForBranchViaLocalQuery(String branch, boolean useRegion)
+ {
+ Query query = manager.createQuery("select account from Account as account where account.branch = ?1");
+ query.setParameter(1, branch);
+ if (useRegion)
+ {
+ query.setHint("org.hibernate.cacheRegion", "AccountRegion");
+ }
+ query.setHint("org.hibernate.cacheable", Boolean.TRUE);
+ return query.getResultList().size();
+
+ }
+
+ private int getCountForBranchViaNamedQuery(String branch, boolean useRegion)
+ {
+ String queryName = useRegion ? "account.bybranch.namedregion"
+ : "account.bybranch.default";
+ Query query = manager.createNamedQuery(queryName);
+ query.setParameter(1, branch);
+ return query.getResultList().size();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.test.clusteredentity.EntityQueryTest#createAccount(org.jboss.ejb3.test.clusteredentity.AccountHolderPK, Integer, Integer)
+ */
+ public void createAccount(AccountHolderPK pk, Integer id, Integer openingBalance, String branch)
+ {
+ Account account = new Account();
+ account.setId(id);
+ account.setAccountHolder(pk);
+ account.setBalance(openingBalance);
+ account.setBranch(branch);
+ manager.persist(account);
+ }
+
+ public void updateAccountBalance(Integer id, Integer newBalance)
+ {
+ Account account = (Account) manager.find(Account.class, id);
+ account.setBalance(newBalance);
+ }
+
+ public String getBranch(AccountHolderPK pk, boolean useNamed, boolean useRegion)
+ {
+ if (useNamed)
+ return getBranchViaNamedQuery(pk, useRegion);
+ else
+ return getBranchViaLocalQuery(pk, useRegion);
+ }
+
+ private String getBranchViaLocalQuery(AccountHolderPK pk, boolean useRegion)
+ {
+ Query query = manager.createQuery("select account.branch from Account as account where account.accountHolder = ?1");
+ query.setParameter(1, pk);
+ if (useRegion)
+ {
+ query.setHint("org.hibernate.cacheRegion", "AccountRegion");
+ }
+ query.setHint("org.hibernate.cacheable", Boolean.TRUE);
+ return (String) query.getResultList().get(0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.test.clusteredentity.EntityQueryTest#getPostCodeViaNamedQuery(org.jboss.ejb3.test.clusteredentity.AccountHolderPK, boolean)
+ */
+ private String getBranchViaNamedQuery(AccountHolderPK pk, boolean useRegion)
+ {
+ String queryName = useRegion ? "account.branch.namedregion"
+ : "account.branch.default";
+ Query query = manager.createNamedQuery(queryName);
+ query.setParameter(1, pk);
+ return (String) query.getResultList().get(0);
+ }
+ public int getTotalBalance(AccountHolderPK pk, boolean useNamed, boolean useRegion)
+ {
+ if (useNamed)
+ return getTotalBalanceViaNamedQuery(pk, useRegion);
+ else
+ return getTotalBalanceViaLocalQuery(pk, useRegion);
+ }
+
+ private int getTotalBalanceViaLocalQuery(AccountHolderPK pk, boolean useRegion)
+ {
+ Query query = manager.createQuery("select account.balance from Account as account where account.accountHolder = ?1");
+ query.setParameter(1, pk);
+ query.setHint("org.hibernate.cacheable", Boolean.TRUE);
+ return totalBalances(query);
+ }
+
+ private int getTotalBalanceViaNamedQuery(AccountHolderPK pk, boolean useRegion)
+ {
+ String queryName = useRegion ? "account.totalbalance.namedregion"
+ : "account.totalbalance.default";
+ Query query = manager.createNamedQuery(queryName);
+ query.setParameter(1, pk);
+ return totalBalances(query);
+ }
+
+ private int totalBalances(Query balanceQuery)
+ {
+ List results = balanceQuery.getResultList();
+ int total = 0;
+ if (results != null)
+ {
+ for (Iterator it = results.iterator(); it.hasNext();)
+ {
+ total += ((Integer) it.next()).intValue();
+ System.out.println("Total = " + total);
+ }
+ }
+ return total;
+ }
+
+ public boolean getSawRegionModification(String regionName)
+ {
+ return getSawRegion(regionName, listener.modified);
+ }
+
+ public boolean getSawRegionAccess(String regionName)
+ {
+ return getSawRegion(regionName, listener.accessed);
+ }
+
+ private boolean getSawRegion(String regionName, Set sawEvent)
+ {
+ boolean saw = false;
+ Fqn fqn = Fqn.fromString("/" + regionName.replace(".", "/"));
+ for (Iterator it = sawEvent.iterator(); it.hasNext();)
+ {
+ Fqn modified = (Fqn) it.next();
+ if (modified.isChildOf(fqn))
+ {
+ it.remove();
+ saw = true;
+ }
+ }
+ return saw;
+
+ }
+
+ public void cleanup()
+ {
+ Query query = manager.createQuery("select account from Account as account");
+ List accts = query.getResultList();
+ if (accts != null)
+ {
+ for (Iterator it = accts.iterator(); it.hasNext();)
+ {
+ try
+ {
+ Account acct = (Account) it.next();
+ log.info("Removing " + acct);
+ manager.remove(acct);
+ }
+ catch (Exception ignored) {}
+ }
+ }
+ }
+
+ @Remove
+ public void remove()
+ {
+ cleanup();
+ listener.clear();
+ try
+ {
+ getCache().removeTreeCacheListener(listener);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private TreeCache getCache() throws Exception
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ TreeCacheMBean proxy = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, new ObjectName("jboss.cache:service=EJB3EntityTreeCache"), server);
+ TreeCache cache = proxy.getInstance();
+
+ return cache;
+ }
+
+ class MyListener extends AbstractTreeCacheListener
+ {
+ HashSet modified = new HashSet();
+ HashSet accessed = new HashSet();
+
+ public void clear()
+ {
+ modified.clear();
+ accessed.clear();
+ }
+
+ public void nodeModified(Fqn fqn)
+ {
+ System.out.println("MyListener - Modified node " + fqn.toString());
+ modified.add(fqn);
+ }
+
+ public void nodeCreated(Fqn fqn)
+ {
+ System.out.println("MyListener - Created node " + fqn.toString());
+ modified.add(fqn);
+ }
+
+ public void nodeVisited(Fqn fqn)
+ {
+ System.out.println("MyListener - Visited node " + fqn.toString());
+ accessed.add(fqn);
+ }
+
+ }
+}
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,154 @@
+/*
+ * 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.unit;
+
+import java.sql.DriverManager;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+/** A TestSetup that starts hypersonic before the testcase with a tcp
+ * listening port at 1701.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revison:$
+ */
+public class DBSetup extends TestSetup
+{
+ public DBSetup(Test test)
+ {
+ super(test);
+ }
+
+ protected void setUp() throws Exception
+ {
+ File hypersoniDir = new File("output/hypersonic");
+ if (!hypersoniDir.exists())
+ {
+ hypersoniDir.mkdirs();
+ }
+
+ if (!hypersoniDir.isDirectory())
+ {
+ throw new IOException("Failed to create directory: " + hypersoniDir);
+ }
+
+ File dbPath = new File(hypersoniDir, "clusteredentity-db");
+
+ // Start DB in new thread, or else it will block us
+ DBThread serverThread = new DBThread(dbPath);
+ serverThread.start();
+
+ int elapsed = 0;
+ while (!serverThread.isStarted() && elapsed < 15000)
+ {
+ try
+ {
+ Thread.sleep(100);
+ elapsed += 100;
+ }
+ catch (InterruptedException ie)
+ {
+ System.out.println("Interrupted while waiting for Hypersonic");
+ }
+ }
+
+ if (!serverThread.isStarted())
+ System.out.println("Hypersonic failed to start in a timely fashion");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ Class.forName("org.hsqldb.jdbcDriver");
+ String dbURL = "jdbc:hsqldb:hsql://" + System.getProperty("jbosstest.server.host", "localhost") + ":1701";
+ Connection conn = DriverManager.getConnection(dbURL, "sa", "");
+ Statement statement = conn.createStatement();
+ statement.executeQuery("SHUTDOWN COMPACT");
+
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ DBSetup setup = new DBSetup(null);
+ setup.setUp();
+ Thread.sleep(120*1000);
+ setup.tearDown();
+ }
+
+ class DBThread extends Thread
+ {
+ boolean started;
+ File dbPath;
+
+ DBThread(File dbPath)
+ {
+ super("hypersonic");
+ this.dbPath = dbPath;
+ }
+
+ boolean isStarted()
+ {
+ return started;
+ }
+
+ public void run()
+ {
+ try
+ {
+ // Create startup arguments
+ String[] args = {
+ "-database",
+ dbPath.toString(),
+ "-port",
+ String.valueOf(1701),
+ "-silent",
+ "false",
+ "-trace",
+ "false",
+ "-no_system_exit",
+ "true",
+ };
+ System.out.println("Starting hsqldb");
+ // HACK Do this by reflection for now until we determine how
+ // we want to handle this in EJB3
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass("org.hsqldb.Server");
+ Method main = clazz.getDeclaredMethod("main", new Class[] { String[].class });
+ main.invoke(null, new Object[] { args });
+// org.hsqldb.Server.main(args);
+ System.out.println("Done");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ started = true;
+ }
+ }
+ }
+}
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,298 @@
+/*
+ * 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.unit;
+
+import java.util.Properties;
+import javax.naming.InitialContext;
+
+import org.hibernate.cache.StandardQueryCache;
+import org.jboss.ejb3.test.clusteredentity.classloader.Account;
+import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
+import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
+import org.jboss.test.JBossClusteredTestCase;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Base class for tests involving clustered entities with a scoped classloader.
+ *
+ * @author Brian Stansberry
+ * @version $Id: EntityUnitTestCase.java 57207 2006-09-26 12:06:13Z dimitris at jboss.org $
+ */
+
+public class EntityClassloaderTestBase
+extends JBossClusteredTestCase
+{
+ protected org.apache.log4j.Category log = getLog();
+
+ protected static final long SLEEP_TIME = 300L;
+
+
+ static boolean deployed0 = true;
+ static boolean deployed1 = true;
+
+ protected static final AccountHolderPK SMITH = new AccountHolderPK("Smith", "1000");
+ protected static final AccountHolderPK JONES = new AccountHolderPK("Jones", "2000");
+ protected static final AccountHolderPK BARNEY = new AccountHolderPK("Barney", "3000");
+
+ protected EntityQueryTest sfsb0;
+
+ protected EntityQueryTest sfsb1;
+
+ public EntityClassloaderTestBase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ sfsb0 = getEntityQueryTest(System.getProperty("jbosstest.cluster.node0"));
+ sfsb1 = getEntityQueryTest(System.getProperty("jbosstest.cluster.node1"));
+ sfsb0.cleanup();
+ sfsb1.cleanup();
+ }
+
+ protected EntityQueryTest getEntityQueryTest(String nodeJNDIAddress) throws Exception
+ {
+ Properties prop1 = new Properties();
+ prop1.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ prop1.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ prop1.put("java.naming.provider.url", "jnp://" + nodeJNDIAddress + ":1099");
+
+ log.info("===== Naming properties for " + nodeJNDIAddress + ": ");
+ log.info(prop1);
+ log.info("Create InitialContext for " + nodeJNDIAddress);
+ InitialContext ctx1 = new InitialContext(prop1);
+
+ log.info("Lookup sfsb from " + nodeJNDIAddress);
+ return (EntityQueryTest)ctx1.lookup("clusteredentity-classloader-test/EntityQueryTestBean/remote");
+
+ }
+
+ protected void tearDown() throws Exception
+ {
+ if (sfsb0 != null)
+ {
+ try
+ {
+ sfsb0.remove();
+ }
+ catch (Exception e) {}
+ }
+ if (sfsb1 != null)
+ {
+ try
+ {
+ sfsb1.remove();
+ }
+ catch (Exception e) {}
+ }
+
+ sfsb0 = sfsb1 = null;
+ }
+
+ protected void standardEntitySetup()
+ {
+// sfsb0.createAccountHolder(SMITH, "94536");
+ sfsb0.createAccount(SMITH, new Integer(1001), new Integer(5), "94536");
+ sfsb0.createAccount(SMITH, new Integer(1002), new Integer(15), "94536");
+ sfsb0.createAccount(SMITH, new Integer(1003), new Integer(20), "94536");
+
+// sfsb0.createAccountHolder(JONES, "63088");
+ sfsb0.createAccount(JONES, new Integer(2001), new Integer(5), "63088");
+ sfsb0.createAccount(JONES, new Integer(2002), new Integer(15), "63088");
+ sfsb0.createAccount(JONES, new Integer(2003), new Integer(20), "63088");
+
+// sfsb0.createAccountHolder(BARNEY, "63088");
+ sfsb0.createAccount(BARNEY, new Integer(3001), new Integer(5), "63088");
+ sfsb0.createAccount(BARNEY, new Integer(3002), new Integer(15), "63088");
+ sfsb0.createAccount(BARNEY, new Integer(3003), new Integer(20), "63088");
+
+ log.info("Standard entities created");
+ }
+
+ protected void resetRegionUsageState()
+ {
+ sfsb0.getSawRegionModification(StandardQueryCache.class.getName());
+ sfsb0.getSawRegionModification("AccountRegion");
+
+ sfsb0.getSawRegionAccess(StandardQueryCache.class.getName());
+ sfsb0.getSawRegionAccess("AccountRegion");
+
+
+ sfsb1.getSawRegionModification(StandardQueryCache.class.getName());
+ sfsb1.getSawRegionModification("AccountRegion");
+
+ sfsb1.getSawRegionAccess(StandardQueryCache.class.getName());
+ sfsb1.getSawRegionAccess("AccountRegion");
+
+ log.info("Region usage state cleared");
+
+ }
+
+ protected void modifyEntities(EntityQueryTest bean)
+ {
+ bean.updateAccountBranch(1001, "63088");
+ bean.updateAccountBalance(2001, 15);
+
+ log.info("Entities modified");
+ }
+
+ protected void restoreEntities(EntityQueryTest bean)
+ {
+ // Undo the mods done in queryTest
+ bean.updateAccountBranch(1001, "94536");
+ bean.updateAccountBalance(2001, 5);
+
+ log.info("Standard entities restored to initial state");
+ }
+
+ protected void queryTest(boolean setupEntities, boolean useNamedQuery, boolean useNamedRegion, boolean checkEmptyRegion)
+ {
+ if (setupEntities)
+ standardEntitySetup();
+ else
+ restoreEntities(sfsb0);
+
+ resetRegionUsageState();
+
+ // Initial ops on node 0
+
+ String regionName = useNamedRegion ? "AccountRegion" : StandardQueryCache.class.getName();
+
+ // Query on post code count
+ assertEquals("63088 has correct # of accounts", 6, sfsb0.getCountForBranch("63088", useNamedQuery, useNamedRegion));
+
+ assertTrue("Query cache used", sfsb0.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb0.getSawRegionAccess(regionName);
+
+ log.info("First query on node0 done");
+
+ // Do it again from node 1
+ // Sleep a bit to allow async repl to happen
+ sleep(SLEEP_TIME);
+
+ // If region isn't activated yet, should not have been modified
+ if (checkEmptyRegion)
+ {
+ assertFalse("Query cache remotely modified", sfsb1.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb1.getSawRegionAccess(regionName);
+ }
+ else if (useNamedRegion)
+ {
+ assertTrue("Query cache remotely modified", sfsb1.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb1.getSawRegionAccess(regionName);
+ }
+
+ assertEquals("63088 has correct # of accounts", 6, sfsb1.getCountForBranch("63088", useNamedQuery, useNamedRegion));
+
+ if (checkEmptyRegion)
+ {
+ // Query should have been inserted
+ assertTrue("Query cache modified", sfsb1.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb1.getSawRegionAccess(regionName);
+ }
+
+ log.info("First query on node 1 done");
+
+ // We now have the query cache region activated on both nodes.
+
+ // Sleep a bit to allow async repl to happen
+ sleep(SLEEP_TIME);
+
+ // Do some more queries on node 0
+
+ assertEquals("Correct branch for Smith", "94536", sfsb0.getBranch(SMITH, useNamedQuery, useNamedRegion));
+
+ assertEquals("Correct high balances for Jones", 40, sfsb0.getTotalBalance(JONES, useNamedQuery, useNamedRegion));
+
+ assertTrue("Query cache used", sfsb0.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb0.getSawRegionAccess(regionName);
+
+ log.info("Second set of queries on node0 done");
+
+ // Sleep a bit to allow async repl to happen
+ sleep(SLEEP_TIME);
+
+ // Do it again from node 1
+
+ // First check if the previous queries replicated (if the region is replicable)
+
+ if (useNamedRegion)
+ {
+ assertTrue("Query cache remotely modified", sfsb1.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb1.getSawRegionAccess(regionName);
+ }
+
+ assertEquals("Correct branch for Smith", "94536", sfsb1.getBranch(SMITH, useNamedQuery, useNamedRegion));
+
+ assertEquals("Correct high balances for Jones", 40, sfsb1.getTotalBalance(JONES, useNamedQuery, useNamedRegion));
+
+ if (useNamedRegion)
+ {
+ // Should be no change; query was already there
+ assertFalse("Query cache modified", sfsb1.getSawRegionModification(regionName));
+ assertTrue("Query cache accessed", sfsb1.getSawRegionAccess(regionName));
+ }
+ else
+ {
+ // Query should have been inserted
+ assertTrue("Query cache modified", sfsb1.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb1.getSawRegionAccess(regionName);
+ }
+
+ log.info("Second set of queries on node1 done");
+
+ // Modify underlying data on node 1
+ modifyEntities(sfsb1);
+
+ // Confirm query results are correct on node 0
+
+ assertEquals("63088 has correct # of accounts", 7, sfsb0.getCountForBranch("63088", useNamedQuery, useNamedRegion));
+
+ assertEquals("Correct branch for Smith", "63088", sfsb0.getBranch(SMITH, useNamedQuery, useNamedRegion));
+
+ assertEquals("Correct high balances for Jones", 50, sfsb0.getTotalBalance(JONES, useNamedQuery, useNamedRegion));
+
+ log.info("Third set of queries on node0 done");
+ }
+
+ protected void sleep(long millis)
+ {
+ try
+ {
+ Thread.sleep(millis);
+ }
+ catch (InterruptedException e)
+ {
+ log.warn("Interrupted while sleeping", e);
+ }
+ }
+}
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,98 @@
+/*
+ * 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.unit;
+
+import java.util.Properties;
+import javax.naming.InitialContext;
+
+import org.hibernate.cache.StandardQueryCache;
+import org.jboss.ejb3.test.clusteredentity.classloader.Account;
+import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
+import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
+import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: EntityUnitTestCase.java 57207 2006-09-26 12:06:13Z dimitris at jboss.org $
+ */
+
+public class EntityQueryRedeployUnitTestCase
+extends EntityClassloaderTestBase
+{
+ private static boolean firstNamedRegionTest = true;
+ private static final String EAR_NAME = "clusteredentity-classloader-test.ear";
+
+ public EntityQueryRedeployUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testRedeploy() throws Exception
+ {
+ // Set things up with the default region
+ queryTest(true, true, false, true);
+ // Now get the named query regions active
+ queryTest(false, true, true, true);
+
+ // Don't set this false, as after redeploy it's as if its the first test
+// firstNamedRegionTest = false;
+
+ redeploy();
+
+ // Redo the test, but no entity creation
+ queryTest(false, true, false, true);
+ queryTest(false, true, true, true);
+ }
+
+ private void redeploy() throws Exception
+ {
+ RMIAdaptor[] adaptors = getAdaptors();
+ undeploy(adaptors[1], EAR_NAME);
+
+ sleep(2000);
+
+ deploy(adaptors[1], EAR_NAME);
+
+ sleep(2000);
+
+ // Get the SFSB again
+ sfsb1 = getEntityQueryTest(System.getProperty("jbosstest.cluster.node1"));
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ Test t1 = getDeploySetup(EntityQueryRedeployUnitTestCase.class, EAR_NAME);
+
+ suite.addTest(t1);
+
+ // Create an initializer for the test suite
+ DBSetup wrapper = new DBSetup(suite);
+ return wrapper;
+ }
+}
Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java 2006-11-30 23:14:51 UTC (rev 58784)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java 2006-11-30 23:14:54 UTC (rev 58785)
@@ -0,0 +1,111 @@
+/*
+ * 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.unit;
+
+import java.util.Properties;
+import javax.naming.InitialContext;
+
+import org.hibernate.cache.StandardQueryCache;
+import org.jboss.ejb3.test.clusteredentity.classloader.Account;
+import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
+import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: EntityUnitTestCase.java 57207 2006-09-26 12:06:13Z dimitris at jboss.org $
+ */
+
+public class EntityQueryUnitTestCase
+extends EntityClassloaderTestBase
+{
+ private static boolean firstNamedRegionTest = true;
+
+ public EntityQueryUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testManualQueryDefaultRegion() throws Exception
+ {
+ log.info("+++ start testManualQueryDefaultRegion");
+ queryTest(false, false);
+ log.info("+++ end testManualQueryDefaultRegion");
+ }
+
+ public void testManualQueryNamedRegion() throws Exception
+ {
+ log.info("+++ start testManualQueryNamedRegion");
+ try
+ {
+ queryTest(false, true);
+ }
+ finally
+ {
+ firstNamedRegionTest = false;
+ }
+ log.info("+++ end testManualQueryNamedRegion");
+ }
+
+ public void testNamedQueryDefaultRegion() throws Exception
+ {
+ log.info("+++ start testNamedQueryDefaultRegion");
+ queryTest(true, false);
+ log.info("+++ end testNamedQueryDefaultRegion");
+ }
+
+ public void testNamedQueryNamedRegion() throws Exception
+ {
+ log.info("+++ start testNamedQueryNamedRegion");
+ try
+ {
+ queryTest(true, true);
+ }
+ finally
+ {
+ firstNamedRegionTest = false;
+ }
+ log.info("+++ start testNamedQueryNamedRegion");
+ }
+
+ private void queryTest(boolean useNamedQuery, boolean useNamedRegion)
+ {
+ queryTest(true, useNamedQuery, useNamedRegion, firstNamedRegionTest);
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ Test t1 = getDeploySetup(EntityQueryUnitTestCase.class,
+ "clusteredentity-classloader-test.ear");
+
+ suite.addTest(t1);
+
+ // Create an initializer for the test suite
+ DBSetup wrapper = new DBSetup(suite);
+ return wrapper;
+ }
+}
More information about the jboss-cvs-commits
mailing list