//
// EntityBean interface methods
//================================
protected void testAllowedOperations(final String methodName) {
final OperationsPolicy policy = new OperationsPolicy();
/*[0] Test getEJBHome /////////////////*/
try {
ejbContext.getEJBHome();
policy.allow(OperationsPolicy.Context_getEJBHome);
} catch (final IllegalStateException ise) {
}
/*[1] Test getCallerPrincipal /////////*/
try {
ejbContext.getCallerPrincipal();
policy.allow(OperationsPolicy.Context_getCallerPrincipal);
} catch (final IllegalStateException ise) {
}
/*[2] Test isCallerInRole /////////////*/
try {
ejbContext.isCallerInRole("TheMan");
policy.allow(OperationsPolicy.Context_isCallerInRole);
} catch (final IllegalStateException ise) {
}
/*[3] Test getRollbackOnly ////////////*/
try {
ejbContext.getRollbackOnly();
policy.allow(OperationsPolicy.Context_getRollbackOnly);
} catch (final IllegalStateException ise) {
}
/*[4] Test setRollbackOnly ////////////*/
try {
ejbContext.setRollbackOnly();
policy.allow(OperationsPolicy.Context_setRollbackOnly);
} catch (final IllegalStateException ise) {
}
/*[5] Test getUserTransaction /////////*/
try {
ejbContext.getUserTransaction();
policy.allow(OperationsPolicy.Context_getUserTransaction);
} catch (final IllegalStateException ise) {
}
/*[6] Test getEJBObject ///////////////*/
try {
ejbContext.getEJBObject();
policy.allow(OperationsPolicy.Context_getEJBObject);
} catch (final IllegalStateException ise) {
}
/*[7] Test Context_getPrimaryKey ///////////////
*
* TODO: Write this test.
*/
try {
ejbContext.getPrimaryKey();
policy.allow(OperationsPolicy.Context_getPrimaryKey);
} catch (final IllegalStateException ise) {
}
/*[8] Test JNDI_access_to_java_comp_env ///////////////*/
try {
final InitialContext jndiContext = new InitialContext();
jndiContext.lookup("java:comp/env/stateless/references/JNDI_access_to_java_comp_env");
policy.allow(OperationsPolicy.JNDI_access_to_java_comp_env);
} catch (final IllegalStateException ise) {
} catch (final NamingException ne) {
}
allowedOperationsTable.put(methodName, policy);