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 [33/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/SingletonJndiEncTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonJndiEncTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonJndiEncTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonJndiEncTests.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 EncSingletonTestClients
- *
*
* @version $Rev: 532866 $ $Date: 2007-04-26 14:14:11 -0700 (Thu, 26 Apr 2007) $
*/
-public class SingletonJndiEncTests extends SingletonTestClient{
+public class SingletonJndiEncTests extends SingletonTestClient {
- protected EncSingletonHome ejbHome;
+ protected EncSingletonHome ejbHome;
protected EncSingletonObject ejbObject;
-
- public SingletonJndiEncTests(){
+
+ public SingletonJndiEncTests() {
super("JNDI_ENC.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/EncBean");
- ejbHome = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
+ final Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ ejbHome = (EncSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, EncSingletonHome.class);
ejbObject = ejbHome.create();
/*[2] Create database table */
TestManager.getDatabase().createEntityTable();
}
-
+
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
@@ -52,249 +51,250 @@ public class SingletonJndiEncTests 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_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_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_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.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 test25_lookupSingletonBusinessLocalBean() {
- 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/SingletonJndiTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonJndiTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonJndiTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonJndiTests.java Tue Jul 15 21:55:09 2014
@@ -19,33 +19,32 @@ package org.apache.openejb.test.singleto
/**
* [1] Should be run as the first test suite of the BasicSingletonTestClients
- *
- *
+ *
* @version $Rev: 481764 $ $Date: 2006-12-03 04:25:05 -0800 (Sun, 03 Dec 2006) $
*/
-public class SingletonJndiTests extends BasicSingletonTestClient{
+public class SingletonJndiTests extends BasicSingletonTestClient {
- public SingletonJndiTests(){
+ public SingletonJndiTests() {
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/singleton/BasicSingletonHome");
+
+ public void test02_Jndi_lookupHome() {
+ try {
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
assertNotNull("The EJBHome looked up from JNDI is null", obj);
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.class);
assertNotNull("The EJBHome is null after PortableRemoteObject.narrow", ejbHome);
- } catch (Exception e){
+ } catch (final Exception e) {
e.printStackTrace();
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalBusinessIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalBusinessIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalBusinessIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalBusinessIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -19,11 +19,11 @@ package org.apache.openejb.test.singleto
public class SingletonLocalBusinessIntfcTests extends SingletonTestClient {
private BasicSingletonBusinessLocal businessLocal;
- public SingletonLocalBusinessIntfcTests(){
+ public SingletonLocalBusinessIntfcTests() {
super("LocalBusinessIntfc.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
}
@@ -31,27 +31,27 @@ public class SingletonLocalBusinessIntfc
// Test remote interface methods
//
public void test00_lookupBusinessInterface() throws Exception {
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeBusinessLocal");
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeBusinessLocal");
assertNotNull(obj);
assertTrue("instance of BasicSingletonBusinessLocal", obj instanceof BasicSingletonBusinessLocal);
businessLocal = (BasicSingletonBusinessLocal) 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 SingletonLocalBusinessIntfc
* 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 SingletonLocalBusinessIntfc
* 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 SingletonLocalBusinessIntfc
/**
* 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,9 +121,9 @@ public class SingletonLocalBusinessIntfc
//
// Test remote interface methods
//=================================
-
- public void test06_testRemove(){
- Object obj = businessLocal.remove();
+
+ public void test06_testRemove() {
+ final Object obj = businessLocal.remove();
assertNotNull(obj);
}
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -17,105 +17,107 @@
package org.apache.openejb.test.singleton;
import javax.ejb.EJBException;
+
public class SingletonLocalIntfcTests extends BasicSingletonLocalTestClient {
- public SingletonLocalIntfcTests() {
- super("LocalIntfc.");
- }
- protected void setUp() throws Exception{
- super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
- ejbLocalHome = (BasicSingletonLocalHome)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
- * singleton session object. All the singleton 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 SingletonLocalIntfcTests() {
+ super("LocalIntfc.");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
+ ejbLocalHome = (BasicSingletonLocalHome) 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
+ * singleton session object. All the singleton 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/singleton/SingletonLocalTestSuite.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalTestSuite.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalTestSuite.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonLocalTestSuite.java Tue Jul 15 21:55:09 2014
@@ -24,12 +24,12 @@ import org.apache.openejb.test.FilteredT
*/
public class SingletonLocalTestSuite extends junit.framework.TestCase {
- public SingletonLocalTestSuite(String name) {
+ public SingletonLocalTestSuite(final String name) {
super(name);
}
public static junit.framework.Test suite() {
- TestSuite suite = new FilteredTestSuite();
+ final TestSuite suite = new FilteredTestSuite();
suite.addTest(new SingletonJndiTests());
suite.addTest(new SingletonPojoLocalJndiTests());
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoContextLookupTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoContextLookupTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoContextLookupTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoContextLookupTests.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 EncSingletonTestClients
- *
*/
-public class SingletonPojoContextLookupTests extends SingletonTestClient{
+public class SingletonPojoContextLookupTests extends SingletonTestClient {
- protected EncSingletonHome ejbHome;
+ protected EncSingletonHome ejbHome;
protected EncSingletonObject ejbObject;
- public SingletonPojoContextLookupTests(){
+ public SingletonPojoContextLookupTests() {
super("JNDI_ENC.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/ContextLookupSingletonPojoBean");
- ejbHome = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, EncSingletonHome.class);
+ final Object obj = initialContext.lookup("client/tests/singleton/ContextLookupSingletonPojoBean");
+ ejbHome = (EncSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, EncSingletonHome.class);
ejbObject = ejbHome.create();
/*[2] Create database table */
@@ -50,7 +49,7 @@ public class SingletonPojoContextLookupT
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 SingletonPojoContextLookupT
}
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 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/singleton/SingletonPojoEjbHomeTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbHomeTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbHomeTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbHomeTests.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 BasicSingletonTestClients
- *
*/
public class SingletonPojoEjbHomeTests extends BasicSingletonTestClient {
- public SingletonPojoEjbHomeTests(){
+ public SingletonPojoEjbHomeTests() {
super("PojoEJBHome.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.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 SingletonPojoEjbHomeTests 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 SingletonPojoEjbHomeTests 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/singleton/SingletonPojoEjbLocalHomeTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbLocalHomeTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbLocalHomeTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbLocalHomeTests.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 BasicSingletonTestClients
- *
*/
public class SingletonPojoEjbLocalHomeTests extends BasicSingletonLocalTestClient {
- public SingletonPojoEjbLocalHomeTests(){
+ public SingletonPojoEjbLocalHomeTests() {
super("PojoEJBLocalHome.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
ejbLocalHome = (BasicSingletonLocalHome) initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
}
@@ -43,14 +42,14 @@ public class SingletonPojoEjbLocalHomeTe
* 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 SingletonPojoEjbLocalHomeTe
* 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/singleton/SingletonPojoEjbLocalObjectTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbLocalObjectTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbLocalObjectTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbLocalObjectTests.java Tue Jul 15 21:55:09 2014
@@ -27,10 +27,10 @@ public class SingletonPojoEjbLocalObject
protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext
- .lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
+ final Object obj = initialContext
+ .lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
ejbLocalHome = (BasicSingletonLocalHome) javax.rmi.PortableRemoteObject
- .narrow(obj, BasicSingletonLocalHome.class);
+ .narrow(obj, BasicSingletonLocalHome.class);
ejbLocalObject = ejbLocalHome.create();
}
@@ -44,16 +44,16 @@ public class SingletonPojoEjbLocalObject
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 SingletonPojoEjbLocalObject
*/
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 SingletonPojoEjbLocalObject
ejbLocalObject.remove();
// you can't really remove a singleton 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/singleton/SingletonPojoEjbMetaDataTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbMetaDataTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbMetaDataTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbMetaDataTests.java Tue Jul 15 21:55:09 2014
@@ -20,42 +20,43 @@ import javax.ejb.EJBHome;
public class SingletonPojoEjbMetaDataTests extends BasicSingletonTestClient {
- public SingletonPojoEjbMetaDataTests() {
- super("PojoEjbMetaData");
- }
-
- protected void setUp() throws Exception{
+ public SingletonPojoEjbMetaDataTests() {
+ super("PojoEjbMetaData");
+ }
+
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.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 , BasicSingletonHome.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, BasicSingletonHome.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,43 +67,43 @@ public class SingletonPojoEjbMetaDataTes
* 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 , BasicSingletonObject.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, BasicSingletonObject.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_isSingletonSession(){
- try{
+ public void test06_isSingletonSession() {
+ try {
// TODO: hopefully an isSingletonSession() method will get added to the EJB 3.1 API
- assertTrue( "EJBMetaData says this is not a singleton session bean", !ejbMetaData.isStatelessSession() );
- } catch (Exception e){
- fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ assertTrue("EJBMetaData says this is not a singleton 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/singleton/SingletonPojoEjbObjectTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbObjectTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbObjectTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoEjbObjectTests.java Tue Jul 15 21:55:09 2014
@@ -35,7 +35,7 @@ public class SingletonPojoEjbObjectTests
protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.class);
ejbObject = ejbHome.createObject();
}
@@ -58,9 +58,9 @@ public class SingletonPojoEjbObjectTests
*/
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 SingletonPojoEjbObjectTests
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 SingletonPojoEjbObjectTests
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 SingletonPojoEjbObjectTests
ejbObject.remove();
// you can't really remove a singleton 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 SingletonPojoEjbObjectTests
*/
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/singleton/SingletonPojoHandleTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHandleTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHandleTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHandleTests.java Tue Jul 15 21:55:09 2014
@@ -26,7 +26,7 @@ public class SingletonPojoHandleTests ex
protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.class);
ejbObject = ejbHome.createObject();
ejbHandle = ejbObject.getHandle();
@@ -42,10 +42,10 @@ public class SingletonPojoHandleTests 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 SingletonPojoHandleTests ex
ejbHome.remove(ejbHandle);
// you can't really remove a singleton 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/singleton/SingletonPojoHomeHandleTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHomeHandleTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHomeHandleTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHomeHandleTests.java Tue Jul 15 21:55:09 2014
@@ -20,26 +20,26 @@ import javax.ejb.EJBHome;
public class SingletonPojoHomeHandleTests extends BasicSingletonTestClient {
- public SingletonPojoHomeHandleTests() {
- super("PojoHomeHandle.");
+ public SingletonPojoHomeHandleTests() {
+ super("PojoHomeHandle.");
}
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.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/singleton/SingletonPojoHomeIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHomeIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHomeIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoHomeIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -19,30 +19,29 @@ package org.apache.openejb.test.singleto
/**
* [2] Should be run as the second test suite of the BasicSingletonTestClients
- *
- *
+ *
* @version $Rev: 525022 $ $Date: 2007-04-02 21:19:21 -0700 (Mon, 02 Apr 2007) $
*/
public class SingletonPojoHomeIntfcTests extends BasicSingletonTestClient {
- public SingletonPojoHomeIntfcTests(){
+ public SingletonPojoHomeIntfcTests() {
super("HomeIntfc.");
}
-
- protected void setUp() throws Exception{
+
+ protected void setUp() throws Exception {
super.setUp();
final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
- ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.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 (final 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/singleton/SingletonPojoLocalHomeIntfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoLocalHomeIntfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoLocalHomeIntfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoLocalHomeIntfcTests.java Tue Jul 15 21:55:09 2014
@@ -19,31 +19,30 @@ package org.apache.openejb.test.singleto
/**
* [2] Should be run as the second test suite of the BasicSingletonTestClients
- *
- *
+ *
* @version $Rev: 450640 $ $Date: 2006-09-27 16:58:13 -0700 (Wed, 27 Sep 2006) $
*/
public class SingletonPojoLocalHomeIntfcTests extends BasicSingletonLocalTestClient {
- public SingletonPojoLocalHomeIntfcTests(){
+ public SingletonPojoLocalHomeIntfcTests() {
super("PojoLocalHomeIntfc.");
}
-
- protected void setUp() throws Exception{
+
+ protected void setUp() throws Exception {
super.setUp();
ejbLocalHome = (BasicSingletonLocalHome) initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
}
-
+
//===============================
// 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/singleton/SingletonPojoLocalJndiTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoLocalJndiTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoLocalJndiTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoLocalJndiTests.java Tue Jul 15 21:55:09 2014
@@ -17,31 +17,30 @@
package org.apache.openejb.test.singleton;
/**
- *
* @version $Rev: 450640 $ $Date: 2006-09-27 16:58:13 -0700 (Wed, 27 Sep 2006) $
*/
public class SingletonPojoLocalJndiTests extends BasicSingletonLocalTestClient {
-
- public SingletonPojoLocalJndiTests(){
+
+ public SingletonPojoLocalJndiTests() {
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 = (BasicSingletonLocalHome) initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
+ public void test02_Jndi_lookupHome() {
+ try {
+ // Here we use the Java casting as what is done while looking-up a local bean
+ ejbLocalHome = (BasicSingletonLocalHome) initialContext.lookup("client/tests/singleton/BasicSingletonPojoHomeLocal");
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/singleton/SingletonPojoRemoteIntrfcTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteIntrfcTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteIntrfcTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteIntrfcTests.java Tue Jul 15 21:55:09 2014
@@ -18,100 +18,99 @@ package org.apache.openejb.test.singleto
public class SingletonPojoRemoteIntrfcTests extends BasicSingletonTestClient {
- public SingletonPojoRemoteIntrfcTests() {
- super("PojoRemoteIntfc.");
- }
-
- protected void setUp() throws Exception{
- super.setUp();
- Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.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
- * singleton session object. All the singleton 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 SingletonPojoRemoteIntrfcTests() {
+ super("PojoRemoteIntfc.");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.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
+ * singleton session object. All the singleton 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();
+ }
}
Modified: tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteJndiTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteJndiTests.java?rev=1610862&r1=1610861&r2=1610862&view=diff
==============================================================================
--- tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteJndiTests.java (original)
+++ tomee/tomee/trunk/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonPojoRemoteJndiTests.java Tue Jul 15 21:55:09 2014
@@ -18,25 +18,25 @@ package org.apache.openejb.test.singleto
public class SingletonPojoRemoteJndiTests extends BasicSingletonTestClient {
- public SingletonPojoRemoteJndiTests(){
+ public SingletonPojoRemoteJndiTests() {
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/singleton/BasicSingletonPojoHome");
- ejbHome = (BasicSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicSingletonHome.class);
+ public void test02_Jndi_lookupHome() {
+ try {
+ final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonPojoHome");
+ ejbHome = (BasicSingletonHome) javax.rmi.PortableRemoteObject.narrow(obj, BasicSingletonHome.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());
}
}