[jboss-cvs] JBossAS SVN: r96150 - in trunk/testsuite: imports/config and 17 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 9 00:55:09 EST 2009
Author: bstansberry at jboss.com
Date: 2009-11-09 00:55:07 -0500 (Mon, 09 Nov 2009)
New Revision: 96150
Added:
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Contact.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Customer.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/Account.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/AccountHolderPK.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/Musician.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/MusicianPK.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/
trunk/testsuite/src/main/org/jboss/test/jpa/entity/
trunk/testsuite/src/main/org/jboss/test/jpa/entityoptimisticlocking/
trunk/testsuite/src/main/org/jboss/test/jpa/entityoptimisticlocking/test/
trunk/testsuite/src/main/org/jboss/test/jpa/test/EntityOptimisticLockingUnitTestCase.java
trunk/testsuite/src/resources/jpa/entityoptimisticlocking/
trunk/testsuite/src/resources/jpa/entityoptimisticlocking/META-INF/
Removed:
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTest.java
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTestBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Contact.java
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Customer.java
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTest.java
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/classloader/
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/embeddedid/
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/unit/
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Contact.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Customer.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/classloader/
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/embeddedid/
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/
trunk/testsuite/src/main/org/jboss/test/cluster/entity/
trunk/testsuite/src/main/org/jboss/test/cluster/entityoptimisticlocking/unit/
trunk/testsuite/src/main/org/jboss/test/jpa/entityoptimisticlocking/test/EntityUnitTestCase.java
trunk/testsuite/src/resources/cluster/entityoptimisticlocking/META-INF/
Modified:
trunk/testsuite/build.xml
trunk/testsuite/imports/config/tests-clustering.xml
trunk/testsuite/imports/sections/cluster.xml
trunk/testsuite/imports/sections/jpa.xml
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticBulkOperationsUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEmbeddedIdClassloaderTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityQueryRedeployUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityQueryUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/ProvidedPrefixEntityQueryUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/Address.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/Airport.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/Company.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/Customer.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/EntityTest.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/EntityTestBean.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldAddress.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldAirport.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldCompany.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldCustomer.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldFlight.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldTicket.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/Flight.java
trunk/testsuite/src/main/org/jboss/test/jpa/entity/Ticket.java
Log:
[JBAS-7428] Final step of move in of clustered entity tests from ejb3 project
Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/build.xml 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1155,11 +1155,6 @@
<!-- The FarmedClusterHugeDeploymentUnitTestCase will fail on slaves with inadequate network buffers -->
<exclude name="org/jboss/test/cluster/defaultcfg/profileservice/test/FarmedClusterHugeDeploymentUnitTestCase.class"/>
- <!-- Tests in the middle of being ported from ejb3 -->
- <exclude name="org/jboss/ejb3/**"/>
- <exclude name="org/jboss/test/cluster/defaultcfg/clusteredentity/**"/>
- <exclude name="org/jboss/test/cluster/entity/**"/>
- <exclude name="org/jboss/test/cluster/entityoptimisticlocking/**"/>
</patternset>
<patternset id="aop-with-classloader.excludes">
Modified: trunk/testsuite/imports/config/tests-clustering.xml
===================================================================
--- trunk/testsuite/imports/config/tests-clustering.xml 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/imports/config/tests-clustering.xml 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,6 +19,8 @@
<!-- These are web tier tests that shouldn't be repeated with REPL_SYNC, etc -->
<include name="org/jboss/test/cluster/defaultcfg/simpleweb/test/*TestCase.class"/>
+
+ <include name="org/jboss/test/cluster/defaultcfg/clusteredentity/test/*TestCase.class"/>
<include name="org/jboss/test/cluster/multicfg/test/*TestCase.class"/>
<include name="org/jboss/test/cluster/multicfg/ejb2/test/*TestCase.class"/>
Modified: trunk/testsuite/imports/sections/cluster.xml
===================================================================
--- trunk/testsuite/imports/sections/cluster.xml 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/imports/sections/cluster.xml 2009-11-09 05:55:07 UTC (rev 96150)
@@ -706,6 +706,139 @@
<include name="org/jboss/test/cluster/web/persistent/PersistentStoreTableSetup.class"/>
</fileset>
</jar>
+
+ <!-- JPA Clustered Second Level Cache -->
+ <jar jarfile="${build.lib}/clusteredentity-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-optimistic-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/optimistic">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-classloader-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/classloader/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-classloader-optimistic-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/classloader/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader/optimistic">
+ <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="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="META-INF/application.xml"/>
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-classloader-optimistic-test.ear">
+ <fileset dir="${build.lib}">
+ <include name="clusteredentity-classloader-optimistic-test.jar"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader/optimistic">
+ <include name="META-INF/application.xml"/>
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-providedprefix-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/classloader/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/providedprefix">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-providedprefix-test.ear">
+ <fileset dir="${build.lib}">
+ <include name="clusteredentity-providedprefix-test.jar"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/providedprefix">
+ <include name="META-INF/application.xml"/>
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-embeddedid-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/embeddedid/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-embeddedid-optimistic-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/clusteredentity/embeddedid/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader/optimistic">
+ <include name="META-INF/persistence.xml"/>
+ <!--include name="META-INF/jboss.xml"/-->
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-embeddedid-test.ear">
+ <fileset dir="${build.lib}">
+ <include name="clusteredentity-embeddedid-test.jar"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/embeddedid">
+ <include name="META-INF/application.xml"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/clusteredentity-embeddedid-optimistic-test.ear">
+ <fileset dir="${build.lib}">
+ <include name="clusteredentity-embeddedid-optimistic-test.jar"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/classloader">
+ <include name="META-INF/jboss-app.xml"/>
+ <include name="clusteredentity-ds.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/cluster/clusteredentity/embeddedid/optimistic">
+ <include name="META-INF/application.xml"/>
+ </fileset>
+ </jar>
+
</target>
Modified: trunk/testsuite/imports/sections/jpa.xml
===================================================================
--- trunk/testsuite/imports/sections/jpa.xml 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/imports/sections/jpa.xml 2009-11-09 05:55:07 UTC (rev 96150)
@@ -54,6 +54,16 @@
</fileset>
</jar>
+ <jar jarfile="${build.lib}/entityoptimisticlocking-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/jpa/entity/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/jpa/entityoptimisticlocking">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+
</target>
</project>
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTest.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,46 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-
-/**
- * @author Brian Stansberry
- * @version $Revision$
- */
-public interface BulkOperationsTest
-{
- void createContacts();
-
- int deleteContacts();
-
- int updateContacts(String name, String newTLF);
-
- List<Integer> getContactsByCustomer(String customerName);
-
- List<Integer> getContactsByTLF(String tlf);
-
- Contact getContact(Integer id);
-
- void remove();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTestBean.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/BulkOperationsTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,162 +0,0 @@
-/*
- * 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;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.FlushModeType;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-
-/**
- * @author Brian Stansberry
- * @version $Revision$
- */
- at Stateless
- at Remote(BulkOperationsTest.class)
- at RemoteBinding(jndiBinding="BulkOperationsTestBean/remote")
-public class BulkOperationsTestBean implements BulkOperationsTest
-{
- @PersistenceContext
- private EntityManager manager;
-
-
- public void createContacts()
- {
- for (int i = 0; i < 10; i++)
- createCustomer(i);
- }
-
- public int deleteContacts()
- {
- String deleteHQL = "delete Contact where customer in ";
- deleteHQL += " (select customer FROM Customer as customer ";
- deleteHQL += " where customer.name = :cName)";
-
- int rowsAffected = manager.createQuery(deleteHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cName", "Red Hat")
- .executeUpdate();
- return rowsAffected;
- }
-
- public List<Integer> getContactsByCustomer(String customerName)
- {
- String selectHQL = "select contact.id from Contact contact";
- selectHQL += " where contact.customer.name = :cName";
-
- List results = manager.createQuery(selectHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cName", customerName)
- .getResultList();
-
- return results;
- }
-
- public List<Integer> getContactsByTLF(String tlf)
- {
- String selectHQL = "select contact.id from Contact contact";
- selectHQL += " where contact.tlf = :cTLF";
-
- List results = manager.createQuery(selectHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cTLF", tlf)
- .getResultList();
-
- return results;
- }
-
- public int updateContacts(String name, String newTLF)
- {
- String updateHQL = "update Contact set tlf = :cNewTLF where name = :cName";
-
- int rowsAffected = manager.createQuery(updateHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cNewTLF", newTLF)
- .setParameter("cName", name)
- .executeUpdate();
- return rowsAffected;
- }
-
- public Contact getContact(Integer id)
- {
- return manager.find(Contact.class, id);
- }
-
- @Remove
- public void remove()
- {
-
- }
-
- private Customer createCustomer(int id)
- {
- System.out.println("CREATE CUSTOMER " + id);
- try
- {
- Customer customer = new Customer();
- customer.setId(id);
- customer.setName((id % 2 == 0) ? "JBoss" : "Red Hat");
- Set<Contact> contacts = new HashSet<Contact>();
-
- Contact kabir = new Contact();
- kabir.setId(1000 + id);
- kabir.setCustomer(customer);
- kabir.setName("Kabir");
- kabir.setTlf("1111");
- contacts.add(kabir);
-
- Contact bill = new Contact();
- bill.setId(2000 +id);
- bill.setCustomer(customer);
- bill.setName("Bill");
- bill.setTlf("2222");
- contacts.add(bill);
-
- customer.setContacts(contacts);
-
- manager.persist(customer);
- return customer;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- System.out.println("CREATE CUSTOMER " + id + " - END");
- }
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Contact.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Contact.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Contact.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,95 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-
-/**
- *
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
- at Entity
- at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
-public class Contact implements Serializable
-{
- Integer id;
- String name;
- String tlf;
- Customer customer;
-
- public Contact()
- {
-
- }
-
- @Id
- public Integer getId()
- {
- return id;
- }
-
- public void setId(Integer id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getTlf()
- {
- return tlf;
- }
-
- public void setTlf(String tlf)
- {
- this.tlf = tlf;
- }
-
- @ManyToOne
- @JoinColumn(name="CUST_ID")
- public Customer getCustomer()
- {
- return customer;
- }
-
- public void setCustomer(Customer customer)
- {
- this.customer = customer;
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Customer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Customer.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/Customer.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,85 +0,0 @@
-/*
- * 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;
-
-import java.util.Set;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-
-/**
- * Company customer
- *
- * @author Emmanuel Bernard
- * @author Kabir Khan
- */
- at Entity
- at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
-public class Customer implements java.io.Serializable
-{
- Integer id;
- String name;
-
- private transient Set<Contact> contacts;
-
- public Customer()
- {
- }
-
- @Id
- public Integer getId()
- {
- return id;
- }
-
- public void setId(Integer id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String string)
- {
- name = string;
- }
-
- @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
- @OneToMany(mappedBy="customer", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
- public Set<Contact> getContacts()
- {
- return contacts;
- }
-
- public void setContacts(Set<Contact> contacts)
- {
- this.contacts = contacts;
- }
-}
-
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTest.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,43 +0,0 @@
-/*
- * 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;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface EntityTest
-{
- void getCache(String cacheConfigName);
-
- Customer createCustomer();
-
- Customer findByCustomerId(Integer id);
-
- String loadedFromCache();
-
- void cleanup();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,265 +0,0 @@
-/*
- * 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;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.annotation.PreDestroy;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheManager;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.event.NodeVisitedEvent;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ha.framework.server.CacheManagerLocator;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
- at Stateful
- at Remote(EntityTest.class)
- at RemoteBinding(jndiBinding="EntityTestBean/remote")
-public class EntityTestBean implements EntityTest
-{
- private static final Logger log = Logger.getLogger(EntityTestBean.class);
-
- @PersistenceContext
- private EntityManager manager;
-
- private String cacheConfigName;
-
- private transient Cache<Object, Object> cache;
-
- private transient MyListener listener;
-
- public EntityTestBean()
- {
- }
-
- public void getCache(String cacheConfigName)
- {
- this.cacheConfigName = cacheConfigName;
-
- try
- {
- if (cache == null && cacheConfigName != null)
- {
- CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
- cache = cm.getCache(cacheConfigName, true);
- cache.start();
- }
-
- if (listener == null)
- {
- listener = new MyListener();
- cache.addCacheListener(listener);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public Customer createCustomer()
- {
- System.out.println("CREATE CUSTOMER");
- try
- {
- listener.clear();
-
- Customer customer = new Customer();
- customer.setId(new Integer(1));
- customer.setName("JBoss");
- Set<Contact> contacts = new HashSet<Contact>();
-
- Contact kabir = new Contact();
- kabir.setId(new Integer(1));
- kabir.setCustomer(customer);
- kabir.setName("Kabir");
- kabir.setTlf("1111");
- contacts.add(kabir);
-
- Contact bill = new Contact();
- bill.setId(new Integer(2));
- bill.setCustomer(customer);
- bill.setName("Bill");
- bill.setTlf("2222");
- contacts.add(bill);
-
- customer.setContacts(contacts);
-
- manager.persist(customer);
- return customer;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- System.out.println("CREATE CUSTOMER - END");
- }
- }
-
- public Customer findByCustomerId(Integer id)
- {
- System.out.println("FIND CUSTOMER");
- listener.clear();
- try
- {
- Customer customer = manager.find(Customer.class, id);
-
- return customer;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- System.out.println("FIND CUSTOMER - END");
- }
- }
-
- public String loadedFromCache()
- {
- System.out.println("CHECK CACHE");
- try
- {
- System.out.println("Visited: " + listener.visited);
- if (!listener.visited.contains("Customer#1"))
- return "Customer#1 was not in cache";
- if (!listener.visited.contains("Contact#1"))
- return "Contact#1 was not in cache";
- if (!listener.visited.contains("Contact#2"))
- return "Contact2#1 was not in cache";
- if (!listener.visited.contains("Customer.contacts#1"))
- return "Customer.contacts#1 was not in cache";
- return null;
- }
- finally
- {
- System.out.println("CHECK CACHE - END");
- }
-
- }
-
- @PreDestroy
- @Remove
- public void cleanup()
- {
- try
- {
- if (cache != null && listener != null)
- {
- cache.removeCacheListener(listener);
- }
- }
- catch (Exception e)
- {
- log.error("Caught exception in cleanup", e);
- }
-
- try
- {
- if (manager != null)
- {
- Customer c = findByCustomerId(new Integer(1));
- if (c != null)
- {
- Set contacts = c.getContacts();
- for (Iterator it = contacts.iterator(); it.hasNext();)
- manager.remove(it.next());
- c.setContacts(null);
- manager.remove(c);
- }
- }
- }
- catch (Exception e)
- {
- log.error("Caught exception in cleanup", e);
- }
-
- try
- {
- if (cache != null)
- CacheManagerLocator.getCacheManagerLocator().getCacheManager(null).releaseCache(cacheConfigName);
- }
- catch (Exception e)
- {
- log.error("Caught exception releasing cache", e);
- }
- }
-
- @CacheListener
- public class MyListener
- {
- HashSet<String> visited = new HashSet<String>();
-
- public void clear()
- {
- visited.clear();
- }
-
- @NodeVisited
- public void nodeVisited(NodeVisitedEvent event)
- {
- if (!event.isPre())
- {
- Fqn fqn = event.getFqn();
- System.out.println("MyListener - Visiting node " + fqn.toString());
- String name = fqn.toString();
- String token = ".clusteredentity.";
- int index = name.indexOf(token);
- if (index > -1)
- {
- index += token.length();
- name = name.substring(index);
- System.out.println("MyListener - recording visit to " + name);
- visited.add(name);
- }
- }
- }
- }
-}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTest.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTest.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.cluster.clusteredentity;
+
+import java.util.List;
+
+/**
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public interface BulkOperationsTest
+{
+ void createContacts();
+
+ int deleteContacts();
+
+ int updateContacts(String name, String newTLF);
+
+ List<Integer> getContactsByCustomer(String customerName);
+
+ List<Integer> getContactsByTLF(String tlf);
+
+ Contact getContact(Integer id);
+
+ void remove();
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTestBean.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTestBean.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTestBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/BulkOperationsTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,162 @@
+/*
+ * 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.test.cluster.clusteredentity;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.FlushModeType;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+ at Stateless
+ at Remote(BulkOperationsTest.class)
+ at RemoteBinding(jndiBinding="BulkOperationsTestBean/remote")
+public class BulkOperationsTestBean implements BulkOperationsTest
+{
+ @PersistenceContext
+ private EntityManager manager;
+
+
+ public void createContacts()
+ {
+ for (int i = 0; i < 10; i++)
+ createCustomer(i);
+ }
+
+ public int deleteContacts()
+ {
+ String deleteHQL = "delete Contact where customer in ";
+ deleteHQL += " (select customer FROM Customer as customer ";
+ deleteHQL += " where customer.name = :cName)";
+
+ int rowsAffected = manager.createQuery(deleteHQL)
+ .setFlushMode(FlushModeType.AUTO)
+ .setParameter("cName", "Red Hat")
+ .executeUpdate();
+ return rowsAffected;
+ }
+
+ public List<Integer> getContactsByCustomer(String customerName)
+ {
+ String selectHQL = "select contact.id from Contact contact";
+ selectHQL += " where contact.customer.name = :cName";
+
+ List results = manager.createQuery(selectHQL)
+ .setFlushMode(FlushModeType.AUTO)
+ .setParameter("cName", customerName)
+ .getResultList();
+
+ return results;
+ }
+
+ public List<Integer> getContactsByTLF(String tlf)
+ {
+ String selectHQL = "select contact.id from Contact contact";
+ selectHQL += " where contact.tlf = :cTLF";
+
+ List results = manager.createQuery(selectHQL)
+ .setFlushMode(FlushModeType.AUTO)
+ .setParameter("cTLF", tlf)
+ .getResultList();
+
+ return results;
+ }
+
+ public int updateContacts(String name, String newTLF)
+ {
+ String updateHQL = "update Contact set tlf = :cNewTLF where name = :cName";
+
+ int rowsAffected = manager.createQuery(updateHQL)
+ .setFlushMode(FlushModeType.AUTO)
+ .setParameter("cNewTLF", newTLF)
+ .setParameter("cName", name)
+ .executeUpdate();
+ return rowsAffected;
+ }
+
+ public Contact getContact(Integer id)
+ {
+ return manager.find(Contact.class, id);
+ }
+
+ @Remove
+ public void remove()
+ {
+
+ }
+
+ private Customer createCustomer(int id)
+ {
+ System.out.println("CREATE CUSTOMER " + id);
+ try
+ {
+ Customer customer = new Customer();
+ customer.setId(id);
+ customer.setName((id % 2 == 0) ? "JBoss" : "Red Hat");
+ Set<Contact> contacts = new HashSet<Contact>();
+
+ Contact kabir = new Contact();
+ kabir.setId(1000 + id);
+ kabir.setCustomer(customer);
+ kabir.setName("Kabir");
+ kabir.setTlf("1111");
+ contacts.add(kabir);
+
+ Contact bill = new Contact();
+ bill.setId(2000 +id);
+ bill.setCustomer(customer);
+ bill.setName("Bill");
+ bill.setTlf("2222");
+ contacts.add(bill);
+
+ customer.setContacts(contacts);
+
+ manager.persist(customer);
+ return customer;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ System.out.println("CREATE CUSTOMER " + id + " - END");
+ }
+ }
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Contact.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Contact.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Contact.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Contact.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,95 @@
+/*
+ * 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.test.cluster.clusteredentity;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ *
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision$
+ */
+ at Entity
+ at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
+public class Contact implements Serializable
+{
+ Integer id;
+ String name;
+ String tlf;
+ Customer customer;
+
+ public Contact()
+ {
+
+ }
+
+ @Id
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public void setId(Integer id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getTlf()
+ {
+ return tlf;
+ }
+
+ public void setTlf(String tlf)
+ {
+ this.tlf = tlf;
+ }
+
+ @ManyToOne
+ @JoinColumn(name="CUST_ID")
+ public Customer getCustomer()
+ {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer)
+ {
+ this.customer = customer;
+ }
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Customer.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Customer.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Customer.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/Customer.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,85 @@
+/*
+ * 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.test.cluster.clusteredentity;
+
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ * Company customer
+ *
+ * @author Emmanuel Bernard
+ * @author Kabir Khan
+ */
+ at Entity
+ at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
+public class Customer implements java.io.Serializable
+{
+ Integer id;
+ String name;
+
+ private transient Set<Contact> contacts;
+
+ public Customer()
+ {
+ }
+
+ @Id
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public void setId(Integer id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String string)
+ {
+ name = string;
+ }
+
+ @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
+ @OneToMany(mappedBy="customer", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
+ public Set<Contact> getContacts()
+ {
+ return contacts;
+ }
+
+ public void setContacts(Set<Contact> contacts)
+ {
+ this.contacts = contacts;
+ }
+}
+
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTest.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTest.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.cluster.clusteredentity;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public interface EntityTest
+{
+ void getCache(String cacheConfigName);
+
+ Customer createCustomer();
+
+ Customer findByCustomerId(Integer id);
+
+ String loadedFromCache();
+
+ void cleanup();
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTestBean.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,265 @@
+/*
+ * 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.test.cluster.clusteredentity;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeVisited;
+import org.jboss.cache.notifications.event.NodeVisitedEvent;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ha.framework.server.CacheManagerLocator;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+ at Stateful
+ at Remote(EntityTest.class)
+ at RemoteBinding(jndiBinding="EntityTestBean/remote")
+public class EntityTestBean implements EntityTest
+{
+ private static final Logger log = Logger.getLogger(EntityTestBean.class);
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ private String cacheConfigName;
+
+ private transient Cache<Object, Object> cache;
+
+ private transient MyListener listener;
+
+ public EntityTestBean()
+ {
+ }
+
+ public void getCache(String cacheConfigName)
+ {
+ this.cacheConfigName = cacheConfigName;
+
+ try
+ {
+ if (cache == null && cacheConfigName != null)
+ {
+ CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
+ cache = cm.getCache(cacheConfigName, true);
+ cache.start();
+ }
+
+ if (listener == null)
+ {
+ listener = new MyListener();
+ cache.addCacheListener(listener);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Customer createCustomer()
+ {
+ System.out.println("CREATE CUSTOMER");
+ try
+ {
+ listener.clear();
+
+ Customer customer = new Customer();
+ customer.setId(new Integer(1));
+ customer.setName("JBoss");
+ Set<Contact> contacts = new HashSet<Contact>();
+
+ Contact kabir = new Contact();
+ kabir.setId(new Integer(1));
+ kabir.setCustomer(customer);
+ kabir.setName("Kabir");
+ kabir.setTlf("1111");
+ contacts.add(kabir);
+
+ Contact bill = new Contact();
+ bill.setId(new Integer(2));
+ bill.setCustomer(customer);
+ bill.setName("Bill");
+ bill.setTlf("2222");
+ contacts.add(bill);
+
+ customer.setContacts(contacts);
+
+ manager.persist(customer);
+ return customer;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ System.out.println("CREATE CUSTOMER - END");
+ }
+ }
+
+ public Customer findByCustomerId(Integer id)
+ {
+ System.out.println("FIND CUSTOMER");
+ listener.clear();
+ try
+ {
+ Customer customer = manager.find(Customer.class, id);
+
+ return customer;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ System.out.println("FIND CUSTOMER - END");
+ }
+ }
+
+ public String loadedFromCache()
+ {
+ System.out.println("CHECK CACHE");
+ try
+ {
+ System.out.println("Visited: " + listener.visited);
+ if (!listener.visited.contains("Customer#1"))
+ return "Customer#1 was not in cache";
+ if (!listener.visited.contains("Contact#1"))
+ return "Contact#1 was not in cache";
+ if (!listener.visited.contains("Contact#2"))
+ return "Contact2#1 was not in cache";
+ if (!listener.visited.contains("Customer.contacts#1"))
+ return "Customer.contacts#1 was not in cache";
+ return null;
+ }
+ finally
+ {
+ System.out.println("CHECK CACHE - END");
+ }
+
+ }
+
+ @PreDestroy
+ @Remove
+ public void cleanup()
+ {
+ try
+ {
+ if (cache != null && listener != null)
+ {
+ cache.removeCacheListener(listener);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception in cleanup", e);
+ }
+
+ try
+ {
+ if (manager != null)
+ {
+ Customer c = findByCustomerId(new Integer(1));
+ if (c != null)
+ {
+ Set contacts = c.getContacts();
+ for (Iterator it = contacts.iterator(); it.hasNext();)
+ manager.remove(it.next());
+ c.setContacts(null);
+ manager.remove(c);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception in cleanup", e);
+ }
+
+ try
+ {
+ if (cache != null)
+ CacheManagerLocator.getCacheManagerLocator().getCacheManager(null).releaseCache(cacheConfigName);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception releasing cache", e);
+ }
+ }
+
+ @CacheListener
+ public class MyListener
+ {
+ HashSet<String> visited = new HashSet<String>();
+
+ public void clear()
+ {
+ visited.clear();
+ }
+
+ @NodeVisited
+ public void nodeVisited(NodeVisitedEvent event)
+ {
+ if (!event.isPre())
+ {
+ Fqn fqn = event.getFqn();
+ System.out.println("MyListener - Visiting node " + fqn.toString());
+ String name = fqn.toString();
+ String token = ".clusteredentity.";
+ int index = name.indexOf(token);
+ if (index > -1)
+ {
+ index += token.length();
+ name = name.substring(index);
+ System.out.println("MyListener - recording visit to " + name);
+ visited.add(name);
+ }
+ }
+ }
+ }
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/Account.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/classloader/Account.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/Account.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/Account.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,116 @@
+/*
+ * 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.test.cluster.clusteredentity.classloader;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.QueryHint;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
+ 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;
+ }
+
+
+
+
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/AccountHolderPK.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/classloader/AccountHolderPK.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/AccountHolderPK.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/AccountHolderPK.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,93 @@
+/*
+ * 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.test.cluster.clusteredentity.classloader;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
+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;
+ }
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTest.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/classloader/EntityQueryTest.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,57 @@
+/*
+ * 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.test.cluster.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);
+
+ 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(boolean removeEntities);
+
+}
\ No newline at end of file
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/classloader/EntityQueryTestBean.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,370 @@
+/*
+ * 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.test.cluster.clusteredentity.classloader;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeCreated;
+import org.jboss.cache.notifications.annotation.NodeModified;
+import org.jboss.cache.notifications.annotation.NodeVisited;
+import org.jboss.cache.notifications.event.NodeCreatedEvent;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import org.jboss.cache.notifications.event.NodeVisitedEvent;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ha.framework.server.CacheManagerLocator;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
+ at Stateful
+ at Remote(EntityQueryTest.class)
+ at RemoteBinding(jndiBinding="EntityQueryTestBean/remote")
+public class EntityQueryTestBean implements EntityQueryTest
+{
+ private static final Logger log = Logger.getLogger(EntityQueryTestBean.class);
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ private String cacheConfigName;
+
+ private transient Cache<Object, Object> cache;
+
+ private MyListener listener;
+
+ public EntityQueryTestBean()
+ {
+ }
+
+ public void getCache(boolean optimistic)
+ {
+ if (optimistic)
+ cacheConfigName = "optimistic-shared";
+ else
+ cacheConfigName = "pessimistic-shared";
+
+ try
+ {
+ //Just to initialise the cache with a listener
+ Cache<Object, Object> cache = getCache();
+ listener = new MyListener();
+ cache.addCacheListener(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<Fqn<String>> sawEvent)
+ {
+ boolean saw = false;
+ for (Iterator<Fqn<String>> it = sawEvent.iterator(); it.hasNext();)
+ {
+ Fqn<String> modified = (Fqn<String>) it.next();
+ if (modified.toString().indexOf(regionName) > -1)
+ {
+ it.remove();
+ saw = true;
+ }
+ }
+ return saw;
+
+ }
+
+ public void cleanup()
+ {
+ internalCleanup();
+ }
+
+ private void internalCleanup()
+ {
+ if (manager != null)
+ {
+ 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) {}
+ }
+ }
+ }
+ }
+
+ @PreDestroy
+ @Remove
+ public void remove(boolean removeEntities)
+ {
+ if (removeEntities)
+ {
+ try
+ {
+ internalCleanup();
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception in remove", e);
+ }
+ }
+
+ try
+ {
+ listener.clear();
+ getCache().removeCacheListener(listener);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception in remove", e);
+ }
+
+ try
+ {
+ if (cache != null)
+ CacheManagerLocator.getCacheManagerLocator().getCacheManager(null).releaseCache(cacheConfigName);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception releasing cache", e);
+ }
+ }
+
+ private Cache<Object, Object> getCache() throws Exception
+ {
+ if (cache == null && cacheConfigName != null)
+ {
+ CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
+ cache = cm.getCache(cacheConfigName, true);
+ cache.start();
+ }
+ return cache;
+ }
+
+ @CacheListener
+ public class MyListener
+ {
+ HashSet<Fqn<String>> modified = new HashSet<Fqn<String>>();
+ HashSet<Fqn<String>> accessed = new HashSet<Fqn<String>>();
+
+ public void clear()
+ {
+ modified.clear();
+ accessed.clear();
+ }
+
+ @NodeModified
+ public void nodeModified(NodeModifiedEvent event)
+ {
+ if (!event.isPre())
+ {
+ Fqn<String> fqn = event.getFqn();
+ System.out.println("MyListener - Modified node " + fqn.toString());
+ modified.add(fqn);
+ }
+ }
+
+ @NodeCreated
+ public void nodeCreated(NodeCreatedEvent event)
+ {
+ if (!event.isPre())
+ {
+ Fqn<String> fqn = event.getFqn();
+ System.out.println("MyListener - Created node " + fqn.toString());
+ modified.add(fqn);
+ }
+ }
+
+ @NodeVisited
+ public void nodeVisited(NodeVisitedEvent event)
+ {
+ if (!event.isPre())
+ {
+ Fqn<String> fqn = event.getFqn();
+ System.out.println("MyListener - Visited node " + fqn.toString());
+ accessed.add(fqn);
+ }
+ }
+
+ }
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTest.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/embeddedid/EmbeddedIdTest.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,44 @@
+/*
+ * 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.test.cluster.clusteredentity.embeddedid;
+
+import java.util.List;
+
+
+/**
+ * SFSB interface for {@link EmbeddedIdTestBean}.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public interface EmbeddedIdTest
+{
+ static final MusicianPK DEFAULT_PK = new MusicianPK("Brian", "Stansberry", "None of your business");
+
+ void createMusician(MusicianPK pk, String instrument);
+
+ List<MusicianPK> getMusiciansForInstrument(String instrument, boolean useNamedRegion);
+
+ void cleanup();
+
+ void remove();
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTestBean.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/embeddedid/EmbeddedIdTestBean.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTestBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/EmbeddedIdTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,125 @@
+/*
+ * 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.test.cluster.clusteredentity.embeddedid;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * SFSB used for testing replicated query caching with an @EmbeddedId.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateful
+ at Remote(EmbeddedIdTest.class)
+ at RemoteBinding(jndiBinding="EmbeddedIdTestBean/remote")
+public class EmbeddedIdTestBean implements EmbeddedIdTest
+{
+ private static final Logger log = Logger.getLogger(EmbeddedIdTestBean.class);
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ public void createMusician(MusicianPK pk, String instrument)
+ {
+ Musician musician = new Musician();
+ musician.setId(pk);
+ musician.setInstrument(instrument);
+ manager.persist(musician);
+ }
+
+ public List<MusicianPK> getMusiciansForInstrument(String instrument, boolean useNamedRegion)
+ {
+ String queryName = useNamedRegion ? "musician.byinstrument.namedregion"
+ : "musician.byinstrument.default";
+ Query query = manager.createNamedQuery(queryName);
+ query.setParameter(1, instrument);
+ List<MusicianPK> result = new ArrayList<MusicianPK>();
+ List users = query.getResultList();
+ if (users != null)
+ {
+ for (Iterator it = users.iterator(); it.hasNext();)
+ {
+ result.add(((Musician) it.next()).getId());
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.test.clusteredentity.classloader.UserTest#cleanup()
+ */
+ public void cleanup()
+ {
+ internalCleanup();
+ }
+
+ private void internalCleanup()
+ {
+ if (manager != null)
+ {
+ Query query = manager.createQuery("select musician from Musician as musician");
+ List accts = query.getResultList();
+ if (accts != null)
+ {
+ for (Iterator it = accts.iterator(); it.hasNext();)
+ {
+ try
+ {
+ Musician musician = (Musician) it.next();
+ log.info("Removing " + musician);
+ manager.remove(musician);
+ }
+ catch (Exception ignored) {}
+ }
+ }
+ }
+ }
+
+ @PreDestroy
+ @Remove
+ public void remove()
+ {
+ try
+ {
+ internalCleanup();
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception in remove", e);
+ }
+ }
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/Musician.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/embeddedid/Musician.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/Musician.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/Musician.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,73 @@
+/*
+ * 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.test.cluster.clusteredentity.embeddedid;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.QueryHint;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ * Entity used for testing replicated query caching with an @EmbeddedId.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+ at Entity
+ at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
+ at NamedQueries({
+ @NamedQuery(name="musician.byinstrument.default",query="select musician from Musician as musician where musician.instrument = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
+ @NamedQuery(name="musician.byinstrument.namedregion",query="select musician from Musician as musician where musician.instrument = ?1",
+ hints={@QueryHint(name="org.hibernate.cacheable",value="true"),
+ @QueryHint(name="org.hibernate.cacheable",value="true")
+ })
+})
+public class Musician
+{
+ private MusicianPK id;
+ private String instrument;
+
+ @EmbeddedId
+ public MusicianPK getId()
+ {
+ return id;
+ }
+ public void setId(MusicianPK id)
+ {
+ this.id = id;
+ }
+
+ public String getInstrument()
+ {
+ return instrument;
+ }
+ public void setInstrument(String instrument)
+ {
+ this.instrument = instrument;
+ }
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/MusicianPK.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/embeddedid/MusicianPK.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/MusicianPK.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/embeddedid/MusicianPK.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,127 @@
+/*
+ * 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.test.cluster.clusteredentity.embeddedid;
+
+import java.io.Serializable;
+
+import javax.persistence.Embeddable;
+
+/**
+ * Primary key for the {@link Musician} entity.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+ at Embeddable
+public class MusicianPK implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String firstName;
+ private String lastName;
+ private String ssn;
+
+ /**
+ * Default constructor
+ */
+ public MusicianPK() {}
+
+ public MusicianPK(String firstName, String lastName, String ssn)
+ {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.ssn = ssn;
+ }
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ public String getSsn()
+ {
+ return ssn;
+ }
+
+ public void setSsn(String ssn)
+ {
+ this.ssn = ssn;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ boolean equal = (this == obj);
+
+ if (!equal && obj instanceof MusicianPK)
+ {
+ MusicianPK other = (MusicianPK) obj;
+
+ equal = firstName.equals(other.firstName)
+ && lastName.equals(other.lastName)
+ && ssn.equals(other.ssn);
+ }
+ return equal;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = 19;
+ result = result * 29 + firstName.hashCode();
+ result = result * 29 + lastName.hashCode();
+ result = result * 29 + ssn.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(getClass().getName());
+ sb.append("[firstName=");
+ sb.append(firstName);
+ sb.append(",lastName=");
+ sb.append(lastName);
+ sb.append(",ssn=");
+ sb.append(ssn);
+ sb.append("]");
+ return sb.toString();
+ }
+
+
+
+}
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTest.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,46 +0,0 @@
-/*
- * 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.test.cluster.defaultcfg.clusteredentity;
-
-import java.util.List;
-
-/**
- * @author Brian Stansberry
- * @version $Revision$
- */
-public interface BulkOperationsTest
-{
- void createContacts();
-
- int deleteContacts();
-
- int updateContacts(String name, String newTLF);
-
- List<Integer> getContactsByCustomer(String customerName);
-
- List<Integer> getContactsByTLF(String tlf);
-
- Contact getContact(Integer id);
-
- void remove();
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTestBean.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/BulkOperationsTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,162 +0,0 @@
-/*
- * 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.test.cluster.defaultcfg.clusteredentity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.FlushModeType;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-
-/**
- * @author Brian Stansberry
- * @version $Revision$
- */
- at Stateless
- at Remote(BulkOperationsTest.class)
- at RemoteBinding(jndiBinding="BulkOperationsTestBean/remote")
-public class BulkOperationsTestBean implements BulkOperationsTest
-{
- @PersistenceContext
- private EntityManager manager;
-
-
- public void createContacts()
- {
- for (int i = 0; i < 10; i++)
- createCustomer(i);
- }
-
- public int deleteContacts()
- {
- String deleteHQL = "delete Contact where customer in ";
- deleteHQL += " (select customer FROM Customer as customer ";
- deleteHQL += " where customer.name = :cName)";
-
- int rowsAffected = manager.createQuery(deleteHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cName", "Red Hat")
- .executeUpdate();
- return rowsAffected;
- }
-
- public List<Integer> getContactsByCustomer(String customerName)
- {
- String selectHQL = "select contact.id from Contact contact";
- selectHQL += " where contact.customer.name = :cName";
-
- List results = manager.createQuery(selectHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cName", customerName)
- .getResultList();
-
- return results;
- }
-
- public List<Integer> getContactsByTLF(String tlf)
- {
- String selectHQL = "select contact.id from Contact contact";
- selectHQL += " where contact.tlf = :cTLF";
-
- List results = manager.createQuery(selectHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cTLF", tlf)
- .getResultList();
-
- return results;
- }
-
- public int updateContacts(String name, String newTLF)
- {
- String updateHQL = "update Contact set tlf = :cNewTLF where name = :cName";
-
- int rowsAffected = manager.createQuery(updateHQL)
- .setFlushMode(FlushModeType.AUTO)
- .setParameter("cNewTLF", newTLF)
- .setParameter("cName", name)
- .executeUpdate();
- return rowsAffected;
- }
-
- public Contact getContact(Integer id)
- {
- return manager.find(Contact.class, id);
- }
-
- @Remove
- public void remove()
- {
-
- }
-
- private Customer createCustomer(int id)
- {
- System.out.println("CREATE CUSTOMER " + id);
- try
- {
- Customer customer = new Customer();
- customer.setId(id);
- customer.setName((id % 2 == 0) ? "JBoss" : "Red Hat");
- Set<Contact> contacts = new HashSet<Contact>();
-
- Contact kabir = new Contact();
- kabir.setId(1000 + id);
- kabir.setCustomer(customer);
- kabir.setName("Kabir");
- kabir.setTlf("1111");
- contacts.add(kabir);
-
- Contact bill = new Contact();
- bill.setId(2000 +id);
- bill.setCustomer(customer);
- bill.setName("Bill");
- bill.setTlf("2222");
- contacts.add(bill);
-
- customer.setContacts(contacts);
-
- manager.persist(customer);
- return customer;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- System.out.println("CREATE CUSTOMER " + id + " - END");
- }
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Contact.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Contact.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Contact.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,95 +0,0 @@
-/*
- * 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.test.cluster.defaultcfg.clusteredentity;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-
-/**
- *
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
- at Entity
- at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
-public class Contact implements Serializable
-{
- Integer id;
- String name;
- String tlf;
- Customer customer;
-
- public Contact()
- {
-
- }
-
- @Id
- public Integer getId()
- {
- return id;
- }
-
- public void setId(Integer id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getTlf()
- {
- return tlf;
- }
-
- public void setTlf(String tlf)
- {
- this.tlf = tlf;
- }
-
- @ManyToOne
- @JoinColumn(name="CUST_ID")
- public Customer getCustomer()
- {
- return customer;
- }
-
- public void setCustomer(Customer customer)
- {
- this.customer = customer;
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Customer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Customer.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/Customer.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,85 +0,0 @@
-/*
- * 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.test.cluster.defaultcfg.clusteredentity;
-
-import java.util.Set;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-
-/**
- * Company customer
- *
- * @author Emmanuel Bernard
- * @author Kabir Khan
- */
- at Entity
- at Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
-public class Customer implements java.io.Serializable
-{
- Integer id;
- String name;
-
- private transient Set<Contact> contacts;
-
- public Customer()
- {
- }
-
- @Id
- public Integer getId()
- {
- return id;
- }
-
- public void setId(Integer id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String string)
- {
- name = string;
- }
-
- @Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
- @OneToMany(mappedBy="customer", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
- public Set<Contact> getContacts()
- {
- return contacts;
- }
-
- public void setContacts(Set<Contact> contacts)
- {
- this.contacts = contacts;
- }
-}
-
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTest.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,43 +0,0 @@
-/*
- * 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.test.cluster.defaultcfg.clusteredentity;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface EntityTest
-{
- void getCache(String cacheConfigName);
-
- Customer createCustomer();
-
- Customer findByCustomerId(Integer id);
-
- String loadedFromCache();
-
- void cleanup();
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTestBean.java 2009-11-09 05:02:22 UTC (rev 96149)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/EntityTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,265 +0,0 @@
-/*
- * 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.test.cluster.defaultcfg.clusteredentity;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.annotation.PreDestroy;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheManager;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.event.NodeVisitedEvent;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ha.framework.server.CacheManagerLocator;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
- at Stateful
- at Remote(EntityTest.class)
- at RemoteBinding(jndiBinding="EntityTestBean/remote")
-public class EntityTestBean implements EntityTest
-{
- private static final Logger log = Logger.getLogger(EntityTestBean.class);
-
- @PersistenceContext
- private EntityManager manager;
-
- private String cacheConfigName;
-
- private transient Cache<Object, Object> cache;
-
- private transient MyListener listener;
-
- public EntityTestBean()
- {
- }
-
- public void getCache(String cacheConfigName)
- {
- this.cacheConfigName = cacheConfigName;
-
- try
- {
- if (cache == null && cacheConfigName != null)
- {
- CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
- cache = cm.getCache(cacheConfigName, true);
- cache.start();
- }
-
- if (listener == null)
- {
- listener = new MyListener();
- cache.addCacheListener(listener);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public Customer createCustomer()
- {
- System.out.println("CREATE CUSTOMER");
- try
- {
- listener.clear();
-
- Customer customer = new Customer();
- customer.setId(new Integer(1));
- customer.setName("JBoss");
- Set<Contact> contacts = new HashSet<Contact>();
-
- Contact kabir = new Contact();
- kabir.setId(new Integer(1));
- kabir.setCustomer(customer);
- kabir.setName("Kabir");
- kabir.setTlf("1111");
- contacts.add(kabir);
-
- Contact bill = new Contact();
- bill.setId(new Integer(2));
- bill.setCustomer(customer);
- bill.setName("Bill");
- bill.setTlf("2222");
- contacts.add(bill);
-
- customer.setContacts(contacts);
-
- manager.persist(customer);
- return customer;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- System.out.println("CREATE CUSTOMER - END");
- }
- }
-
- public Customer findByCustomerId(Integer id)
- {
- System.out.println("FIND CUSTOMER");
- listener.clear();
- try
- {
- Customer customer = manager.find(Customer.class, id);
-
- return customer;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- System.out.println("FIND CUSTOMER - END");
- }
- }
-
- public String loadedFromCache()
- {
- System.out.println("CHECK CACHE");
- try
- {
- System.out.println("Visited: " + listener.visited);
- if (!listener.visited.contains("Customer#1"))
- return "Customer#1 was not in cache";
- if (!listener.visited.contains("Contact#1"))
- return "Contact#1 was not in cache";
- if (!listener.visited.contains("Contact#2"))
- return "Contact2#1 was not in cache";
- if (!listener.visited.contains("Customer.contacts#1"))
- return "Customer.contacts#1 was not in cache";
- return null;
- }
- finally
- {
- System.out.println("CHECK CACHE - END");
- }
-
- }
-
- @PreDestroy
- @Remove
- public void cleanup()
- {
- try
- {
- if (cache != null && listener != null)
- {
- cache.removeCacheListener(listener);
- }
- }
- catch (Exception e)
- {
- log.error("Caught exception in cleanup", e);
- }
-
- try
- {
- if (manager != null)
- {
- Customer c = findByCustomerId(new Integer(1));
- if (c != null)
- {
- Set contacts = c.getContacts();
- for (Iterator it = contacts.iterator(); it.hasNext();)
- manager.remove(it.next());
- c.setContacts(null);
- manager.remove(c);
- }
- }
- }
- catch (Exception e)
- {
- log.error("Caught exception in cleanup", e);
- }
-
- try
- {
- if (cache != null)
- CacheManagerLocator.getCacheManagerLocator().getCacheManager(null).releaseCache(cacheConfigName);
- }
- catch (Exception e)
- {
- log.error("Caught exception releasing cache", e);
- }
- }
-
- @CacheListener
- public class MyListener
- {
- HashSet<String> visited = new HashSet<String>();
-
- public void clear()
- {
- visited.clear();
- }
-
- @NodeVisited
- public void nodeVisited(NodeVisitedEvent event)
- {
- if (!event.isPre())
- {
- Fqn fqn = event.getFqn();
- System.out.println("MyListener - Visiting node " + fqn.toString());
- String name = fqn.toString();
- String token = ".clusteredentity.";
- int index = name.indexOf(token);
- if (index > -1)
- {
- index += token.length();
- name = name.substring(index);
- System.out.println("MyListener - recording visit to " + name);
- visited.add(name);
- }
- }
- }
- }
-}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit)
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/BulkOperationsUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import java.util.List;
import java.util.Properties;
@@ -28,8 +28,8 @@
import junit.framework.Test;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.BulkOperationsTest;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.Contact;
+import org.jboss.test.cluster.clusteredentity.BulkOperationsTest;
+import org.jboss.test.cluster.clusteredentity.Contact;
import org.jboss.test.JBossClusteredTestCase;
/**
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import java.util.List;
import java.util.Properties;
@@ -29,8 +29,8 @@
import junit.framework.Test;
import org.jboss.test.JBossClusteredTestCase;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.embeddedid.EmbeddedIdTest;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.embeddedid.MusicianPK;
+import org.jboss.test.cluster.clusteredentity.embeddedid.EmbeddedIdTest;
+import org.jboss.test.cluster.clusteredentity.embeddedid.MusicianPK;
import org.jboss.test.cluster.testutil.DBSetup;
/**
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/EntityClassloaderTestBase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,13 +19,13 @@
* 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.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import java.util.Properties;
import javax.naming.InitialContext;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.classloader.AccountHolderPK;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.classloader.EntityQueryTest;
+import org.jboss.test.cluster.clusteredentity.classloader.AccountHolderPK;
+import org.jboss.test.cluster.clusteredentity.classloader.EntityQueryTest;
import org.jboss.test.JBossClusteredTestCase;
/**
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import javax.management.MBeanServerConnection;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/EntityQueryUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/EntityUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,12 +19,13 @@
* 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.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import java.util.Properties;
import javax.naming.InitialContext;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.Customer;
-import org.jboss.test.cluster.defaultcfg.clusteredentity.EntityTest;
+
+import org.jboss.test.cluster.clusteredentity.Customer;
+import org.jboss.test.cluster.clusteredentity.EntityTest;
import org.jboss.test.JBossClusteredTestCase;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticBulkOperationsUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/OptimisticBulkOperationsUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticBulkOperationsUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEmbeddedIdClassloaderTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/OptimisticEmbeddedIdClassloaderTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEmbeddedIdClassloaderTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityQueryRedeployUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityQueryRedeployUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityQueryUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityQueryUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/OptimisticEntityUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/OptimisticEntityUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/ProvidedPrefixEntityQueryUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/unit/ProvidedPrefixEntityQueryUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/ProvidedPrefixEntityQueryUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.cluster.defaultcfg.clusteredentity.unit;
+package org.jboss.test.cluster.defaultcfg.clusteredentity.test;
import junit.framework.Test;
Copied: trunk/testsuite/src/main/org/jboss/test/jpa/entity (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/entity)
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/Address.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/Address.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/Address.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/Airport.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/Airport.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/Airport.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.persistence.Entity;
import javax.persistence.Id;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/Company.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/Company.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/Company.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.Set;
import javax.persistence.CascadeType;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/Customer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/Customer.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/Customer.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.Set;
import javax.persistence.CascadeType;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/EntityTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/EntityTest.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/EntityTest.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/EntityTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/EntityTestBean.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/EntityTestBean.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.ArrayList;
import java.util.HashSet;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldAddress.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/FieldAddress.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldAddress.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldAirport.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/FieldAirport.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldAirport.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldCompany.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/FieldCompany.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldCompany.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.Set;
import javax.persistence.CascadeType;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldCustomer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/FieldCustomer.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldCustomer.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.Set;
import javax.persistence.CascadeType;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldFlight.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/FieldFlight.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldFlight.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.Set;
import javax.persistence.Basic;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldTicket.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/FieldTicket.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/FieldTicket.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/Flight.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/Flight.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/Flight.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import java.util.Set;
import javax.persistence.Basic;
Modified: trunk/testsuite/src/main/org/jboss/test/jpa/entity/Ticket.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entity/Ticket.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entity/Ticket.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -19,7 +19,7 @@
* 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.test.cluster.entity;
+package org.jboss.test.jpa.entity;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
Copied: trunk/testsuite/src/main/org/jboss/test/jpa/entityoptimisticlocking/test (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/entityoptimisticlocking/unit)
Deleted: trunk/testsuite/src/main/org/jboss/test/jpa/entityoptimisticlocking/test/EntityUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/entityoptimisticlocking/unit/EntityUnitTestCase.java 2009-11-05 08:27:40 UTC (rev 96045)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/entityoptimisticlocking/test/EntityUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -1,212 +0,0 @@
-/*
- * 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.test.cluster.entityoptimisticlocking.unit;
-
-import java.util.Set;
-import org.jboss.test.cluster.entity.Address;
-import org.jboss.test.cluster.entity.Company;
-import org.jboss.test.cluster.entity.Customer;
-import org.jboss.test.cluster.entity.EntityTest;
-import org.jboss.test.cluster.entity.FieldAddress;
-import org.jboss.test.cluster.entity.FieldCompany;
-import org.jboss.test.cluster.entity.FieldCustomer;
-import org.jboss.test.cluster.entity.FieldFlight;
-import org.jboss.test.cluster.entity.FieldTicket;
-import org.jboss.test.cluster.entity.Flight;
-import org.jboss.test.cluster.entity.Ticket;
-import org.jboss.test.JBossTestCase;
-import junit.framework.Test;
-
-import org.jboss.logging.Logger;
-
-/**
- * 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 EntityUnitTestCase
-extends JBossTestCase
-{
- private static final Logger log = Logger.getLogger(EntityUnitTestCase.class);
-
- static boolean deployed = false;
- static int test = 0;
-
- public EntityUnitTestCase(String name)
- {
-
- super(name);
-
- }
-
- public void testOneToMany() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- Customer c = test.oneToManyCreate();
- assertNotNull(c);
- assertNotNull(c.getTickets());
- Set<Ticket> tickets = c.getTickets();
- assertTrue(tickets.size() > 0);
-
- // test find
- c = test.findCustomerById(c.getId());
- assertNotNull(c);
- assertNotNull(c.getTickets());
- tickets = c.getTickets();
- assertTrue(tickets.size() > 0);
-
- // test 1-1
- Address address = c.getAddress();
- assertTrue(address != null);
- assertTrue(address.getCity().equals("Boston"));
- }
-
- public void testManyToOne() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- Flight f = test.manyToOneCreate();
- f = test.findFlightById(f.getId());
- assertTrue(f.getName().equals("AF0101"));
- assertTrue(f.getCompany().getName().equals("Air France"));
-
- Company c = test.findCompanyById(f.getCompany().getId());
- assertTrue(c != null);
- assertTrue(c.getFlights().size() == 1);
- }
-
- public void testManyToMany() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- test.manyToManyCreate();
-
- Flight one = test.findFlightById(new Long(1));
- assertTrue(one.getCompany().getName().equals("Air France"));
-
- Flight two = test.findFlightById(new Long(2));
- assertTrue(two.getCompany().getName().equals("USAir"));
-
- System.out.println("Air France customers");
- for (Customer c : one.getCustomers())
- {
- System.out.println(c.getName());
-
- }
- System.out.println("USAir customers");
-
- for (Customer c : two.getCustomers())
- {
- System.out.println(c.getName());
- }
-
- }
-
- public void testFieldOneToMany() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- FieldCustomer c = test.fieldOneToManyCreate();
- assertNotNull(c);
- assertNotNull(c.getTickets());
- Set<FieldTicket> tickets = c.getTickets();
- assertTrue(tickets.size() > 0);
-
- // test find
- c = test.fieldFindCustomerById(c.getId());
- assertNotNull(c);
- assertNotNull(c.getTickets());
- tickets = c.getTickets();
- assertTrue(tickets.size() > 0);
-
- // test 1-1
- FieldAddress address = c.getAddress();
- assertTrue(address != null);
- assertTrue(address.getCity().equals("Boston"));
- }
-
- public void testFieldManyToOne() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- FieldFlight f = test.fieldManyToOneCreate();
- f = test.fieldFindFlightById(f.getId());
- assertTrue(f.getName().equals("AF0101"));
- assertTrue(f.getCompany().getName().equals("Air France"));
-
- FieldCompany c = test.fieldFindCompanyById(f.getCompany().getId());
- assertTrue(c != null);
- assertTrue(c.getFlights().size() == 1);
- }
-
- public void testFieldManyToMany() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- test.fieldManyToManyCreate();
-
- FieldFlight one = test.fieldFindFlightById(new Long(1));
- assertTrue(one.getCompany().getName().equals("Air France"));
-
- FieldFlight two = test.fieldFindFlightById(new Long(2));
- assertTrue(two.getCompany().getName().equals("USAir"));
-
- System.out.println("Air France customers");
- for (FieldCustomer c : one.getCustomers())
- {
- System.out.println(c.getName());
-
- }
- System.out.println("USAir customers");
-
- for (FieldCustomer c : two.getCustomers())
- {
- System.out.println(c.getName());
- }
-
- }
-
- public void testNamedQueries() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- test.testNamedQueries();
- }
-
- public void testOutsideTx() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- test.testOutsideTransaction();
-
- }
-
- public void testFlush() throws Exception
- {
- EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
- Customer c = test.createCustomer("Emmanuel");
- test.changeCustomer(c.getId(), "Bill");
- Customer c2 = test.loadCustomer(c.getId());
- assertEquals("Bill", c2.getName());
- }
-
- public static Test suite() throws Exception
- {
- return getDeploySetup(EntityUnitTestCase.class, "entityoptimisticlocking-test.jar");
- }
-
-}
Copied: trunk/testsuite/src/main/org/jboss/test/jpa/test/EntityOptimisticLockingUnitTestCase.java (from rev 96045, trunk/testsuite/src/main/org/jboss/test/cluster/entityoptimisticlocking/unit/EntityUnitTestCase.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jpa/test/EntityOptimisticLockingUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jpa/test/EntityOptimisticLockingUnitTestCase.java 2009-11-09 05:55:07 UTC (rev 96150)
@@ -0,0 +1,213 @@
+/*
+ * 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.test.jpa.test;
+
+import java.util.Set;
+
+import org.jboss.test.jpa.entity.Address;
+import org.jboss.test.jpa.entity.Company;
+import org.jboss.test.jpa.entity.Customer;
+import org.jboss.test.jpa.entity.EntityTest;
+import org.jboss.test.jpa.entity.FieldAddress;
+import org.jboss.test.jpa.entity.FieldCompany;
+import org.jboss.test.jpa.entity.FieldCustomer;
+import org.jboss.test.jpa.entity.FieldFlight;
+import org.jboss.test.jpa.entity.FieldTicket;
+import org.jboss.test.jpa.entity.Flight;
+import org.jboss.test.jpa.entity.Ticket;
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+import org.jboss.logging.Logger;
+
+/**
+ * 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 EntityOptimisticLockingUnitTestCase
+extends JBossTestCase
+{
+ private static final Logger log = Logger.getLogger(EntityOptimisticLockingUnitTestCase.class);
+
+ static boolean deployed = false;
+ static int test = 0;
+
+ public EntityOptimisticLockingUnitTestCase(String name)
+ {
+
+ super(name);
+
+ }
+
+ public void testOneToMany() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ Customer c = test.oneToManyCreate();
+ assertNotNull(c);
+ assertNotNull(c.getTickets());
+ Set<Ticket> tickets = c.getTickets();
+ assertTrue(tickets.size() > 0);
+
+ // test find
+ c = test.findCustomerById(c.getId());
+ assertNotNull(c);
+ assertNotNull(c.getTickets());
+ tickets = c.getTickets();
+ assertTrue(tickets.size() > 0);
+
+ // test 1-1
+ Address address = c.getAddress();
+ assertTrue(address != null);
+ assertTrue(address.getCity().equals("Boston"));
+ }
+
+ public void testManyToOne() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ Flight f = test.manyToOneCreate();
+ f = test.findFlightById(f.getId());
+ assertTrue(f.getName().equals("AF0101"));
+ assertTrue(f.getCompany().getName().equals("Air France"));
+
+ Company c = test.findCompanyById(f.getCompany().getId());
+ assertTrue(c != null);
+ assertTrue(c.getFlights().size() == 1);
+ }
+
+ public void testManyToMany() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ test.manyToManyCreate();
+
+ Flight one = test.findFlightById(new Long(1));
+ assertTrue(one.getCompany().getName().equals("Air France"));
+
+ Flight two = test.findFlightById(new Long(2));
+ assertTrue(two.getCompany().getName().equals("USAir"));
+
+ System.out.println("Air France customers");
+ for (Customer c : one.getCustomers())
+ {
+ System.out.println(c.getName());
+
+ }
+ System.out.println("USAir customers");
+
+ for (Customer c : two.getCustomers())
+ {
+ System.out.println(c.getName());
+ }
+
+ }
+
+ public void testFieldOneToMany() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ FieldCustomer c = test.fieldOneToManyCreate();
+ assertNotNull(c);
+ assertNotNull(c.getTickets());
+ Set<FieldTicket> tickets = c.getTickets();
+ assertTrue(tickets.size() > 0);
+
+ // test find
+ c = test.fieldFindCustomerById(c.getId());
+ assertNotNull(c);
+ assertNotNull(c.getTickets());
+ tickets = c.getTickets();
+ assertTrue(tickets.size() > 0);
+
+ // test 1-1
+ FieldAddress address = c.getAddress();
+ assertTrue(address != null);
+ assertTrue(address.getCity().equals("Boston"));
+ }
+
+ public void testFieldManyToOne() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ FieldFlight f = test.fieldManyToOneCreate();
+ f = test.fieldFindFlightById(f.getId());
+ assertTrue(f.getName().equals("AF0101"));
+ assertTrue(f.getCompany().getName().equals("Air France"));
+
+ FieldCompany c = test.fieldFindCompanyById(f.getCompany().getId());
+ assertTrue(c != null);
+ assertTrue(c.getFlights().size() == 1);
+ }
+
+ public void testFieldManyToMany() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ test.fieldManyToManyCreate();
+
+ FieldFlight one = test.fieldFindFlightById(new Long(1));
+ assertTrue(one.getCompany().getName().equals("Air France"));
+
+ FieldFlight two = test.fieldFindFlightById(new Long(2));
+ assertTrue(two.getCompany().getName().equals("USAir"));
+
+ System.out.println("Air France customers");
+ for (FieldCustomer c : one.getCustomers())
+ {
+ System.out.println(c.getName());
+
+ }
+ System.out.println("USAir customers");
+
+ for (FieldCustomer c : two.getCustomers())
+ {
+ System.out.println(c.getName());
+ }
+
+ }
+
+ public void testNamedQueries() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ test.testNamedQueries();
+ }
+
+ public void testOutsideTx() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ test.testOutsideTransaction();
+
+ }
+
+ public void testFlush() throws Exception
+ {
+ EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+ Customer c = test.createCustomer("Emmanuel");
+ test.changeCustomer(c.getId(), "Bill");
+ Customer c2 = test.loadCustomer(c.getId());
+ assertEquals("Bill", c2.getName());
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EntityOptimisticLockingUnitTestCase.class, "entityoptimisticlocking-test.jar");
+ }
+
+}
Copied: trunk/testsuite/src/resources/jpa/entityoptimisticlocking/META-INF (from rev 96045, trunk/testsuite/src/resources/cluster/entityoptimisticlocking/META-INF)
More information about the jboss-cvs-commits
mailing list