Search in sources :

Example 21 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class CustomErrorsUnitTestCase method test404Error.

/**
     * Test that the custom 404 error page is seen
     *
     * @throws Exception
     */
@Test
@OperateOnDeployment("error-producer.war")
public void test404Error(@ArquillianResource(ErrorGeneratorServlet.class) URL baseURL) throws Exception {
    int errorCode = HttpURLConnection.HTTP_NOT_FOUND;
    URL url = new URL(baseURL + "/ErrorGeneratorServlet?errorCode=" + errorCode);
    testURL(url, errorCode, "404.jsp", null);
}
Also used : URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 22 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SharedSessionTestCase method testSharedSessionsOneEar.

/**
     * Covers test case when there is EAR with enabled session sharing
     */
@Test
@OperateOnDeployment(EAR_DEPLOYMENT_SHARED_SESSIONS)
public void testSharedSessionsOneEar() throws IOException {
    // Note that this test should not need to use a relaxed domain handling, however the http client does not treat ipv6 domains (e.g. ::1) properly
    HttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient();
    HttpGet get1 = new HttpGet("http://" + TestSuiteEnvironment.getServerAddress() + ":8080/war1/SharedSessionServlet");
    HttpGet get2 = new HttpGet("http://" + TestSuiteEnvironment.getServerAddress() + ":8080/war2/SharedSessionServlet");
    String result = runGet(get1, client);
    assertEquals("0", result);
    result = runGet(get1, client);
    assertEquals("1", result);
    result = runGet(get2, client);
    assertEquals("2", result);
    result = runGet(get2, client);
    assertEquals("3", result);
    result = runGet(get1, client);
    assertEquals("4", result);
    HttpClientUtils.closeQuietly(client);
}
Also used : HttpClient(org.apache.http.client.HttpClient) HttpGet(org.apache.http.client.methods.HttpGet) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 23 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SharedSessionTestCase method testNotSharedSessions.

/**
     * Covers test case when there is EAR with disabled session sharing
     */
@Test
@OperateOnDeployment(EAR_DEPLOYMENT_NOT_SHARED_SESSIONS)
public void testNotSharedSessions() throws IOException {
    // Note that this test should not need to use a relaxed domain handling, however the http client does not treat ipv6 domains (e.g. ::1) properly
    HttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient();
    HttpGet getX = new HttpGet("http://" + TestSuiteEnvironment.getServerAddress() + ":8080/warX/SharedSessionServlet");
    HttpGet getY = new HttpGet("http://" + TestSuiteEnvironment.getServerAddress() + ":8080/warY/SharedSessionServlet");
    String result = runGet(getX, client);
    assertEquals("0", result);
    result = runGet(getX, client);
    assertEquals("1", result);
    result = runGet(getY, client);
    assertEquals("0", result);
    result = runGet(getY, client);
    assertEquals("1", result);
    result = runGet(getX, client);
    assertEquals("2", result);
    HttpClientUtils.closeQuietly(client);
}
Also used : HttpClient(org.apache.http.client.HttpClient) HttpGet(org.apache.http.client.methods.HttpGet) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 24 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class WSTrustTestCase method testHolderOfKey.

@Test
@RunAsClient
@OperateOnDeployment(HOLDER_OF_KEY_SERVER_DEP)
@WrapThreadContextClassLoader
public void testHolderOfKey() throws Exception {
    Bus bus = BusFactory.newInstance().createBus();
    try {
        BusFactory.setThreadDefaultBus(bus);
        final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/holderofkeywssecuritypolicy", "HolderOfKeyService");
        final URL wsdlURL = new URL("https", serviceURL.getHost(), serviceURL.getPort() - 8080 + 8444, "/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService?wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        HolderOfKeyIface proxy = (HolderOfKeyIface) service.getPort(HolderOfKeyIface.class);
        WSTrustTestUtils.setupWsseAndSTSClientHolderOfKey((BindingProvider) proxy, bus);
        assertEquals("Holder-Of-Key WS-Trust Hello World!", proxy.sayHello());
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) HolderOfKeyIface(org.jboss.as.test.integration.ws.wsse.trust.holderofkey.HolderOfKeyIface) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) WrapThreadContextClassLoader(org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)

Example 25 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class WSTrustTestCase method testUsingEPR.

/**
     * WS-Trust test with the STS information coming from EPR specified in service endpoint contract policy
     *
     * @throws Exception
     */
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testUsingEPR() throws Exception {
    Bus bus = BusFactory.newInstance().createBus();
    try {
        BusFactory.setThreadDefaultBus(bus);
        final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
        final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
        WSTrustTestUtils.setupWsse(proxy, bus);
        try {
            assertEquals("WS-Trust Hello World!", proxy.sayHello());
        } catch (Exception e) {
            throw e;
        }
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) ActAsServiceIface(org.jboss.as.test.integration.ws.wsse.trust.actas.ActAsServiceIface) ServiceIface(org.jboss.as.test.integration.ws.wsse.trust.service.ServiceIface) OnBehalfOfServiceIface(org.jboss.as.test.integration.ws.wsse.trust.onbehalfof.OnBehalfOfServiceIface) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) IOException(java.io.IOException) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) WrapThreadContextClassLoader(org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)

Aggregations

OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)94 Test (org.junit.Test)93 URL (java.net.URL)31 URI (java.net.URI)22 HttpGet (org.apache.http.client.methods.HttpGet)20 HttpResponse (org.apache.http.HttpResponse)17 InitialContext (javax.naming.InitialContext)15 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)13 QName (javax.xml.namespace.QName)11 Service (javax.xml.ws.Service)11 HttpEntity (org.apache.http.HttpEntity)10 Bus (org.apache.cxf.Bus)9 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)9 WrapThreadContextClassLoader (org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)9 ActAsServiceIface (org.jboss.as.test.integration.ws.wsse.trust.actas.ActAsServiceIface)6 OnBehalfOfServiceIface (org.jboss.as.test.integration.ws.wsse.trust.onbehalfof.OnBehalfOfServiceIface)6 GetMethodWebRequest (com.meterware.httpunit.GetMethodWebRequest)5 WebConversation (com.meterware.httpunit.WebConversation)5 WebForm (com.meterware.httpunit.WebForm)5 WebRequest (com.meterware.httpunit.WebRequest)5