[jboss-cvs] JBossAS SVN: r112715 - in branches/JBPAPP_5_1/testsuite: src/main/org/jboss/test/ejb3 and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 29 04:55:31 EST 2012
Author: wolfc
Date: 2012-02-29 04:55:30 -0500 (Wed, 29 Feb 2012)
New Revision: 112715
Added:
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanA.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanB.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/LocalB.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassA.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassB.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/RemoteA.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/unit/
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/unit/ExtendedPersistenceContextPropagationUnitTestCase.java
branches/JBPAPP_5_1/testsuite/src/resources/ejb3/jbpapp923/
branches/JBPAPP_5_1/testsuite/src/resources/ejb3/jbpapp923/META-INF/
branches/JBPAPP_5_1/testsuite/src/resources/ejb3/jbpapp923/META-INF/persistence.xml
Modified:
branches/JBPAPP_5_1/testsuite/imports/sections/ejb3.xml
Log:
JBPAPP-923: test XPC propagation
Modified: branches/JBPAPP_5_1/testsuite/imports/sections/ejb3.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/sections/ejb3.xml 2012-02-29 09:42:23 UTC (rev 112714)
+++ branches/JBPAPP_5_1/testsuite/imports/sections/ejb3.xml 2012-02-29 09:55:30 UTC (rev 112715)
@@ -81,6 +81,17 @@
<copy file="${source.resources}/ejb3/jbas7883/jbas7883-service.xml" todir="${build.lib}" />
</target>
+ <target name="jbpapp923" depends="compile">
+ <mkdir dir="${build.lib}" />
+
+ <jar destfile="${build.lib}/jbpapp923.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/ejb3/jbpapp923/**" />
+ </fileset>
+ <fileset dir="${source.resources}/ejb3/jbpapp923" includes="**" />
+ </jar>
+ </target>
+
<target name="jbpapp2260" depends="compile">
<mkdir dir="${build.lib}" />
@@ -273,6 +284,7 @@
jbas7883,
ejb3iiop,
ejb3-webservice,
+ jbpapp923,
jbpapp2260,
jbpapp2473,
jbpapp3026,
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanA.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanA.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanA.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923;
+
+import static javax.ejb.TransactionAttributeType.REQUIRED;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Stateful
+ at TransactionAttribute(TransactionAttributeType.NEVER)
+public class BeanA implements RemoteA {
+ @PersistenceContext(type = PersistenceContextType.EXTENDED)
+ private EntityManager em;
+ @EJB
+ private LocalB beanB;
+
+ public boolean check() {
+ MyClassA a = find(2L);
+ if (!em.contains(a))
+ throw new IllegalStateException("EM should contain #2");
+ beanB.find("myId"); // JBPAPP-923: Now every object returned from A's EM should still be attached.
+ return em.contains(a);
+ }
+
+ @TransactionAttribute(REQUIRED)
+ public boolean checkInTx() {
+ return check();
+ }
+
+ public void create() {
+ final MyClassA entity = new MyClassA();
+ entity.setId(2L);
+ em.persist(entity);
+ }
+
+ public MyClassA find(Long id) {
+ return em.find(MyClassA.class, id);
+ }
+}
\ No newline at end of file
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanB.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanB.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/BeanB.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Stateless
+ at TransactionAttribute(TransactionAttributeType.SUPPORTS)
+public class BeanB implements LocalB {
+ @PersistenceContext
+ private EntityManager em;
+
+ public MyClassB find(String id) {
+ return em.find(MyClassB.class, id);
+ }
+}
\ No newline at end of file
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/LocalB.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/LocalB.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/LocalB.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923;
+
+import javax.ejb.Local;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Local
+public interface LocalB {
+ MyClassB find(String id);
+}
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassA.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassA.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassA.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Entity
+public class MyClassA implements Serializable {
+ private Long id;
+
+ @Id
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassB.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassB.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/MyClassB.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Entity
+public class MyClassB {
+ private String id;
+
+ @Id
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/RemoteA.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/RemoteA.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/RemoteA.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Remote
+public interface RemoteA {
+ void create();
+ boolean check();
+ boolean checkInTx();
+}
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/unit/ExtendedPersistenceContextPropagationUnitTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/unit/ExtendedPersistenceContextPropagationUnitTestCase.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ejb3/jbpapp923/unit/ExtendedPersistenceContextPropagationUnitTestCase.java 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2012, Red Hat, Inc., 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.ejb3.jbpapp923.unit;
+
+import junit.framework.Test;
+import org.jboss.test.ejb3.common.EJB3TestCase;
+import org.jboss.test.ejb3.jbpapp923.RemoteA;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class ExtendedPersistenceContextPropagationUnitTestCase extends EJB3TestCase {
+ public ExtendedPersistenceContextPropagationUnitTestCase(String name) {
+ super(name);
+ }
+
+ public void testCheck() throws Exception {
+ final RemoteA beanA = lookup("BeanA/remote", RemoteA.class);
+ beanA.create();
+ final boolean result = beanA.check();
+ assertTrue("JBPAPP-923: entity should remain attached after calling another EJB", result);
+ }
+
+ public void testCheckInTx() throws Exception {
+ final RemoteA beanA = lookup("BeanA/remote", RemoteA.class);
+ beanA.create();
+ final boolean result = beanA.checkInTx();
+ assertTrue("JBPAPP-923: entity should remain attached after calling another EJB", result);
+ }
+
+ public static Test suite() throws Exception {
+ return getDeploySetup(ExtendedPersistenceContextPropagationUnitTestCase.class, "jbpapp923.jar");
+ }
+}
Copied: branches/JBPAPP_5_1/testsuite/src/resources/ejb3/jbpapp923/META-INF/persistence.xml (from rev 112704, branches/JBPAPP_5_1/testsuite/src/resources/ejb3/ejbthree1597/META-INF/persistence.xml)
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/ejb3/jbpapp923/META-INF/persistence.xml (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/resources/ejb3/jbpapp923/META-INF/persistence.xml 2012-02-29 09:55:30 UTC (rev 112715)
@@ -0,0 +1,29 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright (c) 2012, Red Hat, Inc., 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.
+ -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
+ <persistence-unit name="jbpapp923">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ </properties>
+ </persistence-unit>
+</persistence>
More information about the jboss-cvs-commits
mailing list