use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.
the class ApplicationContextSharedTest method testApplicationContextShared.
@OperateOnDeployment("TEST")
@Test
@SpecAssertion(section = APPLICATION_CONTEXT_EE, id = "e")
public void testApplicationContextShared() throws Exception {
FMSModelIII.reset();
FMS flightManagementSystem = getContextualReference(FMS.class);
flightManagementSystem.climb();
Timer timer = new Timer().setDelay(20, TimeUnit.SECONDS).addStopCondition(new StopCondition() {
public boolean isSatisfied() {
return FMSModelIII.isClimbed();
}
}).start();
flightManagementSystem.descend();
timer.addStopCondition(new StopCondition() {
public boolean isSatisfied() {
return FMSModelIII.isDescended();
}
}, true).start();
assertTrue(flightManagementSystem.isSameBean());
}
use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.
the class DestroyForSameCreationalContext2Test method testDestroyForSameCreationalContextOnly.
@Test
@SpecAssertion(section = CONTEXT, id = "r")
public void testDestroyForSameCreationalContextOnly() {
// Check that the mock cc is called (via cc.release()) when we request a context destroyed
// Note that this is an indirect effect
Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
// We also test this directly using a custom contextual, and ensuring that the same contextual is passed to both methods
DummyContextual contextual = new DummyContextual();
sessionContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
destroyContext(sessionContext);
assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
// Also test the request context
contextual = new DummyContextual();
requestContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
destroyContext(requestContext);
assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
}
use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.
the class ProcessInjectionPointFiredTest method testDisposerMethodInjectionPoint.
@Test
@SpecAssertion(section = BEAN_DISCOVERY_STEPS, id = "je")
public void testDisposerMethodInjectionPoint() {
InjectionPoint deltaIp = extension.getDisposerDeltaIp();
assertNotNull(deltaIp);
verifyType(deltaIp, Delta.class);
}
use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.
the class SessionContextTest method testSessionContextSharedBetweenServletRequestsInSameHttpSession.
@Test(groups = INTEGRATION)
@SpecAssertion(section = SESSION_CONTEXT_EE, id = "b")
public void testSessionContextSharedBetweenServletRequestsInSameHttpSession() throws Exception {
WebClient webClient = new WebClient();
TextPage firstRequestResult = webClient.getPage(contextPath + "introspect");
assertNotNull(firstRequestResult.getContent());
String sessionBeanId = firstRequestResult.getContent();
assertNotNull(sessionBeanId);
// Make a second request and make sure the same context is used
TextPage secondRequestResult = webClient.getPage(contextPath + "introspect");
assertNotNull(secondRequestResult.getContent());
assertEquals(secondRequestResult.getContent(), sessionBeanId);
}
use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.
the class SessionContextTest method testSessionContextDestroyedWhenHttpSessionInvalidated.
/**
* Test that the session context is destroyed at the very end of any request
* in which invalidate() was called, after all filters and
* ServletRequestListeners have been called.
*
* @throws Exception
*/
@Test(groups = INTEGRATION)
@SpecAssertion(section = SESSION_CONTEXT_EE, id = "ca")
public void testSessionContextDestroyedWhenHttpSessionInvalidated() throws Exception {
WebClient webClient = new WebClient();
TextPage firstRequestResult = webClient.getPage(contextPath + "introspect");
assertNotNull(firstRequestResult.getContent());
String sessionBeanId = firstRequestResult.getContent();
// Invalidate the session
webClient.getPage(contextPath + "introspect?mode=invalidate");
// Make a second request and make sure the same context is not there
TextPage secondRequestResult = webClient.getPage(contextPath + "introspect");
assertNotNull(secondRequestResult.getContent());
assertNotEquals(secondRequestResult.getContent(), sessionBeanId);
// Verify context is destroyed after all filters and
// ServletRequestListeners
TextPage verifyResult = webClient.getPage(contextPath + "introspect?mode=verify");
ActionSequence correctSequence = new ActionSequence().add(IntrospectServlet.class.getName()).add(IntrospectHttpSessionListener.class.getName()).add(IntrospectFilter.class.getName()).add(IntrospectServletRequestListener.class.getName()).add(SimpleSessionBean.class.getName());
assertEquals(verifyResult.getContent(), correctSequence.toString());
}
Aggregations