You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2014/07/15 23:55:19 UTC
svn commit: r1610862 [31/44] - in /tomee/tomee/trunk/itests: ./ failover-ejb/
failover-ejb/src/main/java/org/apache/openejb/itest/failover/ejb/ failover/
failover/src/main/java/org/apache/openejb/itest/failover/
failover/src/main/java/org/apache/openej...
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/AnnotatedSetterInjectionSingletonTestClient.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/AnnotatedSetterInjectionSingletonTestClient.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/AnnotatedSetterInjectionSingletonTestClient.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/AnnotatedSetterInjectionSingletonTestClient.java Tue Jul 15 21:55:09 2014
@@ -18,20 +18,19 @@ package org.apache.openejb.test.singleto
/**
* [2] Should be run as the second test suite of the BasicSingletonTestClients
- *
- *
+ *
* @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $
*/
public abstract class AnnotatedSetterInjectionSingletonTestClient extends BasicSingletonTestClient {
- public AnnotatedSetterInjectionSingletonTestClient(String name) {
+ public AnnotatedSetterInjectionSingletonTestClient(final String name) {
super("AnnotatedSetterInjectionSingletonTestClient." + name);
}
-
- protected void setUp() throws Exception{
+
+ protected void setUp() throws Exception {
super.setUp();
processSetterInjections();
}
-
+
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BMTSingletonAllowedOperationsTests.java Tue Jul 15 21:55:09 2014
@@ -20,57 +20,55 @@ import org.apache.openejb.test.object.Op
import org.apache.openejb.test.beans.TimerSync;
/**
- *
* [10] Should be run as the nineth test suite of the BasicSingletonTestClients
- *
+ * <p/>
* <PRE>
* =========================================================================
- * Operations allowed in the methods of a singleton SessionBean with
+ * Operations allowed in the methods of a singleton SessionBean with
* bean-managed transaction demarcation
* =========================================================================
- *
+ * <p/>
* Bean method | Bean method can perform the following operations
* ______________________|__________________________________________________
- * |
+ * |
* constructor | -
* ______________________|__________________________________________________
- * |
+ * |
* setSessionContext | SessionContext methods:
- * | - getEJBHome
- * | JNDI access to java:comp/env
+ * | - getEJBHome
+ * | JNDI access to java:comp/env
* ______________________|__________________________________________________
- * |
+ * |
* ejbCreate | SessionContext methods:
* ejbRemove | - getEJBHome
- * | - getEJBObject
- * | - getUserTransaction
- * | JNDI access to java:comp/env
+ * | - 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
+ * from remote interface | - getEJBHome
+ * | - getCallerPrincipal
+ * | - isCallerInRole
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
* ______________________|__________________________________________________
* </PRE>
- *
*/
-public class BMTSingletonAllowedOperationsTests extends BasicSingletonTestClient{
+public class BMTSingletonAllowedOperationsTests extends BasicSingletonTestClient {
protected TimerSync timerSync;
- public BMTSingletonAllowedOperationsTests(){
+ public BMTSingletonAllowedOperationsTests() {
super("BMTAllowedOperations.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BeanManagedBasicSingletonHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ final 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");
@@ -85,11 +83,11 @@ public class BMTSingletonAllowedOperatio
*/
ejbObject.businessMethod("let's go!");
}
-
- protected void tearDown() throws Exception{
+
+ protected void tearDown() throws Exception {
try {
ejbObject.remove();
- } catch (Exception e){
+ } catch (final Exception e) {
throw e;
} finally {
super.tearDown();
@@ -99,167 +97,170 @@ public class BMTSingletonAllowedOperatio
//=====================================
// 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
+ * | - 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());
+ public void test01_setSessionContext() {
+ try {
+ final OperationsPolicy policy = new OperationsPolicy();
+ policy.allow(policy.Context_getEJBHome);
+ policy.allow(policy.Context_lookup);
+ policy.allow(policy.JNDI_access_to_java_comp_env);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("setSessionContext");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final 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
+ * | - 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());
+ public void test02_ejbCreate() {
+ try {
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("ejbCreate");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final 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
+ * | - getEJBObject
+ * | - getUserTransaction
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
* ______________________|__________________________________________________
* </PRE>
*/
- public void TODO_test03_ejbRemove(){
- try{
+ 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());
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("ejbRemove");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final 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
+ * | - 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 test04_businessMethod() {
+ try {
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("businessMethod");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void _test05_ejbTimeout(){
+ 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());
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("ejbTimeout");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
//
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalTestClient.java Tue Jul 15 21:55:09 2014
@@ -19,24 +19,23 @@ package org.apache.openejb.test.singleto
import javax.ejb.EJB;
/**
- *
* @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;
+ @EJB(name = "client/tests/singleton/BasicSingletonPojoHomeLocal",
+ beanInterface = BasicSingletonLocalHome.class)
+ protected BasicSingletonLocalHome ejbLocalHome = null;
protected BasicSingletonLocalObject ejbLocalObject = null;
- public BasicSingletonLocalTestClient(String name){
+ public BasicSingletonLocalTestClient(final String name) {
super(name);
}
-
- protected Object cast(Object object, Class type) {
- return type.cast(object);
+
+ protected Object cast(final Object object, final Class type) {
+ return type.cast(object);
}
-
+
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/BasicSingletonTestClient.java Tue Jul 15 21:55:09 2014
@@ -18,14 +18,14 @@ package org.apache.openejb.test.singleto
import javax.ejb.EJB;
-public abstract class BasicSingletonTestClient extends SingletonTestClient{
-
- @EJB(name="client/tests/singleton/BasicSingletonPojoHome",
- beanInterface=BasicSingletonHome.class)
+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){
+ public BasicSingletonTestClient(final String name) {
super(name);
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/MiscEjbTests.java Tue Jul 15 21:55:09 2014
@@ -23,23 +23,23 @@ import org.apache.openejb.test.entity.cm
import org.apache.openejb.test.stateful.EncStatefulHome;
import org.apache.openejb.test.stateful.EncStatefulObject;
-public class MiscEjbTests extends BasicSingletonTestClient{
+public class MiscEjbTests extends BasicSingletonTestClient {
- public MiscEjbTests(){
+ public MiscEjbTests() {
super("EJBObject.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.class);
ejbObject = ejbHome.createObject();
}
protected void tearDown() throws Exception {
try {
//ejbObject.remove();
- } catch (Exception e){
+ } catch (final Exception e) {
throw e;
} finally {
super.tearDown();
@@ -49,88 +49,88 @@ public class MiscEjbTests extends BasicS
//===============================
// Test ejb object methods
//
- public void test01_isIdentical_singleton(){
- try{
- String jndiName = "client/tests/singleton/EncBean";
+ public void test01_isIdentical_singleton() {
+ try {
+ final String jndiName = "client/tests/singleton/EncBean";
EncSingletonHome ejbHome2 = null;
EncSingletonObject ejbObject2 = null;
- Object obj = initialContext.lookup(jndiName);
- ejbHome2 = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
+ final Object obj = initialContext.lookup(jndiName);
+ ejbHome2 = (EncSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, EncSingletonHome.class);
ejbObject2 = ejbHome2.create();
//System.out.println("_______________________________________________________");
//System.out.println(" ejb1 "+ejbObject);
//System.out.println(" ejb2 "+ejbObject2);
- assertTrue( "The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2) );
+ assertTrue("The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2));
//System.out.println("-------------------------------------------------------");
- } catch (Exception e){
+ } catch (final Exception e) {
//System.out.println("-------------------------------------------------------");
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test02_isIdentical_stateful(){
- try{
- String jndiName = "client/tests/stateful/EncBean";
+ public void test02_isIdentical_stateful() {
+ try {
+ final String jndiName = "client/tests/stateful/EncBean";
EncStatefulHome ejbHome2 = null;
EncStatefulObject ejbObject2 = null;
- Object obj = initialContext.lookup(jndiName);
- ejbHome2 = (EncStatefulHome)javax.rmi.PortableRemoteObject.narrow( obj, EncStatefulHome.class);
+ final Object obj = initialContext.lookup(jndiName);
+ ejbHome2 = (EncStatefulHome) javax.rmi.PortableRemoteObject.narrow(obj, EncStatefulHome.class);
ejbObject2 = ejbHome2.create("isIdentical test");
//System.out.println("_______________________________________________________");
//System.out.println(" ejb1 "+ejbObject);
//System.out.println(" ejb2 "+ejbObject2);
- assertTrue( "The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2) );
+ assertTrue("The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2));
//System.out.println("-------------------------------------------------------");
- } catch (Exception e){
+ } catch (final Exception e) {
//System.out.println("-------------------------------------------------------");
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test03_isIdentical_bmp(){
- try{
- String jndiName = "client/tests/entity/bmp/EncBean";
+ public void test03_isIdentical_bmp() {
+ try {
+ final String jndiName = "client/tests/entity/bmp/EncBean";
EncBmpHome ejbHome2 = null;
EncBmpObject ejbObject2 = null;
- Object obj = initialContext.lookup(jndiName);
- ejbHome2 = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
+ final Object obj = initialContext.lookup(jndiName);
+ ejbHome2 = (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncBmpHome.class);
ejbObject2 = ejbHome2.create("isIdentical test");
//System.out.println("_______________________________________________________");
- assertTrue( "The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2) );
+ assertTrue("The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2));
//System.out.println(" ejb1 "+ejbObject);
//System.out.println(" ejb2 "+ejbObject2);
//System.out.println("-------------------------------------------------------");
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
* DMB: Calling this now causes an error as the "entity" table doesn't exist yet
- */
- public void _test04_isIdentical_cmp(){
- try{
- String jndiName = "client/tests/entity/cmp/EncBean";
+ */
+ public void _test04_isIdentical_cmp() {
+ try {
+ final String jndiName = "client/tests/entity/cmp/EncBean";
EncCmpHome ejbHome2 = null;
EncCmpObject ejbObject2 = null;
- Object obj = initialContext.lookup(jndiName);
- ejbHome2 = (EncCmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncCmpHome.class);
+ final Object obj = initialContext.lookup(jndiName);
+ ejbHome2 = (EncCmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncCmpHome.class);
ejbObject2 = ejbHome2.create("isIdentical test");
//System.out.println("_______________________________________________________");
//System.out.println(" ejb1 "+ejbObject);
//System.out.println(" ejb2 "+ejbObject2);
- assertTrue( "The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2) );
+ assertTrue("The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2));
//System.out.println("-------------------------------------------------------");
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAllowedOperationsTests.java Tue Jul 15 21:55:09 2014
@@ -22,57 +22,55 @@ import org.apache.openejb.test.object.Op
import org.apache.openejb.test.beans.TimerSync;
/**
- *
* [9] Should be run as the nineth test suite of the BasicSingletonTestClients
- *
+ * <p/>
* <PRE>
* =========================================================================
- * Operations allowed in the methods of a singleton SessionBean with
+ * Operations allowed in the methods of a singleton SessionBean with
* container-managed transaction demarcation
* =========================================================================
- *
+ * <p/>
* Bean method | Bean method can perform the following operations
* ______________________|__________________________________________________
- * |
+ * |
* constructor | -
* ______________________|__________________________________________________
- * |
+ * |
* setSessionContext | SessionContext methods:
- * | - getEJBHome
- * | JNDI access to java:comp/env
+ * | - getEJBHome
+ * | JNDI access to java:comp/env
* ______________________|__________________________________________________
- * |
+ * |
* ejbCreate | SessionContext methods:
* ejbRemove | - getEJBHome
- * | - getEJBObject
- * | JNDI access to java:comp/env
+ * | - 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
+ * from remote interface | - getEJBHome
+ * | - getCallerPrincipal
+ * | - getRollbackOnly
+ * | - isCallerInRole
+ * | - setRollbackOnly
+ * | - getEJBObject
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
* ______________________|__________________________________________________
* </PRE>
- *
*/
-public class SingletonAllowedOperationsTests extends BasicSingletonTestClient{
+public class SingletonAllowedOperationsTests extends BasicSingletonTestClient {
protected TimerSync timerSync;
- public SingletonAllowedOperationsTests(){
+ public SingletonAllowedOperationsTests() {
super("AllowedOperations.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ final 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");
@@ -86,26 +84,26 @@ public class SingletonAllowedOperationsT
* 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{
+
+ 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++){
+ final 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{
+
+ protected void tearDown() throws Exception {
try {
ejbObject.remove();
- } catch (Exception e){
+ } catch (final Exception e) {
throw e;
} finally {
super.tearDown();
@@ -115,169 +113,172 @@ public class SingletonAllowedOperationsT
//=====================================
// 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
+ * | - getEJBHome
+ * | - lookup
+ * | JNDI access to java:comp/env
* ______________________|__________________________________________________
* </PRE>
*/
- public void test01_setSessionContext(){
+ 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());
+ final OperationsPolicy policy = new OperationsPolicy();
+ policy.allow(OperationsPolicy.Context_getEJBHome);
+ policy.allow(OperationsPolicy.Context_lookup);
+ policy.allow(OperationsPolicy.JNDI_access_to_java_comp_env);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("setSessionContext");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final 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
+ * | - 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.
+ // 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());
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("ejbCreate");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final 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
+ * | - getEJBObject
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
* ______________________|__________________________________________________
* </PRE>
*/
- public void TODO_test03_ejbRemove(){
+ 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());
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("ejbRemove");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final 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
+ * | - getCallerPrincipal
+ * | - getRollbackOnly
+ * | - isCallerInRole
+ * | - setRollbackOnly
+ * | - getEJBObject
+ * | - getTimerService
+ * | - lookup
+ * | JNDI access to java:comp/env
+ * | Resource manager access
+ * | Enterprise bean access
* ______________________|__________________________________________________
* </PRE>
*/
- public void test04_businessMethod(){
+ 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());
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("businessMethod");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void _test05_ejbTimeout(){
+ 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());
+ final 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);
+
+ final Object expected = policy;
+ final Object actual = ejbObject.getAllowedOperationsReport("ejbTimeout");
+
+ assertNotNull("The OperationsPolicy is null", actual);
+ assertEquals(expected, actual);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
//
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonAnnotatedFieldInjectionTests.java Tue Jul 15 21:55:09 2014
@@ -22,21 +22,20 @@ import org.apache.openejb.test.TestFailu
/**
* [4] Should be run as the fourth test suite of the StatefulTestClients
- *
*/
public class SingletonAnnotatedFieldInjectionTests extends StatefulTestClient {
- protected EncSingletonHome ejbHome;
+ protected EncSingletonHome ejbHome;
protected EncSingletonObject ejbObject;
- public SingletonAnnotatedFieldInjectionTests(){
+ public SingletonAnnotatedFieldInjectionTests() {
super("FieldInjection.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("AnnotatedFieldInjectionSingletonBean");
- ejbHome = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
+ final Object obj = initialContext.lookup("AnnotatedFieldInjectionSingletonBean");
+ ejbHome = (EncSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, EncSingletonHome.class);
ejbObject = ejbHome.create();
/*[2] Create database table */
@@ -51,7 +50,7 @@ public class SingletonAnnotatedFieldInje
try {
/*[1] Drop database table */
TestManager.getDatabase().dropEntityTable();
- } catch (Exception e){
+ } catch (final Exception e) {
throw e;
} finally {
super.tearDown();
@@ -59,232 +58,232 @@ public class SingletonAnnotatedFieldInje
}
public void test01_lookupStringEntry() {
- try{
+ try {
ejbObject.lookupStringEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test02_lookupDoubleEntry() {
- try{
+ try {
ejbObject.lookupDoubleEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test03_lookupLongEntry() {
- try{
+ try {
ejbObject.lookupLongEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test04_lookupFloatEntry() {
- try{
+ try {
ejbObject.lookupFloatEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test05_lookupIntegerEntry() {
- try{
+ try {
ejbObject.lookupIntegerEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test06_lookupShortEntry() {
- try{
+ try {
ejbObject.lookupShortEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test07_lookupBooleanEntry() {
- try{
+ try {
ejbObject.lookupBooleanEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test08_lookupByteEntry() {
- try{
+ try {
ejbObject.lookupByteEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test09_lookupCharacterEntry() {
- try{
+ try {
ejbObject.lookupCharacterEntry();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test10_lookupEntityBean() {
- try{
+ try {
ejbObject.lookupEntityBean();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test11_lookupStatefulBean() {
- try{
+ try {
ejbObject.lookupStatefulBean();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test12_lookupSingletonBean() {
- try{
+ try {
ejbObject.lookupSingletonBean();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test13_lookupResource() {
- try{
+ try {
ejbObject.lookupResource();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test14_lookupPersistenceUnit() {
- try{
+ try {
ejbObject.lookupPersistenceUnit();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test15_lookupPersistenceContext() {
- try{
+ try {
ejbObject.lookupPersistenceContext();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test18_lookupSessionContext() {
- try{
+ try {
ejbObject.lookupSessionContext();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test19_lookupSingletonBusinessLocal() {
- try{
+ try {
ejbObject.lookupSingletonBusinessLocal();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test20_lookupSingletonBusinessRemote() {
- try{
+ try {
ejbObject.lookupSingletonBusinessRemote();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test21_lookupStatefulBusinessLocal() {
- try{
+ try {
ejbObject.lookupStatefulBusinessLocal();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test22_lookupStatefulBusinessRemote() {
- try{
+ try {
ejbObject.lookupStatefulBusinessRemote();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test23_lookupJMSConnectionFactory() {
- try{
+ try {
ejbObject.lookupJMSConnectionFactory();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test24_lookupStatefulBusinessLocalBean() {
- try{
+ try {
ejbObject.lookupStatefulBusinessLocalBean();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test25_lookupSingletonBusinessLocal() {
- try{
+ try {
ejbObject.lookupSingletonBusinessLocalBean();
- } catch (TestFailureException e){
+ } catch (final TestFailureException e) {
throw e.error;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonBeanTxTests.java Tue Jul 15 21:55:09 2014
@@ -31,23 +31,22 @@ import org.apache.openejb.test.object.Tr
/**
* [1] Should be run as the first test suite of the SingletonTestClients
- *
*/
-public class SingletonBeanTxTests extends org.apache.openejb.test.NamedTestCase{
+public class SingletonBeanTxTests extends org.apache.openejb.test.NamedTestCase {
public final static String jndiEJBHomeEntry = "client/tests/singleton/BeanManagedTransactionTests/EJBHome";
- protected BeanTxSingletonHome ejbHome;
+ protected BeanTxSingletonHome ejbHome;
protected BeanTxSingletonObject ejbObject;
- protected EJBMetaData ejbMetaData;
- protected HomeHandle ejbHomeHandle;
- protected Handle ejbHandle;
- protected Integer ejbPrimaryKey;
+ protected EJBMetaData ejbMetaData;
+ protected HomeHandle ejbHomeHandle;
+ protected Handle ejbHandle;
+ protected Integer ejbPrimaryKey;
protected InitialContext initialContext;
- public SingletonBeanTxTests(){
+ public SingletonBeanTxTests() {
super("Singleton.BeanManagedTransaction.");
}
@@ -57,15 +56,15 @@ public class SingletonBeanTxTests extend
*/
protected void setUp() throws Exception {
- Properties properties = TestManager.getServer().getContextEnvironment();
+ final 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);
+ final Object obj = initialContext.lookup(jndiEJBHomeEntry);
+ ejbHome = (BeanTxSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BeanTxSingletonHome.class);
ejbObject = ejbHome.create();
/*[2] Create database table */
@@ -84,7 +83,7 @@ public class SingletonBeanTxTests extend
/**
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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.
@@ -94,24 +93,23 @@ public class SingletonBeanTxTests extend
* responsible for the global coordination of the transaction commit.
* </P>
* <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());
+ public void test01_EJBContext_getUserTransaction() {
+ try {
+ final Transaction t = ejbObject.getUserTransaction();
+ assertNotNull("UserTransaction is null.", t);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
- *
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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.
@@ -121,128 +119,128 @@ public class SingletonBeanTxTests extend
* responsible for the global coordination of the transaction commit.
* </P>
* <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();
+ public void test02_java_comp_UserTransaction() {
+ try {
+ final 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());
+ } catch (final 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>
+ * <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>
+ * <p/>
* Test that setRollbackOnly() throws a java.lang.IllegalStateException
* </P>
*/
- public void TODO_test03_EJBContext_setRollbackOnly(){
- try{
+ public void TODO_test03_EJBContext_setRollbackOnly() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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>
+ * <p/>
* Test that getRollbackOnly() throws a java.lang.IllegalStateException
* </P>
*/
- public void TODO_test04_EJBContext_getRollbackOnly(){
- try{
+ public void TODO_test04_EJBContext_getRollbackOnly() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
*
*/
- public void test05_singleTransactionCommit(){
- try{
- Account expected = new Account("123-45-6789","Joe","Cool",40000);
+ public void test05_singleTransactionCommit() {
+ try {
+ final 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() );
+ 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());
+ assertNotNull("The transaction was not commited. The record is null", actual);
+ assertEquals("The transaction was not commited cleanly.", expected, actual);
+ } catch (final RollbackException re) {
+ fail("Transaction was rolledback. Received Exception " + re.getClass() + " : " + re.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
- * This test does work for the IntraVM Server, but it fails on
+ * 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();
+ public void BUG_test06_singleTransactionRollback() {
+ final Account expected = new Account("234-56-7890", "Charlie", "Brown", 20000);
+ final Account actual = new Account();
// Try and add the account in a transaction. This should fail and
// throw a RollbackException
- try{
+ try {
ejbObject.openAccount(expected, new Boolean(true));
- fail( "A javax.transaction.RollbackException should have been thrown." );
- } catch (RollbackException re){
+ fail("A javax.transaction.RollbackException should have been thrown.");
+ } catch (final RollbackException re) {
// Good.
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final 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());
- //}
+
+ //// 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>
+ * <p/>
* The Container must allow the enterprise bean instance to serially perform several transactions in a
* method.
* </P>
*/
- public void TODO_test07_serialTransactions(){
- try{
+ public void TODO_test07_serialTransactions() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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
@@ -250,18 +248,18 @@ public class SingletonBeanTxTests extend
* javax.transaction.NotSupportedException in the begin() method.
* </P>
*/
- public void TODO_test08_nestedTransactions(){
- try{
+ public void TODO_test08_nestedTransactions() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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
@@ -275,17 +273,17 @@ public class SingletonBeanTxTests extend
* </UL>
* </P>
*/
- public void TODO_test09_beginWithNoCommit(){
- try{
+ public void TODO_test09_beginWithNoCommit() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- /**
+ /**
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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
@@ -295,46 +293,46 @@ public class SingletonBeanTxTests extend
* =========================================================================
* 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
+ * <p/>
+ * | IF | AND | THEN
+ * scenario | Client's | Transaction currently | Transaction associated
+ * | transaction | associated with instance | with the method is
* ___________|_____________|__________________________|________________________
- * | | |
- * 1 | none | none | none
+ * | | |
+ * 1 | none | none | none
* ___________|_____________|__________________________|________________________
- * | | |
- * 2 | T1 | none | none
+ * | | |
+ * 2 | T1 | none | none
* ___________|_____________|__________________________|________________________
- * | | |
- * 3 | none | T2 | T2
+ * | | |
+ * 3 | none | T2 | T2
* ___________|_____________|__________________________|________________________
- * | | |
- * 4 | T1 | T2 | T2
+ * | | |
+ * 4 | T1 | T2 | T2
* ___________|_____________|__________________________|________________________
* </PRE>
- * <P>
+ * <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>
+ * <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{
+ public void TODO_test10_scenario1_NoneNone() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
/**
* <B>11.6.1 Bean-managed transaction demarcation</B>
- * <P>
+ * <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
@@ -344,40 +342,40 @@ public class SingletonBeanTxTests extend
* =========================================================================
* 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
+ * <p/>
+ * | IF | AND | THEN
+ * scenario | Client's | Transaction currently | Transaction associated
+ * | transaction | associated with instance | with the method is
* ___________|_____________|__________________________|________________________
- * | | |
- * 1 | none | none | none
+ * | | |
+ * 1 | none | none | none
* ___________|_____________|__________________________|________________________
- * | | |
- * 2 | T1 | none | none
+ * | | |
+ * 2 | T1 | none | none
* ___________|_____________|__________________________|________________________
- * | | |
- * 3 | none | T2 | T2
+ * | | |
+ * 3 | none | T2 | T2
* ___________|_____________|__________________________|________________________
- * | | |
- * 4 | T1 | T2 | T2
+ * | | |
+ * 4 | T1 | T2 | T2
* ___________|_____________|__________________________|________________________
* </PRE>
- * <P>
+ * <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>
+ * <p/>
* Test scenario 2: T1 none<BR>
* </P>
*/
- public void TODO_test11_scenario2_T1None(){
- try{
+ public void TODO_test11_scenario2_T1None() {
+ try {
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}