Search in sources :

Example 31 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class SessionContextListenerShutdownTest method testApplicationContextDestroyed.

/**
 * Note that this test method depends on (must be run after) {@link #deployArchives()}.
 *
 * @param alphaContext
 * @param bravoContext
 * @throws Exception
 */
@Test(groups = INTEGRATION, dataProvider = ARQUILLIAN_DATA_PROVIDER)
@SpecAssertion(section = SESSION_CONTEXT_EE, id = "ac")
public void testApplicationContextDestroyed(@ArquillianResource @OperateOnDeployment(ALPHA_DEPLOYMENT_NAME) URL alphaContext, @ArquillianResource @OperateOnDeployment(BRAVO_ARCHIVE_NAME) URL bravoContext) throws Exception {
    // Init SessionScopedTestFlagClient - set bravo archive deployment url
    WebClient webClient = new WebClient();
    webClient.getPage(alphaContext + "init?url=" + URLEncoder.encode(bravoContext.toExternalForm(), "UTF-8"));
    deployer.undeploy(ALPHA_DEPLOYMENT_NAME);
    TextPage info = webClient.getPage(bravoContext + "info?action=get");
    assertEquals(info.getContent(), "true");
    deployer.undeploy(BRAVO_ARCHIVE_NAME);
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 32 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class EagerSingletonPostConstructCallbackTest method testEagerSingletonPostConstructCallback.

@Test(groups = INTEGRATION)
@SpecAssertion(section = REQUEST_CONTEXT, id = "db")
@SpecAssertion(section = REQUEST_CONTEXT, id = "eb")
public void testEagerSingletonPostConstructCallback() throws Exception {
    WebClient client = new WebClient();
    TextPage page = client.getPage(contextPath + "eager");
    // Context was active
    assertTrue(page.getContent().contains("Active:true"));
    // Only singleton callback, current request not destroyed yet
    assertTrue(page.getContent().contains("Destroyed requests:1"));
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 33 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class SyntheticBeanTest method testRegisteredBean.

@Test
@SpecAssertion(section = BM_OBTAIN_BEAN, id = "a")
public void testRegisteredBean() {
    Bean<Office> bean = getUniqueBean(Office.class, Large.Literal.INSTANCE);
    assertEquals(bean.getInjectionPoints().size(), 3);
    for (InjectionPoint ip : bean.getInjectionPoints()) {
        assertEquals(bean, ip.getBean());
    }
    testOffice(bean);
}
Also used : InjectionPoint(jakarta.enterprise.inject.spi.InjectionPoint) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 34 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class LifecycleEventOrderingTest method testEventsWereFiredInCorrectOrderForManagedBean.

@Test
@SpecAssertion(section = BEAN_DISCOVERY_STEPS, id = "e")
@SpecAssertion(section = BEAN_DISCOVERY_STEPS, id = "f")
@SpecAssertion(section = BEAN_DISCOVERY_STEPS, id = "h")
@SpecAssertion(section = BEAN_DISCOVERY_STEPS, id = "i")
public void testEventsWereFiredInCorrectOrderForManagedBean() {
    ActionSequence producerEventsSeq = ActionSequence.getSequence(ProductManagement.BEAN_SEQ);
    producerEventsSeq.assertDataEquals("PIP", "PIT", "PBA", "PB");
}
Also used : ActionSequence(org.jboss.cdi.tck.util.ActionSequence) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 35 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class LongRunningConversationPropagatedByFacesContextTest method testConversationPropagatedAjax.

@Test
@SpecAssertion(section = CONVERSATION_CONTEXT_EE, id = "l")
public void testConversationPropagatedAjax() throws Exception {
    WebClient webClient = new WebClient();
    webClient.setAjaxController(new NicelyResynchronizingAjaxController());
    HtmlPage storm = webClient.getPage(getPath("storm-ajax.jsf"));
    // Begin long-running conversation - note that we use ajax
    HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
    storm = beginConversationButton.click();
    String cid = getFirstMatchingElement(storm, HtmlInput.class, "conversationId").getValueAttribute();
    assertFalse(cid.isEmpty());
    // Set input value
    HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
    stormStrength.setValueAttribute(AJAX_STORM_STRENGTH);
    // Submit value - note that we use ajax
    HtmlSubmitInput thunderButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "thunderButton");
    thunderButton.click();
    HtmlPage thunder = webClient.getPage(getPath("thunder.jsf", cid));
    stormStrength = getFirstMatchingElement(thunder, HtmlTextInput.class, "stormStrength");
    assertEquals(stormStrength.getValueAttribute(), AJAX_STORM_STRENGTH);
}
Also used : HtmlTextInput(com.gargoylesoftware.htmlunit.html.HtmlTextInput) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) NicelyResynchronizingAjaxController(com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController) WebClient(com.gargoylesoftware.htmlunit.WebClient) HtmlInput(com.gargoylesoftware.htmlunit.html.HtmlInput) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Aggregations

SpecAssertion (org.jboss.test.audit.annotations.SpecAssertion)943 Test (org.testng.annotations.Test)893 AbstractTCKTest (org.hibernate.beanvalidation.tck.tests.AbstractTCKTest)595 ConstraintViolation (jakarta.validation.ConstraintViolation)265 Validator (jakarta.validation.Validator)216 AbstractTest (org.jboss.cdi.tck.AbstractTest)212 WebClient (com.gargoylesoftware.htmlunit.WebClient)190 Method (java.lang.reflect.Method)152 TextPage (com.gargoylesoftware.htmlunit.TextPage)80 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)73 Test (org.junit.Test)49 MethodDescriptor (jakarta.validation.metadata.MethodDescriptor)44 BeanDescriptor (jakarta.validation.metadata.BeanDescriptor)40 ConstructorDescriptor (jakarta.validation.metadata.ConstructorDescriptor)38 NotNull (jakarta.validation.constraints.NotNull)35 ValidatorFactory (jakarta.validation.ValidatorFactory)32 PropertyDescriptor (jakarta.validation.metadata.PropertyDescriptor)31 Context (jakarta.enterprise.context.spi.Context)30 SeContainer (jakarta.enterprise.inject.se.SeContainer)30 WebResponse (com.gargoylesoftware.htmlunit.WebResponse)28