Search in sources :

Example 26 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class StatefulFailoverTestCase method nestedBeanFailover.

/**
 * Validates failover of a @Stateful bean containing a nested @Stateful bean
 * containing an injected CDI bean that uses an interceptor and decorator.
 */
@ATTest({ "modules/testcases/jdkAll/Wildfly/clustering/src/main/java#10.0.0.Final*11.0.0.Final", "modules/testcases/jdkAll/Eap7/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x/clustering/src/main/java" })
public void nestedBeanFailover(@ArquillianResource() @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1, @ArquillianResource() @OperateOnDeployment(DEPLOYMENT_2) URL baseURL2) throws Exception {
    URI uri1 = StatefulServlet.createURI(baseURL1, MODULE_NAME, NestedIncrementorBean.class.getSimpleName());
    URI uri2 = StatefulServlet.createURI(baseURL2, MODULE_NAME, NestedIncrementorBean.class.getSimpleName());
    try (CloseableHttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient()) {
        assertEquals(20010101, queryCount(client, uri1));
        assertEquals(20020202, queryCount(client, uri1));
        assertEquals(20030303, queryCount(client, uri2));
        assertEquals(20040404, queryCount(client, uri2));
        undeploy(DEPLOYMENT_2);
        assertEquals(20050505, queryCount(client, uri1));
        assertEquals(20060606, queryCount(client, uri1));
        deploy(DEPLOYMENT_2);
        assertEquals(20070707, queryCount(client, uri1));
        assertEquals(20080808, queryCount(client, uri1));
        assertEquals(20090909, queryCount(client, uri2));
        assertEquals(20101010, queryCount(client, uri2));
        undeploy(DEPLOYMENT_1);
        assertEquals(20111111, queryCount(client, uri2));
        assertEquals(20121212, queryCount(client, uri2));
        deploy(DEPLOYMENT_1);
        assertEquals(20131313, queryCount(client, uri1));
        assertEquals(20141414, queryCount(client, uri1));
        assertEquals(20151515, queryCount(client, uri2));
        assertEquals(20161616, queryCount(client, uri2));
    }
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) NestedIncrementorBean(org.jboss.additional.testsuite.jdkall.present.clustering.cluster.ejb.stateful.bean.NestedIncrementorBean) URI(java.net.URI) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Example 27 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class StatefulFailoverTestCase method failoverOnStop.

/**
 * Validates failover on server restart of a simple @Stateful bean
 */
@ATTest({ "modules/testcases/jdkAll/Wildfly/clustering/src/main/java#10.0.0.Final*11.0.0.Final", "modules/testcases/jdkAll/Eap7/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x/clustering/src/main/java" })
public void failoverOnStop(@ArquillianResource() @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1, @ArquillianResource() @OperateOnDeployment(DEPLOYMENT_2) URL baseURL2) throws Exception {
    URI uri1 = StatefulServlet.createURI(baseURL1, MODULE_NAME, SimpleIncrementorBean.class.getSimpleName());
    URI uri2 = StatefulServlet.createURI(baseURL2, MODULE_NAME, SimpleIncrementorBean.class.getSimpleName());
    try (CloseableHttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient()) {
        assertEquals(1, queryCount(client, uri1));
        assertEquals(2, queryCount(client, uri1));
        assertEquals(3, queryCount(client, uri2));
        assertEquals(4, queryCount(client, uri2));
        stop(CONTAINER_2);
        assertEquals(5, queryCount(client, uri1));
        assertEquals(6, queryCount(client, uri1));
        start(CONTAINER_2);
        assertEquals(7, queryCount(client, uri1));
        assertEquals(8, queryCount(client, uri1));
        assertEquals(9, queryCount(client, uri2));
        assertEquals(10, queryCount(client, uri2));
        stop(CONTAINER_1);
        assertEquals(11, queryCount(client, uri2));
        assertEquals(12, queryCount(client, uri2));
        start(CONTAINER_1);
        assertEquals(13, queryCount(client, uri1));
        assertEquals(14, queryCount(client, uri1));
        assertEquals(15, queryCount(client, uri2));
        assertEquals(16, queryCount(client, uri2));
    }
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) SimpleIncrementorBean(org.jboss.additional.testsuite.jdkall.present.clustering.cluster.ejb.stateful.bean.SimpleIncrementorBean) URI(java.net.URI) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Example 28 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class CookieHeaderServletTestCase method headerProtocolTest.

