Author: rsearls
Date: 2014-12-28 17:59:59 -0500 (Sun, 28 Dec 2014)
New Revision: 19295
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1582/JBWS1582TestCase.java
Log:
arquillian migration jbws1582 test
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1582/JBWS1582TestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1582/JBWS1582TestCase.java 2014-12-28
22:35:19 UTC (rev 19294)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1582/JBWS1582TestCase.java 2014-12-28
22:59:59 UTC (rev 19295)
@@ -36,7 +36,18 @@
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import junit.framework.Test;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.Deployer;
import org.jboss.ws.common.IOUtils;
import org.jboss.wsf.test.JBossWSTest;
@@ -49,45 +60,47 @@
*
* @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
*/
+(a)RunWith(Arquillian.class)
public class JBWS1582TestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-jbws1582-attacked.war") { {
+ @ArquillianResource
+ private URL baseURL;
+
+ @ArquillianResource
+ Deployer deployer;
+
+ @Deployment(name="jaxws-jbws1582-attacked", testable = false,
managed=false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-jbws1582-attacked.war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.jbws1582.AttackedEndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws1582.Endpoint.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1582/WEB-INF/wsdl/attack-service.wsdl"),
"wsdl/attack-service.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1582/WEB-INF/attack-web.xml"));
+ return archive;
+ }
+
+ @Deployment(name="jaxws-jbws1582", testable = false)
+ public static WebArchive createDeployment1() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-jbws1582.war");
archive
.addManifest()
- .addClass(org.jboss.test.ws.jaxws.jbws1582.AttackedEndpointImpl.class)
.addClass(org.jboss.test.ws.jaxws.jbws1582.Endpoint.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1582/WEB-INF/wsdl/attack-service.wsdl"),
"wsdl/attack-service.wsdl")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1582/WEB-INF/attack-web.xml"));
- }
- });
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-jbws1582.war") { {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.jbws1582.Endpoint.class)
.addClass(org.jboss.test.ws.jaxws.jbws1582.EndpointImpl.class)
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1582/WEB-INF/wsdl/service.wsdl"), "wsdl/service.wsdl")
.setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1582/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ return archive;
}
-
- static {
- JBossWSTestHelper.writeToFile(createDeployments());
- }
- private String endpointURL = "http://" + getServerHost() +
":8080/jaxws-jbws1582/TestService";
private String targetNS = "http://jbws1582.jaxws.ws.test.jboss.org/";
- public static Test suite()
- {
- return new JBossWSTestSetup(JBWS1582TestCase.class,
"jaxws-jbws1582.war");
- }
-
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-jbws1582")
public void testLegalAccess() throws Exception
{
+ String endpointURL = "http://" + baseURL.getHost() +
":8080/jaxws-jbws1582/TestService";
URL wsdlURL = new URL(endpointURL + "?wsdl");
QName serviceName = new QName(targetNS, "EndpointService");
@@ -98,6 +111,9 @@
assertEquals("Hello", retObj);
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-jbws1582")
public void testSOAPMessage() throws Exception
{
String response = getResponse("jaxws/jbws1582/message.xml");
@@ -105,6 +121,9 @@
assertTrue(response.contains("<return>Hello</return>"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-jbws1582")
public void testSOAPMessageAttack1() throws Exception
{
String response = getResponse("jaxws/jbws1582/attack-message-1.xml");
@@ -119,6 +138,9 @@
}
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-jbws1582")
public void testSOAPMessageAttack2() throws Exception
{
String response = getResponse("jaxws/jbws1582/attack-message-2.xml");
@@ -158,11 +180,14 @@
return response;
}
+
+ @Test
+ @RunAsClient
public void testAttackedArchiveDeployment() throws Exception
{
try
{
- deploy("jaxws-jbws1582-attacked.war");
+ deployer.deploy("jaxws-jbws1582-attacked");
if (isIntegrationCXF())
{
// Apache CXF ignores DOCTYPE section in WSDLs
@@ -181,7 +206,7 @@
}
finally
{
- undeploy("jaxws-jbws1582-attacked.war");
+ deployer.undeploy("jaxws-jbws1582-attacked");
}
}
Show replies by date