public void testSingletonPostconstructSecurityNotPropagating() throws Exception {
SecurityClient client = SecurityClientFactory.getSecurityClient();
client.setSimple("user1", "password1");
client.login();
try {
WhoAmI bean = lookupSingletonUseBeanWithIdentity(); //To load the singleton
bean.getCallerPrincipal();
Assert.fail("Deployment should fail");
} catch (Exception dex) {
Throwable t = checkEjbException(dex);
log.info("Expected deployment error because the Singleton has nosecurity context per itself", dex.getCause());
Assert.assertThat(t.getMessage(), t.getMessage(), CoreMatchers.containsString("WFLYEJB0364"));