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/07 21:07:53 UTC
svn commit: r1608563 [15/38] - in /tomee/tomee/branches/tomee-1.7.x/itests:
failover-ejb/src/main/java/org/apache/openejb/itest/failover/ejb/
failover/src/main/java/org/apache/openejb/itest/failover/
failover/src/main/java/org/apache/openejb/server/con...
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulBean.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulBean.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulBean.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulBean.java Mon Jul 7 19:07:41 2014
@@ -54,14 +54,15 @@ public class EncStatefulBean implements
//=============================
// Home interface methods
//
+
/**
* Maps to EncStatefulHome.create
*
* @param name
- * @exception javax.ejb.CreateException
+ * @throws javax.ejb.CreateException
* @see EncStatefulHome#create
*/
- public void ejbCreate(String name) throws CreateException{
+ public void ejbCreate(final String name) throws CreateException {
this.name = name;
}
//
@@ -73,461 +74,461 @@ public class EncStatefulBean implements
// Remote interface methods
//
- public void lookupEntityBean() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupEntityBean() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicBmpHome home = (BasicBmpHome) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/bmp_entity"), BasicBmpHome.class );
- Assert.assertNotNull("The EJBHome looked up is null",home);
+ final BasicBmpHome home = (BasicBmpHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/bmp_entity"), BasicBmpHome.class);
+ Assert.assertNotNull("The EJBHome looked up is null", home);
- BasicBmpObject object = home.createObject("Enc Bean");
- Assert.assertNotNull("The EJBObject is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicBmpObject object = home.createObject("Enc Bean");
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBean() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatefulBean() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/stateful"), BasicStatefulHome.class );
- Assert.assertNotNull("The EJBHome looked up is null",home);
+ final BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/stateful"), BasicStatefulHome.class);
+ Assert.assertNotNull("The EJBHome looked up is null", home);
- BasicStatefulObject object = home.createObject("Enc Bean");
- Assert.assertNotNull("The EJBObject is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicStatefulObject object = home.createObject("Enc Bean");
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBean() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatelessBean() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/stateless"), BasicStatelessHome.class );
- Assert.assertNotNull("The EJBHome looked up is null",home);
+ final BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/stateless"), BasicStatelessHome.class);
+ Assert.assertNotNull("The EJBHome looked up is null", home);
- BasicStatelessObject object = home.createObject();
- Assert.assertNotNull("The EJBObject is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicStatelessObject object = home.createObject();
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBusinessLocal() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatelessBusinessLocal() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Object o = ctx.lookup("java:comp/env/stateful/beanReferences/stateless-business-local");
- BasicStatelessBusinessLocal object = (BasicStatelessBusinessLocal) o;
- Assert.assertNotNull("The EJB BusinessLocal is null", object );
- } catch (Exception e){
+ final Object o = ctx.lookup("java:comp/env/stateful/beanReferences/stateless-business-local");
+ final BasicStatelessBusinessLocal object = (BasicStatelessBusinessLocal) o;
+ Assert.assertNotNull("The EJB BusinessLocal is null", object);
+ } catch (final Exception e) {
e.printStackTrace();
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBusinessLocalBean() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatelessBusinessLocalBean() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Object o = ctx.lookup("java:comp/env/stateful/beanReferences/stateless-business-localbean");
- BasicStatelessPojoBean object = (BasicStatelessPojoBean) o;
- Assert.assertNotNull("The EJB BusinessLocalBean is null", object );
- } catch (Exception e){
+ final Object o = ctx.lookup("java:comp/env/stateful/beanReferences/stateless-business-localbean");
+ final BasicStatelessPojoBean object = (BasicStatelessPojoBean) o;
+ Assert.assertNotNull("The EJB BusinessLocalBean is null", object);
+ } catch (final Exception e) {
e.printStackTrace();
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBusinessRemote() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatelessBusinessRemote() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/stateless-business-remote"), BasicStatelessBusinessRemote.class );
- Assert.assertNotNull("The EJB BusinessRemote is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/stateless-business-remote"), BasicStatelessBusinessRemote.class);
+ Assert.assertNotNull("The EJB BusinessRemote is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBusinessLocal() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatefulBusinessLocal() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/stateful-business-local"), BasicStatefulBusinessLocal.class );
- Assert.assertNotNull("The EJB BusinessLocal is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/stateful-business-local"), BasicStatefulBusinessLocal.class);
+ Assert.assertNotNull("The EJB BusinessLocal is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBusinessLocalBean() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatefulBusinessLocalBean() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicStatefulPojoBean object = (BasicStatefulPojoBean) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/stateful-business-localbean"), BasicStatefulPojoBean.class );
- Assert.assertNotNull("The EJB BusinessLocalBean is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicStatefulPojoBean object = (BasicStatefulPojoBean) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/stateful-business-localbean"), BasicStatefulPojoBean.class);
+ Assert.assertNotNull("The EJB BusinessLocalBean is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBusinessRemote() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStatefulBusinessRemote() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) javax.rmi.PortableRemoteObject.narrow( ctx.lookup("java:comp/env/stateful/beanReferences/stateful-business-remote"), BasicStatefulBusinessRemote.class );
- Assert.assertNotNull("The EJB BusinessRemote is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateful/beanReferences/stateful-business-remote"), BasicStatefulBusinessRemote.class);
+ Assert.assertNotNull("The EJB BusinessRemote is null", object);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStringEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupStringEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- String expected = new String("1");
- String actual = (String)ctx.lookup("java:comp/env/stateful/references/String");
+ final String expected = new String("1");
+ final String actual = (String) ctx.lookup("java:comp/env/stateful/references/String");
- Assert.assertNotNull("The String looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The String looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupDoubleEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupDoubleEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Double expected = new Double(1.0D);
- Double actual = (Double)ctx.lookup("java:comp/env/stateful/references/Double");
+ final Double expected = new Double(1.0D);
+ final Double actual = (Double) ctx.lookup("java:comp/env/stateful/references/Double");
- Assert.assertNotNull("The Double looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Double looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupLongEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupLongEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Long expected = new Long(1L);
- Long actual = (Long)ctx.lookup("java:comp/env/stateful/references/Long");
+ final Long expected = new Long(1L);
+ final Long actual = (Long) ctx.lookup("java:comp/env/stateful/references/Long");
- Assert.assertNotNull("The Long looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Long looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupFloatEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupFloatEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Float expected = new Float(1.0F);
- Float actual = (Float)ctx.lookup("java:comp/env/stateful/references/Float");
+ final Float expected = new Float(1.0F);
+ final Float actual = (Float) ctx.lookup("java:comp/env/stateful/references/Float");
- Assert.assertNotNull("The Float looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Float looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupIntegerEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupIntegerEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Integer expected = new Integer(1);
- Integer actual = (Integer)ctx.lookup("java:comp/env/stateful/references/Integer");
+ final Integer expected = new Integer(1);
+ final Integer actual = (Integer) ctx.lookup("java:comp/env/stateful/references/Integer");
- Assert.assertNotNull("The Integer looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Integer looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupShortEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupShortEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Short expected = new Short((short)1);
- Short actual = (Short)ctx.lookup("java:comp/env/stateful/references/Short");
+ final Short expected = new Short((short) 1);
+ final Short actual = (Short) ctx.lookup("java:comp/env/stateful/references/Short");
- Assert.assertNotNull("The Short looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Short looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupBooleanEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupBooleanEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Boolean expected = new Boolean(true);
- Boolean actual = (Boolean)ctx.lookup("java:comp/env/stateful/references/Boolean");
+ final Boolean expected = new Boolean(true);
+ final Boolean actual = (Boolean) ctx.lookup("java:comp/env/stateful/references/Boolean");
- Assert.assertNotNull("The Boolean looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Boolean looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupByteEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupByteEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Byte expected = new Byte((byte)1);
- Byte actual = (Byte)ctx.lookup("java:comp/env/stateful/references/Byte");
+ final Byte expected = new Byte((byte) 1);
+ final Byte actual = (Byte) ctx.lookup("java:comp/env/stateful/references/Byte");
- Assert.assertNotNull("The Byte looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Byte looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupCharacterEntry() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
- Assert.assertNotNull("The InitialContext is null", ctx );
+ public void lookupCharacterEntry() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
- Character expected = new Character('D');
- Character actual = (Character)ctx.lookup("java:comp/env/stateful/references/Character");
+ final Character expected = new Character('D');
+ final Character actual = (Character) ctx.lookup("java:comp/env/stateful/references/Character");
- Assert.assertNotNull("The Character looked up is null", actual );
- Assert.assertEquals(expected, actual );
+ Assert.assertNotNull("The Character looked up is null", actual);
+ Assert.assertEquals(expected, actual);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupResource() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
+ public void lookupResource() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- Object obj = ctx.lookup("java:comp/env/datasource");
+ final Object obj = ctx.lookup("java:comp/env/datasource");
Assert.assertNotNull("The DataSource is null", obj);
Assert.assertTrue("Not an instance of DataSource", obj instanceof DataSource);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupJMSConnectionFactory() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
+ public void lookupJMSConnectionFactory() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
Object obj = ctx.lookup("java:comp/env/jms");
Assert.assertNotNull("The JMS ConnectionFactory is null", obj);
Assert.assertTrue("Not an instance of ConnectionFactory", obj instanceof ConnectionFactory);
- ConnectionFactory connectionFactory = (ConnectionFactory) obj;
+ final ConnectionFactory connectionFactory = (ConnectionFactory) obj;
testJmsConnection(connectionFactory.createConnection());
obj = ctx.lookup("java:comp/env/TopicCF");
Assert.assertNotNull("The JMS TopicConnectionFactory is null", obj);
Assert.assertTrue("Not an instance of TopicConnectionFactory", obj instanceof TopicConnectionFactory);
- TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) obj;
+ final TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) obj;
testJmsConnection(topicConnectionFactory.createConnection());
obj = ctx.lookup("java:comp/env/QueueCF");
Assert.assertNotNull("The JMS QueueConnectionFactory is null", obj);
Assert.assertTrue("Not an instance of QueueConnectionFactory", obj instanceof QueueConnectionFactory);
- QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) obj;
+ final QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) obj;
testJmsConnection(queueConnectionFactory.createConnection());
- } catch (Exception e){
+ } catch (final Exception e) {
e.printStackTrace();
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- private void testJmsConnection(Connection connection) throws JMSException {
- Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
- Topic topic = session.createTopic("test");
- MessageProducer producer = session.createProducer(topic);
+ private void testJmsConnection(final Connection connection) throws JMSException {
+ final Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+ final Topic topic = session.createTopic("test");
+ final MessageProducer producer = session.createProducer(topic);
producer.send(session.createMessage());
producer.close();
session.close();
connection.close();
}
- public void lookupPersistenceUnit() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
+ public void lookupPersistenceUnit() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- EntityManagerFactory emf = (EntityManagerFactory)ctx.lookup("java:comp/env/persistence/TestUnit");
- Assert.assertNotNull("The EntityManagerFactory is null", emf );
+ final EntityManagerFactory emf = (EntityManagerFactory) ctx.lookup("java:comp/env/persistence/TestUnit");
+ Assert.assertNotNull("The EntityManagerFactory is null", emf);
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupPersistenceContext() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
+ public void lookupPersistenceContext() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- EntityManager em = (EntityManager)ctx.lookup("java:comp/env/persistence/TestContext");
+ final EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/TestContext");
Assert.assertNotNull("The EntityManager is null", em);
// call a do nothing method to assure entity manager actually exists
em.getFlushMode();
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupSessionContext() throws TestFailureException{
- try{
- try{
- InitialContext ctx = new InitialContext();
+ public void lookupSessionContext() throws TestFailureException {
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
// lookup in enc
- SessionContext sctx = (SessionContext)ctx.lookup("java:comp/env/sessioncontext");
- Assert.assertNotNull("The SessionContext got from java:comp/env/sessioncontext is null", sctx );
+ final SessionContext sctx = (SessionContext) ctx.lookup("java:comp/env/sessioncontext");
+ Assert.assertNotNull("The SessionContext got from java:comp/env/sessioncontext is null", sctx);
// lookup using global name
- EJBContext ejbCtx = (EJBContext)ctx.lookup("java:comp/EJBContext");
- Assert.assertNotNull("The SessionContext got from java:comp/EJBContext is null ", ejbCtx );
+ final EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
+ Assert.assertNotNull("The SessionContext got from java:comp/EJBContext is null ", ejbCtx);
// verify context was set via legacy set method
- Assert.assertNotNull("The SessionContext is null from setter method", ejbContext );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ Assert.assertNotNull("The SessionContext is null from setter method", ejbContext);
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
-
- public String remove(String arg) {
+
+ public String remove(final String arg) {
return arg;
}
@@ -539,34 +540,38 @@ public class EncStatefulBean implements
//=================================
// SessionBean interface methods
//
+
/**
* Set the associated session context. The container calls this method
* after the instance creation.
*/
- public void setSessionContext(SessionContext ctx) throws EJBException,RemoteException {
+ public void setSessionContext(final SessionContext ctx) throws EJBException, RemoteException {
ejbContext = ctx;
}
+
/**
* A container invokes this method before it ends the life of the session
* object. This happens as a result of a client's invoking a remove
* operation, or when a container decides to terminate the session object
* after a timeout.
*/
- public void ejbRemove() throws EJBException,RemoteException {
+ public void ejbRemove() throws EJBException, RemoteException {
}
+
/**
* The activate method is called when the instance is activated
* from its "passive" state. The instance should acquire any resource
* that it has released earlier in the ejbPassivate() method.
*/
- public void ejbActivate() throws EJBException,RemoteException {
+ public void ejbActivate() throws EJBException, RemoteException {
}
+
/**
* The passivate method is called before the instance enters
* the "passive" state. The instance should release any resources that
* it can re-acquire later in the ejbActivate() method.
*/
- public void ejbPassivate() throws EJBException,RemoteException {
+ public void ejbPassivate() throws EJBException, RemoteException {
}
//
// SessionBean interface methods
@@ -576,26 +581,29 @@ public class EncStatefulBean implements
//============================================
// SessionSynchronization interface methods
//
+
/**
* The afterBegin method notifies a session Bean instance that a new
* transaction has started, and that the subsequent business methods on the
* instance will be invoked in the context of the transaction.
*/
- public void afterBegin() throws EJBException,RemoteException {
+ public void afterBegin() throws EJBException, RemoteException {
}
+
/**
* The beforeCompletion method notifies a session Bean instance that
* a transaction is about to be committed. The instance can use this
* method, for example, to write any cached data to a database.
*/
- public void beforeCompletion() throws EJBException,RemoteException {
+ public void beforeCompletion() throws EJBException, RemoteException {
}
+
/**
* The afterCompletion method notifies a session Bean instance that a
* transaction commit protocol has completed, and tells the instance
* whether the transaction has been committed or rolled back.
*/
- public void afterCompletion(boolean committed) throws EJBException,RemoteException {
+ public void afterCompletion(final boolean committed) throws EJBException, RemoteException {
}
//
// SessionSynchronization interface methods
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulHome.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulHome.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulHome.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulHome.java Mon Jul 7 19:07:41 2014
@@ -20,5 +20,5 @@ package org.apache.openejb.test.stateful
public interface EncStatefulHome extends javax.ejb.EJBHome {
public EncStatefulObject create(String name)
- throws javax.ejb.CreateException, java.rmi.RemoteException;
+ throws javax.ejb.CreateException, java.rmi.RemoteException;
}
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulObject.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulObject.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulObject.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/EncStatefulObject.java Mon Jul 7 19:07:41 2014
@@ -20,32 +20,52 @@ import java.rmi.RemoteException;
import org.apache.openejb.test.TestFailureException;
-public interface EncStatefulObject extends javax.ejb.EJBObject{
-
- public void lookupEntityBean() throws TestFailureException, RemoteException;
- public void lookupStatefulBean() throws TestFailureException, RemoteException;
+public interface EncStatefulObject extends javax.ejb.EJBObject {
+
+ public void lookupEntityBean() throws TestFailureException, RemoteException;
+
+ public void lookupStatefulBean() throws TestFailureException, RemoteException;
+
public void lookupStatelessBean() throws TestFailureException, RemoteException;
public void lookupStatelessBusinessLocal() throws TestFailureException, RemoteException;
+
public void lookupStatelessBusinessLocalBean() throws TestFailureException, RemoteException;
+
public void lookupStatelessBusinessRemote() throws TestFailureException, RemoteException;
+
public void lookupStatefulBusinessLocal() throws TestFailureException, RemoteException;
+
public void lookupStatefulBusinessLocalBean() throws TestFailureException, RemoteException;
+
public void lookupStatefulBusinessRemote() throws TestFailureException, RemoteException;
public void lookupResource() throws TestFailureException, RemoteException;
+
public void lookupJMSConnectionFactory() throws TestFailureException, RemoteException;
+
public void lookupPersistenceUnit() throws TestFailureException, RemoteException;
+
public void lookupPersistenceContext() throws TestFailureException, RemoteException;
- public void lookupSessionContext() throws TestFailureException,RemoteException;
- public void lookupStringEntry() throws TestFailureException, RemoteException;
- public void lookupDoubleEntry() throws TestFailureException, RemoteException;
- public void lookupLongEntry() throws TestFailureException, RemoteException;
- public void lookupFloatEntry() throws TestFailureException, RemoteException;
+
+ public void lookupSessionContext() throws TestFailureException, RemoteException;
+
+ public void lookupStringEntry() throws TestFailureException, RemoteException;
+
+ public void lookupDoubleEntry() throws TestFailureException, RemoteException;
+
+ public void lookupLongEntry() throws TestFailureException, RemoteException;
+
+ public void lookupFloatEntry() throws TestFailureException, RemoteException;
+
public void lookupIntegerEntry() throws TestFailureException, RemoteException;
- public void lookupShortEntry() throws TestFailureException, RemoteException;
+
+ public void lookupShortEntry() throws TestFailureException, RemoteException;
+
public void lookupBooleanEntry() throws TestFailureException, RemoteException;
- public void lookupByteEntry() throws TestFailureException, RemoteException;
- public void lookupCharacterEntry() throws TestFailureException, RemoteException;
+
+ public void lookupByteEntry() throws TestFailureException, RemoteException;
+
+ public void lookupCharacterEntry() throws TestFailureException, RemoteException;
}
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/FieldInjectionStatefulBean.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/FieldInjectionStatefulBean.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/FieldInjectionStatefulBean.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/FieldInjectionStatefulBean.java Mon Jul 7 19:07:41 2014
@@ -85,7 +85,7 @@ public class FieldInjectionStatefulBean
* @throws javax.ejb.CreateException
* @see EncStatefulHome#create
*/
- public void ejbCreate(String name) throws CreateException {
+ public void ejbCreate(final String name) throws CreateException {
this.name = name;
}
//
@@ -99,7 +99,7 @@ public class FieldInjectionStatefulBean
public void lookupEntityBean() throws TestFailureException {
try {
Assert.assertNotNull("The EJBObject is null", bmpHome);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -107,7 +107,7 @@ public class FieldInjectionStatefulBean
public void lookupStatefulBean() throws TestFailureException {
try {
Assert.assertNotNull("The EJBObject is null", statefulHome);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -115,155 +115,155 @@ public class FieldInjectionStatefulBean
public void lookupStatelessBean() throws TestFailureException {
try {
Assert.assertNotNull("The EJBObject is null", statelessHome);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBusinessLocal() throws TestFailureException{
- try{
- Assert.assertNotNull("The EJB BusinessLocal is null", statelessBusinessLocal );
- } catch (AssertionFailedError afe){
+ public void lookupStatelessBusinessLocal() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJB BusinessLocal is null", statelessBusinessLocal);
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBusinessLocalBean() throws TestFailureException{
- try{
- Assert.assertNotNull("The EJB BusinessLocalBean is null", statelessBusinessLocalBean );
- } catch (AssertionFailedError afe){
+ public void lookupStatelessBusinessLocalBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJB BusinessLocalBean is null", statelessBusinessLocalBean);
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatelessBusinessRemote() throws TestFailureException{
- try{
- Assert.assertNotNull("The EJB BusinessRemote is null", statelessBusinessRemote );
- } catch (AssertionFailedError afe){
+ public void lookupStatelessBusinessRemote() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJB BusinessRemote is null", statelessBusinessRemote);
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBusinessLocal() throws TestFailureException{
- try{
- Assert.assertNotNull("The EJB BusinessLocal is null", statefulBusinessLocal );
- } catch (AssertionFailedError afe){
+ public void lookupStatefulBusinessLocal() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJB BusinessLocal is null", statefulBusinessLocal);
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBusinessLocalBean() throws TestFailureException{
- try{
- Assert.assertNotNull("The EJB BusinessLocalBean is null", statefulBusinessLocalBean );
- } catch (AssertionFailedError afe){
+ public void lookupStatefulBusinessLocalBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJB BusinessLocalBean is null", statefulBusinessLocalBean);
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupStatefulBusinessRemote() throws TestFailureException{
- try{
- Assert.assertNotNull("The EJB BusinessRemote is null", statefulBusinessRemote );
- } catch (AssertionFailedError afe){
+ public void lookupStatefulBusinessRemote() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJB BusinessRemote is null", statefulBusinessRemote);
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupStringEntry() throws TestFailureException {
try {
- String expected = new String("1");
+ final String expected = new String("1");
Assert.assertNotNull("The String looked up is null", striing);
Assert.assertEquals(expected, striing);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupDoubleEntry() throws TestFailureException {
try {
- Double expected = new Double(1.0D);
+ final Double expected = new Double(1.0D);
Assert.assertNotNull("The Double looked up is null", doouble);
Assert.assertEquals(expected, doouble);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupLongEntry() throws TestFailureException {
try {
- Long expected = new Long(1L);
+ final Long expected = new Long(1L);
Assert.assertNotNull("The Long looked up is null", loong);
Assert.assertEquals(expected, loong);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupFloatEntry() throws TestFailureException {
try {
- Float expected = new Float(1.0F);
+ final Float expected = new Float(1.0F);
Assert.assertNotNull("The Float looked up is null", flooat);
Assert.assertEquals(expected, flooat);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupIntegerEntry() throws TestFailureException {
try {
- Integer expected = new Integer(1);
+ final Integer expected = new Integer(1);
Assert.assertNotNull("The Integer looked up is null", inteeger);
Assert.assertEquals(expected, inteeger);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupShortEntry() throws TestFailureException {
try {
- Short expected = new Short((short) 1);
+ final Short expected = new Short((short) 1);
Assert.assertNotNull("The Short looked up is null", shoort);
Assert.assertEquals(expected, shoort);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupBooleanEntry() throws TestFailureException {
try {
- Boolean expected = new Boolean(true);
+ final Boolean expected = new Boolean(true);
Assert.assertNotNull("The Boolean looked up is null", booolean);
Assert.assertEquals(expected, booolean);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupByteEntry() throws TestFailureException {
try {
- Byte expected = new Byte((byte) 1);
+ final Byte expected = new Byte((byte) 1);
Assert.assertNotNull("The Byte looked up is null", byyte);
Assert.assertEquals(expected, byyte);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
public void lookupCharacterEntry() throws TestFailureException {
try {
- Character expected = new Character('D');
+ final Character expected = new Character('D');
Assert.assertNotNull("The Character looked up is null", chaaracter);
Assert.assertEquals(expected, chaaracter);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -271,30 +271,30 @@ public class FieldInjectionStatefulBean
public void lookupResource() throws TestFailureException {
try {
Assert.assertNotNull("The DataSource is null", daataSource);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- public void lookupJMSConnectionFactory() throws TestFailureException{
- try{
- try{
+ public void lookupJMSConnectionFactory() throws TestFailureException {
+ try {
+ try {
testJmsConnection(coonnectionFactory.createConnection());
testJmsConnection(queueCoonnectionFactory.createConnection());
testJmsConnection(topicCoonnectionFactory.createConnection());
- } catch (Exception e){
+ } catch (final Exception e) {
e.printStackTrace();
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
- private void testJmsConnection(javax.jms.Connection connection) throws JMSException {
- Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
- Topic topic = session.createTopic("test");
- MessageProducer producer = session.createProducer(topic);
+ private void testJmsConnection(final javax.jms.Connection connection) throws JMSException {
+ final Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+ final Topic topic = session.createTopic("test");
+ final MessageProducer producer = session.createProducer(topic);
producer.send(session.createMessage());
producer.close();
session.close();
@@ -304,7 +304,7 @@ public class FieldInjectionStatefulBean
public void lookupPersistenceUnit() throws TestFailureException {
try {
Assert.assertNotNull("The EntityManagerFactory is null", emf);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -316,10 +316,10 @@ public class FieldInjectionStatefulBean
try {
// call a do nothing method to assure entity manager actually exists
em.getFlushMode();
- } catch (Exception e) {
+ } catch (final Exception e) {
Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -328,7 +328,7 @@ public class FieldInjectionStatefulBean
try {
// TODO: DMB: Can't seem to find where to make this work
// Assert.assertNotNull("The SessionContext is null", ejbContext);
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
@@ -343,10 +343,10 @@ public class FieldInjectionStatefulBean
public void ejbRemove() throws EJBException, RemoteException {
}
- public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {
+ public void setSessionContext(final SessionContext sessionContext) throws EJBException, RemoteException {
}
-
- public String remove(String arg) {
+
+ public String remove(final String arg) {
return arg;
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/PersistenceContextStatefulBean.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/PersistenceContextStatefulBean.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/PersistenceContextStatefulBean.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/PersistenceContextStatefulBean.java Mon Jul 7 19:07:41 2014
@@ -39,32 +39,32 @@ public class PersistenceContextStatefulB
private SessionContext ejbContext;
@Resource
- public void setSessionContext(SessionContext ctx) {
+ public void setSessionContext(final SessionContext ctx) {
ejbContext = ctx;
}
@Remove
- public void remove(){
+ public void remove() {
}
-
- public String remove(String arg) {
+
+ public String remove(final String arg) {
return arg;
}
-
+
public void testPersistenceContext() throws TestFailureException {
- try{
- try{
- InitialContext ctx = new InitialContext();
+ try {
+ try {
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- EntityManager em = (EntityManager)ctx.lookup("java:comp/env/persistence/TestContext");
+ final EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/TestContext");
Assert.assertNotNull("The EntityManager is null", em);
// call a do nothing method to assure entity manager actually exists
em.getFlushMode();
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ } catch (final Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe){
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -72,9 +72,9 @@ public class PersistenceContextStatefulB
public void testExtendedPersistenceContext() throws TestFailureException {
try {
try {
- InitialContext ctx = new InitialContext();
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/ExtendedTestContext");
+ final EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/ExtendedTestContext");
Assert.assertNotNull("The EntityManager is null", em);
// call a do nothing method to assure entity manager actually exists
@@ -82,26 +82,26 @@ public class PersistenceContextStatefulB
if (extendedEntityManager != null) {
Assert.assertSame("Extended entity manager should be the same instance that was found last time",
- extendedEntityManager,
- em);
+ extendedEntityManager,
+ em);
Assert.assertSame("Extended entity manager delegate should be the same instance that was found last time",
- extendedEntityManager.getDelegate(),
- em.getDelegate());
+ extendedEntityManager.getDelegate(),
+ em.getDelegate());
}
extendedEntityManager = em;
- UserTransaction userTransaction = ejbContext.getUserTransaction();
+ final UserTransaction userTransaction = ejbContext.getUserTransaction();
userTransaction.begin();
try {
em.getFlushMode();
} finally {
userTransaction.commit();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -109,9 +109,9 @@ public class PersistenceContextStatefulB
public void testPropagatedPersistenceContext() throws TestFailureException {
try {
try {
- InitialContext ctx = new InitialContext();
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/ExtendedTestContext");
+ final EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/ExtendedTestContext");
Assert.assertNotNull("The EntityManager is null", em);
// call a do nothing method to assure entity manager actually exists
@@ -121,13 +121,13 @@ public class PersistenceContextStatefulB
inheritedDelegate = (EntityManager) em.getDelegate();
// The extended entity manager is not propigated to a non-extended entity manager unless there is a transaction
- EntityManager nonExtendedEm = (EntityManager) ctx.lookup("java:comp/env/persistence/TestContext");
+ final EntityManager nonExtendedEm = (EntityManager) ctx.lookup("java:comp/env/persistence/TestContext");
nonExtendedEm.getFlushMode();
- EntityManager nonExtendedDelegate = ((EntityManager) nonExtendedEm.getDelegate());
+ final EntityManager nonExtendedDelegate = ((EntityManager) nonExtendedEm.getDelegate());
Assert.assertTrue("non-extended entity manager should be open", nonExtendedDelegate.isOpen());
Assert.assertNotSame("Extended non-extended entity manager shound not be the same instance as extendend entity manager when accessed out side of a transactions",
- inheritedDelegate,
- nonExtendedDelegate);
+ inheritedDelegate,
+ nonExtendedDelegate);
// When the non-extended entity manager is accessed within a transaction is should see the stateful extended context.
//
@@ -135,12 +135,12 @@ public class PersistenceContextStatefulB
// container associates the persistence context with the JTA transaction and calls EntityManager.joinTransaction."
// If our the extended entity manager were not associted with the transaction, the non-extended entity manager would
// not see it.
- UserTransaction userTransaction = ejbContext.getUserTransaction();
+ final UserTransaction userTransaction = ejbContext.getUserTransaction();
userTransaction.begin();
try {
Assert.assertSame("Extended non-extended entity manager to be same instance as extendend entity manager",
- inheritedDelegate,
- nonExtendedEm.getDelegate());
+ inheritedDelegate,
+ nonExtendedEm.getDelegate());
} finally {
userTransaction.commit();
}
@@ -148,18 +148,18 @@ public class PersistenceContextStatefulB
// When a stateful bean with an extended entity manager creates another stateful bean, the new bean will
// inherit the extended entity manager (assuming it contains an extended entity manager for the same persistence
// unit).
- PersistenceContextStatefulHome home = (PersistenceContextStatefulHome) ejbContext.getEJBHome();
- PersistenceContextStatefulObject object = home.create();
+ final PersistenceContextStatefulHome home = (PersistenceContextStatefulHome) ejbContext.getEJBHome();
+ final PersistenceContextStatefulObject object = home.create();
// test the new stateful bean recieved the context
object.testPropgation();
// remove the bean
object.remove();
- } catch (Exception e) {
+ } catch (final Exception e) {
Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}
@@ -168,23 +168,23 @@ public class PersistenceContextStatefulB
if (inheritedDelegate == null) return;
try {
try {
- InitialContext ctx = new InitialContext();
+ final InitialContext ctx = new InitialContext();
Assert.assertNotNull("The InitialContext is null", ctx);
- EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/ExtendedTestContext");
+ final EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/ExtendedTestContext");
Assert.assertNotNull("The EntityManager is null", em);
// call a do nothing method to assure entity manager actually exists
em.getFlushMode();
- EntityManager delegate = (EntityManager) em.getDelegate();
+ final EntityManager delegate = (EntityManager) em.getDelegate();
Assert.assertSame("Extended entity manager delegate should be the same instance that was found last time",
- inheritedDelegate,
- delegate);
- } catch (Exception e) {
+ inheritedDelegate,
+ delegate);
+ } catch (final Exception e) {
e.printStackTrace();
Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
- } catch (AssertionFailedError afe) {
+ } catch (final AssertionFailedError afe) {
throw new TestFailureException(afe);
}
}