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 [3/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/cont...
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmp2DataSourcesBean.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/entity/bmp/BasicBmp2DataSourcesBean.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/entity/bmp/BasicBmp2DataSourcesBean.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmp2DataSourcesBean.java Mon Jul 7 19:07:41 2014
@@ -54,7 +54,7 @@ public class BasicBmp2DataSourcesBean im
* @return x + y
* @see BasicBmp2DataSourcesHome#sum
*/
- public int ejbHomeSum(int x, int y) {
+ public int ejbHomeSum(final int x, final int y) {
testAllowedOperations("ejbHome");
return x + y;
}
@@ -67,7 +67,7 @@ public class BasicBmp2DataSourcesBean im
* @throws javax.ejb.FinderException
*/
public java.util.Collection ejbFindEmptyCollection()
- throws javax.ejb.FinderException, java.rmi.RemoteException {
+ throws javax.ejb.FinderException, java.rmi.RemoteException {
return new java.util.Vector();
}
@@ -78,16 +78,16 @@ public class BasicBmp2DataSourcesBean im
* @return Integer
* @throws javax.ejb.FinderException
*/
- public Integer ejbFindByPrimaryKey(Integer primaryKey)
- throws javax.ejb.FinderException {
+ public Integer ejbFindByPrimaryKey(final Integer primaryKey)
+ throws javax.ejb.FinderException {
boolean found = false;
try {
- InitialContext jndiContext = new InitialContext();
- DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
try {
stmt.setInt(1, primaryKey.intValue());
found = stmt.executeQuery().next();
@@ -97,7 +97,7 @@ public class BasicBmp2DataSourcesBean im
} finally {
con.close();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new FinderException("FindByPrimaryKey failed");
}
@@ -112,14 +112,14 @@ public class BasicBmp2DataSourcesBean im
* @return Integer
* @throws javax.ejb.CreateException
*/
- public Integer ejbCreate(String name)
- throws javax.ejb.CreateException {
+ public Integer ejbCreate(final String name)
+ throws javax.ejb.CreateException {
try {
- StringTokenizer st = new StringTokenizer(name, " ");
+ final StringTokenizer st = new StringTokenizer(name, " ");
firstName = st.nextToken();
lastName = st.nextToken();
- InitialContext jndiContext = new InitialContext();
+ final InitialContext jndiContext = new InitialContext();
DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
@@ -142,7 +142,7 @@ public class BasicBmp2DataSourcesBean im
try {
stmt.setString(1, firstName);
stmt.setString(2, lastName);
- ResultSet set = stmt.executeQuery();
+ final ResultSet set = stmt.executeQuery();
while (set.next()) primaryKey = set.getInt("id");
} finally {
stmt.close();
@@ -174,14 +174,14 @@ public class BasicBmp2DataSourcesBean im
return new Integer(primaryKey);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
throw new javax.ejb.CreateException("can't create");
}
}
- public void ejbPostCreate(String name)
- throws javax.ejb.CreateException {
+ public void ejbPostCreate(final String name)
+ throws javax.ejb.CreateException {
}
//
@@ -197,9 +197,9 @@ public class BasicBmp2DataSourcesBean im
*
* @return String
*/
- public String businessMethod(String text) {
+ public String businessMethod(final String text) {
testAllowedOperations("businessMethod");
- StringBuffer b = new StringBuffer(text);
+ final StringBuffer b = new StringBuffer(text);
return b.reverse().toString();
}
@@ -226,7 +226,7 @@ public class BasicBmp2DataSourcesBean im
* @param methodName The method for which to get the allowed opperations report
* @return OperationPolicy
*/
- public OperationsPolicy getAllowedOperationsReport(String methodName) {
+ public OperationsPolicy getAllowedOperationsReport(final String methodName) {
return (OperationsPolicy) allowedOperationsTable.get(methodName);
}
@@ -245,16 +245,16 @@ public class BasicBmp2DataSourcesBean im
*/
public void ejbLoad() throws EJBException, RemoteException {
try {
- InitialContext jndiContext = new InitialContext();
- DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
try {
- Integer primaryKey = (Integer) ejbContext.getPrimaryKey();
+ final Integer primaryKey = (Integer) ejbContext.getPrimaryKey();
stmt.setInt(1, primaryKey.intValue());
- ResultSet rs = stmt.executeQuery();
+ final ResultSet rs = stmt.executeQuery();
while (rs.next()) {
lastName = rs.getString("last_name");
firstName = rs.getString("first_name");
@@ -266,7 +266,7 @@ public class BasicBmp2DataSourcesBean im
con.close();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -275,7 +275,7 @@ public class BasicBmp2DataSourcesBean im
* Set the associated entity context. The container invokes this method
* on an instance after the instance has been created.
*/
- public void setEntityContext(EntityContext ctx) throws EJBException, RemoteException {
+ public void setEntityContext(final EntityContext ctx) throws EJBException, RemoteException {
ejbContext = ctx;
testAllowedOperations("setEntityContext");
}
@@ -295,12 +295,12 @@ public class BasicBmp2DataSourcesBean im
*/
public void ejbStore() throws EJBException, RemoteException {
try {
- InitialContext jndiContext = new InitialContext();
- DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("update entity set first_name = ?, last_name = ? where EmployeeID = ?");
+ final PreparedStatement stmt = con.prepareStatement("update entity set first_name = ?, last_name = ? where EmployeeID = ?");
try {
stmt.setString(1, firstName);
stmt.setString(2, lastName);
@@ -312,7 +312,7 @@ public class BasicBmp2DataSourcesBean im
} finally {
con.close();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -327,13 +327,13 @@ public class BasicBmp2DataSourcesBean im
*/
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
try {
- InitialContext jndiContext = new InitialContext();
- DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("delete from entity where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("delete from entity where id = ?");
try {
- Integer primaryKey = (Integer) ejbContext.getPrimaryKey();
+ final Integer primaryKey = (Integer) ejbContext.getPrimaryKey();
stmt.setInt(1, primaryKey.intValue());
stmt.executeUpdate();
} finally {
@@ -343,7 +343,7 @@ public class BasicBmp2DataSourcesBean im
con.close();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
throw new javax.ejb.EJBException(e);
}
@@ -372,63 +372,63 @@ public class BasicBmp2DataSourcesBean im
// EntityBean interface methods
//================================
- protected void testAllowedOperations(String methodName) {
- OperationsPolicy policy = new OperationsPolicy();
+ protected void testAllowedOperations(final String methodName) {
+ final OperationsPolicy policy = new OperationsPolicy();
/*[1] Test getEJBHome /////////////////*/
try {
ejbContext.getEJBHome();
policy.allow(policy.Context_getEJBHome);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/*[2] Test getCallerPrincipal /////////*/
try {
ejbContext.getCallerPrincipal();
policy.allow(policy.Context_getCallerPrincipal);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/*[3] Test isCallerInRole /////////////*/
try {
ejbContext.isCallerInRole("TheMan");
policy.allow(policy.Context_isCallerInRole);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/*[4] Test getRollbackOnly ////////////*/
try {
ejbContext.getRollbackOnly();
policy.allow(policy.Context_getRollbackOnly);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/*[5] Test setRollbackOnly ////////////*/
try {
ejbContext.setRollbackOnly();
policy.allow(policy.Context_setRollbackOnly);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/*[6] Test getUserTransaction /////////*/
try {
ejbContext.getUserTransaction();
policy.allow(policy.Context_getUserTransaction);
- } catch (Exception e) {
+ } catch (final Exception e) {
}
/*[7] Test getEJBObject ///////////////*/
try {
ejbContext.getEJBObject();
policy.allow(policy.Context_getEJBObject);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/*[8] Test getPrimaryKey //////////////*/
try {
ejbContext.getPrimaryKey();
policy.allow(policy.Context_getPrimaryKey);
- } catch (IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
}
/* TO DO:
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmp2DataSourcesHome.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/entity/bmp/BasicBmp2DataSourcesHome.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/entity/bmp/BasicBmp2DataSourcesHome.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmp2DataSourcesHome.java Mon Jul 7 19:07:41 2014
@@ -21,13 +21,13 @@ public interface BasicBmp2DataSourcesHom
public BasicBmp2DataSourcesObject create(String name)
- throws javax.ejb.CreateException, java.rmi.RemoteException;
-
+ throws javax.ejb.CreateException, java.rmi.RemoteException;
+
public BasicBmp2DataSourcesObject findByPrimaryKey(Integer primarykey)
- throws javax.ejb.FinderException, java.rmi.RemoteException;
-
+ throws javax.ejb.FinderException, java.rmi.RemoteException;
+
public java.util.Collection findEmptyCollection()
- throws javax.ejb.FinderException, java.rmi.RemoteException;
-
+ throws javax.ejb.FinderException, java.rmi.RemoteException;
+
public int sum(int x, int y) throws java.rmi.RemoteException;
}
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmp2DataSourcesObject.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/entity/bmp/BasicBmp2DataSourcesObject.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/entity/bmp/BasicBmp2DataSourcesObject.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmp2DataSourcesObject.java Mon Jul 7 19:07:41 2014
@@ -21,23 +21,23 @@ import java.util.Properties;
import org.apache.openejb.test.object.OperationsPolicy;
-public interface BasicBmp2DataSourcesObject extends javax.ejb.EJBObject{
-
+public interface BasicBmp2DataSourcesObject extends javax.ejb.EJBObject {
+
/**
* Reverses the string passed in then returns it
*/
public String businessMethod(String text) throws RemoteException;
-
+
/**
- * Returns a report of the bean's
+ * Returns a report of the bean's
* runtime permissions
*/
public Properties getPermissionsReport() throws RemoteException;
-
+
/**
* Returns a report of the allowed opperations
* for one of the bean's methods.
- *
+ *
* @param methodName The method for which to get the allowed opperations report
*/
public OperationsPolicy getAllowedOperationsReport(String methodName) throws RemoteException;
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmpBean.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/entity/bmp/BasicBmpBean.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/entity/bmp/BasicBmpBean.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmpBean.java Mon Jul 7 19:07:41 2014
@@ -54,62 +54,61 @@ public class BasicBmpBean implements jav
/**
* Maps to BasicBmpHome.sum
- *
+ * <p/>
* Adds x and y and returns the result.
- *
+ *
* @param x
* @param y
* @return x + y
* @see BasicBmpHome#sum
*/
- public int ejbHomeSum(int x, int y) {
+ public int ejbHomeSum(final int x, final int y) {
testAllowedOperations("ejbHome");
- return x+y;
+ return x + y;
}
/**
* Maps to BasicBmpHome.findEmptyCollection
- *
+ *
* @return
- * @exception javax.ejb.FinderException
+ * @throws javax.ejb.FinderException
* @see BasicBmpHome#sum
*/
public java.util.Collection ejbFindEmptyCollection()
- throws javax.ejb.FinderException, java.rmi.RemoteException {
+ throws javax.ejb.FinderException, java.rmi.RemoteException {
return new java.util.Vector();
}
/**
* Maps to BasicBmpHome.findEmptyEnumeration()
- *
+ *
* @return empty enumeration
* @throws javax.ejb.FinderException
*/
public java.util.Enumeration ejbFindEmptyEnumeration()
- throws javax.ejb.FinderException
- {
+ throws javax.ejb.FinderException {
return (new java.util.Vector()).elements();
}
-
+
/**
* Maps to BasicBmpHome.findByPrimaryKey
- *
+ *
* @param primaryKey
- * @return
- * @exception javax.ejb.FinderException
+ * @return
+ * @throws javax.ejb.FinderException
* @see BasicBmpHome#sum
*/
- public Integer ejbFindByPrimaryKey(Integer primaryKey)
- throws javax.ejb.FinderException{
+ public Integer ejbFindByPrimaryKey(final Integer primaryKey)
+ throws javax.ejb.FinderException {
boolean found = false;
try {
- InitialContext jndiContext = new InitialContext( );
- DataSource ds = (DataSource)jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
try {
stmt.setInt(1, primaryKey.intValue());
found = stmt.executeQuery().next();
@@ -119,69 +118,70 @@ public class BasicBmpBean implements jav
} finally {
con.close();
}
- } catch ( Exception e ) {
+ } catch (final Exception e) {
throw new FinderException("FindByPrimaryKey failed");
}
- if ( found ) return primaryKey;
- else throw new javax.ejb.ObjectNotFoundException();
+ if (found) return primaryKey;
+ else throw new javax.ejb.ObjectNotFoundException();
}
/**
* Maps to BasicBmpHome.findByPrimaryKey
- *
+ *
* @param lastName
- * @return
- * @exception javax.ejb.FinderException
+ * @return
+ * @throws javax.ejb.FinderException
* @see BasicBmpHome#sum
*/
- public java.util.Collection ejbFindByLastName(String lastName)
- throws javax.ejb.FinderException{
- java.util.Vector keys = new java.util.Vector();
- try {
- InitialContext jndiContext = new InitialContext( );
- DataSource ds = (DataSource)jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ public java.util.Collection ejbFindByLastName(final String lastName)
+ throws javax.ejb.FinderException {
+ final java.util.Vector keys = new java.util.Vector();
+ try {
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("SELECT id FROM entity WHERE last_name = ?");
+ final PreparedStatement stmt = con.prepareStatement("SELECT id FROM entity WHERE last_name = ?");
try {
stmt.setString(1, lastName);
- ResultSet set = stmt.executeQuery();
- while ( set.next() ) keys.add( new Integer(set.getInt("id")) );
+ final ResultSet set = stmt.executeQuery();
+ while (set.next()) keys.add(new Integer(set.getInt("id")));
} finally {
stmt.close();
}
} finally {
con.close();
}
- } catch ( Exception e ) {
+ } catch (final Exception e) {
throw new FinderException("FindByPrimaryKey failed");
}
- if ( keys.size() > 0 ) return keys;
- else throw new javax.ejb.ObjectNotFoundException();
+ if (keys.size() > 0) return keys;
+ else throw new javax.ejb.ObjectNotFoundException();
}
+
/**
* Maps to BasicBmpHome.create
- *
+ *
* @param name
- * @return
- * @exception javax.ejb.CreateException
+ * @return
+ * @throws javax.ejb.CreateException
* @see BasicBmpHome#createObject
*/
- public Integer ejbCreateObject(String name)
- throws javax.ejb.CreateException{
+ public Integer ejbCreateObject(final String name)
+ throws javax.ejb.CreateException {
try {
- StringTokenizer st = new StringTokenizer(name, " ");
+ final StringTokenizer st = new StringTokenizer(name, " ");
firstName = st.nextToken();
lastName = st.nextToken();
- InitialContext jndiContext = new InitialContext( );
+ final InitialContext jndiContext = new InitialContext();
- DataSource ds = (DataSource)jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final Connection con = ds.getConnection();
try {
// Support for Oracle because Oracle doesn't do auto increment
@@ -203,8 +203,8 @@ public class BasicBmpBean implements jav
try {
stmt.setString(1, firstName);
stmt.setString(2, lastName);
- ResultSet set = stmt.executeQuery();
- while ( set.next() ) primaryKey = set.getInt("id");
+ final ResultSet set = stmt.executeQuery();
+ while (set.next()) primaryKey = set.getInt("id");
} finally {
stmt.close();
}
@@ -214,14 +214,14 @@ public class BasicBmpBean implements jav
return new Integer(primaryKey);
- } catch ( Exception e ) {
+ } catch (final Exception e) {
e.printStackTrace();
- throw new javax.ejb.CreateException("can't create: "+e.getClass().getName()+" "+e.getMessage());
+ throw new javax.ejb.CreateException("can't create: " + e.getClass().getName() + " " + e.getMessage());
}
}
- public void ejbPostCreateObject(String name)
- throws javax.ejb.CreateException{
+ public void ejbPostCreateObject(final String name)
+ throws javax.ejb.CreateException {
}
//
@@ -235,44 +235,42 @@ public class BasicBmpBean implements jav
/**
* Maps to BasicBmpObject.businessMethod
- *
- * @return
+ *
+ * @return
* @see BasicBmpObject#businessMethod
*/
- public String businessMethod(String text) {
+ public String businessMethod(final String text) {
testAllowedOperations("businessMethod");
- StringBuffer b = new StringBuffer(text);
+ final StringBuffer b = new StringBuffer(text);
return b.reverse().toString();
}
/**
* Throws an ApplicationException when invoked
- *
*/
- public void throwApplicationException() throws ApplicationException{
+ public void throwApplicationException() throws ApplicationException {
throw new ApplicationException("Testing ability to throw Application Exceptions");
}
-
+
/**
* Throws a java.lang.NullPointerException when invoked
- * This is a system exception and should result in the
+ * This is a system exception and should result in the
* destruction of the instance and invalidation of the
* remote reference.
- *
*/
public void throwSystemException_NullPointer() {
throw new NullPointerException("Testing ability to throw System Exceptions");
}
-
+
/**
* Maps to BasicBmpObject.getPermissionsReport
- *
+ * <p/>
* Returns a report of the bean's
* runtime permissions
- *
- * @return
+ *
+ * @return
* @see BasicBmpObject#getPermissionsReport
*/
public Properties getPermissionsReport() {
@@ -282,16 +280,16 @@ public class BasicBmpBean implements jav
/**
* Maps to BasicBmpObject.getAllowedOperationsReport
- *
+ * <p/>
* Returns a report of the allowed opperations
* for one of the bean's methods.
- *
+ *
* @param methodName The method for which to get the allowed opperations report
- * @return
+ * @return
* @see BasicBmpObject#getAllowedOperationsReport
*/
- public OperationsPolicy getAllowedOperationsReport(String methodName) {
- return(OperationsPolicy) allowedOperationsTable.get(methodName);
+ public OperationsPolicy getAllowedOperationsReport(final String methodName) {
+ return (OperationsPolicy) allowedOperationsTable.get(methodName);
}
//
@@ -308,18 +306,18 @@ public class BasicBmpBean implements jav
* instance to synchronize its state by loading it state from the
* underlying database.
*/
- public void ejbLoad() throws EJBException,RemoteException {
+ public void ejbLoad() throws EJBException, RemoteException {
try {
- InitialContext jndiContext = new InitialContext( );
- DataSource ds = (DataSource)jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("select * from entity where id = ?");
try {
stmt.setInt(1, primaryKey);
- ResultSet rs = stmt.executeQuery();
+ final ResultSet rs = stmt.executeQuery();
if (!rs.next()) {
throw new NoSuchEntityException("" + primaryKey);
}
@@ -334,9 +332,9 @@ public class BasicBmpBean implements jav
} finally {
con.close();
}
- } catch (NamingException e) {
+ } catch (final NamingException e) {
throw new EJBException(e);
- } catch (SQLException e) {
+ } catch (final SQLException e) {
throw new EJBException(e);
}
}
@@ -345,7 +343,7 @@ public class BasicBmpBean implements jav
* Set the associated entity context. The container invokes this method
* on an instance after the instance has been created.
*/
- public void setEntityContext(EntityContext ctx) throws EJBException,RemoteException {
+ public void setEntityContext(final EntityContext ctx) throws EJBException, RemoteException {
ejbContext = ctx;
testAllowedOperations("setEntityContext");
}
@@ -354,7 +352,7 @@ public class BasicBmpBean implements jav
* Unset the associated entity context. The container calls this method
* before removing the instance.
*/
- public void unsetEntityContext() throws EJBException,RemoteException {
+ public void unsetEntityContext() throws EJBException, RemoteException {
testAllowedOperations("unsetEntityContext");
}
@@ -363,14 +361,14 @@ public class BasicBmpBean implements jav
* instance to synchronize its state by storing it to the underlying
* database.
*/
- public void ejbStore() throws EJBException,RemoteException {
+ public void ejbStore() throws EJBException, RemoteException {
try {
- InitialContext jndiContext = new InitialContext( );
- DataSource ds = (DataSource)jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("update entity set first_name = ?, last_name = ? where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("update entity set first_name = ?, last_name = ? where id = ?");
try {
stmt.setString(1, firstName);
stmt.setString(2, lastName);
@@ -382,7 +380,7 @@ public class BasicBmpBean implements jav
} finally {
con.close();
}
- } catch ( Exception e ) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -395,14 +393,14 @@ public class BasicBmpBean implements jav
* This method transitions the instance from the ready state to the pool
* of available instances.
*/
- public void ejbRemove() throws RemoveException,EJBException,RemoteException {
+ public void ejbRemove() throws RemoveException, EJBException, RemoteException {
try {
- InitialContext jndiContext = new InitialContext( );
- DataSource ds = (DataSource)jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
- Connection con = ds.getConnection();
+ final InitialContext jndiContext = new InitialContext();
+ final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/basic/entityDatabase");
+ final Connection con = ds.getConnection();
try {
- PreparedStatement stmt = con.prepareStatement("delete from entity where id = ?");
+ final PreparedStatement stmt = con.prepareStatement("delete from entity where id = ?");
try {
stmt.setInt(1, primaryKey);
stmt.executeUpdate();
@@ -413,7 +411,7 @@ public class BasicBmpBean implements jav
con.close();
}
- } catch ( Exception e ) {
+ } catch (final Exception e) {
e.printStackTrace();
throw new javax.ejb.EJBException(e);
}
@@ -425,8 +423,8 @@ public class BasicBmpBean implements jav
* with a specific EJB object. This method transitions the instance to
* the ready state.
*/
- public void ejbActivate() throws EJBException,RemoteException {
- primaryKey = (Integer)ejbContext.getPrimaryKey();
+ public void ejbActivate() throws EJBException, RemoteException {
+ primaryKey = (Integer) ejbContext.getPrimaryKey();
testAllowedOperations("ejbActivate");
}
@@ -436,7 +434,7 @@ public class BasicBmpBean implements jav
* completes, the container will place the instance into the pool of
* available instances.
*/
- public void ejbPassivate() throws EJBException,RemoteException {
+ public void ejbPassivate() throws EJBException, RemoteException {
testAllowedOperations("ejbPassivate");
primaryKey = -1;
}
@@ -446,56 +444,56 @@ public class BasicBmpBean implements jav
// EntityBean interface methods
//================================
- protected void testAllowedOperations(String methodName) {
- OperationsPolicy policy = new OperationsPolicy();
+ protected void testAllowedOperations(final String methodName) {
+ final OperationsPolicy policy = new OperationsPolicy();
/*[0] Test getEJBHome /////////////////*/
try {
ejbContext.getEJBHome();
policy.allow(policy.Context_getEJBHome);
- } catch ( IllegalStateException ise ) {
+ } catch (final IllegalStateException ise) {
}
/*[1] Test getCallerPrincipal /////////*/
try {
ejbContext.getCallerPrincipal();
- policy.allow( policy.Context_getCallerPrincipal );
- } catch ( IllegalStateException ise ) {
+ policy.allow(policy.Context_getCallerPrincipal);
+ } catch (final IllegalStateException ise) {
}
/*[2] Test isCallerInRole /////////////*/
try {
ejbContext.isCallerInRole("TheMan");
- policy.allow( policy.Context_isCallerInRole );
- } catch ( IllegalStateException ise ) {
+ policy.allow(policy.Context_isCallerInRole);
+ } catch (final IllegalStateException ise) {
}
/*[3] Test getRollbackOnly ////////////*/
try {
ejbContext.getRollbackOnly();
- policy.allow( policy.Context_getRollbackOnly );
- } catch ( IllegalStateException ise ) {
+ policy.allow(policy.Context_getRollbackOnly);
+ } catch (final IllegalStateException ise) {
}
/*[4] Test setRollbackOnly ////////////*/
try {
ejbContext.setRollbackOnly();
- policy.allow( policy.Context_setRollbackOnly );
- } catch ( IllegalStateException ise ) {
+ policy.allow(policy.Context_setRollbackOnly);
+ } catch (final IllegalStateException ise) {
}
/*[5] Test getUserTransaction /////////*/
try {
ejbContext.getUserTransaction();
- policy.allow( policy.Context_getUserTransaction );
- } catch ( IllegalStateException ise ) {
+ policy.allow(policy.Context_getUserTransaction);
+ } catch (final IllegalStateException ise) {
}
/*[6] Test getEJBObject ///////////////*/
try {
ejbContext.getEJBObject();
- policy.allow( policy.Context_getEJBObject );
- } catch ( IllegalStateException ise ) {
+ policy.allow(policy.Context_getEJBObject);
+ } catch (final IllegalStateException ise) {
}
/*[7] Test Context_getPrimaryKey ///////////////
@@ -505,13 +503,13 @@ public class BasicBmpBean implements jav
/*[8] Test JNDI_access_to_java_comp_env ///////////////*/
try {
- InitialContext jndiContext = new InitialContext();
+ final InitialContext jndiContext = new InitialContext();
- String actual = (String)jndiContext.lookup("java:comp/env/stateless/references/JNDI_access_to_java_comp_env");
+ final String actual = (String) jndiContext.lookup("java:comp/env/stateless/references/JNDI_access_to_java_comp_env");
- policy.allow( policy.JNDI_access_to_java_comp_env );
- } catch ( IllegalStateException ise ) {
- } catch ( javax.naming.NamingException ne ) {
+ policy.allow(policy.JNDI_access_to_java_comp_env);
+ } catch (final IllegalStateException ise) {
+ } catch (final javax.naming.NamingException ne) {
}
allowedOperationsTable.put(methodName, policy);
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmpHome.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/entity/bmp/BasicBmpHome.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/entity/bmp/BasicBmpHome.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmpHome.java Mon Jul 7 19:07:41 2014
@@ -22,19 +22,19 @@ import java.util.Enumeration;
public interface BasicBmpHome extends javax.ejb.EJBHome {
public BasicBmpObject createObject(String name)
- throws javax.ejb.CreateException, java.rmi.RemoteException;
-
+ throws javax.ejb.CreateException, java.rmi.RemoteException;
+
public BasicBmpObject findByPrimaryKey(Integer primarykey)
- throws javax.ejb.FinderException, java.rmi.RemoteException;
-
+ throws javax.ejb.FinderException, java.rmi.RemoteException;
+
public java.util.Collection findEmptyCollection()
- throws javax.ejb.FinderException, java.rmi.RemoteException;
-
+ throws javax.ejb.FinderException, java.rmi.RemoteException;
+
public java.util.Collection findByLastName(String lastName)
- throws javax.ejb.FinderException, java.rmi.RemoteException;
-
+ throws javax.ejb.FinderException, java.rmi.RemoteException;
+
public Enumeration findEmptyEnumeration()
- throws javax.ejb.FinderException, java.rmi.RemoteException;
-
+ throws javax.ejb.FinderException, java.rmi.RemoteException;
+
public int sum(int x, int y) throws java.rmi.RemoteException;
}
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmpObject.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/entity/bmp/BasicBmpObject.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/entity/bmp/BasicBmpObject.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/BasicBmpObject.java Mon Jul 7 19:07:41 2014
@@ -22,40 +22,36 @@ import java.util.Properties;
import org.apache.openejb.test.ApplicationException;
import org.apache.openejb.test.object.OperationsPolicy;
-public interface BasicBmpObject extends javax.ejb.EJBObject{
-
+public interface BasicBmpObject extends javax.ejb.EJBObject {
+
/**
* Reverses the string passed in then returns it
- *
*/
public String businessMethod(String text) throws RemoteException;
-
+
/**
* Throws an ApplicationException when invoked
- *
*/
public void throwApplicationException() throws RemoteException, ApplicationException;
-
+
/**
* Throws a java.lang.NullPointerException when invoked
- * This is a system exception and should result in the
+ * This is a system exception and should result in the
* destruction of the instance and invalidation of the
* remote reference.
- *
*/
public void throwSystemException_NullPointer() throws RemoteException;
-
+
/**
- * Returns a report of the bean's
+ * Returns a report of the bean's
* runtime permissions
- *
*/
public Properties getPermissionsReport() throws RemoteException;
-
+
/**
* Returns a report of the allowed opperations
* for one of the bean's methods.
- *
+ *
* @param methodName The method for which to get the allowed opperations report
*/
public OperationsPolicy getAllowedOperationsReport(String methodName) throws RemoteException;
Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/ContextLookupBmpBean.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/entity/bmp/ContextLookupBmpBean.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/entity/bmp/ContextLookupBmpBean.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/ContextLookupBmpBean.java Mon Jul 7 19:07:41 2014
@@ -63,7 +63,7 @@ public class ContextLookupBmpBean implem
* @see EncBmpHome#findEmptyCollection()
*/
public java.util.Collection ejbFindEmptyCollection()
- throws javax.ejb.FinderException, java.rmi.RemoteException {
+ throws javax.ejb.FinderException, java.rmi.RemoteException {
return new java.util.Vector();
}
@@ -75,8 +75,8 @@ public class ContextLookupBmpBean implem
* @throws javax.ejb.FinderException
* @see EncBmpHome#findByPrimaryKey(Integer)
*/
- public Integer ejbFindByPrimaryKey(Integer primaryKey)
- throws javax.ejb.FinderException {
+ public Integer ejbFindByPrimaryKey(final Integer primaryKey)
+ throws javax.ejb.FinderException {
return new Integer(-1);
}
@@ -88,13 +88,13 @@ public class ContextLookupBmpBean implem
* @throws javax.ejb.CreateException
* @see EncBmpHome#create
*/
- public Integer ejbCreate(String name)
- throws javax.ejb.CreateException {
+ public Integer ejbCreate(final String name)
+ throws javax.ejb.CreateException {
return new Integer(-1);
}
- public void ejbPostCreate(String name)
- throws javax.ejb.CreateException {
+ public void ejbPostCreate(final String name)
+ throws javax.ejb.CreateException {
}
//
@@ -109,15 +109,15 @@ public class ContextLookupBmpBean implem
public void lookupEntityBean() throws TestFailureException {
try {
try {
- BasicBmpHome home = (BasicBmpHome) ejbContext.lookup("entity/bmp/beanReferences/bmp_entity");
+ final BasicBmpHome home = (BasicBmpHome) ejbContext.lookup("entity/bmp/beanReferences/bmp_entity");
Assert.assertNotNull("The EJBHome looked up is null", home);
- BasicBmpObject object = home.createObject("Enc Bean");
+ final BasicBmpObject object = home.createObject("Enc Bean");
Assert.assertNotNull("The EJBObject is null", object);
- } 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);
}
}
@@ -125,15 +125,15 @@ public class ContextLookupBmpBean implem
public void lookupStatefulBean() throws TestFailureException {
try {
try {
- BasicStatefulHome home = (BasicStatefulHome) ejbContext.lookup("entity/bmp/beanReferences/stateful");
+ final BasicStatefulHome home = (BasicStatefulHome) ejbContext.lookup("entity/bmp/beanReferences/stateful");
Assert.assertNotNull("The EJBHome looked up is null", home);
- BasicStatefulObject object = home.createObject("Enc Bean");
+ final BasicStatefulObject object = home.createObject("Enc Bean");
Assert.assertNotNull("The EJBObject is null", object);
- } 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);
}
}
@@ -141,67 +141,67 @@ public class ContextLookupBmpBean implem
public void lookupStatelessBean() throws TestFailureException {
try {
try {
- BasicStatelessHome home = (BasicStatelessHome) ejbContext.lookup("entity/bmp/beanReferences/stateless");
+ final BasicStatelessHome home = (BasicStatelessHome) ejbContext.lookup("entity/bmp/beanReferences/stateless");
Assert.assertNotNull("The EJBHome looked up is null", home);
- BasicStatelessObject object = home.createObject();
+ final BasicStatelessObject object = home.createObject();
Assert.assertNotNull("The EJBObject is null", object);
- } 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);
}
}
- public void lookupStatelessBusinessLocal() throws TestFailureException{
- try{
- try{
- BasicStatelessBusinessLocal object = (BasicStatelessBusinessLocal) ejbContext.lookup("entity/bmp/beanReferences/stateless-business-local");
- Assert.assertNotNull("The EJB BusinessLocal is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void lookupStatelessBusinessLocal() throws TestFailureException {
+ try {
+ try {
+ final BasicStatelessBusinessLocal object = (BasicStatelessBusinessLocal) ejbContext.lookup("entity/bmp/beanReferences/stateless-business-local");
+ 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 lookupStatelessBusinessRemote() throws TestFailureException{
- try{
- try{
- BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ejbContext.lookup("entity/bmp/beanReferences/stateless-business-remote");
- Assert.assertNotNull("The EJB BusinessRemote is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void lookupStatelessBusinessRemote() throws TestFailureException {
+ try {
+ try {
+ final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ejbContext.lookup("entity/bmp/beanReferences/stateless-business-remote");
+ 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{
- BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ejbContext.lookup("entity/bmp/beanReferences/stateful-business-local");
- Assert.assertNotNull("The EJB BusinessLocal is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void lookupStatefulBusinessLocal() throws TestFailureException {
+ try {
+ try {
+ final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ejbContext.lookup("entity/bmp/beanReferences/stateful-business-local");
+ 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 lookupStatefulBusinessRemote() throws TestFailureException{
- try{
- try{
- BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) ejbContext.lookup("entity/bmp/beanReferences/stateful-business-remote");
- Assert.assertNotNull("The EJB BusinessRemote is null", object );
- } catch (Exception e){
- Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ public void lookupStatefulBusinessRemote() throws TestFailureException {
+ try {
+ try {
+ final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) ejbContext.lookup("entity/bmp/beanReferences/stateful-business-remote");
+ 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);
}
}
@@ -209,16 +209,16 @@ public class ContextLookupBmpBean implem
public void lookupStringEntry() throws TestFailureException {
try {
try {
- String expected = new String("1");
- String actual = (String) ejbContext.lookup("entity/bmp/references/String");
+ final String expected = new String("1");
+ final String actual = (String) ejbContext.lookup("entity/bmp/references/String");
Assert.assertNotNull("The String looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -226,16 +226,16 @@ public class ContextLookupBmpBean implem
public void lookupDoubleEntry() throws TestFailureException {
try {
try {
- Double expected = new Double(1.0D);
- Double actual = (Double) ejbContext.lookup("entity/bmp/references/Double");
+ final Double expected = new Double(1.0D);
+ final Double actual = (Double) ejbContext.lookup("entity/bmp/references/Double");
Assert.assertNotNull("The Double looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -243,16 +243,16 @@ public class ContextLookupBmpBean implem
public void lookupLongEntry() throws TestFailureException {
try {
try {
- Long expected = new Long(1L);
- Long actual = (Long) ejbContext.lookup("entity/bmp/references/Long");
+ final Long expected = new Long(1L);
+ final Long actual = (Long) ejbContext.lookup("entity/bmp/references/Long");
Assert.assertNotNull("The Long looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -260,16 +260,16 @@ public class ContextLookupBmpBean implem
public void lookupFloatEntry() throws TestFailureException {
try {
try {
- Float expected = new Float(1.0F);
- Float actual = (Float) ejbContext.lookup("entity/bmp/references/Float");
+ final Float expected = new Float(1.0F);
+ final Float actual = (Float) ejbContext.lookup("entity/bmp/references/Float");
Assert.assertNotNull("The Float looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -277,16 +277,16 @@ public class ContextLookupBmpBean implem
public void lookupIntegerEntry() throws TestFailureException {
try {
try {
- Integer expected = new Integer(1);
- Integer actual = (Integer) ejbContext.lookup("entity/bmp/references/Integer");
+ final Integer expected = new Integer(1);
+ final Integer actual = (Integer) ejbContext.lookup("entity/bmp/references/Integer");
Assert.assertNotNull("The Integer looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -294,16 +294,16 @@ public class ContextLookupBmpBean implem
public void lookupShortEntry() throws TestFailureException {
try {
try {
- Short expected = new Short((short) 1);
- Short actual = (Short) ejbContext.lookup("entity/bmp/references/Short");
+ final Short expected = new Short((short) 1);
+ final Short actual = (Short) ejbContext.lookup("entity/bmp/references/Short");
Assert.assertNotNull("The Short looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -311,16 +311,16 @@ public class ContextLookupBmpBean implem
public void lookupBooleanEntry() throws TestFailureException {
try {
try {
- Boolean expected = new Boolean(true);
- Boolean actual = (Boolean) ejbContext.lookup("entity/bmp/references/Boolean");
+ final Boolean expected = new Boolean(true);
+ final Boolean actual = (Boolean) ejbContext.lookup("entity/bmp/references/Boolean");
Assert.assertNotNull("The Boolean looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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,16 +328,16 @@ public class ContextLookupBmpBean implem
public void lookupByteEntry() throws TestFailureException {
try {
try {
- Byte expected = new Byte((byte) 1);
- Byte actual = (Byte) ejbContext.lookup("entity/bmp/references/Byte");
+ final Byte expected = new Byte((byte) 1);
+ final Byte actual = (Byte) ejbContext.lookup("entity/bmp/references/Byte");
Assert.assertNotNull("The Byte looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -346,16 +346,16 @@ public class ContextLookupBmpBean implem
public void lookupCharacterEntry() throws TestFailureException {
try {
try {
- Character expected = new Character('D');
- Character actual = (Character) ejbContext.lookup("entity/bmp/references/Character");
+ final Character expected = new Character('D');
+ final Character actual = (Character) ejbContext.lookup("entity/bmp/references/Character");
Assert.assertNotNull("The Character looked up is null", actual);
Assert.assertEquals(expected, actual);
- } 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);
}
}
@@ -363,82 +363,82 @@ public class ContextLookupBmpBean implem
public void lookupResource() throws TestFailureException {
try {
try {
- Object obj = ejbContext.lookup("datasource");
+ final Object obj = ejbContext.lookup("datasource");
Assert.assertNotNull("The DataSource is null", obj);
Assert.assertTrue("Not an instance of DataSource", obj instanceof DataSource);
- } 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);
}
}
- public void lookupJMSConnectionFactory() throws TestFailureException{
- try{
- try{
+ public void lookupJMSConnectionFactory() throws TestFailureException {
+ try {
+ try {
Object obj = ejbContext.lookup("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 = ejbContext.lookup("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 = ejbContext.lookup("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{
- EntityManagerFactory emf = (EntityManagerFactory)ejbContext.lookup("persistence/TestUnit");
- Assert.assertNotNull("The EntityManagerFactory is null", emf );
+ public void lookupPersistenceUnit() throws TestFailureException {
+ try {
+ try {
+ final EntityManagerFactory emf = (EntityManagerFactory) ejbContext.lookup("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{
- EntityManager em = (EntityManager)ejbContext.lookup("persistence/TestContext");
+
+ public void lookupPersistenceContext() throws TestFailureException {
+ try {
+ try {
+ final EntityManager em = (EntityManager) ejbContext.lookup("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);
}
}
@@ -463,7 +463,7 @@ public class ContextLookupBmpBean implem
* Set the associated entity context. The container invokes this method
* on an instance after the instance has been created.
*/
- public void setEntityContext(EntityContext ctx) throws EJBException, RemoteException {
+ public void setEntityContext(final EntityContext ctx) throws EJBException, RemoteException {
ejbContext = ctx;
}