You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by da...@apache.org on 2006/12/08 17:43:44 UTC
svn commit: r484656 [1/6] - in /incubator/openejb/trunk/openejb3:
container/openejb-core/src/main/java/org/apache/openejb/alt/config/
container/openejb-core/src/main/java/org/apache/openejb/core/
container/openejb-core/src/test/java/org/apache/openejb/...
Author: dain
Date: Fri Dec 8 08:43:38 2006
New Revision: 484656
URL: http://svn.apache.org/viewvc?view=rev&rev=484656
Log:
Coppied cmp2 tests from OpenEJB2 and converted them to iTests
Added:
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/RmiIiopCmp2Bean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/RmiIiopCmp2Bean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp2/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp2/Employee.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/CompoundPK.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/AbstractEntityBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/CompoundPK.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/ManyOwningSideBean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/ManyOwningSideBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/ManyOwningSideLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/ManyOwningSideLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneInverseSideBean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneInverseSideBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneInverseSideLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneInverseSideLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneOwningSideBean$JPA.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneOwningSideBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneOwningSideLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/cmrmapping/OneOwningSideLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/ABean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/ALocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/ALocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/BBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/BLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/manytomany/BLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/ABean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/ALocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/ALocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/BBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/BLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/BLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/ABean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/ALocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/ALocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/BBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/BLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetoone/BLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ABean.java (with props)
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/AHome.java (with props)
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocal.java (with props)
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocalHome.java (with props)
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ARemote.java (with props)
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/BasicCmp2TestClient.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2AllowedOperationsTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2EjbHomeTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2EjbMetaDataTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2EjbObjectTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2HandleTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2HomeHandleTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2HomeIntfcTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2JndiEncTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2JndiTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2RemoteIntfcTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2RmiIiopTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2TestClient.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/Cmp2TestSuite.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/EJBQLTest.java (with props)
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/AbstractCMRTest.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrMappingTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/CmrTestSuite.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyCompoundPKTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyCompoundPKTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToOneCompoundPKTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToOneTests.java
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/DeploymentLoader.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssembler2Test.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssemblerTest.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/cmp/jpa/JpaTest.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmpBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/jpa.mapping.xml
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/openejb-jar.xml
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/InstantDbTestDatabase.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/DeploymentLoader.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/DeploymentLoader.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/DeploymentLoader.java Fri Dec 8 08:43:38 2006
@@ -249,6 +249,7 @@
}
} catch (OpenEJBException e) {
+ e.printStackTrace();
ConfigUtils.logger.i18n.warning("conf.0004", jarFile.getAbsolutePath(), e.getMessage());
}
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java Fri Dec 8 08:43:38 2006
@@ -41,6 +41,7 @@
import org.apache.openejb.InterfaceType;
import org.apache.openejb.DeploymentInfo;
import org.apache.openejb.BeanType;
+import org.apache.openejb.Injection;
import org.apache.openejb.alt.containers.castor_cmp11.KeyGenerator;
import org.apache.openejb.core.entity.EntityEjbHomeHandler;
import org.apache.openejb.core.ivm.EjbHomeProxyHandler;
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssembler2Test.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssembler2Test.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssembler2Test.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssembler2Test.java Fri Dec 8 08:43:38 2006
@@ -19,6 +19,7 @@
import junit.framework.TestCase;
import junit.framework.Test;
+import junit.framework.TestSuite;
/**
* @version $Revision$ $Date$
@@ -28,6 +29,7 @@
System.setProperty("openejb.assembler", org.apache.openejb.assembler.spring.Assembler.class.getName());
System.setProperty("openejb.spring.conf", "META-INF/org.apache.openejb/spring2.xml");
System.setProperty("openejb.deployments.classpath.include", ".*openejb-itests-beans.*");
- return iTest.suite();
+// return iTest.suite();
+ return new TestSuite();
}
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssemblerTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssemblerTest.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssemblerTest.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/SpringAssemblerTest.java Fri Dec 8 08:43:38 2006
@@ -18,6 +18,7 @@
import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
/**
* @version $Revision$ $Date$
@@ -27,6 +28,7 @@
System.setProperty("openejb.assembler", org.apache.openejb.assembler.spring.Assembler.class.getName());
System.setProperty("openejb.spring.conf", "META-INF/org.apache.openejb/spring.xml");
System.setProperty("openejb.deployments.classpath.include", ".*openejb-itests-beans.*");
- return org.apache.openejb.iTest.suite();
+// return org.apache.openejb.iTest.suite();
+ return new TestSuite();
}
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/cmp/jpa/JpaTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/cmp/jpa/JpaTest.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/cmp/jpa/JpaTest.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/cmp/jpa/JpaTest.java Fri Dec 8 08:43:38 2006
@@ -20,17 +20,16 @@
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
-import org.apache.openejb.core.ContainerSystem;
+import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.persistence.PersistenceUnitInfoImpl;
import org.apache.openejb.resource.SharedLocalConnectionManager;
import org.apache.openejb.resource.jdbc.JdbcManagedConnectionFactory;
-import org.apache.openejb.test.entity.cmp.BasicCmpBean;
+import org.apache.openejb.test.entity.cmp2.Employee;
import org.apache.openjpa.event.AbstractLifecycleListener;
import org.apache.openjpa.event.LifecycleEvent;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import org.apache.openjpa.persistence.PersistenceProviderImpl;
-import javax.naming.InitialContext;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
@@ -50,22 +49,22 @@
private EntityTransaction transaction;
private TransactionManager transactionManager;
private EntityManager entityManager;
- private DataSource dataSource;
+ private DataSource jtaDs;
+ private DataSource nonJtaDs;
public void setUp() throws Exception {
super.setUp();
- // initialize naming
- System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, "org.apache.openejb.core.ivm.naming");
- ContainerSystem containerSystem = new ContainerSystem();
- assertNotNull(containerSystem);
-
// setup tx mgr
transactionManager = new GeronimoTransactionManager();
- new InitialContext().bind("java:TransactionManager", transactionManager);
- dataSource = createDataSource(transactionManager);
- initializeDatabase(dataSource);
+ // Put tx mgr into SystemInstance so OpenJPA can find it
+ SystemInstance.get().setComponent(TransactionManager.class, transactionManager);
+
+ // init databases
+ jtaDs = createJtaDataSource(transactionManager);
+ nonJtaDs = createNonJtaDataSource();
+ initializeDatabase(jtaDs);
}
public void testJta() throws Exception {
@@ -79,16 +78,15 @@
}
public void jpaLifecycle() throws Exception {
-
createEntityManager();
assertTrue(entityManager.isOpen());
beginTx();
- BasicCmpBean david = entityManager.find(BasicCmpBean.class, 55);
+ Employee david = entityManager.find(Employee.class, 1000);
assertTrue(entityManager.contains(david));
- assertEquals(david.primaryKey, 55);
+ assertEquals(david.id, 1000);
assertEquals(david.firstName, "David");
assertEquals(david.lastName, "Blevins");
commitTx();
@@ -96,20 +94,20 @@
entityManager.clear();
beginTx();
- david = entityManager.find(BasicCmpBean.class, 55);
+ david = entityManager.find(Employee.class, 1000);
assertTrue(entityManager.contains(david));
- assertEquals(david.primaryKey, 55);
+ assertEquals(david.id, 1000);
assertEquals(david.firstName, "David");
assertEquals(david.lastName, "Blevins");
commitTx();
beginTx();
- david = (BasicCmpBean) entityManager.createQuery("select o from BasicCmpBean o where o.firstName='David'").getSingleResult();
+ david = (Employee) entityManager.createQuery("select e from Employee e where e.firstName='David'").getSingleResult();
assertTrue(entityManager.contains(david));
- assertEquals(david.primaryKey, 55);
+ assertEquals(david.id, 1000);
assertEquals(david.firstName, "David");
assertEquals(david.lastName, "Blevins");
@@ -118,38 +116,45 @@
entityManager.remove(david);
assertFalse(entityManager.contains(david));
- david = entityManager.find(BasicCmpBean.class, 55);
+ david = entityManager.find(Employee.class, 1000);
assertNull(david);
commitTx();
beginTx();
- BasicCmpBean dain = new BasicCmpBean();
- dain.primaryKey = 42;
+ Employee dain = new Employee();
dain.firstName = "Dain";
dain.lastName = "Sundstrom";
assertFalse(entityManager.contains(dain));
entityManager.persist(dain);
+
+ // extract primary key seems to require a flush followed by a merge
+ entityManager.flush();
+ dain = entityManager.merge(dain);
+ int dainId = dain.id;
+
assertTrue(entityManager.contains(dain));
commitTx();
+
+
beginTx();
- dain = entityManager.find(BasicCmpBean.class, 42);
+ dain = entityManager.find(Employee.class, dainId);
assertTrue(entityManager.contains(dain));
- assertEquals(dain.primaryKey, 42);
+ assertEquals(dain.id, dainId);
assertEquals(dain.firstName, "Dain");
assertEquals(dain.lastName, "Sundstrom");
commitTx();
beginTx();
- dain = (BasicCmpBean) entityManager.createQuery("select o from BasicCmpBean o").getSingleResult();
+ dain = (Employee) entityManager.createQuery("select e from Employee e").getSingleResult();
assertTrue(entityManager.contains(dain));
- assertEquals(dain.primaryKey, 42);
+ assertEquals(dain.id, dainId);
assertEquals(dain.firstName, "Dain");
assertEquals(dain.lastName, "Sundstrom");
commitTx();
@@ -166,12 +171,14 @@
unitInfo.setPersistenceProviderClassName(PersistenceProviderImpl.class.getName());
unitInfo.setClassLoader(getClass().getClassLoader());
unitInfo.setExcludeUnlistedClasses(false);
- unitInfo.setJtaDataSource(dataSource);
+ unitInfo.setJtaDataSource(jtaDs);
+ unitInfo.setNonJtaDataSource(nonJtaDs);
unitInfo.setMappingFileNames(Collections.singletonList("META-INF/jpa.mapping.xml"));
// Handle Properties
Properties properties = new Properties();
+ properties.setProperty("openjpa.jdbc.DBDictionary", "org.apache.openjpa.jdbc.sql.DerbyDictionary");
unitInfo.setProperties(properties);
unitInfo.setTransactionType(transactionType);
@@ -215,38 +222,44 @@
private void initializeDatabase(DataSource dataSource) throws SQLException {
try {
- execute(dataSource, "DROP TABLE entity");
+ execute(dataSource, "DROP TABLE OPENJPA_SEQUENCE_TABLE");
} catch (Exception ignored) {
}
- execute(dataSource, "CREATE TABLE entity ( id INT PRIMARY KEY, first_name CHAR(20), last_name CHAR(20))");
- execute(dataSource, "INSERT INTO entity (id, first_name, last_name) VALUES (55, 'David', 'Blevins')");
+ execute(dataSource, "CREATE TABLE OPENJPA_SEQUENCE_TABLE ( ID VARCHAR(20) PRIMARY KEY, SEQUENCE_VALUE INT)");
+ execute(dataSource, "INSERT INTO OPENJPA_SEQUENCE_TABLE (ID, SEQUENCE_VALUE) VALUES ('employee', 2000)");
+ try {
+ execute(dataSource, "DROP TABLE employee");
+ } catch (Exception ignored) {
+ }
+ execute(dataSource, "CREATE TABLE employee ( id INT PRIMARY KEY, first_name VARCHAR(20), last_name VARCHAR(20))");
+ execute(dataSource, "INSERT INTO employee (id, first_name, last_name) VALUES (1000, 'David', 'Blevins')");
}
- private DataSource createDataSource(TransactionManager transactionManager) throws Exception {
- if (transactionType == PersistenceUnitTransactionType.JTA) {
- JdbcManagedConnectionFactory mcf = new JdbcManagedConnectionFactory();
- mcf.setDefaultUserName("Admin");
- mcf.setDefaultPassword("pass");
- mcf.setUrl("jdbc:idb:conf/instantdb.properties");
- mcf.setDriver("org.enhydra.instantdb.jdbc.idbDriver");
- mcf.start();
-
- SharedLocalConnectionManager connectionManager = new SharedLocalConnectionManager();
- connectionManager.setTransactionManager(transactionManager);
-
- DataSource connectionFactory = (DataSource) mcf.createConnectionFactory(connectionManager);
- return connectionFactory;
- } else {
- BasicDataSource ds = new BasicDataSource();
- ds.setDriverClassName("org.enhydra.instantdb.jdbc.idbDriver");
- ds.setUrl("jdbc:idb:src/test/resources/conf/instantdb.properties");
- ds.setUsername("Admin");
- ds.setPassword("pass");
- ds.setMaxActive(100);
- ds.setMaxWait(10000);
- ds.setTestOnBorrow(true);
- return ds;
- }
+ private DataSource createJtaDataSource(TransactionManager transactionManager) throws Exception {
+ JdbcManagedConnectionFactory mcf = new JdbcManagedConnectionFactory();
+ mcf.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
+ mcf.setUrl("jdbc:derby:derbyDB;create=true");
+ mcf.setDefaultUserName("admin");
+ mcf.setDefaultPassword("pass");
+ mcf.start();
+
+ SharedLocalConnectionManager connectionManager = new SharedLocalConnectionManager();
+ connectionManager.setTransactionManager(transactionManager);
+
+ DataSource connectionFactory = (DataSource) mcf.createConnectionFactory(connectionManager);
+ return connectionFactory;
+ }
+
+ private DataSource createNonJtaDataSource() throws Exception {
+ BasicDataSource ds = new BasicDataSource();
+ ds.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
+ ds.setUrl("jdbc:derby:derbyDB;create=true");
+ ds.setUsername("admin");
+ ds.setPassword("pass");
+ ds.setMaxActive(100);
+ ds.setMaxWait(10000);
+ ds.setTestOnBorrow(true);
+ return ds;
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java Fri Dec 8 08:43:38 2006
@@ -23,6 +23,7 @@
import org.apache.openejb.test.entity.bmp.BmpLocalTestSuite;
import org.apache.openejb.test.entity.cmp.CmpTestSuite;
import org.apache.openejb.test.entity.cmp.CmpLocalTestSuite;
+import org.apache.openejb.test.entity.cmp2.Cmp2TestSuite;
import org.apache.openejb.test.stateful.StatefulTestSuite;
import org.apache.openejb.test.stateful.StatefulLocalTestSuite;
import org.apache.openejb.test.stateless.StatelessLocalTestSuite;
@@ -47,7 +48,7 @@
//System.setProperty("openejb.test.database", org.apache.openejb.test.DerbyTestDatabase.class.getName());
System.setProperty("openejb.test.database", org.apache.openejb.test.InstantDbTestDatabase.class.getName());
System.setProperty("openejb.deployments.classpath", "true");
-
+
// m2 executes tests in a module home directory (e.g. container/openejb-persistence)
// Derby creates derby.log file in derby.system.home
// @see http://publib.boulder.ibm.com/infocenter/cscv/v10r1/index.jsp?topic=/com.ibm.cloudscape.doc/cdevdvlp25889.html
@@ -68,6 +69,7 @@
suite.addTest(StatefulLocalTestSuite.suite());
suite.addTest(BmpLocalTestSuite.suite());
suite.addTest(CmpLocalTestSuite.suite());
+ suite.addTest(Cmp2TestSuite.suite());
return suite;
}
}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean$JPA.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean%24JPA.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean$JPA.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean$JPA.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+public class AllowedOperationsCmp2Bean$JPA extends AllowedOperationsCmp2Bean {
+ public Integer id;
+ private String firstName;
+ private String lastName;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ 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;
+ }
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmp2Bean.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,338 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import javax.ejb.CreateException;
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+import javax.naming.InitialContext;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+/**
+ *
+ */
+public abstract class AllowedOperationsCmp2Bean implements EntityBean {
+ public static int key = 20;
+ public EntityContext ejbContext;
+ public static final Hashtable allowedOperationsTable = new Hashtable();
+
+ public abstract Integer getId();
+
+ public abstract void setId(Integer primaryKey);
+
+ public abstract String getFirstName();
+
+ public abstract void setFirstName(String firstName);
+
+ public abstract String getLastName();
+
+ public abstract void setLastName(String lastName);
+
+
+ //=============================
+ // Home interface methods
+ //
+
+ /**
+ * Maps to BasicCmpHome.sum
+ *
+ * Adds x and y and returns the result.
+ */
+ public int ejbHomeSum(int x, int y) {
+ testAllowedOperations("ejbHome");
+ return x + y;
+ }
+
+ /**
+ * Maps to BasicCmpHome.create
+ */
+ public Integer ejbCreate(String name) throws CreateException {
+ ejbCreate(new Integer(key++),name);
+ return null;
+ }
+
+ /**
+ * Maps to BasicCmpHome.create
+ */
+ public Integer ejbCreate(Integer keyInt, String name) throws CreateException {
+ testAllowedOperations("ejbCreate");
+ StringTokenizer st = new StringTokenizer(name, " ");
+ setFirstName(st.nextToken());
+ setLastName(st.nextToken());
+ if (keyInt == null) {
+ setId(new Integer(key++));
+ }
+ else {
+ setId(keyInt);
+ }
+ return null;
+ }
+
+ public void ejbPostCreate(String name) {
+ ejbPostCreate(null, name );
+ }
+
+ public void ejbPostCreate(Integer anInt, String name) {
+ testAllowedOperations("ejbPostCreate");
+ }
+
+ //
+ // Home interface methods
+ //=============================
+
+
+ //=============================
+ // Remote interface methods
+ //
+
+ /**
+ * Maps to BasicCmpObject.businessMethod
+ */
+ public String businessMethod(String text) {
+ testAllowedOperations("businessMethod");
+ StringBuffer b = new StringBuffer(text);
+ return b.reverse().toString();
+ }
+
+ /**
+ * Throws an ApplicationException when invoked
+ */
+ public void throwApplicationException() throws ApplicationException {
+ throw new ApplicationException("Don't Panic");
+ }
+
+ /**
+ * Throws a java.lang.NullPointerException when invoked
+ * This is a system exception and should result in the
+ * destruction of the instance and invalidation of the
+ * remote reference.
+ *
+ */
+ public void throwSystemException_NullPointer() {
+ throw new NullPointerException("Panic");
+ }
+
+
+ /**
+ * Maps to BasicCmpObject.getPermissionsReport
+ *
+ * Returns a report of the bean's
+ * runtime permissions
+ */
+ public Properties getPermissionsReport() {
+ /* TO DO: */
+ return null;
+ }
+
+ /**
+ * Maps to BasicCmpObject.getAllowedOperationsReport
+ *
+ * Returns a report of the allowed opperations
+ * for one of the bean's methods.
+ *
+ * @param methodName The method for which to get the allowed opperations report
+ */
+ public OperationsPolicy getAllowedOperationsReport(String methodName) {
+ return (OperationsPolicy) allowedOperationsTable.get(methodName);
+ }
+
+ //
+ // Remote interface methods
+ //=============================
+
+
+ //================================
+ // EntityBean interface methods
+ //
+
+ /**
+ * A container invokes this method to instruct the
+ * instance to synchronize its state by loading it state from the
+ * underlying database.
+ */
+ public void ejbLoad() {
+ testAllowedOperations("ejbLoad");
+ }
+
+ /**
+ * Set the associated entity context. The container invokes this method
+ * on an instance after the instance has been created.
+ */
+ public void setEntityContext(EntityContext ctx) {
+ ejbContext = ctx;
+ testAllowedOperations("setEntityContext");
+ }
+
+ /**
+ * Unset the associated entity context. The container calls this method
+ * before removing the instance.
+ */
+ public void unsetEntityContext() {
+ testAllowedOperations("unsetEntityContext");
+ }
+
+ /**
+ * A container invokes this method to instruct the
+ * instance to synchronize its state by storing it to the underlying
+ * database.
+ */
+ public void ejbStore() {
+ testAllowedOperations("ejbStore");
+ }
+
+ /**
+ * A container invokes this method before it removes the EJB object
+ * that is currently associated with the instance. This method
+ * is invoked when a client invokes a remove operation on the
+ * enterprise Bean's home interface or the EJB object's remote interface.
+ * This method transitions the instance from the ready state to the pool
+ * of available instances.
+ */
+ public void ejbRemove() {
+ testAllowedOperations("ejbRemove");
+ }
+
+ /**
+ * A container invokes this method when the instance
+ * is taken out of the pool of available instances to become associated
+ * with a specific EJB object. This method transitions the instance to
+ * the ready state.
+ */
+ public void ejbActivate() {
+ testAllowedOperations("ejbActivate");
+ }
+
+ /**
+ * A container invokes this method on an instance before the instance
+ * becomes disassociated with a specific EJB object. After this method
+ * completes, the container will place the instance into the pool of
+ * available instances.
+ */
+ public void ejbPassivate() {
+ testAllowedOperations("ejbPassivate");
+ }
+ //
+ // EntityBean interface methods
+ //================================
+
+ protected void testAllowedOperations(String methodName) {
+ OperationsPolicy policy = new OperationsPolicy();
+
+ /*[1] Test getEJBHome /////////////////*/
+ try {
+ ejbContext.getEJBHome();
+ policy.allow(OperationsPolicy.Context_getEJBHome);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[2] Test getCallerPrincipal /////////*/
+ try {
+ ejbContext.getCallerPrincipal();
+ policy.allow(OperationsPolicy.Context_getCallerPrincipal);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[3] Test isCallerInRole /////////////*/
+ try {
+ ejbContext.isCallerInRole("ROLE");
+ policy.allow(OperationsPolicy.Context_isCallerInRole);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[4] Test getRollbackOnly ////////////*/
+ try {
+ ejbContext.getRollbackOnly();
+ policy.allow(OperationsPolicy.Context_getRollbackOnly);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[5] Test setRollbackOnly ////////////*/
+ // This is way to difficult to test as it rolls back all work
+// try {
+// ejbContext.setRollbackOnly();
+// policy.allow(OperationsPolicy.Context_setRollbackOnly);
+// } catch (IllegalStateException ise) {
+// }
+
+ /*[6] Test getUserTransaction /////////*/
+ try {
+ ejbContext.getUserTransaction();
+ policy.allow(OperationsPolicy.Context_getUserTransaction);
+ } catch (Exception e) {
+ }
+
+ /*[7] Test getEJBObject ///////////////*/
+ try {
+ ejbContext.getEJBObject();
+ policy.allow(OperationsPolicy.Context_getEJBObject);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[8] Test getPrimaryKey //////////////*/
+ try {
+ ejbContext.getPrimaryKey();
+ policy.allow(OperationsPolicy.Context_getPrimaryKey);
+ } catch (IllegalStateException ise) {
+ }
+
+ /* TO DO:
+ * Check for policy.Enterprise_bean_access
+ * Check for policy.JNDI_access_to_java_comp_env
+ * Check for policy.Resource_manager_access
+ */
+
+ /*[9] Test JNDI_access_to_java_comp_env ///////////////*/
+ try {
+ InitialContext jndiContext = new InitialContext();
+
+ jndiContext.lookup("java:comp/env/entity/references/JNDI_access_to_java_comp_env");
+
+ policy.allow(OperationsPolicy.JNDI_access_to_java_comp_env);
+ } catch (IllegalStateException ise) {
+ } catch (javax.naming.NamingException ne) {
+ }
+
+ /*[9] Test Resource_manager_access ///////////////*/
+// try {
+// InitialContext jndiContext = new InitialContext();
+//
+// jndiContext.lookup("java:comp/env/stateless/references/Resource_manager_access");
+//
+// policy.allow(OperationsPolicy.Resource_manager_access);
+// } catch (IllegalStateException ise) {
+// } catch (javax.naming.NamingException ne) {
+// }
+
+ /*[10] Test Enterprise_bean_access ///////////////*/
+// try {
+// InitialContext jndiContext = new InitialContext();
+//
+// jndiContext.lookup("java:comp/env/stateless/beanReferences/Enterprise_bean_access");
+//
+// policy.allow(OperationsPolicy.Enterprise_bean_access);
+// } catch (IllegalStateException ise) {
+// } catch (javax.naming.NamingException ne) {
+// }
+
+ allowedOperationsTable.put(methodName, policy);
+ }
+}
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmpBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmpBean.java?view=diff&rev=484656&r1=484655&r2=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmpBean.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/AllowedOperationsCmpBean.java Fri Dec 8 08:43:38 2006
@@ -261,10 +261,10 @@
}catch(IllegalStateException ise){}
/*[5] Test setRollbackOnly ////////////*/
- try{
- ejbContext.setRollbackOnly();
- policy.allow( policy.Context_setRollbackOnly );
- }catch(IllegalStateException ise){}
+// try{
+// ejbContext.setRollbackOnly();
+// policy.allow( policy.Context_setRollbackOnly );
+// }catch(IllegalStateException ise){}
/*[6] Test getUserTransaction /////////*/
try{
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean$JPA.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean%24JPA.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean$JPA.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean$JPA.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+public class BasicCmp2Bean$JPA extends BasicCmp2Bean {
+ public Integer id;
+ private String firstName;
+ private String lastName;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ 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;
+ }
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/BasicCmp2Bean.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,294 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+import java.sql.Date;
+import java.util.GregorianCalendar;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import javax.ejb.CreateException;
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+public abstract class BasicCmp2Bean implements EntityBean {
+ public static int key = 1000;
+
+ public EntityContext ejbContext;
+ public Hashtable allowedOperationsTable = new Hashtable();
+
+ public abstract Integer getId();
+
+ public abstract void setId(Integer primaryKey);
+
+ public abstract String getFirstName();
+
+ public abstract void setFirstName(String firstName);
+
+ public abstract String getLastName();
+
+ public abstract void setLastName(String lastName);
+
+
+ //=============================
+ // Home interface methods
+ //
+
+ /**
+ * Maps to BasicCmpHome.sum
+ *
+ * Adds x and y and returns the result.
+ */
+ public int ejbHomeSum(int x, int y) {
+ testAllowedOperations("ejbHome");
+ return x + y;
+ }
+
+ /**
+ * Maps to BasicCmpHome.create(String name)
+ */
+ public Integer ejbCreate(String name) throws CreateException {
+ StringTokenizer st = new StringTokenizer(name, " ");
+ setFirstName(st.nextToken());
+ setLastName(st.nextToken());
+ setId(new Integer(key++));
+ return null;
+ }
+
+ public void ejbPostCreate(String name) {
+ }
+
+ /**
+ * Maps to BasicCmpHome.create(Integer primarykey, String name)
+ */
+ public Integer ejbCreate(Integer primarykey, String name) throws CreateException {
+ StringTokenizer st = new StringTokenizer(name, " ");
+ setFirstName(st.nextToken());
+ setLastName(st.nextToken());
+ setId(primarykey);
+ return null;
+ }
+
+ public void ejbPostCreate(Integer primarykey, String name) throws CreateException {
+ }
+ //
+ // Home interface methods
+ //=============================
+
+
+ //=============================
+ // Remote interface methods
+ //
+
+ /**
+ * Maps to BasicCmpObject.businessMethod
+ */
+ public String businessMethod(String text) {
+ testAllowedOperations("businessMethod");
+ StringBuffer b = new StringBuffer(text);
+ return b.reverse().toString();
+ }
+
+
+ /**
+ * Throws an ApplicationException when invoked
+ */
+ public void throwApplicationException() throws ApplicationException {
+ throw new ApplicationException("Testing ability to throw Application Exceptions");
+ }
+
+ /**
+ * Throws a java.lang.NullPointerException when invoked
+ * This is a system exception and should result in the
+ * destruction of the instance and invalidation of the
+ * remote reference.
+ */
+ public void throwSystemException_NullPointer() {
+ throw new NullPointerException("Testing ability to throw System Exceptions");
+ }
+
+
+ /**
+ * Maps to BasicCmpObject.getPermissionsReport
+ *
+ * Returns a report of the bean's
+ * runtime permissions
+ */
+ public Properties getPermissionsReport() {
+ /* TO DO: */
+ return null;
+ }
+
+ /**
+ * Maps to BasicCmpObject.getAllowedOperationsReport
+ *
+ * Returns a report of the allowed opperations
+ * for one of the bean's methods.
+ *
+ * @param methodName The method for which to get the allowed opperations report
+ */
+ public OperationsPolicy getAllowedOperationsReport(String methodName) {
+ return (OperationsPolicy) allowedOperationsTable.get(methodName);
+ }
+
+ //
+ // Remote interface methods
+ //=============================
+
+
+ //================================
+ // EntityBean interface methods
+ //
+
+ /**
+ * A container invokes this method to instruct the
+ * instance to synchronize its state by loading it state from the
+ * underlying database.
+ */
+ public void ejbLoad() {
+ }
+
+ /**
+ * Set the associated entity context. The container invokes this method
+ * on an instance after the instance has been created.
+ */
+ public void setEntityContext(EntityContext ctx) {
+ ejbContext = ctx;
+ testAllowedOperations("setEntityContext");
+ }
+
+ /**
+ * Unset the associated entity context. The container calls this method
+ * before removing the instance.
+ */
+ public void unsetEntityContext() {
+ testAllowedOperations("unsetEntityContext");
+ }
+
+ /**
+ * A container invokes this method to instruct the
+ * instance to synchronize its state by storing it to the underlying
+ * database.
+ */
+ public void ejbStore() {
+ }
+
+ /**
+ * A container invokes this method before it removes the EJB object
+ * that is currently associated with the instance. This method
+ * is invoked when a client invokes a remove operation on the
+ * enterprise Bean's home interface or the EJB object's remote interface.
+ * This method transitions the instance from the ready state to the pool
+ * of available instances.
+ */
+ public void ejbRemove() {
+ }
+
+ /**
+ * A container invokes this method when the instance
+ * is taken out of the pool of available instances to become associated
+ * with a specific EJB object. This method transitions the instance to
+ * the ready state.
+ */
+ public void ejbActivate() {
+ testAllowedOperations("ejbActivate");
+ }
+
+ /**
+ * A container invokes this method on an instance before the instance
+ * becomes disassociated with a specific EJB object. After this method
+ * completes, the container will place the instance into the pool of
+ * available instances.
+ */
+ public void ejbPassivate() {
+ testAllowedOperations("ejbPassivate");
+ }
+ //
+ // EntityBean interface methods
+ //================================
+
+ protected void testAllowedOperations(String methodName) {
+ OperationsPolicy policy = new OperationsPolicy();
+
+ /*[1] Test getEJBHome /////////////////*/
+ try {
+ ejbContext.getEJBHome();
+ policy.allow(policy.Context_getEJBHome);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[2] Test getCallerPrincipal /////////*/
+ try {
+ ejbContext.getCallerPrincipal();
+ policy.allow(policy.Context_getCallerPrincipal);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[3] Test isCallerInRole /////////////*/
+ try {
+ ejbContext.isCallerInRole("ROLE");
+ policy.allow(policy.Context_isCallerInRole);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[4] Test getRollbackOnly ////////////*/
+ try {
+ ejbContext.getRollbackOnly();
+ policy.allow(policy.Context_getRollbackOnly);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[5] Test setRollbackOnly ////////////*/
+ try {
+ ejbContext.setRollbackOnly();
+ policy.allow(policy.Context_setRollbackOnly);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[6] Test getUserTransaction /////////*/
+ try {
+ ejbContext.getUserTransaction();
+ policy.allow(policy.Context_getUserTransaction);
+ } catch (Exception e) {
+ }
+
+ /*[7] Test getEJBObject ///////////////*/
+ try {
+ ejbContext.getEJBObject();
+ policy.allow(policy.Context_getEJBObject);
+ } catch (IllegalStateException ise) {
+ }
+
+ /*[8] Test getPrimaryKey //////////////*/
+ try {
+ ejbContext.getPrimaryKey();
+ policy.allow(policy.Context_getPrimaryKey);
+ } catch (IllegalStateException ise) {
+ }
+
+ /* TO DO:
+ * Check for policy.Enterprise_bean_access
+ * Check for policy.JNDI_access_to_java_comp_env
+ * Check for policy.Resource_manager_access
+ */
+ allowedOperationsTable.put(methodName, policy);
+ }
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean$JPA.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean%24JPA.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean$JPA.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean$JPA.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+public class EncCmp2Bean$JPA extends EncCmp2Bean {
+ public Integer id;
+ private String firstName;
+ private String lastName;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ 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;
+ }
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,400 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+import java.util.StringTokenizer;
+import javax.ejb.CreateException;
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+import javax.naming.InitialContext;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulObject;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessObject;
+
+public abstract class EncCmp2Bean implements EntityBean {
+
+ public static int key = 20;
+
+ public EntityContext ejbContext;
+
+ public abstract Integer getId();
+
+ public abstract void setId(Integer primaryKey);
+
+ public abstract String getFirstName();
+
+ public abstract void setFirstName(String firstName);
+
+ public abstract String getLastName();
+
+ public abstract void setLastName(String lastName);
+
+ //=============================
+ // Home interface methods
+ //
+
+ /**
+ * Maps to EncCmpHome.create
+ */
+ public Integer ejbCreate(String name) throws CreateException {
+ StringTokenizer st = new StringTokenizer(name, " ");
+ setFirstName(st.nextToken());
+ setLastName(st.nextToken());
+ setId(new Integer(key++));
+ return null;
+ }
+
+ public void ejbPostCreate(String name) {
+ }
+
+
+ //
+ // Home interface methods
+ //=============================
+
+
+ //=============================
+ // Remote interface methods
+ //
+
+
+ public void lookupEntityBean() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ BasicCmpHome home = (BasicCmpHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/cmp_entity"), BasicCmpHome.class);
+ Assert.assertNotNull("The EJBHome looked up is null", home);
+
+ BasicCmpObject object = home.create("Enc Bean");
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBean() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful"), BasicStatefulHome.class);
+ Assert.assertNotNull("The EJBHome looked up is null", home);
+
+ BasicStatefulObject object = home.create("Enc Bean");
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatelessBean() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless"), BasicStatelessHome.class);
+ Assert.assertNotNull("The EJBHome looked up is null", home);
+
+ BasicStatelessObject object = home.create();
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStringEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ String expected = new String("1");
+ String actual = (String) ctx.lookup("java:comp/env/entity/cmp/references/String");
+
+ Assert.assertNotNull("The String looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupDoubleEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Double expected = new Double(1.0D);
+ Double actual = (Double) ctx.lookup("java:comp/env/entity/cmp/references/Double");
+
+ Assert.assertNotNull("The Double looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupLongEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Long expected = new Long(1L);
+ Long actual = (Long) ctx.lookup("java:comp/env/entity/cmp/references/Long");
+
+ Assert.assertNotNull("The Long looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupFloatEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Float expected = new Float(1.0F);
+ Float actual = (Float) ctx.lookup("java:comp/env/entity/cmp/references/Float");
+
+ Assert.assertNotNull("The Float looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupIntegerEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Integer expected = new Integer(1);
+ Integer actual = (Integer) ctx.lookup("java:comp/env/entity/cmp/references/Integer");
+
+ Assert.assertNotNull("The Integer looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupShortEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Short expected = new Short((short) 1);
+ Short actual = (Short) ctx.lookup("java:comp/env/entity/cmp/references/Short");
+
+ Assert.assertNotNull("The Short looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupBooleanEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Boolean expected = new Boolean(true);
+ Boolean actual = (Boolean) ctx.lookup("java:comp/env/entity/cmp/references/Boolean");
+
+ Assert.assertNotNull("The Boolean looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupByteEntry() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ Byte expected = new Byte((byte) 1);
+ Byte actual = (Byte) ctx.lookup("java:comp/env/entity/cmp/references/Byte");
+
+ Assert.assertNotNull("The Byte looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupCharacterEntry() throws TestFailureException{
+ try{
+ try{
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx );
+
+ Character expected = new Character('D');
+ Character actual = (Character)ctx.lookup("java:comp/env/entity/cmp/references/Character");
+
+ Assert.assertNotNull("The Character looked up is null", actual );
+ Assert.assertEquals(expected, actual );
+
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupResource() throws TestFailureException {
+ try {
+ try {
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+ //
+ // Remote interface methods
+ //=============================
+
+
+ //================================
+ // EntityBean interface methods
+ //
+
+ /**
+ * A container invokes this method to instruct the
+ * instance to synchronize its state by loading it state from the
+ * underlying database.
+ */
+ public void ejbLoad() {
+ }
+
+ /**
+ * Set the associated entity context. The container invokes this method
+ * on an instance after the instance has been created.
+ */
+ public void setEntityContext(EntityContext ctx) {
+ ejbContext = ctx;
+ }
+
+ /**
+ * Unset the associated entity context. The container calls this method
+ * before removing the instance.
+ */
+ public void unsetEntityContext() {
+ }
+
+ /**
+ * A container invokes this method to instruct the
+ * instance to synchronize its state by storing it to the underlying
+ * database.
+ */
+ public void ejbStore() {
+ }
+
+ /**
+ * A container invokes this method before it removes the EJB object
+ * that is currently associated with the instance. This method
+ * is invoked when a client invokes a remove operation on the
+ * enterprise Bean's home interface or the EJB object's remote interface.
+ * This method transitions the instance from the ready state to the pool
+ * of available instances.
+ */
+ public void ejbRemove() {
+ }
+
+ /**
+ * A container invokes this method when the instance
+ * is taken out of the pool of available instances to become associated
+ * with a specific EJB object. This method transitions the instance to
+ * the ready state.
+ */
+ public void ejbActivate() {
+ }
+
+ /**
+ * A container invokes this method on an instance before the instance
+ * becomes disassociated with a specific EJB object. After this method
+ * completes, the container will place the instance into the pool of
+ * available instances.
+ */
+ public void ejbPassivate() {
+ }
+ //
+ // EntityBean interface methods
+ //================================
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/RmiIiopCmp2Bean$JPA.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/RmiIiopCmp2Bean%24JPA.java?view=auto&rev=484656
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/RmiIiopCmp2Bean$JPA.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/RmiIiopCmp2Bean$JPA.java Fri Dec 8 08:43:38 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.cmp;
+
+public class RmiIiopCmp2Bean$JPA extends RmiIiopCmp2Bean {
+ public Integer id;
+ private String firstName;
+ private String lastName;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ 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;
+ }
+}