use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SubDeploymentAvailableInClassPathTestCase method testServletClassNotAvailableToEjbInEar.
/**
* Tests that for a .ear like this one:
* myapp.ear
* |
* |--- web.war
* |
* |--- ejb.jar
* <p/>
* <p/>
* the classes within the ejb.jar *don't* have access to the classes in the web.war
*
* @throws Exception
*/
@Test
@OperateOnDeployment("ear-with-single-war")
public void testServletClassNotAvailableToEjbInEar(@ArquillianResource(EjbInvokingServlet.class) URL baseUrl) throws Exception {
try (final CloseableHttpClient httpClient = HttpClients.createDefault()) {
final String classInWar = HelloWorldServlet.class.getName();
final String requestURL = baseUrl.toURI() + EjbInvokingServlet.URL_PATTERN + "?" + EjbInvokingServlet.CLASS_IN_WAR_PARAMETER + "=" + classInWar;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Unexpected echo message from servlet", EjbInvokingServlet.SUCCESS_MESSAGE, responseMessage);
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SubDeploymentAvailableInClassPathTestCase method testWarsDontSeeEachOtherInEar.
/**
* Tests that for a .ear like this one:
* myapp.ear
* |
* |--- web-one.war
* |
* |--- web-two.war
* <p/>
* <p/>
* the classes within the web-one.war *don't* have access to the classes in the web-two.war
*
* @throws Exception
*/
@Test
@OperateOnDeployment("ear-with-multiple-wars")
public void testWarsDontSeeEachOtherInEar(@ContainerResource ManagementClient managementClient) throws Exception {
try (final CloseableHttpClient httpClient = HttpClients.createDefault()) {
final String classInOtherWar = HelloWorldServlet.class.getName();
final String requestURL = managementClient.getWebUri() + "/" + OTHER_WEB_APP_CONTEXT + ServletInOtherWar.URL_PATTERN + "?" + ServletInOtherWar.CLASS_IN_OTHER_WAR_PARAMETER + "=" + classInOtherWar;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Unexpected echo message from servlet", ServletInOtherWar.SUCCESS_MESSAGE, responseMessage);
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class XercesUsageTestCase method testXercesUsageInServletInJSFApp.
/**
* Test that a JSF web application, with xerces jar packaged within the deployment, functions correctly while using
* the packaged xerces API.
*
* @throws Exception
*/
@OperateOnDeployment("app-with-jsf")
@Test
public void testXercesUsageInServletInJSFApp() throws Exception {
final HttpClient httpClient = new DefaultHttpClient();
final String xml = "dummy.xml";
final String requestURL = withJsf.toExternalForm() + XercesUsageServlet.URL_PATTERN + "?" + XercesUsageServlet.XML_RESOURCE_NAME_PARAMETER + "=" + xml;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Unexpected echo message from servlet", XercesUsageServlet.SUCCESS_MESSAGE, responseMessage);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class XercesUsageTestCase method testXercesUsageInServletInNonJSFApp.
/**
* Test that a non-JSF web application, with xerces jar packaged within the deployment, functions correctly
* while using the packaged xerces API.
*
* @throws Exception
*/
@OperateOnDeployment("app-without-jsf")
@Test
public void testXercesUsageInServletInNonJSFApp() throws Exception {
final HttpClient httpClient = new DefaultHttpClient();
final String xml = "dummy.xml";
final String requestURL = withoutJsf.toExternalForm() + XercesUsageServlet.URL_PATTERN + "?" + XercesUsageServlet.XML_RESOURCE_NAME_PARAMETER + "=" + xml;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Unexpected echo message from servlet", XercesUsageServlet.SUCCESS_MESSAGE, responseMessage);
}
Aggregations