@ATTest({ "modules/testcases/jdkAll/Wildfly/web/src/main/java#13.0.0", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/web/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/web/src/main/java#7.1.4", "modules/testcases/jdkAll/Eap71x/web/src/main/java#7.1.4" })
@Test
@OperateOnDeployment(DEPLOYMENT)
public void headerProtocolTest(@ArquillianResource URL url) throws Exception {
    URL testURL = new URL(url.toString() + "cookieHeaderServlet");
    final HttpGet request = new HttpGet(testURL.toString());
    request.setProtocolVersion(HttpVersion.HTTP_1_0);
    CloseableHttpClient httpClient = HttpClientBuilder.create().build();
    CloseableHttpResponse response = null;
    response = httpClient.execute(request);
    System.out.println("Protocol Version : " + response.getProtocolVersion());
    Assert.assertTrue("Protocol Version should be HTTP/1.1.", response.getProtocolVersion().toString().contains("HTTP/1.1"));
    IOUtils.closeQuietly(response);
    httpClient.close();
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) HttpGet(org.apache.http.client.methods.HttpGet) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Example 29 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class SecurityDeserializationTestCase method testSecuirtyDatabind6.

@ATTest({ "modules/testcases/jdkAll/Wildfly/security/src/main/java#16.0.0.Beta1", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/security/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/security/src/main/java#7.1.6", "modules/testcases/jdkAll/Eap71x/security/src/main/java#7.1.6", "modules/testcases/jdkAll/Eap72x-Proposed/security/src/main/java#7.2.1", "modules/testcases/jdkAll/Eap72x/security/src/main/java#7.2.1" })
@Test
public void testSecuirtyDatabind6() throws Exception {
    final String JSON = aposToQuotes("{'v':['org.jboss.util.propertyeditor.DocumentEditor','/tmp/foobar.txt']}");
    ObjectMapper mapper = new ObjectMapper();
    mapper.enableDefaultTyping();
    try {
        PolyWrapper sc = mapper.readValue(JSON, PolyWrapper.class);
        fail("Should not be able to deserialize because of security prevention.");
    } catch (JsonMappingException e) {
        assertTrue("Fail because of security issues...", e.getMessage().contains("prevented for security reasons"));
    }
}
Also used : JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Example 30 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class SecurityDeserializationTestCase method testSecuirtyDatabind5.

@ATTest({ "modules/testcases/jdkAll/Wildfly/security/src/main/java#16.0.0.Beta1", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/security/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/security/src/main/java#7.1.6", "modules/testcases/jdkAll/Eap71x/security/src/main/java#7.1.6", "modules/testcases/jdkAll/Eap72x-Proposed/security/src/main/java#7.2.1", "modules/testcases/jdkAll/Eap72x/security/src/main/java#7.2.1" })
@Test
public void testSecuirtyDatabind5() throws Exception {
    final String JSON = aposToQuotes("{'v':['org.slf4j.ext.EventData','/tmp/foobar.txt']}");
    ObjectMapper mapper = new ObjectMapper();
    mapper.enableDefaultTyping();
    try {
        PolyWrapper sc = mapper.readValue(JSON, PolyWrapper.class);
        fail("Should not be able to deserialize because of security prevention.");
    } catch (JsonMappingException e) {
        assertTrue("Fail because of security issues...", e.getMessage().contains("prevented for security reasons"));
    }
}
Also used : JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Aggregations

ATTest (org.jboss.eap.additional.testsuite.annotations.ATTest)33 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)23 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)23 Test (org.junit.Test)14 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)6 URI (java.net.URI)4 URL (java.net.URL)2 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 ScheduleExpression (javax.ejb.ScheduleExpression)2 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)2 HttpGet (org.apache.http.client.methods.HttpGet)2 CalendarBasedTimeout (org.jboss.as.ejb3.timerservice.schedule.CalendarBasedTimeout)2 ComboPooledDataSource (com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1