Author: asoldano
Date: 2014-11-26 12:13:12 -0500 (Wed, 26 Nov 2014)
New Revision: 19114
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
Log:
More tests converted...
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-26 11:35:37
UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-26 17:13:12
UTC (rev 19114)
@@ -106,6 +106,20 @@
</properties>
</configuration>
</execution>
+ <execution>
+ <id>testsuite-default-config-tests</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+
<source>${basedir}/src/test/scripts/jbws-testsuite-default-config-tests.groovy</source>
+ <properties>
+
<inputFile>${jboss.home}/standalone/configuration/standalone.xml</inputFile>
+
<outputFile>${jboss.home}/standalone/configuration/jbws-testsuite-default-config-tests.xml</outputFile>
+ </properties>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin> <!-- This copies jbossws-cxf-factories jar to endorsed dir
before the integration-tests are run -->
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2014-11-26
17:13:12 UTC (rev 19114)
@@ -36,5 +36,22 @@
<property
name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
+ <container qualifier="default-config-tests" mode="manual">
+ <configuration>
+ <property name="jbossHome">${jboss.home}</property>
+ <property
name="javaVmArguments">-Djboss.socket.binding.port-offset=20000</property>
+ <!-- <property name="javaVmArguments">${server.jvm.args}
-Djboss.inst=${basedir}/target/jbossas -Dtest.bind.address=${node0}</property>
-->
+ <property
name="serverConfig">jbws-testsuite-default-config-tests.xml</property>
+ <!-- -Djboss.inst is not necessarily needed, only in case the test case
neeeds path to the instance it runs in.
+ In the future, Arquillian should capable of injecting it into
@ArquillianResource File or such. -->
+ <property
name="allowConnectingToRunningServer">true</property>
+ <!-- <property
name="managementAddress">${node0:127.0.0.1}</property> -->
+ <property
name="managementPort">${as.managementPort:29990}</property>
+
+ <!-- AS7-4070 -->
+ <property name="waitForPorts">${as.debug.port:28787}
${as.managementPort:29990}</property>
+ <property
name="waitForPortsTimeoutInSeconds">8</property>
+ </configuration>
+ </container>
</group>
</arquillian>
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,13 +21,23 @@
*/
package org.jboss.test.ws.jaxws.cxf.clientConfig;
+import java.io.File;
import java.net.URL;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+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.ws.common.IOUtils;
import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Verifies client configuration setup
@@ -35,46 +45,110 @@
* @author alessio.soldano(a)jboss.com
* @since 31-May-2012
*/
+(a)RunWith(Arquillian.class)
public class CXFClientConfigurationTestCase extends JBossWSTest
{
- public static Test suite()
- {
- return new JBossWSTestSetup(CXFClientConfigurationTestCase.class,
DeploymentArchives.NAMES);
+ private static final String DEP = "jaxws-cxf-clientConfig";
+ private static final String CLIENT_DEP =
"jaxws-cxf-clientConfig-inContainer-client";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = DEP, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.EndpointImpl.class);
+ return archive;
}
+
+ @Deployment(name = CLIENT_DEP, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, CLIENT_DEP +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf.impl\n"))
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/clientConfig/META-INF/jaxws-client-config.xml"),
"META-INF/jaxws-client-config.xml")
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.TestUtils.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/clientConfig/META-INF/permissions.xml"),
"permissions.xml");
+ return archive;
+ }
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-cxf-clientConfig-client.jar") { {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/clientConfig/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
+ }
+ });
+ }
+
/**
* Verifies a custom client configuration can be read from conf file and set
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFile() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFile());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationOnDispatchFromFile() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationOnDispatchFromFile());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationFromFileInContainer() throws Exception {
assertEquals("1",
runTestInContainer("testCustomClientConfigurationFromFile"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationOnDispatchFromFileInContainer() throws
Exception {
assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatchFromFile"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFileUsingFeature() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFileUsingFeature());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationOnDispatchFromFileUsingFeature() throws
Exception {
assertTrue(getHelper().testCustomClientConfigurationOnDispatchFromFileUsingFeature());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationFromFileUsingFeatureInContainer() throws
Exception {
assertEquals("1",
runTestInContainer("testCustomClientConfigurationFromFileUsingFeature"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationOnDispatchFromFileUsingFeatureInContainer()
throws Exception {
assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatchFromFileUsingFeature"));
}
@@ -84,18 +158,32 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testConfigurationChange() throws Exception {
assertTrue(getHelper().testConfigurationChange());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testConfigurationChangeOnDispatch() throws Exception {
assertTrue(getHelper().testConfigurationChangeOnDispatch());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testConfigurationChangeInContainer() throws Exception {
assertEquals("1",
runTestInContainer("testConfigurationChange"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testConfigurationChangeOnDispatchInContainer() throws Exception {
assertEquals("1",
runTestInContainer("testConfigurationChangeOnDispatch"));
}
@@ -104,15 +192,13 @@
private Helper getHelper() {
Helper helper = new Helper();
- helper.setTargetEndpoint("http://" + getServerHost() +
":8080/jaxws-cxf-clientConfig/EndpointImpl");
+ helper.setTargetEndpoint(baseURL + "EndpointImpl");
return helper;
}
private String runTestInContainer(String test) throws Exception
{
- URL url = new URL("http://" + getServerHost()
- +
":8080/jaxws-cxf-clientConfig-inContainer-client?path=/jaxws-cxf-clientConfig/EndpointImpl&method="
+ test
- + "&helper=" + Helper.class.getName());
+ URL url = new URL(baseURL +
"?path=/jaxws-cxf-clientConfig/EndpointImpl&method=" + test +
"&helper=" + Helper.class.getName());
return IOUtils.readAndCloseStream(url.openStream());
}
}
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2013, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.cxf.clientConfig;
-
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
-
-/**
- * Verifies client configuration setup (in-container tests, relying on AS model)
- *
- * @author alessio.soldano(a)jboss.com
- * @since 31-May-2012
- */
-public class CXFClientConfigurationTestCaseForked extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSTestSetup(CXFClientConfigurationTestCaseForked.class,
DeploymentArchives.NAMES);
- }
-
- /**
- * Verifies the default client configuration from AS model is used
- *
- * @throws Exception
- */
- public void testDefaultClientConfigurationInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testDefaultClientConfiguration"));
- }
-
- public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testDefaultClientConfigurationOnDispatch"));
- }
-
- /**
- * Verifies a client configuration from AS model can be set
- *
- * @throws Exception
- */
- public void testCustomClientConfigurationInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfiguration"));
- }
-
- public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatch"));
- }
-
- public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfigurationUsingFeature"));
- }
-
- public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws
Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
- }
-
- // -------------------------
-
- private String runTestInContainer(String test) throws Exception
- {
- URL url = new URL("http://" + getServerHost()
- +
":8080/jaxws-cxf-clientConfig-inContainer-client?path=/jaxws-cxf-clientConfig/EndpointImpl&method="
+ test
- + "&helper=" + Helper.class.getName());
- return IOUtils.readAndCloseStream(url.openStream());
- }
-}
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java
(rev 0)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.clientConfig;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.arquillian.container.test.api.ContainerController;
+import org.jboss.arquillian.container.test.api.Deployer;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+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.ws.common.IOUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Verifies client configuration setup (in-container tests, relying on AS model)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 31-May-2012
+ */
+(a)RunWith(Arquillian.class)
+public class CXFDefaultClientConfigurationTestCase extends JBossWSTest
+{
+ private static final String DEP = "jaxws-cxf-clientConfig-def";
+ private static final String CLIENT_DEP =
"jaxws-cxf-clientConfig-inContainer-def-client";
+ private static final String DEFAULT_CONFIG_TESTS_SERVER =
"default-config-tests";
+
+ @ArquillianResource
+ private Deployer deployer;
+
+ @ArquillianResource
+ private ContainerController containerController;
+
+ @Deployment(name = DEP, testable = false)
+ @TargetsContainer(DEFAULT_CONFIG_TESTS_SERVER)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.EndpointImpl.class);
+ return archive;
+ }
+
+ @Deployment(name = CLIENT_DEP, testable = false)
+ @TargetsContainer(DEFAULT_CONFIG_TESTS_SERVER)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, CLIENT_DEP +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf.impl\n"))
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/clientConfig/META-INF/jaxws-client-config.xml"),
"META-INF/jaxws-client-config.xml")
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.TestUtils.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/clientConfig/META-INF/permissions.xml"),
"permissions.xml");
+ return archive;
+ }
+
+ @Before
+ public void startContainerAndDeploy() throws Exception {
+ if (!containerController.isStarted(DEFAULT_CONFIG_TESTS_SERVER)) {
+ containerController.start(DEFAULT_CONFIG_TESTS_SERVER);
+ }
+ }
+
+ /**
+ * Verifies the default client configuration from AS model is used
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testDefaultClientConfigurationInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testDefaultClientConfiguration"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testDefaultClientConfigurationOnDispatch"));
+ }
+
+ /**
+ * Verifies a client configuration from AS model can be set
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfiguration"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatch"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationUsingFeature"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws
Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
+ }
+
+ // -------------------------
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL("http://" + getServerHost()
+ +
":28080/jaxws-cxf-clientConfig-inContainer-def-client?path=/jaxws-cxf-clientConfig-def/EndpointImpl&method="
+ test
+ + "&helper=" + Helper.class.getName());
+ return IOUtils.readAndCloseStream(url.openStream());
+ }
+}
Property changes on:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -23,68 +23,55 @@
import java.io.File;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+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.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author ema(a)redhat.com
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class HelloBasicSecTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-cxf-basic-sec";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-basic-sec.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/basic/jboss-web.xml"), "jboss-web.xml")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/basic/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-basic-sec.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/basic/jboss-web.xml"), "jboss-web.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/basic/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- JBossWSCXFTestSetup testSetup;
- testSetup = new JBossWSCXFTestSetup(HelloBasicSecTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String,
String>();
- authenticationOptions.put("usersProperties",
-
getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
-
getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-roles.properties").getAbsolutePath());
- authenticationOptions.put("password-stacking",
"useFirstPass");
- testSetup.addSecurityDomainRequirement("ws-basic-domain",
authenticationOptions);
- return testSetup;
- }
-
+ @Test
+ @RunAsClient
public void testBasicAuth() throws Exception
{
QName serviceName = new
QName("http://jboss.org/http/security",
"HelloService");
URL wsdlURL =
getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"jbossws");
int result = proxy.helloRequest("number");
@@ -92,13 +79,15 @@
}
+ @Test
+ @RunAsClient
public void testBasicAuthFail() throws Exception
{
QName serviceName = new
QName("http://jboss.org/http/security",
"HelloService");
URL wsdlURL =
getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"wrongPwd");
try {
@@ -109,13 +98,15 @@
}
}
+ @Test
+ @RunAsClient
public void testBasicNoAuth() throws Exception
{
QName serviceName = new
QName("http://jboss.org/http/security",
"HelloService");
URL wsdlURL =
getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL.toString());
try {
proxy.helloRequest("number");
fail("Authorization exception expected!");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -23,72 +23,55 @@
import java.io.File;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transport.http.auth.DigestAuthSupplier;
+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.spec.WebArchive;
import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author ema(a)redhat.com
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class HelloDigestTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-cxf-digest-sec";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-digest-sec.war")
{ {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/digest/jboss-web.xml"), "jboss-web.xml")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/digest/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-digest-sec.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/digest/jboss-web.xml"), "jboss-web.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpauth/digest/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- JBossWSCXFTestSetup testSetup;
- testSetup = new JBossWSCXFTestSetup(HelloDigestTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String,
String>();
- authenticationOptions.put("usersProperties",
-
getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
-
getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-roles.properties").getAbsolutePath());
- authenticationOptions.put("hashAlgorithm", "MD5");
- authenticationOptions.put("hashEncoding", "RFC2617");
- authenticationOptions.put("hashUserPassword", "false");
- authenticationOptions.put("hashStorePassword", "true");
- authenticationOptions.put("storeDigestCallback",
"org.jboss.security.auth.callback.RFC2617Digest");
- testSetup.addSecurityDomainRequirement("ws-digest-domain",
authenticationOptions);
- return testSetup;
- }
-
+ @Test
+ @RunAsClient
public void testDigest() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
@@ -98,7 +81,7 @@
URL wsdlURL =
getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName, new
UseThreadBusFeature());
Hello proxy = (Hello)service.getPort(Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"jbossws");
HTTPConduit cond = (HTTPConduit)ClientProxy.getClient(proxy).getConduit();
@@ -110,6 +93,8 @@
}
}
+ @Test
+ @RunAsClient
public void testDigestAuthFail() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
@@ -119,7 +104,7 @@
URL wsdlURL =
getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName, new
UseThreadBusFeature());
Hello proxy = (Hello)service.getPort(Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"wrongPwd");
HTTPConduit cond = (HTTPConduit)ClientProxy.getClient(proxy).getConduit();
@@ -135,13 +120,15 @@
}
}
+ @Test
+ @RunAsClient
public void testDigestNoAuth() throws Exception
{
QName serviceName = new
QName("http://jboss.org/http/security",
"HelloService");
URL wsdlURL =
getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL.toString());
try {
proxy.helloRequest("number");
fail("Authorization exception expected!");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -42,18 +42,24 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.cxf.transports.http.configuration.ProxyServerType;
+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.spec.WebArchive;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.littleshoot.proxy.ChainedProxy;
import org.littleshoot.proxy.ChainedProxyAdapter;
import org.littleshoot.proxy.ChainedProxyManager;
@@ -67,6 +73,7 @@
* @author alessio.soldano(a)jboss.com
* @since 24-May-2011
*/
+(a)RunWith(Arquillian.class)
public class HTTPProxyTestCaseForked extends JBossWSTest
{
private static int proxyPort = 19387;
@@ -75,24 +82,21 @@
private static final String ENDPOINT_PATH =
"/jaxws-cxf-httpproxy/HelloWorldService/HelloWorldImpl";
private HttpProxyServer proxyServer;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-httpproxy.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorldImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpproxy/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-httpproxy.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorldImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/httpproxy/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(HTTPProxyTestCaseForked.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testHttpProxy() throws Exception
{
if (checkNativeLibraries()) {
@@ -142,6 +146,8 @@
assertEquals(hi, port.echo(hi));
}
+ @Test
+ @RunAsClient
public void testHttpProxyUsingHTTPClientPolicy() throws Exception
{
if (checkNativeLibraries()) {
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -23,19 +23,21 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import junit.framework.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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Testcase for:
@@ -45,36 +47,34 @@
* @author alessio.soldano(a)jboss.com
* @since 10-Oct-2014
*/
+(a)RunWith(Arquillian.class)
public class InterceptorsTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-cxf-interceptors.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.AnotherEndpointImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusCounterInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointCounterInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.Counter.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml")
- .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-interceptors.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.AnotherEndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusCounterInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointCounterInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.Counter.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml")
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(InterceptorsTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testEndpointWithBothBusAndEndpointInterceptors() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-cxf-interceptors/MyService" + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "MyService?wsdl");
Service service = Service.create(wsdlURL, new
QName("http://org.jboss.ws.jaxws.cxf/interceptors", "MyService"));
Endpoint port = service.getPort(new
QName("http://org.jboss.ws.jaxws.cxf/interceptors", "MyEndpointPort"),
Endpoint.class);
assertEquals("Hi FooBar! 0", port.echo("Hi"));
@@ -83,8 +83,10 @@
assertEquals("Hi FooBar! 6", port.echo("Hi"));
}
+ @Test
+ @RunAsClient
public void testEndpointWithBusInterceptorsOnly() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-cxf-interceptors/AnotherService" + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "AnotherService?wsdl");
Service service = Service.create(wsdlURL, new
QName("http://org.jboss.ws.jaxws.cxf/interceptors",
"AnotherService"));
AnotherEndpoint port = service.getPort(new
QName("http://org.jboss.ws.jaxws.cxf/interceptors",
"AnotherEndpointPort"), AnotherEndpoint.class);
assertEquals("Hi.Foo!.0", port.echo("Hi"));
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java 2014-11-26
17:13:12 UTC (rev 19114)
@@ -74,8 +74,7 @@
try
{
ClientHelper helper = (ClientHelper)
Class.forName(helperClassName).newInstance();
- String hostName =
toIPv6URLFormat(System.getProperty("jboss.bind.address",
"localhost"));
- helper.setTargetEndpoint("http://" + hostName + ":8080" +
path);
+ helper.setTargetEndpoint("http://" + req.getLocalAddr() +
":" + req.getLocalPort() + path);
List<String> failedTests = new LinkedList<String>();
List<String> errorTests = new LinkedList<String>();
Method[] methods = helper.getClass().getMethods();
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy
(rev 0)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy 2014-11-26
17:13:12 UTC (rev 19114)
@@ -0,0 +1,34 @@
+def root = new XmlParser().parse(project.properties['inputFile'])
+
+/**
+ * Add a security-domain block like this:
+ *
+ * <security-domain name="JBossWS" cache-type="default">
+ * <authentication>
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-users.properties"/>
+ * <module-option name="unauthenticatedIdentity"
value="anonymous"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-roles.properties"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomains = root.profile.subsystem.'security-domains'[0]
+def securityDomain = securityDomains.appendNode('security-domain',
['name':'JBossWS','cache-type':'default'])
+def authentication = securityDomain.appendNode('authentication')
+def loginModule = authentication.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModule.appendNode('module-option',
['name':'unauthenticatedIdentity','value':'anonymous'])
+loginModule.appendNode('module-option',
['name':'usersProperties','value':project.properties['usersPropFile']])
+loginModule.appendNode('module-option',
['name':'rolesProperties','value':project.properties['rolesPropFile']])
+
+/**
+ * Save the configuration to a new file
+ */
+
+def writer = new StringWriter()
+writer.println('<?xml version="1.0"
encoding="UTF-8"?>')
+new XmlNodePrinter(new PrintWriter(writer)).print(root)
+def f = new File(project.properties['outputFile'])
+f.write(writer.toString())
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy 2014-11-26
11:35:37 UTC (rev 19113)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy 2014-11-26
17:13:12 UTC (rev 19114)
@@ -48,6 +48,58 @@
/**
* Add a security-domain block like this:
*
+ * <security-domain name="ws-basic-domain"
cache-type="default">
+ * <authentication>
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-users.properties"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties"/>
+ * <module-option name="password-stacking"
value="useFirstPass"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomainBasicAuth = securityDomains.appendNode('security-domain',
['name':'ws-basic-domain','cache-type':'default'])
+def authenticationBasicAuth =
securityDomainBasicAuth.appendNode('authentication')
+def loginModuleBasicAuth = authenticationBasicAuth.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModuleBasicAuth.appendNode('module-option',
['name':'usersProperties','value':project.properties['testResourcesDir']
+ '/jaxws/cxf/httpauth/WEB-INF/ws-users.properties'])
+loginModuleBasicAuth.appendNode('module-option',
['name':'rolesProperties','value':project.properties['testResourcesDir']
+ '/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties'])
+loginModuleBasicAuth.appendNode('module-option',
['name':'password-stacking','value':'useFirstPass'])
+
+/**
+ * Add a security-domain block like this:
+ *
+ * <security-domain name="ws-digest-domain"
cache-type="default">
+ * <authentication>
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="hashUserPassword"
value="false"/>
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-users.properties"/>
+ * <module-option name="hashAlgorithm" value="MD5"/>
+ * <module-option name="hashEncoding" value="RFC2617"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties"/>
+ * <module-option name="storeDigestCallback"
value="org.jboss.security.auth.callback.RFC2617Digest"/>
+ * <module-option name="hashStorePassword"
value="true"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomainDigestAuth = securityDomains.appendNode('security-domain',
['name':'ws-digest-domain','cache-type':'default'])
+def authenticationDigestAuth =
securityDomainDigestAuth.appendNode('authentication')
+def loginModuleDigestAuth = authenticationDigestAuth.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'hashUserPassword','value':'false'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'usersProperties','value':project.properties['testResourcesDir']
+ '/jaxws/cxf/httpauth/WEB-INF/ws-users.properties'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'hashAlgorithm','value':'MD5'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'hashEncoding','value':'RFC2617'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'rolesProperties','value':project.properties['testResourcesDir']
+ '/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'storeDigestCallback','value':'org.jboss.security.auth.callback.RFC2617Digest'])
+loginModuleDigestAuth.appendNode('module-option',
['name':'hashStorePassword','value':'true'])
+
+/**
+ * Add a security-domain block like this:
+ *
* <security-domain name="JBossWSDigest" cache-type="default">
* <authentication>
* <login-module code="UsersRoles" flag="required">