{
Object obj = getInitialContext().lookup("DeploymentLevelRoleMappingBean");
obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
StatelessSessionHome home = (StatelessSessionHome) obj;
log.debug("Found Unsecure StatelessSessionHome");
StatelessSession bean = null;
try
{
bean = home.create();
log.debug("Created spec.UnsecureStatelessSession2");
bean.echo("Hello from nobody?");
fail("Should not be allowed");
}
catch(RemoteException re)
{
}
finally
{
if(bean != null)
bean.remove();
}
login();
obj = getInitialContext().lookup("DeploymentLevelRoleMappingBean");
obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
home = (StatelessSessionHome) obj;
log.debug("Found spec.StatelessSession2");
bean = home.create();
log.debug("Created spec.StatelessSession2");
// Test that the Entity bean sees username as its principal
String echo = bean.echo("jduke");
log.debug("bean.echo(username) = "+echo);
assertTrue("username == echo", echo.equals("jduke"));
bean.remove();
logout();
}