Author: rsearls
Date: 2014-12-23 10:21:28 -0500 (Tue, 23 Dec 2014)
New Revision: 19225
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
Log:
arquillian migration context test
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java 2014-12-23
15:00:36 UTC (rev 19224)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java 2014-12-23
15:21:28 UTC (rev 19225)
@@ -30,7 +30,15 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
+import org.junit.runner.RunWith;
+import org.junit.Test;
+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.JavaArchive;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.wsf.test.CleanupOperation;
@@ -45,68 +53,68 @@
* @author Thomas.Diesler(a)jboss.org
* @since 29-Apr-2005
*/
+(a)RunWith(Arquillian.class)
public class WebServiceContextEJBTestCase extends JBossWSTest
{
private static Endpoint port;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.JarDeployment("jaxws-samples-context.jar")
{ {
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static JavaArchive createDeployments() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"jaxws-samples-context.jar");
archive
.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ "Dependencies: org.jboss.ws.common\n"))
.addClass(org.jboss.test.ws.jaxws.samples.context.EndpointEJB.class)
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/context/META-INF/jboss.xml"), "jboss.xml");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSTestSetup(WebServiceContextEJBTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()), true, new CleanupOperation() {
- @Override
- public void cleanUp() {
- port = null;
- }
- });
- }
+ public void setUp() throws Exception {
+ URL wsdlURL = new URL(baseURL + "/jaxws-samples-context?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/context",
"EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ port = (Endpoint) service.getPort(Endpoint.class);
- public void setUp() throws Exception
- {
- if (port == null)
- {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-context?wsdl");
- QName qname = new QName("http://org.jboss.ws/jaxws/context",
"EndpointService");
- Service service = Service.create(wsdlURL, qname);
- port = (Endpoint)service.getPort(Endpoint.class);
-
- BindingProvider bp = (BindingProvider)port;
- bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"kermit");
- bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"thefrog");
- }
+ BindingProvider bp = (BindingProvider) port;
+ bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "kermit");
+ bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"thefrog");
}
+ @Test
+ @RunAsClient
public void testGetWebContext() throws Exception
{
+ setUp();
String retStr = port.testGetMessageContext();
assertEquals("pass", retStr);
}
+ @Test
+ @RunAsClient
public void testMessageContextProperties() throws Exception
{
+ setUp();
String retStr = port.testMessageContextProperties();
assertEquals("pass", retStr);
}
-
+
+ @Test
+ @RunAsClient
public void testGetUserPrincipal() throws Exception
{
+ setUp();
String retStr = port.testGetUserPrincipal();
assertEquals("kermit", retStr);
}
+ @Test
+ @RunAsClient
public void testIsUserInRole() throws Exception
{
+ setUp();
assertTrue("kermit is my friend",
port.testIsUserInRole("friend"));
}
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2014-12-23
15:00:36 UTC (rev 19224)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2014-12-23
15:21:28 UTC (rev 19225)
@@ -30,7 +30,15 @@
import javax.xml.ws.BindingProvider;
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.asset.StringAsset;
import org.jboss.wsf.test.CleanupOperation;
@@ -45,13 +53,17 @@
* @author Thomas.Diesler(a)jboss.org
* @since 29-Apr-2005
*/
+(a)RunWith(Arquillian.class)
public class WebServiceContextJSETestCase extends JBossWSTest
{
private static Endpoint port;
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-context-jse.war") { {
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployments() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-context-jse.war");
archive
.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ "Dependencies: org.jboss.ws.common\n"))
@@ -59,56 +71,53 @@
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/context/META-INF/permissions.xml"),
"permissions.xml")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/context/WEB-INF/jboss-web.xml"), "jboss-web.xml")
.setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/context/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSTestSetup(WebServiceContextJSETestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()), true, new CleanupOperation() {
- @Override
- public void cleanUp() {
- port = null;
- }
- });
- }
- public void setUp() throws Exception
- {
- if (port == null)
- {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-context-jse?wsdl");
- QName qname = new QName("http://org.jboss.ws/jaxws/context",
"EndpointService");
- Service service = Service.create(wsdlURL, qname);
- port = (Endpoint)service.getPort(Endpoint.class);
-
- BindingProvider bp = (BindingProvider)port;
- bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"kermit");
- bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"thefrog");
- }
+ public void setUp() throws Exception {
+ URL wsdlURL = new URL(baseURL + "/jaxws-samples-context-jse?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/context",
"EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ port = (Endpoint) service.getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider) port;
+ bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "kermit");
+ bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"thefrog");
}
+ @Test
+ @RunAsClient
public void testGetWebContext() throws Exception
{
+ setUp();
String retStr = port.testGetMessageContext();
assertEquals("pass", retStr);
}
+ @Test
+ @RunAsClient
public void testMessageContextProperties() throws Exception
{
+ setUp();
String retStr = port.testMessageContextProperties();
assertEquals("pass", retStr);
}
+ @Test
+ @RunAsClient
public void testGetUserPrincipal() throws Exception
{
+ setUp();
String retStr = port.testGetUserPrincipal();
assertEquals("kermit", retStr);
}
+ @Test
+ @RunAsClient
public void testIsUserInRole() throws Exception
{
+ setUp();
assertTrue("kermit is my friend",
port.testIsUserInRole("friend"));
}
}