use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class WSTrustTestCase method testNoSignatureUsername.
/**
* No SIGNATURE_USERNAME is provided to the service. Service will use the
* client's keystore alias in its place.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoSignatureUsername() 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);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
WSTrustTestUtils.setupWsseAndSTSClientNoSignatureUsername(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SubDeploymentAvailableInClassPathTestCase method testWarSeeJarAndJarSeeImplicitModulesFirst.
/**
* Tests that for a .ear like this one:
* myapp.ear
* |
* |--- lib/javax-naming-test-impl.jar this jar contains override for javax.naming.Binding class
* | which has to be resolved from implicit modules
* |
* |--- war-access-to-jar.war
* |
* |--- servlet-logic.jar
* <p/>
* the classes within the war-access-to-jar.war have access to the classes in the servlet-logic.jar
* and servlet-logic.jar has implicit module dependencies first in class path
*
* @throws Exception
*/
@Test
@OperateOnDeployment("ear-with-war-and-jar")
public void testWarSeeJarAndJarSeeImplicitModulesFirst(@ArquillianResource(EjbInvokeClassloaderToStringServlet.class) URL baseUrl) throws Exception {
try (final CloseableHttpClient httpClient = HttpClients.createDefault()) {
final String requestURL = baseUrl.toURI() + EjbInvokeClassloaderToStringServlet.URL_PATTERN + "?" + EjbInvokeClassloaderToStringServlet.CLASS_NAME_PARAMETER + "=javax.naming.InitialContext";
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);
// expected is that class is loaded from implicit module
// app's class loader toString returns: ModuleClassLoader for Module deployment.war-access-to-jar.ear:main from Service Module Loader
Assert.assertEquals("Unexpected response from servlet", "bootstrap class loader", responseMessage);
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SubDeploymentAvailableInClassPathTestCase method testEjbClassAvailableInServlet.
/**
* Tests that for a .ear like this one:
* myapp.ear
* |
* |--- web.war
* |
* |--- ejb.jar
* <p/>
* the classes within the web.war have access to the classes in the ejb.jar
*
* @throws Exception
*/
@Test
@OperateOnDeployment("ear-with-single-war")
public void testEjbClassAvailableInServlet(@ArquillianResource(HelloWorldServlet.class) URL baseUrl) throws Exception {
try (final CloseableHttpClient httpClient = HttpClients.createDefault()) {
final String message = "JBossAS7";
final String requestURL = baseUrl.toURI() + HelloWorldServlet.URL_PATTERN + "?" + HelloWorldServlet.PARAMETER_NAME + "=" + message;
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", message, responseMessage);
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SubDeploymentAvailableInClassPathTestCase method testExplodedWarInEar.
/**
* Tests that for a .ear like this one:
* myapp.ear
* |
* |--- web.war/WEB-INF/classes
* |--- web.war/index.jsp
* |
* |--- ejb.jar
* <p/>
* <p/>
* the classes within the web.war have access to the classes in the ejb.jar
* web.war is a folder, not an archive.
*
* @throws Exception
*/
@Test
@OperateOnDeployment("ear-with-exploded-war")
public void testExplodedWarInEar(@ArquillianResource(HelloWorldServlet.class) URL baseUrl) throws Exception {
try (final CloseableHttpClient httpClient = HttpClients.createDefault()) {
String message = "OK!";
String requestURL = baseUrl.toURI() + "/index.jsp";
HttpGet request = new HttpGet(requestURL);
HttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Unexpected echo message from servlet", message, responseMessage);
message = "JBossAS7";
requestURL = baseUrl.toURI() + HelloWorldServlet.URL_PATTERN + "?" + HelloWorldServlet.PARAMETER_NAME + "=" + message;
request = new HttpGet(requestURL);
response = httpClient.execute(request);
entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Unexpected echo message from servlet", message, responseMessage);
}
}
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);
}
}
Aggregations