You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2008/06/28 20:48:33 UTC
svn commit: r672566 [6/9] - in /openejb/trunk/openejb3: ./ api/
api/ejb31-api-experimental/ api/ejb31-api-experimental/src/
api/ejb31-api-experimental/src/main/
api/ejb31-api-experimental/src/main/java/
api/ejb31-api-experimental/src/main/java/javax/ a...
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,272 @@
+/**
+ * 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.singleton;
+
+import org.apache.openejb.test.object.OperationsPolicy;
+import org.apache.openejb.test.beans.TimerSync;
+
+/**
+ *
+ * [10] Should be run as the nineth test suite of the BasicSingletonTestClients
+ *
+ * <PRE>
+ * =========================================================================
+ * Operations allowed in the methods of a singleton SessionBean with
+ * bean-managed transaction demarcation
+ * =========================================================================
+ *
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * constructor | -
+ * ______________________|__________________________________________________
+ * |
+ * setSessionContext | SessionContext methods:
+ * | - getEJBHome
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * |
+ * ejbCreate | SessionContext methods:
+ * ejbRemove | - getEJBHome
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * |
+ * business method | SessionContext methods:
+ * from remote interface | - getEJBHome
+ * | - getCallerPrincipal
+ * | - isCallerInRole
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
+ * ______________________|__________________________________________________
+ * </PRE>
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class BMTSingletonAllowedOperationsTests extends BasicSingletonTestClient{
+ protected TimerSync timerSync;
+
+ public BMTSingletonAllowedOperationsTests(){
+ super("BMTAllowedOperations.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = initialContext.lookup("client/tests/singleton/BeanManagedBasicSingletonHome");
+ ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ ejbObject = ejbHome.createObject();
+ ejbHandle = ejbObject.getHandle();
+ timerSync = (TimerSync) initialContext.lookup("TimerSyncBeanBusinessRemote");
+
+ /* These tests will only work if the specified
+ * method has already been called by the container.
+ *
+ * TO DO:
+ * Implement a little application senario to ensure
+ * that all methods tested for below have been called
+ * by the container.
+ */
+ ejbObject.businessMethod("let's go!");
+ }
+
+ protected void tearDown() throws Exception{
+ try {
+ ejbObject.remove();
+ } catch (Exception e){
+ throw e;
+ } finally {
+ super.tearDown();
+ }
+ }
+
+ //=====================================
+ // Test EJBContext allowed operations
+ //
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * setSessionContext | SessionContext methods:
+ * | - getEJBHome
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void test01_setSessionContext(){
+ try{
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( policy.Context_getEJBHome );
+ policy.allow( policy.Context_lookup );
+ policy.allow( policy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("setSessionContext");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * ejbCreate | SessionContext methods:
+ * ejbRemove | - getEJBHome
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void test02_ejbCreate(){
+ try{
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( policy.Context_getEJBHome );
+ policy.allow( policy.Context_getEJBObject );
+ policy.allow( policy.Context_getUserTransaction );
+ policy.allow( policy.Context_getTimerService );
+ policy.allow( policy.Context_lookup );
+ policy.allow( policy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("ejbCreate");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * ejbCreate | SessionContext methods:
+ * ejbRemove | - getEJBHome
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void TODO_test03_ejbRemove(){
+ try{
+ /* TO DO: This test needs unique functionality to work */
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( policy.Context_getEJBHome );
+ policy.allow( policy.Context_getEJBObject );
+ policy.allow( policy.Context_getUserTransaction );
+ policy.allow( policy.Context_getTimerService );
+ policy.allow( policy.Context_lookup );
+ policy.allow( policy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("ejbRemove");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * business method | SessionContext methods:
+ * from remote interface | - getEJBHome
+ * | - getCallerPrincipal
+ * | - isCallerInRole
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void test04_businessMethod(){
+ try{
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( policy.Context_getEJBHome );
+ policy.allow( policy.Context_getCallerPrincipal );
+ policy.allow( policy.Context_isCallerInRole );
+ policy.allow( policy.Context_getEJBObject );
+ policy.allow( policy.Context_getUserTransaction );
+ policy.allow( policy.Context_getTimerService );
+ policy.allow( policy.Context_lookup );
+ policy.allow( policy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("businessMethod");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void _test05_ejbTimeout(){
+ try {
+ ejbObject.scheduleTimer("BmtSingletonAllowedOperationsTests");
+ timerSync.waitFor("BmtSingletonAllowedOperationsTests");
+
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( policy.Context_getEJBHome );
+ policy.allow( policy.Context_getCallerPrincipal );
+ policy.allow( policy.Context_isCallerInRole );
+ policy.allow( policy.Context_getEJBObject );
+ policy.allow( policy.Context_getUserTransaction );
+ policy.allow( policy.Context_getTimerService );
+ policy.allow( policy.Context_lookup );
+ policy.allow( policy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("ejbTimeout");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ //
+ // Test EJBContext allowed operations
+ //=====================================
+}
+
+
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,45 @@
+/**
+ * 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.singleton;
+
+import javax.ejb.EJB;
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ * @author <a href="mailto:nour.mohammad@gmail.com">Mohammad Nour El-Din</a>
+ *
+ * @version $Rev: 525022 $ $Date: 2007-04-02 21:19:21 -0700 (Mon, 02 Apr 2007) $
+ */
+public abstract class BasicSingletonLocalTestClient extends SingletonTestClient {
+
+ @EJB(name="client/tests/singleton/BasicSingletonPojoHomeLocal",
+ beanInterface = BasicSingletonLocalHome.class)
+ protected BasicSingletonLocalHome ejbLocalHome = null;
+ protected BasicSingletonLocalObject ejbLocalObject = null;
+
+ public BasicSingletonLocalTestClient(String name){
+ super(name);
+ }
+
+ protected Object cast(Object object, Class type) {
+ return type.cast(object);
+ }
+
+}
+
+
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,38 @@
+/**
+ * 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.singleton;
+
+import javax.ejb.EJB;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public abstract class BasicSingletonTestClient extends SingletonTestClient{
+
+ @EJB(name="client/tests/singleton/BasicSingletonPojoHome",
+ beanInterface=BasicSingletonHome.class)
+ protected BasicSingletonHome ejbHome = null;
+ protected BasicSingletonObject ejbObject = null;
+
+ public BasicSingletonTestClient(String name){
+ super(name);
+ }
+}
+
+
Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java?rev=672566&r1=672456&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java Sat Jun 28 11:48:28 2008
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.test.stateless;
+package org.apache.openejb.test.singleton;
import org.apache.openejb.test.entity.bmp.EncBmpHome;
import org.apache.openejb.test.entity.bmp.EncBmpObject;
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
*/
-public class MiscEjbTests extends BasicStatelessTestClient{
+public class MiscEjbTests extends BasicSingletonTestClient{
public MiscEjbTests(){
super("EJBObject.");
@@ -35,8 +35,8 @@
protected void setUp() throws Exception{
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessHome");
- ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+ Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
+ ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
ejbObject = ejbHome.createObject();
}
@@ -53,14 +53,14 @@
//===============================
// Test ejb object methods
//
- public void test01_isIdentical_stateless(){
+ public void test01_isIdentical_singleton(){
try{
- String jndiName = "client/tests/stateless/EncBean";
- EncStatelessHome ejbHome2 = null;
- EncStatelessObject ejbObject2 = null;
+ String jndiName = "client/tests/singleton/EncBean";
+ EncSingletonHome ejbHome2 = null;
+ EncSingletonObject ejbObject2 = null;
Object obj = initialContext.lookup(jndiName);
- ejbHome2 = (EncStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, EncStatelessHome.class);
+ ejbHome2 = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
ejbObject2 = ejbHome2.create();
//System.out.println("_______________________________________________________");
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,290 @@
+/**
+ * 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.singleton;
+
+import javax.ejb.EJBObject;
+
+import org.apache.openejb.test.object.OperationsPolicy;
+import org.apache.openejb.test.beans.TimerSync;
+
+/**
+ *
+ * [9] Should be run as the nineth test suite of the BasicSingletonTestClients
+ *
+ * <PRE>
+ * =========================================================================
+ * Operations allowed in the methods of a singleton SessionBean with
+ * container-managed transaction demarcation
+ * =========================================================================
+ *
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * constructor | -
+ * ______________________|__________________________________________________
+ * |
+ * setSessionContext | SessionContext methods:
+ * | - getEJBHome
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * |
+ * ejbCreate | SessionContext methods:
+ * ejbRemove | - getEJBHome
+ * | - getEJBObject
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * |
+ * business method | SessionContext methods:
+ * from remote interface | - getEJBHome
+ * | - getCallerPrincipal
+ * | - getRollbackOnly
+ * | - isCallerInRole
+ * | - setRollbackOnly
+ * | - getEJBObject
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
+ * ______________________|__________________________________________________
+ * </PRE>
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonAllowedOperationsTests extends BasicSingletonTestClient{
+ protected TimerSync timerSync;
+
+ public SingletonAllowedOperationsTests(){
+ super("AllowedOperations.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
+ ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ ejbObject = ejbHome.createObject();
+ ejbHandle = ejbObject.getHandle();
+ timerSync = (TimerSync) initialContext.lookup("TimerSyncBeanBusinessRemote");
+
+ //setUp_ejbActivate_Passivate();
+
+ /* These tests will only work if the specified
+ * method has already been called by the container.
+ *
+ * TO DO:
+ * Implement a little application senario to ensure
+ * that all methods tested for below have been called
+ * by the container.
+ */
+ ejbObject.businessMethod("activate me please");
+ }
+
+ private void setUp_ejbActivate_Passivate() throws Exception{
+
+ /* Create more instances to fill the pool size
+ * causing instances to be passivated
+ */
+ EJBObject[] ejbObjects = new EJBObject[10];
+ for (int i=0; i < ejbObjects.length; i++){
+ ejbObjects[i] = ejbHome.createObject();
+ }
+ ejbObject.businessMethod("activate me please");
+ }
+
+ protected void tearDown() throws Exception{
+ try {
+ ejbObject.remove();
+ } catch (Exception e){
+ throw e;
+ } finally {
+ super.tearDown();
+ }
+ }
+
+ //=====================================
+ // Test EJBContext allowed operations
+ //
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * setSessionContext | SessionContext methods:
+ * | - getEJBHome
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void test01_setSessionContext(){
+ try {
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( OperationsPolicy.Context_getEJBHome );
+ policy.allow( OperationsPolicy.Context_lookup );
+ policy.allow( OperationsPolicy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("setSessionContext");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * ejbCreate | SessionContext methods:
+ * ejbRemove | - getEJBHome
+ * | - getEJBObject
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void test02_ejbCreate() {
+ // The singleton session bean has container managed transactions
+ // so, the test Context_getUserTransaction should fail, but,
+ // it does not. Someone should see why it does not fail.
+ try {
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( OperationsPolicy.Context_getEJBHome );
+ policy.allow( OperationsPolicy.Context_getEJBObject );
+ policy.allow( OperationsPolicy.Context_getTimerService );
+ policy.allow( OperationsPolicy.Context_lookup );
+ policy.allow( OperationsPolicy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("ejbCreate");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * ejbCreate | SessionContext methods:
+ * ejbRemove | - getEJBHome
+ * | - getEJBObject
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void TODO_test03_ejbRemove(){
+ try {
+ /* TO DO: This test needs unique functionality to work */
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( OperationsPolicy.Context_getEJBHome );
+ policy.allow( OperationsPolicy.Context_getEJBObject );
+ policy.allow( OperationsPolicy.Context_getTimerService );
+ policy.allow( OperationsPolicy.Context_lookup );
+ policy.allow( OperationsPolicy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("ejbRemove");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <PRE>
+ * Bean method | Bean method can perform the following operations
+ * ______________________|__________________________________________________
+ * |
+ * business method | SessionContext methods:
+ * from remote interface | - getEJBHome
+ * | - getCallerPrincipal
+ * | - getRollbackOnly
+ * | - isCallerInRole
+ * | - setRollbackOnly
+ * | - getEJBObject
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
+ * ______________________|__________________________________________________
+ * </PRE>
+ */
+ public void test04_businessMethod(){
+ try {
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( OperationsPolicy.Context_getEJBHome );
+ policy.allow( OperationsPolicy.Context_getCallerPrincipal );
+ policy.allow( OperationsPolicy.Context_getRollbackOnly );
+ policy.allow( OperationsPolicy.Context_setRollbackOnly );
+ policy.allow( OperationsPolicy.Context_isCallerInRole );
+ policy.allow( OperationsPolicy.Context_getEJBObject );
+ policy.allow( OperationsPolicy.Context_getTimerService );
+ policy.allow( OperationsPolicy.Context_lookup );
+ policy.allow( OperationsPolicy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("businessMethod");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void _test05_ejbTimeout(){
+ try {
+ ejbObject.scheduleTimer("SingletonAllowedOperationsTests");
+ timerSync.waitFor("SingletonAllowedOperationsTests");
+
+ OperationsPolicy policy = new OperationsPolicy();
+ policy.allow( OperationsPolicy.Context_getEJBHome );
+ policy.allow( OperationsPolicy.Context_getCallerPrincipal );
+ policy.allow( OperationsPolicy.Context_getRollbackOnly );
+ policy.allow( OperationsPolicy.Context_setRollbackOnly );
+ policy.allow( OperationsPolicy.Context_isCallerInRole );
+ policy.allow( OperationsPolicy.Context_getEJBObject );
+ policy.allow( OperationsPolicy.Context_getTimerService );
+ policy.allow( OperationsPolicy.Context_lookup );
+ policy.allow( OperationsPolicy.JNDI_access_to_java_comp_env );
+
+ Object expected = policy;
+ Object actual = ejbObject.getAllowedOperationsReport("ejbTimeout");
+
+ assertNotNull("The OperationsPolicy is null", actual );
+ assertEquals( expected, actual );
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ //
+ // Test EJBContext allowed operations
+ //=====================================
+}
+
+
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,272 @@
+/**
+ * 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.singleton;
+
+import org.apache.openejb.test.stateful.StatefulTestClient;
+import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.TestFailureException;
+
+/**
+ * [4] Should be run as the fourth test suite of the StatefulTestClients
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonAnnotatedFieldInjectionTests extends StatefulTestClient {
+
+ protected EncSingletonHome ejbHome;
+ protected EncSingletonObject ejbObject;
+
+ public SingletonAnnotatedFieldInjectionTests(){
+ super("FieldInjection.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = initialContext.lookup("AnnotatedFieldInjectionSingletonBean");
+ ejbHome = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
+ ejbObject = ejbHome.create();
+
+ /*[2] Create database table */
+ TestManager.getDatabase().createEntityTable();
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection.
+ * This method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+ try {
+ /*[1] Drop database table */
+ TestManager.getDatabase().dropEntityTable();
+ } catch (Exception e){
+ throw e;
+ } finally {
+ super.tearDown();
+ }
+ }
+
+ public void test01_lookupStringEntry() {
+ try{
+ ejbObject.lookupStringEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_lookupDoubleEntry() {
+ try{
+ ejbObject.lookupDoubleEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test03_lookupLongEntry() {
+ try{
+ ejbObject.lookupLongEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_lookupFloatEntry() {
+ try{
+ ejbObject.lookupFloatEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_lookupIntegerEntry() {
+ try{
+ ejbObject.lookupIntegerEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_lookupShortEntry() {
+ try{
+ ejbObject.lookupShortEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test07_lookupBooleanEntry() {
+ try{
+ ejbObject.lookupBooleanEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_lookupByteEntry() {
+ try{
+ ejbObject.lookupByteEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_lookupCharacterEntry() {
+ try{
+ ejbObject.lookupCharacterEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_lookupEntityBean() {
+ try{
+ ejbObject.lookupEntityBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test11_lookupStatefulBean() {
+ try{
+ ejbObject.lookupStatefulBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_lookupSingletonBean() {
+ try{
+ ejbObject.lookupSingletonBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test13_lookupResource() {
+ try{
+ ejbObject.lookupResource();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test14_lookupPersistenceUnit() {
+ try{
+ ejbObject.lookupPersistenceUnit();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test15_lookupPersistenceContext() {
+ try{
+ ejbObject.lookupPersistenceContext();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test18_lookupSessionContext() {
+ try{
+ ejbObject.lookupSessionContext();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test19_lookupSingletonBusinessLocal() {
+ try{
+ ejbObject.lookupSingletonBusinessLocal();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test20_lookupSingletonBusinessRemote() {
+ try{
+ ejbObject.lookupSingletonBusinessRemote();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test21_lookupStatefulBusinessLocal() {
+ try{
+ ejbObject.lookupStatefulBusinessLocal();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test22_lookupStatefulBusinessRemote() {
+ try{
+ ejbObject.lookupStatefulBusinessRemote();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test23_lookupJMSConnectionFactory() {
+ try{
+ ejbObject.lookupJMSConnectionFactory();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,387 @@
+/**
+ * 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.singleton;
+
+import java.util.Properties;
+
+import javax.ejb.EJBMetaData;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.RollbackException;
+
+import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.object.Account;
+import org.apache.openejb.test.object.Transaction;
+
+/**
+ * [1] Should be run as the first test suite of the SingletonTestClients
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonBeanTxTests extends org.apache.openejb.test.NamedTestCase{
+
+ public final static String jndiEJBHomeEntry = "client/tests/singleton/BeanManagedTransactionTests/EJBHome";
+
+ protected BeanTxSingletonHome ejbHome;
+ protected BeanTxSingletonObject ejbObject;
+
+ protected EJBMetaData ejbMetaData;
+ protected HomeHandle ejbHomeHandle;
+ protected Handle ejbHandle;
+ protected Integer ejbPrimaryKey;
+
+ protected InitialContext initialContext;
+
+ public SingletonBeanTxTests(){
+ super("Singleton.BeanManagedTransaction.");
+ }
+
+ /**
+ * Sets up the fixture, for example, open a network connection.
+ * This method is called before a test is executed.
+ */
+ protected void setUp() throws Exception {
+
+ Properties properties = TestManager.getServer().getContextEnvironment();
+ //properties.put(Context.SECURITY_PRINCIPAL, "SINGLETON_test00_CLIENT");
+ //properties.put(Context.SECURITY_CREDENTIALS, "SINGLETON_test00_CLIENT");
+
+ initialContext = new InitialContext(properties);
+
+ /*[1] Get bean */
+ Object obj = initialContext.lookup(jndiEJBHomeEntry);
+ ejbHome = (BeanTxSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BeanTxSingletonHome.class);
+ ejbObject = ejbHome.create();
+
+ /*[2] Create database table */
+ TestManager.getDatabase().createAccountTable();
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection.
+ * This method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+ /*[1] Drop database table */
+ TestManager.getDatabase().dropAccountTable();
+ }
+
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The Container must make the javax.transaction.UserTransaction interface available to
+ * the enterprise bean's business method via the javax.ejb.EJBContext interface and under the
+ * environment entry java:comp/UserTransaction. When an instance uses the javax.trans-action.
+ * UserTransaction interface to demarcate a transaction, the Container must enlist all the
+ * resource managers used by the instance between the begin() and commit(),or rollback(),
+ * methods with the transaction. When the instance attempts to commit the transaction, the Container is
+ * responsible for the global coordination of the transaction commit.
+ * </P>
+ * <P>--------------------------------------------------------</P>
+ * <P>
+ * Check that a javax.transaction.UserTransaction can be obtained from
+ * the javax.ejb.EJBContext
+ * </P>
+ */
+ public void test01_EJBContext_getUserTransaction(){
+ try{
+ Transaction t = ejbObject.getUserTransaction();
+ assertNotNull("UserTransaction is null.", t);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ *
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The Container must make the javax.transaction.UserTransaction interface available to
+ * the enterprise bean's business method via the javax.ejb.EJBContext interface and under the
+ * environment entry java:comp/UserTransaction. When an instance uses the javax.trans-action.
+ * UserTransaction interface to demarcate a transaction, the Container must enlist all the
+ * resource managers used by the instance between the begin() and commit(),or rollback(),
+ * methods with the transaction. When the instance attempts to commit the transaction, the Container is
+ * responsible for the global coordination of the transaction commit.
+ * </P>
+ * <P>--------------------------------------------------------</P>
+ * <P>
+ * Check that a javax.transaction.UserTransaction can be obtained from
+ * the environment entry java:comp/UserTransaction
+ * </P>
+ */
+ public void test02_java_comp_UserTransaction(){
+ try{
+ Transaction t = ejbObject.jndiUserTransaction();
+ assertNotNull("UserTransaction is null. Could not retreive a UserTransaction from the bean's JNDI namespace.", t);
+ } catch (Exception e){
+ fail("Could not retreive a UserTransaction from the bean's JNDI namespace. Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The Container must throw the java.lang.IllegalStateException if an instance of a bean
+ * with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or
+ * getRollbackOnly() method of the javax.ejb.EJBContext interface.
+ * </P>
+ * <P>--------------------------------------------------------</P>
+ * <P>
+ * Test that setRollbackOnly() throws a java.lang.IllegalStateException
+ * </P>
+ */
+ public void TODO_test03_EJBContext_setRollbackOnly(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The Container must throw the java.lang.IllegalStateException if an instance of a bean
+ * with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or
+ * getRollbackOnly() method of the javax.ejb.EJBContext interface.
+ * </P>
+ * <P>--------------------------------------------------------</P>
+ * <P>
+ * Test that getRollbackOnly() throws a java.lang.IllegalStateException
+ * </P>
+ */
+ public void TODO_test04_EJBContext_getRollbackOnly(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ *
+ */
+ public void test05_singleTransactionCommit(){
+ try{
+ Account expected = new Account("123-45-6789","Joe","Cool",40000);
+ Account actual = new Account();
+
+ ejbObject.openAccount(expected, new Boolean(false));
+ actual = ejbObject.retreiveAccount( expected.getSsn() );
+
+ assertNotNull( "The transaction was not commited. The record is null", actual );
+ assertEquals( "The transaction was not commited cleanly.", expected, actual );
+ } catch (RollbackException re){
+ fail("Transaction was rolledback. Received Exception "+re.getClass()+ " : "+re.getMessage());
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * This test does work for the IntraVM Server, but it fails on
+ * the Remote Server. For some reason, when the RollbackException is
+ * sent to the client, the server blocks.
+ */
+ public void BUG_test06_singleTransactionRollback(){
+ Account expected = new Account("234-56-7890","Charlie","Brown", 20000);
+ Account actual = new Account();
+
+ // Try and add the account in a transaction. This should fail and
+ // throw a RollbackException
+ try{
+ ejbObject.openAccount(expected, new Boolean(true));
+ fail( "A javax.transaction.RollbackException should have been thrown." );
+ } catch (RollbackException re){
+ // Good.
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+
+ //// Now check that the account really wasn't added.
+ //try{
+ // actual = ejbObject.retreiveAccount( expected.getSsn() );
+ // //assertTrue( "The transaction was commited when it should have been rolledback.", !expected.equals(actual) );
+ //} catch (Exception e){
+ // fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ //}
+ }
+
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The Container must allow the enterprise bean instance to serially perform several transactions in a
+ * method.
+ * </P>
+ */
+ public void TODO_test07_serialTransactions(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * When an instance attempts to start a transaction using the
+ * begin() method of the javax.transaction.UserTransaction
+ * interface while the instance has not committed the previous
+ * transaction, the Container must throw the
+ * javax.transaction.NotSupportedException in the begin() method.
+ * </P>
+ */
+ public void TODO_test08_nestedTransactions(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * If a singleton session bean instance starts a transaction in a
+ * business method, it must commit the transaction before the
+ * business method returns. The Container must detect the case in
+ * which a transaction was started, but not completed, in the
+ * business method, and handle it as follows:
+ * <UL>
+ * <LI>Log this as an application error to alert the system administrator.
+ * <LI>Roll back the started transaction.
+ * <LI>Discard the instance of the session bean.
+ * <LI>Throw the java.rmi.RemoteException to the client.
+ * </UL>
+ * </P>
+ */
+ public void TODO_test09_beginWithNoCommit(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The actions performed by the Container for an instance with bean-managed transaction are summarized
+ * by the following table. T1 is a transaction associated with a client request, T2 is a transaction that is cur-rently
+ * associated with the instance (i.e. a transaction that was started but not completed by a previous
+ * business method).
+ * </P>
+ * <PRE>
+ * =========================================================================
+ * Container's actions for methods of beans with bean-managed transaction
+ * =========================================================================
+ *
+ * | IF | AND | THEN
+ * scenario | Client's | Transaction currently | Transaction associated
+ * | transaction | associated with instance | with the method is
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 1 | none | none | none
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 2 | T1 | none | none
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 3 | none | T2 | T2
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 4 | T1 | T2 | T2
+ * ___________|_____________|__________________________|________________________
+ * </PRE>
+ * <P>
+ * If the client request is not associated with a transaction and the instance is not associated with a
+ * transaction, the container invokes the instance with an unspecified transaction context.
+ * </P>
+ * <P>--------------------------------------------------------</P>
+ * <P>
+ * Test scenario 1: none none<BR>
+ * If the client's transaction is none and the transaction currently
+ * associated with instance none then the transaction associated with the method is none.
+ * </P>
+ */
+ public void TODO_test10_scenario1_NoneNone(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <B>11.6.1 Bean-managed transaction demarcation</B>
+ * <P>
+ * The actions performed by the Container for an instance with bean-managed transaction are summarized
+ * by the following table. T1 is a transaction associated with a client request, T2 is a transaction that is cur-rently
+ * associated with the instance (i.e. a transaction that was started but not completed by a previous
+ * business method).
+ * </P>
+ * <PRE>
+ * =========================================================================
+ * Container's actions for methods of beans with bean-managed transaction
+ * =========================================================================
+ *
+ * | IF | AND | THEN
+ * scenario | Client's | Transaction currently | Transaction associated
+ * | transaction | associated with instance | with the method is
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 1 | none | none | none
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 2 | T1 | none | none
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 3 | none | T2 | T2
+ * ___________|_____________|__________________________|________________________
+ * | | |
+ * 4 | T1 | T2 | T2
+ * ___________|_____________|__________________________|________________________
+ * </PRE>
+ * <P>
+ * If the client is associated with a transaction T1, and the instance is not associated with a transaction,
+ * the container suspends the client's transaction association and invokes the method with
+ * an unspecified transaction context. The container resumes the client's ntransaction association
+ * (T1) when the method completes.
+ * </P>
+ * <P>--------------------------------------------------------</P>
+ * <P>
+ * Test scenario 2: T1 none<BR>
+ * </P>
+ */
+ public void TODO_test11_scenario2_T1None(){
+ try{
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+}
+
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContainerTxTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContainerTxTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContainerTxTests.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContainerTxTests.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,443 @@
+/**
+ * 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.singleton;
+
+import java.util.Properties;
+
+import javax.ejb.EJBMetaData;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.openejb.test.TestManager;
+
+/**
+ * [1] Should be run as the first test suite of the SingletonTestClients
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonContainerTxTests extends org.apache.openejb.test.NamedTestCase{
+
+ public final static String jndiEJBHomeEntry = "client/tests/singleton/ContainerManagedTransactionTests/EJBHome";
+
+ protected ContainerTxSingletonHome ejbHome;
+ protected ContainerTxSingletonObject ejbObject;
+
+ protected EJBMetaData ejbMetaData;
+ protected HomeHandle ejbHomeHandle;
+ protected Handle ejbHandle;
+ protected Integer ejbPrimaryKey;
+
+ protected InitialContext initialContext;
+
+ public SingletonContainerTxTests(){
+ super("Singleton.ContainerManagedTransaction.");
+ }
+
+ /**
+ * Sets up the fixture, for example, open a network connection.
+ * This method is called before a test is executed.
+ */
+ protected void setUp() throws Exception {
+
+ Properties properties = TestManager.getServer().getContextEnvironment();
+ //properties.put(Context.SECURITY_PRINCIPAL, "SINGLETON_test00_CLIENT");
+ //properties.put(Context.SECURITY_CREDENTIALS, "SINGLETON_test00_CLIENT");
+
+ initialContext = new InitialContext(properties);
+
+ /*[1] Get bean */
+ Object obj = initialContext.lookup(jndiEJBHomeEntry);
+ ejbHome = (ContainerTxSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, ContainerTxSingletonHome.class);
+ ejbObject = ejbHome.create();
+
+ /*[2] Create database table */
+ TestManager.getDatabase().createAccountTable();
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection.
+ * This method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+ /*[1] Drop database table */
+ TestManager.getDatabase().dropAccountTable();
+ }
+
+ public void test01_txMandatory_withoutTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txMandatoryMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_txNever_withoutTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNeverMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test03_txNotSupported_withoutTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNotSupportedMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_txRequired_withoutTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiredMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_txRequiresNew_withoutTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiresNewMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_txSupports_withoutTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txSupportsMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test07_txMandatory_withTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txMandatoryMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_txNever_withTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNeverMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_txNotSupported_withTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNotSupportedMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_txRequired_withTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiredMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test11_txRequiresNew_withTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiresNewMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_txSupports_withTx(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txSupportsMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test01_txMandatory_withoutTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txMandatoryMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_txNever_withoutTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNeverMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test03_txNotSupported_withoutTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNotSupportedMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_txRequired_withoutTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiredMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_txRequiresNew_withoutTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiresNewMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_txSupports_withoutTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txSupportsMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test07_txMandatory_withTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txMandatoryMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_txNever_withTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNeverMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_txNotSupported_withTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNotSupportedMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_txRequired_withTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiredMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test11_txRequiresNew_withTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiresNewMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_txSupports_withTx_appException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txSupportsMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test01_txMandatory_withoutTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txMandatoryMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_txNever_withoutTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNeverMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test03_txNotSupported_withoutTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNotSupportedMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_txRequired_withoutTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiredMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_txRequiresNew_withoutTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiresNewMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_txSupports_withoutTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txSupportsMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test07_txMandatory_withTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txMandatoryMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_txNever_withTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNeverMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_txNotSupported_withTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txNotSupportedMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_txRequired_withTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiredMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test11_txRequiresNew_withTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txRequiresNewMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_txSupports_withTx_sysException(){
+ try{
+ String expected = "ping";
+ String actual = ejbObject.txSupportsMethod( expected );
+ assertEquals("The method invocation was invalid.", expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+}
+
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContextLookupTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContextLookupTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContextLookupTests.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonContextLookupTests.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,231 @@
+/**
+ * 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.singleton;
+
+import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.TestFailureException;
+
+/**
+ * [4] Should be run as the fourth test suite of the EncSingletonTestClients
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonContextLookupTests extends SingletonTestClient{
+
+ protected EncSingletonHome ejbHome;
+ protected EncSingletonObject ejbObject;
+
+ public SingletonContextLookupTests(){
+ super("JNDI_ENC.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = initialContext.lookup("client/tests/singleton/ContextLookupSingletonBean");
+ ejbHome = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
+ ejbObject = ejbHome.create();
+
+ /*[2] Create database table */
+ TestManager.getDatabase().createEntityTable();
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection.
+ * This method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+ try {
+ /*[1] Drop database table */
+ TestManager.getDatabase().dropEntityTable();
+ } catch (Exception e){
+ throw e;
+ } finally {
+ super.tearDown();
+ }
+ }
+
+ public void test01_lookupStringEntry() {
+ try{
+ ejbObject.lookupStringEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_lookupDoubleEntry() {
+ try{
+ ejbObject.lookupDoubleEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test03_lookupLongEntry() {
+ try{
+ ejbObject.lookupLongEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_lookupFloatEntry() {
+ try{
+ ejbObject.lookupFloatEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_lookupIntegerEntry() {
+ try{
+ ejbObject.lookupIntegerEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_lookupShortEntry() {
+ try{
+ ejbObject.lookupShortEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test07_lookupBooleanEntry() {
+ try{
+ ejbObject.lookupBooleanEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_lookupByteEntry() {
+ try{
+ ejbObject.lookupByteEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_lookupCharacterEntry() {
+ try{
+ ejbObject.lookupCharacterEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_lookupEntityBean() {
+ try{
+ ejbObject.lookupEntityBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test11_lookupStatefulBean() {
+ try{
+ ejbObject.lookupStatefulBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_lookupSingletonBean() {
+ try{
+ ejbObject.lookupSingletonBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test13_lookupResource() {
+ try{
+ ejbObject.lookupResource();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test14_lookupPersistenceUnit() {
+ try{
+ ejbObject.lookupPersistenceUnit();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test15_lookupPersistenceContext() {
+ try{
+ ejbObject.lookupPersistenceContext();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test18_lookupSessionContext() {
+ try{
+ ejbObject.lookupSessionContext();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test23_lookupJMSConnectionFactory() {
+ try{
+ ejbObject.lookupJMSConnectionFactory();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+}