Search in sources :

Example 86 with OperateOnDeployment

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

the class LoggingDeploymentResourceTestCase method testWarDeploymentConfigurationResource.

@OperateOnDeployment(WAR_DEPLOYMENT_NAME)
@Test
public void testWarDeploymentConfigurationResource() throws Exception {
    final ModelNode loggingConfiguration = readDeploymentResource(WAR_DEPLOYMENT_NAME, WAR_DEPLOYMENT_NAME + "/META-INF/logging.properties");
    // The address should have logging.properties
    final Deque<Property> resultAddress = new ArrayDeque<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList());
    Assert.assertTrue("The configuration path did not include logging.properties", resultAddress.getLast().getValue().asString().contains("logging.properties"));
    final ModelNode handler = loggingConfiguration.get("handler", "FILE");
    Assert.assertTrue("The FILE handler was not found effective configuration", handler.isDefined());
    Assert.assertTrue(handler.hasDefined("properties"));
    String fileName = null;
    // Find the fileName property
    for (Property property : handler.get("properties").asPropertyList()) {
        if ("fileName".equals(property.getName())) {
            fileName = property.getValue().asString();
            break;
        }
    }
    Assert.assertNotNull("fileName property not found", fileName);
    Assert.assertTrue(fileName.endsWith("test-logging-war.log"));
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) ArrayDeque(java.util.ArrayDeque) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 87 with OperateOnDeployment

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

the class LoggingDeploymentResourceTestCase method testDeploymentConfigurationResource.

@OperateOnDeployment(EAR_PARENT_DEPLOYMENT_NAME)
@Test
public void testDeploymentConfigurationResource() throws Exception {
    ModelNode loggingConfiguration = readDeploymentResource(EAR_PARENT_DEPLOYMENT_NAME, EAR_PARENT_DEPLOYMENT_NAME + "/META-INF/logging.properties");
    // The address should have logging.properties
    Deque<Property> resultAddress = new ArrayDeque<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList());
    Assert.assertTrue("The configuration path did not include logging.properties", resultAddress.getLast().getValue().asString().contains("logging.properties"));
    ModelNode handler = loggingConfiguration.get("handler", "FILE");
    Assert.assertTrue("The FILE handler was not found effective configuration", handler.isDefined());
    Assert.assertTrue(handler.hasDefined("properties"));
    String fileName = null;
    // Find the fileName property
    for (Property property : handler.get("properties").asPropertyList()) {
        if ("fileName".equals(property.getName())) {
            fileName = property.getValue().asString();
            break;
        }
    }
    Assert.assertNotNull("fileName property not found", fileName);
    Assert.assertTrue(fileName.endsWith("test-logging-parent-ear.log"));
    // Check the WAR which should have it's own configuration
    loggingConfiguration = readSubDeploymentResource(EAR_PARENT_DEPLOYMENT_NAME, EAR_CHILD_WAR_DEPLOYMENT_NAME, EAR_CHILD_WAR_DEPLOYMENT_NAME + "/META-INF/logging.properties");
    // The address should have logging.properties
    resultAddress = new ArrayDeque<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList());
    Assert.assertTrue("The configuration path did not include logging.properties", resultAddress.getLast().getValue().asString().contains("logging.properties"));
    handler = loggingConfiguration.get("handler", "FILE");
    Assert.assertTrue("The FILE handler was not found effective configuration", handler.isDefined());
    Assert.assertTrue(handler.hasDefined("properties"));
    fileName = null;
    // Find the fileName property
    for (Property property : handler.get("properties").asPropertyList()) {
        if ("fileName".equals(property.getName())) {
            fileName = property.getValue().asString();
            break;
        }
    }
    Assert.assertNotNull("fileName property not found", fileName);
    Assert.assertTrue(fileName.endsWith("test-logging-child-war.log"));
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) ArrayDeque(java.util.ArrayDeque) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 88 with OperateOnDeployment

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

the class RestoreOriginalRequestTestCase method testRedirectOriginalRequest.

@Test
@OperateOnDeployment("service-provider-1")
public void testRedirectOriginalRequest(@ArquillianResource URL serviceProvider1) throws Exception {
    WebRequest request = new GetMethodWebRequest(formatUrl(serviceProvider1) + "/savedRequest/savedRequest.html");
    WebConversation conversation = new WebConversation();
    WebResponse response = conversation.getResponse(request);
    WebForm webForm = response.getForms()[0];
    webForm.setParameter("j_username", "tomcat");
    webForm.setParameter("j_password", "tomcat");
    webForm.getSubmitButtons()[0].click();
    response = conversation.getCurrentPage();
    assertTrue(response.getText().contains("Back to the original requested resource."));
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) WebConversation(com.meterware.httpunit.WebConversation) WebForm(com.meterware.httpunit.WebForm) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 89 with OperateOnDeployment

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

the class RestoreOriginalRequestTestCase method testPostOriginalRequestWithParams.

@Test
@OperateOnDeployment("service-provider-2")
public void testPostOriginalRequestWithParams(@ArquillianResource URL serviceProvider2) throws Exception {
    WebRequest request = new GetMethodWebRequest(formatUrl(serviceProvider2) + "/savedRequest/savedRequest.jsp");
    request.setParameter("SAVED_PARAM", "Param was saved.");
    WebConversation conversation = new WebConversation();
    WebResponse response = conversation.getResponse(request);
    WebForm webForm = response.getForms()[0];
    webForm.setParameter("j_username", "tomcat");
    webForm.setParameter("j_password", "tomcat");
    webForm.getSubmitButtons()[0].click();
    response = conversation.getCurrentPage();
    assertTrue(response.getText().contains("Param was saved."));
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) WebConversation(com.meterware.httpunit.WebConversation) WebForm(com.meterware.httpunit.WebForm) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 90 with OperateOnDeployment

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

the class ReloadWSDLPublisherTestCase method testHelloStringAfterReload.

@Test
@OperateOnDeployment(DEPLOYMENT)
public void testHelloStringAfterReload() throws Exception {
    Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
    ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    QName serviceName = new QName("http://jbossws.org/basic", "POJOService");
    URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEPLOYMENT + "/POJOService?wsdl");
    checkWsdl(wsdlURL);
    Service service = Service.create(wsdlURL, serviceName);
    EndpointIface proxy = service.getPort(EndpointIface.class);
    Assert.assertEquals("Hello World!", proxy.helloString("World"));
    executeReloadAndWaitForCompletion(managementClient.getControllerClient(), 100000);
    checkWsdl(wsdlURL);
    serviceName = new QName("http://jbossws.org/basic", "POJOService");
    service = Service.create(wsdlURL, serviceName);
    proxy = service.getPort(EndpointIface.class);
    Assert.assertEquals("Hello World!", proxy.helloString("World"));
    Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

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