Search in sources :

Example 6 with SpecAssertion

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

the class InjectionIntoNonContextualComponentTest method testFilterInitCalledAfterResourceInjection.

@Test(groups = INTEGRATION)
@SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "br")
public void testFilterInitCalledAfterResourceInjection() throws Exception {
    WebClient webClient = new WebClient();
    webClient.getPage(contextPath + "TestFilter?test=resource");
    webClient.getPage(contextPath + "TestFilter?test=ejb");
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 7 with SpecAssertion

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

the class ClientConversationContextTest method testConversationIdMayBeSetByContainer.

@Test(groups = INTEGRATION)
@SpecAssertion(section = CONVERSATION_CONTEXT_EE, id = "hb")
@SpecAssertion(section = CONVERSATION, id = "j")
public void testConversationIdMayBeSetByContainer() throws Exception {
    WebClient client = new WebClient();
    HtmlPage page = client.getPage(getPath("cumulus.jsf"));
    assert !isLongRunning(page);
    // begin a conversation
    HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
    page = beginConversationButton.click();
    assert isLongRunning(page);
    assert getCid(page) != null;
    assert page.getBody().getTextContent().contains("Cumulus congestus");
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 8 with SpecAssertion

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

the class ClientConversationContextTest method testConversationsDontCrossSessionBoundary2.

@Test(groups = INTEGRATION)
@SpecAssertion(section = CONVERSATION_CONTEXT_EE, id = "p")
public void testConversationsDontCrossSessionBoundary2() throws Exception {
    WebClient client = new WebClient();
    // Load the page
    HtmlPage rain = client.getPage(getPath("rain.jsf"));
    // begin a conversation
    HtmlSubmitInput beginConversationButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "beginConversationButton");
    rain = beginConversationButton.click();
    String cid = getCid(rain);
    // Cause rain
    HtmlSubmitInput rainButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "rain");
    rain = rainButton.click();
    // Re-request the page, inside the conversation and check it has rained
    rain = client.getPage(getPath("rain.jsf", cid));
    assertTrue(hasRained(rain));
    // Create a new web client and load the page
    WebClient client2 = new WebClient();
    verifyNonexistentConversationExceptionThrown(client2.getPage(getPath("rain.jsf", cid)));
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 9 with SpecAssertion

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

the class ClientConversationContextTest method testBeanWithDefaultQualifier.

@Test(groups = INTEGRATION)
@SpecAssertion(section = CONVERSATION, id = "id")
public void testBeanWithDefaultQualifier() throws Exception {
    WebClient client = new WebClient();
    HtmlPage page = client.getPage(getPath("builtin.jsf"));
    assert page.getBody().getTextContent().contains("Correct qualifier: true");
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 10 with SpecAssertion

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

the class ClientConversationContextTest method testBeginConversationWithExplicitIdAlreadyUsedByDifferentConversation.

@Test(groups = INTEGRATION)
@SpecAssertion(section = CONVERSATION, id = "s")
public void testBeginConversationWithExplicitIdAlreadyUsedByDifferentConversation() throws Exception {
    WebClient client = new WebClient();
    HtmlPage page = client.getPage(getPath("cumulus.jsf"));
    assertFalse(isLongRunning(page));
    // Begin a conversation with explicit id
    HtmlSubmitInput beginConversationButton = (HtmlSubmitInput) page.getElementById("form:beginNextConversationIdentifiedByCustomIdentifier");
    page = beginConversationButton.click();
    assertTrue(isLongRunning(page));
    // Try it again with the same id
    page = client.getPage(getPath("cumulus.jsf"));
    beginConversationButton = (HtmlSubmitInput) page.getElementById("form:beginConversationIdentifiedByCustomIdentifierAndSwallowException");
    page = beginConversationButton.click();
    // Exception is swallowed and the browser is redirected to home
    assertTrue(page.getBody().getTextContent().contains("Hello world!"));
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) WebClient(com.gargoylesoftware.htmlunit.WebClient) 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