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 [41/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/stateless/StatelessJndiEncTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiEncTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiEncTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiEncTests.java Tue Jul 15 21:55:09 2014
@@ -21,29 +21,28 @@ import org.apache.openejb.test.TestManag
/**
* [4] Should be run as the fourth test suite of the EncStatelessTestClients
- *
*
* @version $Rev$ $Date$
*/
-public class StatelessJndiEncTests extends StatelessTestClient{
+public class StatelessJndiEncTests extends StatelessTestClient {
- protected EncStatelessHome ejbHome;
+ protected EncStatelessHome ejbHome;
protected EncStatelessObject ejbObject;
-
- public StatelessJndiEncTests(){
+
+ public StatelessJndiEncTests() {
super("JNDI_ENC.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/EncBean");
- ejbHome = (EncStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, EncStatelessHome.class);
+ final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
+ ejbHome = (EncStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, EncStatelessHome.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.
@@ -52,249 +51,250 @@ public class StatelessJndiEncTests exten
try {
/*[1] Drop database table */
TestManager.getDatabase().dropEntityTable();
- } catch (Exception e){
+ } catch (final Exception e) {
throw e;
} finally {
super.tearDown();
}
}
-
+
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{
+
+ public void test02_lookupDoubleEntry() {
+ 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{
+
+ public void test03_lookupLongEntry() {
+ 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{
+
+ public void test04_lookupFloatEntry() {
+ 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{
+
+ public void test06_lookupShortEntry() {
+ 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{
+
+ public void test08_lookupByteEntry() {
+ 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_lookupStatelessBean() {
- try{
+ try {
ejbObject.lookupStatelessBean();
- } 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_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 test16_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_lookupStatelessBusinessLocal() {
- try{
+ try {
ejbObject.lookupStatelessBusinessLocal();
- } 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_lookupStatelessBusinessRemote() {
- try{
+ try {
ejbObject.lookupStatelessBusinessRemote();
- } 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_lookupStatelessBusinessLocalBean() {
- try{
+ try {
ejbObject.lookupStatelessBusinessLocalBean();
- } 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_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());
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessJndiTests.java Tue Jul 15 21:55:09 2014
@@ -19,31 +19,30 @@ package org.apache.openejb.test.stateles
/**
* [1] Should be run as the first test suite of the BasicStatelessTestClients
- *
- *
+ *
* @version $Rev$ $Date$
*/
-public class StatelessJndiTests extends BasicStatelessTestClient{
+public class StatelessJndiTests extends BasicStatelessTestClient {
- public StatelessJndiTests(){
+ public StatelessJndiTests() {
super("JNDI.");
}
- public void test01_initialContext(){
- try{
+ public void test01_initialContext() {
+ try {
assertNotNull("The InitialContext reference is null.", initialContext);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
-
- public void test02_Jndi_lookupHome(){
- try{
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessHome");
- ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+
+ public void test02_Jndi_lookupHome() {
+ try {
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessHome");
+ ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
assertNotNull("The EJBHome is null", ejbHome);
- } 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/stateless/StatelessLocalBusinessIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -19,11 +19,11 @@ package org.apache.openejb.test.stateles
public class StatelessLocalBusinessIntfcTests extends StatelessTestClient {
private BasicStatelessBusinessLocal businessLocal;
- public StatelessLocalBusinessIntfcTests(){
+ public StatelessLocalBusinessIntfcTests() {
super("LocalBusinessIntfc.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
}
@@ -31,27 +31,27 @@ public class StatelessLocalBusinessIntfc
// Test remote interface methods
//
public void test00_lookupBusinessInterface() throws Exception {
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeBusinessLocal");
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeBusinessLocal");
assertNotNull(obj);
assertTrue("instance of BasicStatelessBusinessLocal", obj instanceof BasicStatelessBusinessLocal);
businessLocal = (BasicStatelessBusinessLocal) obj;
}
- public void test01_businessMethod(){
- try{
- String expected = "Success";
- String actual = businessLocal.businessMethod("sseccuS");
+ public void test01_businessMethod() {
+ try {
+ final String expected = "Success";
+ final String actual = businessLocal.businessMethod("sseccuS");
assertEquals(expected, actual);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- try{
- Integer expected = new Integer(42);
- Object actual = businessLocal.echo(expected);
+ try {
+ final Integer expected = new Integer(42);
+ final Object actual = businessLocal.echo(expected);
assertSame("pass by reference", expected, actual);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -59,14 +59,14 @@ public class StatelessLocalBusinessIntfc
* Throw an application exception and make sure the exception
* reaches the bean nicely.
*/
- public void test02_throwApplicationException(){
- try{
+ public void test02_throwApplicationException() {
+ try {
businessLocal.throwApplicationException();
- } catch (org.apache.openejb.test.ApplicationException e){
+ } catch (final org.apache.openejb.test.ApplicationException e) {
//Good. This is the correct behaviour
return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
fail("An ApplicationException should have been thrown.");
}
@@ -75,28 +75,28 @@ public class StatelessLocalBusinessIntfc
* After an application exception we should still be able to
* use our bean
*/
- public void test03_invokeAfterApplicationException(){
- try{
- String expected = "Success";
- String actual = businessLocal.businessMethod("sseccuS");
+ public void test03_invokeAfterApplicationException() {
+ try {
+ final String expected = "Success";
+ final String actual = businessLocal.businessMethod("sseccuS");
assertEquals(expected, actual);
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
// TODO: check which exception should be thrown
- public void _test04_throwSystemException(){
- try{
+ public void _test04_throwSystemException() {
+ try {
businessLocal.throwSystemException_NullPointer();
- } catch (Exception e){
+ } catch (final Exception e) {
//Good, so far.
- Throwable n = e.getCause();
- assertNotNull("Nested exception should not be is null", n );
- assertTrue("Nested exception should be an instance of NullPointerException, but exception is "+n.getClass().getName(), (n instanceof NullPointerException));
+ final Throwable n = e.getCause();
+ assertNotNull("Nested exception should not be is null", n);
+ assertTrue("Nested exception should be an instance of NullPointerException, but exception is " + n.getClass().getName(), (n instanceof NullPointerException));
return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
fail("A NullPointerException should have been thrown.");
}
@@ -104,11 +104,11 @@ public class StatelessLocalBusinessIntfc
/**
* After a system exception the intance should be garbage collected
* and the remote reference should be invalidated.
- *
+ * <p/>
* This one seems to fail. we should double-check the spec on this.
*/
//TODO: implement
- public void TODO_test05_invokeAfterSystemException(){
+ public void TODO_test05_invokeAfterSystemException() {
// try{
// businessLocal.businessMethod("This refernce is invalid");
// fail("A java.rmi.NoSuchObjectException should have been thrown.");
@@ -121,24 +121,24 @@ public class StatelessLocalBusinessIntfc
//
// Test remote interface methods
//=================================
-
- public void test06_testRemove(){
- Object obj = businessLocal.remove();
+
+ public void test06_testRemove() {
+ final Object obj = businessLocal.remove();
assertNotNull(obj);
}
-
+
/**
* Throw an (annotated) application exception and make sure the exception
* reaches the bean nicely.
*/
- public void test07_throwAnnotatedApplicationException(){
- try{
+ public void test07_throwAnnotatedApplicationException() {
+ try {
businessLocal.throwAnnotatedApplicationException();
- } catch (org.apache.openejb.test.AnnotatedApplicationException e){
+ } catch (final org.apache.openejb.test.AnnotatedApplicationException e) {
//Good. This is the correct behaviour
return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
fail("An AnnotatedApplicationException should have been thrown.");
}
@@ -147,13 +147,13 @@ public class StatelessLocalBusinessIntfc
* After an (annotated) application exception we should still be able to
* use our bean
*/
- public void test08_invokeAfterAnnotatedApplicationException(){
- try{
- String expected = "Success";
- String actual = businessLocal.businessMethod("sseccuS");
+ public void test08_invokeAfterAnnotatedApplicationException() {
+ try {
+ final String expected = "Success";
+ final String actual = businessLocal.businessMethod("sseccuS");
assertEquals(expected, actual);
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -17,105 +17,107 @@
package org.apache.openejb.test.stateless;
import javax.ejb.EJBException;
+
public class StatelessLocalIntfcTests extends BasicStatelessLocalTestClient {
- public StatelessLocalIntfcTests() {
- super("LocalIntfc.");
- }
- protected void setUp() throws Exception{
- super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
- ejbLocalHome = (BasicStatelessLocalHome)obj;
- ejbLocalObject = ejbLocalHome.create();
- }
-
- //=================================
- // Test local interface methods
- //
- public void test01_businessMethod(){
- try{
- String expected = "Success";
- String actual = ejbLocalObject.businessMethod("sseccuS");
- assertEquals(expected, actual);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- }
-
- /**
- * Throw an application exception in the bean and make sure the exception
- * reaches the client nicely.
- */
- public void test02_throwApplicationException(){
- try{
- ejbLocalObject.throwApplicationException();
- } catch (org.apache.openejb.test.ApplicationException e){
- //Good. This is the correct behaviour
- return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- fail("An ApplicationException should have been thrown.");
- }
-
- /**
- * After an application exception we should still be able to
- * use our bean
- */
- public void test03_invokeAfterApplicationException(){
- try{
- String expected = "Success";
- String actual = ejbLocalObject.businessMethod("sseccuS");
- assertEquals(expected, actual);
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- }
-
- public void test04_throwSystemException(){
- try{
- ejbLocalObject.throwSystemException_NullPointer();
- } catch (EJBException e){
- //Good, so far.
-
- assertNotNull("Nested exception should not be is null", e );
- assertTrue("Nested exception should be an instance of NullPointerException, but exception is "+e.getCausedByException().getClass().getName(), (e.getCausedByException() instanceof NullPointerException));
- return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- fail("An EJBException encapsulating a NullPointerException should have been thrown.");
- }
-
- /**
- * After a system exception the intance should be garbage collected
- * but this is invisible to the client as it will just use another
- * stateless session object. All the stateless session objects are
- * equal. Refer 4.5.3 in EJB 3.0 core specification.
- * This one seems to fail. we should double-check the spec on this.
- */
- public void test05_invokeAfterSystemException(){
- try{
- String expected = "Success";
- String actual = ejbLocalObject.businessMethod("sseccuS");
- assertEquals(expected, actual);
-
- } catch (Exception e){
- fail("The business method should have been executed.");
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- }
- //
- // Test remote interface methods
- //=================================
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- //TODO Tests for the below conditions need to be added.
- /* Test an Application Exception that is a runtime exception
+ public StatelessLocalIntfcTests() {
+ super("LocalIntfc.");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
+ ejbLocalHome = (BasicStatelessLocalHome) obj;
+ ejbLocalObject = ejbLocalHome.create();
+ }
+
+ //=================================
+ // Test local interface methods
+ //
+ public void test01_businessMethod() {
+ try {
+ final String expected = "Success";
+ final String actual = ejbLocalObject.businessMethod("sseccuS");
+ assertEquals(expected, actual);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ }
+
+ /**
+ * Throw an application exception in the bean and make sure the exception
+ * reaches the client nicely.
+ */
+ public void test02_throwApplicationException() {
+ try {
+ ejbLocalObject.throwApplicationException();
+ } catch (final org.apache.openejb.test.ApplicationException e) {
+ //Good. This is the correct behaviour
+ return;
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ fail("An ApplicationException should have been thrown.");
+ }
+
+ /**
+ * After an application exception we should still be able to
+ * use our bean
+ */
+ public void test03_invokeAfterApplicationException() {
+ try {
+ final String expected = "Success";
+ final String actual = ejbLocalObject.businessMethod("sseccuS");
+ assertEquals(expected, actual);
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ }
+
+ public void test04_throwSystemException() {
+ try {
+ ejbLocalObject.throwSystemException_NullPointer();
+ } catch (final EJBException e) {
+ //Good, so far.
+
+ assertNotNull("Nested exception should not be is null", e);
+ assertTrue("Nested exception should be an instance of NullPointerException, but exception is " + e.getCausedByException().getClass().getName(), (e.getCausedByException() instanceof NullPointerException));
+ return;
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ fail("An EJBException encapsulating a NullPointerException should have been thrown.");
+ }
+
+ /**
+ * After a system exception the intance should be garbage collected
+ * but this is invisible to the client as it will just use another
+ * stateless session object. All the stateless session objects are
+ * equal. Refer 4.5.3 in EJB 3.0 core specification.
+ * This one seems to fail. we should double-check the spec on this.
+ */
+ public void test05_invokeAfterSystemException() {
+ try {
+ final String expected = "Success";
+ final String actual = ejbLocalObject.businessMethod("sseccuS");
+ assertEquals(expected, actual);
+
+ } catch (final Exception e) {
+ fail("The business method should have been executed.");
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ }
+ //
+ // Test remote interface methods
+ //=================================
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ //TODO Tests for the below conditions need to be added.
+ /* Test an Application Exception that is a runtime exception
* Throwing an application exception within a transaction
* will rollback only if that method is marked for rollback
* Also FinderException, CreateException and RemoveException
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java Tue Jul 15 21:55:09 2014
@@ -24,12 +24,12 @@ import org.apache.openejb.test.FilteredT
*/
public class StatelessLocalTestSuite extends junit.framework.TestCase {
- public StatelessLocalTestSuite(String name) {
+ public StatelessLocalTestSuite(final String name) {
super(name);
}
public static junit.framework.Test suite() {
- TestSuite suite = new FilteredTestSuite();
+ final TestSuite suite = new FilteredTestSuite();
suite.addTest(new StatelessJndiTests());
suite.addTest(new StatelessPojoLocalJndiTests());
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoContextLookupTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoContextLookupTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoContextLookupTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoContextLookupTests.java Tue Jul 15 21:55:09 2014
@@ -21,21 +21,20 @@ import org.apache.openejb.test.TestFailu
/**
* [4] Should be run as the fourth test suite of the EncStatelessTestClients
- *
*/
-public class StatelessPojoContextLookupTests extends StatelessTestClient{
+public class StatelessPojoContextLookupTests extends StatelessTestClient {
- protected EncStatelessHome ejbHome;
+ protected EncStatelessHome ejbHome;
protected EncStatelessObject ejbObject;
- public StatelessPojoContextLookupTests(){
+ public StatelessPojoContextLookupTests() {
super("JNDI_ENC.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/ContextLookupStatelessPojoBean");
- ejbHome = (EncStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, EncStatelessHome.class);
+ final Object obj = initialContext.lookup("client/tests/stateless/ContextLookupStatelessPojoBean");
+ ejbHome = (EncStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, EncStatelessHome.class);
ejbObject = ejbHome.create();
/*[2] Create database table */
@@ -50,7 +49,7 @@ public class StatelessPojoContextLookupT
try {
/*[1] Drop database table */
TestManager.getDatabase().dropEntityTable();
- } catch (Exception e){
+ } catch (final Exception e) {
throw e;
} finally {
super.tearDown();
@@ -58,172 +57,172 @@ public class StatelessPojoContextLookupT
}
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_lookupStatelessBean() {
- try{
+ try {
ejbObject.lookupStatelessBean();
- } 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 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());
}
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbHomeTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbHomeTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbHomeTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbHomeTests.java Tue Jul 15 21:55:09 2014
@@ -21,38 +21,37 @@ import javax.ejb.RemoveException;
/**
* [3] Should be run as the third test suite of the BasicStatelessTestClients
- *
*/
public class StatelessPojoEjbHomeTests extends BasicStatelessTestClient {
- public StatelessPojoEjbHomeTests(){
+ public StatelessPojoEjbHomeTests() {
super("PojoEJBHome.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
- ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
}
//===============================
// Test ejb home methods
//
- public void test01_getEJBMetaData(){
- try{
- EJBMetaData ejbMetaData = ejbHome.getEJBMetaData();
- assertNotNull( "EJBMetaData is null", ejbMetaData );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void test01_getEJBMetaData() {
+ try {
+ final EJBMetaData ejbMetaData = ejbHome.getEJBMetaData();
+ assertNotNull("EJBMetaData is null", ejbMetaData);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test02_getHomeHandle(){
- try{
+ public void test02_getHomeHandle() {
+ try {
ejbHomeHandle = ejbHome.getHomeHandle();
- assertNotNull("The HomeHandle is null", ejbHomeHandle );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ assertNotNull("The HomeHandle is null", ejbHomeHandle);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -61,14 +60,14 @@ public class StatelessPojoEjbHomeTests e
* 5.3.2 Removing a session object
* A client may remove a session object using the remove() method on the javax.ejb.EJBObject
* interface, or the remove(Handle handle) method of the javax.ejb.EJBHome interface.
- *
+ * <p/>
* Because session objects do not have primary keys that are accessible to clients, invoking the
* javax.ejb.EJBHome.remove(Object primaryKey) method on a session results in the
* javax.ejb.RemoveException.
- *
+ * <p/>
* ------------------------------------
* 5.5 Session object identity
- *
+ * <p/>
* Session objects are intended to be private resources used only by the
* client that created them. For this reason, session objects, from the
* client's perspective, appear anonymous. In contrast to entity objects,
@@ -79,25 +78,25 @@ public class StatelessPojoEjbHomeTests e
* method is invoked on a EJBMetaData object for a Session bean, the method throws
* the java.lang.RuntimeException.
* ------------------------------------
- *
+ * <p/>
* Sections 5.3.2 and 5.5 conflict. 5.3.2 says to throw javax.ejb.RemoveException, 5.5 says to
* throw java.rmi.RemoteException.
- *
+ * <p/>
* For now, we are going with java.rmi.RemoteException.
* ==============================================================================================
* TODO - MNour: Please add related sections from EJB3.0 Core contracts and requirements specification
- * (Sections: 3.6.2.2, 3.6.3.2 and 3.6.5)
+ * (Sections: 3.6.2.2, 3.6.3.2 and 3.6.5)
*/
- public void test03_removeByPrimaryKey(){
- try{
+ public void test03_removeByPrimaryKey() {
+ try {
ejbHome.remove("primaryKey");
- } catch (RemoveException e){
- assertTrue( true );
+ } catch (final RemoveException e) {
+ assertTrue(true);
return;
- } catch (Exception e){
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " instead of javax.ejb.RemoveException : " + e.getMessage());
}
- assertTrue("javax.ejb.RemoveException should have been thrown", false );
+ assertTrue("javax.ejb.RemoveException should have been thrown", false);
}
//
// Test ejb home methods
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalHomeTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalHomeTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalHomeTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalHomeTests.java Tue Jul 15 21:55:09 2014
@@ -21,15 +21,14 @@ import javax.ejb.RemoveException;
/**
* [3] Should be run as the third test suite of the BasicStatelessTestClients
- *
*/
public class StatelessPojoEjbLocalHomeTests extends BasicStatelessLocalTestClient {
- public StatelessPojoEjbLocalHomeTests(){
+ public StatelessPojoEjbLocalHomeTests() {
super("PojoEJBLocalHome.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
ejbLocalHome = (BasicStatelessLocalHome) initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
}
@@ -43,14 +42,14 @@ public class StatelessPojoEjbLocalHomeTe
* 5.3.2 Removing a session object
* A client may remove a session object using the remove() method on the javax.ejb.EJBObject
* interface, or the remove(Handle handle) method of the javax.ejb.EJBHome interface.
- *
+ * <p/>
* Because session objects do not have primary keys that are accessible to clients, invoking the
* javax.ejb.EJBHome.remove(Object primaryKey) method on a session results in the
* javax.ejb.RemoveException.
- *
+ * <p/>
* ------------------------------------
* 5.5 Session object identity
- *
+ * <p/>
* Session objects are intended to be private resources used only by the
* client that created them. For this reason, session objects, from the
* client's perspective, appear anonymous. In contrast to entity objects,
@@ -61,25 +60,25 @@ public class StatelessPojoEjbLocalHomeTe
* method is invoked on a EJBMetaData object for a Session bean, the method throws
* the java.lang.RuntimeException.
* ------------------------------------
- *
+ * <p/>
* Sections 5.3.2 and 5.5 conflict. 5.3.2 says to throw javax.ejb.RemoveException, 5.5 says to
* throw java.rmi.RemoteException.
- *
+ * <p/>
* For now, we are going with java.rmi.RemoteException.
* ==============================================================================================
* TODO - MNour: Please add related sections from EJB3.0 Core contracts and requirements specification
- * (Sections: 3.6.2.2, 3.6.3.2 and 3.6.5)
+ * (Sections: 3.6.2.2, 3.6.3.2 and 3.6.5)
*/
- public void test03_removeByPrimaryKey(){
- try{
+ public void test03_removeByPrimaryKey() {
+ try {
ejbLocalHome.remove("primaryKey");
- } catch (RemoveException e){
- assertTrue( true );
+ } catch (final RemoveException e) {
+ assertTrue(true);
return;
- } catch (Exception e){
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " instead of javax.ejb.RemoveException : " + e.getMessage());
}
- assertTrue("javax.ejb.RemoveException should have been thrown", false );
+ assertTrue("javax.ejb.RemoveException should have been thrown", false);
}
//
// Test ejb local-home methods
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalObjectTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalObjectTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalObjectTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbLocalObjectTests.java Tue Jul 15 21:55:09 2014
@@ -27,10 +27,10 @@ public class StatelessPojoEjbLocalObject
protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext
- .lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
+ final Object obj = initialContext
+ .lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
ejbLocalHome = (BasicStatelessLocalHome) javax.rmi.PortableRemoteObject
- .narrow(obj, BasicStatelessLocalHome.class);
+ .narrow(obj, BasicStatelessLocalHome.class);
ejbLocalObject = ejbLocalHome.create();
}
@@ -44,16 +44,16 @@ public class StatelessPojoEjbLocalObject
public void test01_isIdentical() {
try {
assertTrue("The EJBLocalObjects are not equal", ejbLocalObject.isIdentical(ejbLocalObject));
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
public void test02_getEjbLocalHome() {
try {
- EJBLocalHome localHome = ejbLocalObject.getEJBLocalHome();
+ final EJBLocalHome localHome = ejbLocalObject.getEJBLocalHome();
assertNotNull("The EJBLocalHome is null", localHome);
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -73,11 +73,11 @@ public class StatelessPojoEjbLocalObject
*/
public void test03_getPrimaryKey() {
try {
- Object key = ejbLocalObject.getPrimaryKey();
- } catch (javax.ejb.EJBException e) {
+ final Object key = ejbLocalObject.getPrimaryKey();
+ } catch (final javax.ejb.EJBException e) {
assertTrue(true);
return;
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("A RuntimeException should have been thrown. Received Exception " + e.getClass() + " : " + e.getMessage());
}
fail("A RuntimeException should have been thrown.");
@@ -88,7 +88,7 @@ public class StatelessPojoEjbLocalObject
ejbLocalObject.remove();
// you can't really remove a stateless handle
ejbLocalObject.businessMethod("Should not throw an exception");
- } catch (Exception e) {
+ } 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/stateless/StatelessPojoEjbMetaDataTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbMetaDataTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbMetaDataTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbMetaDataTests.java Tue Jul 15 21:55:09 2014
@@ -20,42 +20,43 @@ import javax.ejb.EJBHome;
public class StatelessPojoEjbMetaDataTests extends BasicStatelessTestClient {
- public StatelessPojoEjbMetaDataTests() {
- super("PojoEjbMetaData");
- }
-
- protected void setUp() throws Exception{
+ public StatelessPojoEjbMetaDataTests() {
+ super("PojoEjbMetaData");
+ }
+
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
- ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
ejbMetaData = ejbHome.getEJBMetaData();
}
//=================================
// Test meta data methods
//
- public void test01_getEJBHome(){
- try{
+ public void test01_getEJBHome() {
+ try {
- EJBHome home = ejbMetaData.getEJBHome();
- assertNotNull( "The EJBHome is null", home );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final EJBHome home = ejbMetaData.getEJBHome();
+ assertNotNull("The EJBHome is null", home);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test02_getHomeInterfaceClass(){
- try{
- Class clazz = ejbMetaData.getHomeInterfaceClass();
- assertNotNull( "The Home Interface class is null", clazz );
- assertEquals(clazz , BasicStatelessHome.class);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void test02_getHomeInterfaceClass() {
+ try {
+ final Class clazz = ejbMetaData.getHomeInterfaceClass();
+ assertNotNull("The Home Interface class is null", clazz);
+ assertEquals(clazz, BasicStatelessHome.class);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
+
/**
* Session object identity
- *
+ * <p/>
* Session objects are intended to be private resources used only by the
* client that created them. For this reason, session objects, from the
* client's perspective, appear anonymous. In contrast to entity objects,
@@ -66,42 +67,42 @@ public class StatelessPojoEjbMetaDataTes
* method is invoked on a EJBMetaData object for a Session bean, the method throws
* the java.lang.RuntimeException.
*/
- public void test03_getPrimaryKeyClass(){
- try{
- Class clazz = ejbMetaData.getPrimaryKeyClass();
- assertNull("Should not return a primary key. Method should throw an java.lang.RuntimeException", clazz );
- } catch (UnsupportedOperationException e){
- assertTrue( true );
+ public void test03_getPrimaryKeyClass() {
+ try {
+ final Class clazz = ejbMetaData.getPrimaryKeyClass();
+ assertNull("Should not return a primary key. Method should throw an java.lang.RuntimeException", clazz);
+ } catch (final UnsupportedOperationException e) {
+ assertTrue(true);
return;
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- assertTrue( "Method should throw an java.lang.RuntimeException", false );
+ assertTrue("Method should throw an java.lang.RuntimeException", false);
}
- public void test04_getRemoteInterfaceClass(){
- try{
- Class clazz = ejbMetaData.getRemoteInterfaceClass();
- assertNotNull( "The Remote Interface class is null", clazz );
- assertEquals(clazz , BasicStatelessObject.class);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void test04_getRemoteInterfaceClass() {
+ try {
+ final Class clazz = ejbMetaData.getRemoteInterfaceClass();
+ assertNotNull("The Remote Interface class is null", clazz);
+ assertEquals(clazz, BasicStatelessObject.class);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test05_isSession(){
- try{
- assertTrue( "EJBMetaData says this is not a session bean", ejbMetaData.isSession() );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void test05_isSession() {
+ try {
+ assertTrue("EJBMetaData says this is not a session bean", ejbMetaData.isSession());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test06_isStatelessSession(){
- try{
- assertTrue( "EJBMetaData says this is not a stateless session bean", ejbMetaData.isStatelessSession() );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void test06_isStatelessSession() {
+ try {
+ assertTrue("EJBMetaData says this is not a stateless session bean", ejbMetaData.isStatelessSession());
+ } 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/stateless/StatelessPojoEjbObjectTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbObjectTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbObjectTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoEjbObjectTests.java Tue Jul 15 21:55:09 2014
@@ -35,7 +35,7 @@ public class StatelessPojoEjbObjectTests
protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
ejbObject = ejbHome.createObject();
}
@@ -58,9 +58,9 @@ public class StatelessPojoEjbObjectTests
*/
public void test01_getEjbHome() {
try {
- EJBHome home = ejbObject.getEJBHome();
+ final EJBHome home = ejbObject.getEJBHome();
assertNotNull("The EJBHome is null", home);
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -72,7 +72,7 @@ public class StatelessPojoEjbObjectTests
try {
ejbHandle = ejbObject.getHandle();
assertNotNull("The Handle is null", ejbHandle);
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -91,7 +91,7 @@ public class StatelessPojoEjbObjectTests
otherEJBObject = ejbHome.createObject();
assertTrue("The EJBObjects are not identical", ejbObject.isIdentical(ejbObject));
assertTrue("The EJBObject and the OtherEJBObject are not identical", ejbObject.isIdentical(otherEJBObject));
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -105,7 +105,7 @@ public class StatelessPojoEjbObjectTests
ejbObject.remove();
// you can't really remove a stateless handle
ejbObject.businessMethod("Should not throw an exception");
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -115,13 +115,13 @@ public class StatelessPojoEjbObjectTests
*/
public void test05_getPrimaryKey() {
try {
- Object key = ejbObject.getPrimaryKey();
- } catch (java.rmi.RemoteException e) {
+ final Object key = ejbObject.getPrimaryKey();
+ } catch (final java.rmi.RemoteException e) {
assertTrue(true);
return;
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("A RuntimeException should have been thrown. Received Exception "
- + e.getClass() + " : " + e.getMessage());
+ + e.getClass() + " : " + e.getMessage());
}
fail("A RuntimeException should have been thrown.");
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java Tue Jul 15 21:55:09 2014
@@ -26,7 +26,7 @@ public class StatelessPojoHandleTests ex
protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
ejbObject = ejbHome.createObject();
ejbHandle = ejbObject.getHandle();
@@ -42,10 +42,10 @@ public class StatelessPojoHandleTests ex
public void test01_getEJBObject() {
try {
- EJBObject object = ejbHandle.getEJBObject();
+ final EJBObject object = ejbHandle.getEJBObject();
assertNotNull("The EJBObject is null", object);
assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
- } catch (Exception e) {
+ } catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
@@ -69,7 +69,7 @@ public class StatelessPojoHandleTests ex
ejbHome.remove(ejbHandle);
// you can't really remove a stateless handle
ejbObject.businessMethod("Should not throw an exception");
- } catch (Exception e) {
+ } 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/stateless/StatelessPojoHomeHandleTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHomeHandleTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHomeHandleTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHomeHandleTests.java Tue Jul 15 21:55:09 2014
@@ -20,26 +20,26 @@ import javax.ejb.EJBHome;
public class StatelessPojoHomeHandleTests extends BasicStatelessTestClient {
- public StatelessPojoHomeHandleTests() {
- super("PojoHomeHandle.");
+ public StatelessPojoHomeHandleTests() {
+ super("PojoHomeHandle.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
- ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
ejbHomeHandle = ejbHome.getHomeHandle();
}
-
+
//=================================
// Test home handle methods
//
- public void test01_getEJBHome(){
- try{
- EJBHome home = ejbHomeHandle.getEJBHome();
- assertNotNull( "The EJBHome is null", home );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void test01_getEJBHome() {
+ try {
+ final EJBHome home = ejbHomeHandle.getEJBHome();
+ assertNotNull("The EJBHome is null", home);
+ } 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/stateless/StatelessPojoHomeIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHomeIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHomeIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHomeIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -19,30 +19,29 @@ package org.apache.openejb.test.stateles
/**
* [2] Should be run as the second test suite of the BasicStatelessTestClients
- *
- *
+ *
* @version $Rev$ $Date$
*/
public class StatelessPojoHomeIntfcTests extends BasicStatelessTestClient {
- public StatelessPojoHomeIntfcTests(){
+ public StatelessPojoHomeIntfcTests() {
super("HomeIntfc.");
}
-
- protected void setUp() throws Exception{
+
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
- ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
}
-
+
//===============================
// Test home interface methods
//
- public void test01_create(){
- try{
+ public void test01_create() {
+ try {
ejbObject = ejbHome.createObject();
- assertNotNull( "The EJBObject is null", ejbObject );
- } catch (Exception e){
+ assertNotNull("The EJBObject is null", ejbObject);
+ } 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/stateless/StatelessPojoLocalHomeIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalHomeIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalHomeIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalHomeIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -19,31 +19,30 @@ package org.apache.openejb.test.stateles
/**
* [2] Should be run as the second test suite of the BasicStatelessTestClients
- *
- *
+ *
* @version $Rev$ $Date$
*/
public class StatelessPojoLocalHomeIntfcTests extends BasicStatelessLocalTestClient {
- public StatelessPojoLocalHomeIntfcTests(){
+ public StatelessPojoLocalHomeIntfcTests() {
super("PojoLocalHomeIntfc.");
}
-
- protected void setUp() throws Exception{
+
+ protected void setUp() throws Exception {
super.setUp();
ejbLocalHome = (BasicStatelessLocalHome) initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
}
-
+
//===============================
// Test home interface methods
//
- public void test01_create(){
- try{
+ public void test01_create() {
+ try {
ejbLocalObject = ejbLocalHome.create();
- assertNotNull( "The EJBObject is null", ejbLocalObject );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
+ assertNotNull("The EJBObject is null", ejbLocalObject);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
}
//
// Test home interface methods
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalJndiTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalJndiTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalJndiTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoLocalJndiTests.java Tue Jul 15 21:55:09 2014
@@ -17,31 +17,30 @@
package org.apache.openejb.test.stateless;
/**
- *
* @version $Rev$ $Date$
*/
public class StatelessPojoLocalJndiTests extends BasicStatelessLocalTestClient {
-
- public StatelessPojoLocalJndiTests(){
+
+ public StatelessPojoLocalJndiTests() {
super("LocalJNDI.");
}
- public void test01_initialContext(){
- try{
+ public void test01_initialContext() {
+ try {
assertNotNull("The InitialContext reference is null.", initialContext);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
- public void test02_Jndi_lookupHome(){
- try{
- // Here we use the Java casting as what is done while looking-up a local bean
- ejbLocalHome = (BasicStatelessLocalHome) initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
+ public void test02_Jndi_lookupHome() {
+ try {
+ // Here we use the Java casting as what is done while looking-up a local bean
+ ejbLocalHome = (BasicStatelessLocalHome) initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeLocal");
assertNotNull("The EJBLocalHome is null", ejbLocalHome);
- } 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/stateless/StatelessPojoRemoteIntrfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoRemoteIntrfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoRemoteIntrfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoRemoteIntrfcTests.java Tue Jul 15 21:55:09 2014
@@ -18,100 +18,99 @@ package org.apache.openejb.test.stateles
public class StatelessPojoRemoteIntrfcTests extends BasicStatelessTestClient {
- public StatelessPojoRemoteIntrfcTests() {
- super("PojoRemoteIntfc.");
- }
-
- protected void setUp() throws Exception{
- super.setUp();
- Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
- ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
- ejbObject = ejbHome.createObject();
- }
-
- //=================================
- // Test remote interface methods
- //
- public void test01_businessMethod(){
- try{
- String expected = "Success";
- String actual = ejbObject.businessMethod("sseccuS");
- assertEquals(expected, actual);
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- }
-
- /**
- * Throw an application exception and make sure the exception
- * reaches the bean nicely.
- */
- public void test02_throwApplicationException(){
- try{
- ejbObject.throwApplicationException();
- } catch (org.apache.openejb.test.ApplicationException e){
- assertTrue(true);
- return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- fail("An ApplicationException should have been thrown.");
- }
-
- /**
- * After an application exception we should still be able to
- * use our bean
- */
- public void test03_invokeAfterApplicationException(){
- try{
- String expected = "Success";
- String actual = ejbObject.businessMethod("sseccuS");
- assertEquals(expected, actual);
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- }
-
- public void test04_throwSystemException(){
- try{
- ejbObject.throwSystemException_NullPointer();
- } catch (java.rmi.RemoteException e){
- //Good, so far.
- Throwable n = e.detail;
- assertNotNull("Nested exception should not be is null", n );
- assertTrue("Nested exception should be an instance of NullPointerException, but exception is "+n.getClass().getName(), (n instanceof NullPointerException));
- return;
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- fail("A NullPointerException should have been thrown.");
- }
-
- /**
- * After a system exception the intance should be garbage collected
- * but this is invisible to the client as it will just use another
- * stateless session object. All the stateless session objects are
- * equal. Refer 4.5.3 in EJB 3.0 core specification.
- *
- */
-
- public void test05_invokeAfterSystemException(){
- try{
- String expected = "Success";
- String actual = ejbObject.businessMethod("sseccuS");
- assertEquals(expected, actual);
-
- } catch (Exception e){
- fail("The business method should have been executed.");
- } catch (Throwable e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
- }
- }
- //
- // Test remote interface methods
- //=================================
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+ public StatelessPojoRemoteIntrfcTests() {
+ super("PojoRemoteIntfc.");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ ejbHome = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicStatelessHome.class);
+ ejbObject = ejbHome.createObject();
+ }
+
+ //=================================
+ // Test remote interface methods
+ //
+ public void test01_businessMethod() {
+ try {
+ final String expected = "Success";
+ final String actual = ejbObject.businessMethod("sseccuS");
+ assertEquals(expected, actual);
+ } catch (final Exception e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ }
+
+ /**
+ * Throw an application exception and make sure the exception
+ * reaches the bean nicely.
+ */
+ public void test02_throwApplicationException() {
+ try {
+ ejbObject.throwApplicationException();
+ } catch (final org.apache.openejb.test.ApplicationException e) {
+ assertTrue(true);
+ return;
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ fail("An ApplicationException should have been thrown.");
+ }
+
+ /**
+ * After an application exception we should still be able to
+ * use our bean
+ */
+ public void test03_invokeAfterApplicationException() {
+ try {
+ final String expected = "Success";
+ final String actual = ejbObject.businessMethod("sseccuS");
+ assertEquals(expected, actual);
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ }
+
+ public void test04_throwSystemException() {
+ try {
+ ejbObject.throwSystemException_NullPointer();
+ } catch (final java.rmi.RemoteException e) {
+ //Good, so far.
+ final Throwable n = e.detail;
+ assertNotNull("Nested exception should not be is null", n);
+ assertTrue("Nested exception should be an instance of NullPointerException, but exception is " + n.getClass().getName(), (n instanceof NullPointerException));
+ return;
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ fail("A NullPointerException should have been thrown.");
+ }
+
+ /**
+ * After a system exception the intance should be garbage collected
+ * but this is invisible to the client as it will just use another
+ * stateless session object. All the stateless session objects are
+ * equal. Refer 4.5.3 in EJB 3.0 core specification.
+ */
+
+ public void test05_invokeAfterSystemException() {
+ try {
+ final String expected = "Success";
+ final String actual = ejbObject.businessMethod("sseccuS");
+ assertEquals(expected, actual);
+
+ } catch (final Exception e) {
+ fail("The business method should have been executed.");
+ } catch (final Throwable e) {
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ }
+ //
+ // Test remote interface methods
+ //=================================
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
}