log.debug("+++ testEJBNullSecurityDomain");
Object obj = getInitialContext().lookup("null.StatelessSession");
obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
StatelessSessionHome home = (StatelessSessionHome) obj;
log.debug("Found null.StatelessSession Home");
StatelessSession bean = null;
try
{
bean = home.create();
fail("Invoking create() should fail");
}
catch (Exception e)
{
Throwable t = e.getCause();
if (t instanceof SecurityException)
{
log.debug("Invoking create() was correctly denied by a SecurityException:", e);
}
else
{
log.debug("Invoking create() failed by an unexpected reason:", e);
fail("Unexpected exception");
}
}
SecurityClient client = SecurityClientFactory.getSecurityClient();
client.setSimple("scott", "echoman");
client.login();
try
{
bean = home.create();
bean.echo("hi");
}
catch (Exception e)
{
fail(e.getLocalizedMessage());
}