JBossWS SVN: r19394 - stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-20 11:32:42 -0500 (Tue, 20 Jan 2015)
New Revision: 19394
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
Log:
Increate timeout a bit...
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2015-01-20 16:32:01 UTC (rev 19393)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2015-01-20 16:32:42 UTC (rev 19394)
@@ -57,7 +57,7 @@
@RunWith(Arquillian.class)
public final class WSDiscoveryTestCase extends JBossWSTest
{
- private static final int TIMEOUT = Integer.getInteger(WSDiscoveryTestCase.class.getName() + ".timeout", 2000);
+ private static final int TIMEOUT = Integer.getInteger(WSDiscoveryTestCase.class.getName() + ".timeout", 4000);
@Deployment(name = "jaxws-samples-wsdd2", testable = false)
public static WebArchive createDeployment2() {
10 years
JBossWS SVN: r19393 - stack/cxf/branches/arquillian/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-20 11:32:01 -0500 (Tue, 20 Jan 2015)
New Revision: 19393
Modified:
stack/cxf/branches/arquillian/modules/testsuite/pom.xml
Log:
A bit less of memory...
Modified: stack/cxf/branches/arquillian/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/pom.xml 2015-01-19 23:13:09 UTC (rev 19392)
+++ stack/cxf/branches/arquillian/modules/testsuite/pom.xml 2015-01-20 16:32:01 UTC (rev 19393)
@@ -17,7 +17,7 @@
<!-- Properties -->
<properties>
<surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
- <surefire.memory.args>-Xmx768m -XX:MaxPermSize=450m</surefire.memory.args>
+ <surefire.memory.args>-Xmx640m -XX:MaxPermSize=256m</surefire.memory.args>
<surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
<surefire.management.args>-Dcom.sun.management.jmxremote</surefire.management.args>
<test.archive.directory>${project.build.directory}/test-libs</test.archive.directory>
10 years
JBossWS SVN: r19392 - stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/scripts.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 18:13:09 -0500 (Mon, 19 Jan 2015)
New Revision: 19392
Added:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/scripts/jbws-testsuite-shared-address-rewrite.groovy
Log:
Adding forgotten file
Added: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/scripts/jbws-testsuite-shared-address-rewrite.groovy
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/scripts/jbws-testsuite-shared-address-rewrite.groovy (rev 0)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/scripts/jbws-testsuite-shared-address-rewrite.groovy 2015-01-19 23:13:09 UTC (rev 19392)
@@ -0,0 +1,66 @@
+def root = new XmlParser().parse(project.properties['inputFile'])
+
+/**
+ * Fix logging: remove CONSOLE handler and set a specific log file
+ *
+ */
+def logHandlers = root.profile.subsystem.'root-logger'.handlers[0]
+def consoleHandler = logHandlers.find{it.@name == 'CONSOLE'}
+logHandlers.remove(consoleHandler)
+def file = root.profile.subsystem.'periodic-rotating-file-handler'.file[0]
+file.attributes()['path'] = project.properties['serverLog']
+
+/**
+ * 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']])
+
+/**
+ * Add a https connector like this:
+ *
+ * <security-realm name="jbws-test-https-realm">
+ * <server-identities>
+ * <ssl>
+ * <keystore path="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/test.keystore" keystore-password="changeit" alias="tomcat"/>
+ * </ssl>
+ * </server-identities>
+ * </security-realm>
+ *
+ */
+
+def securityRealms = root.management.'security-realms'[0]
+def securityRealm = securityRealms.appendNode('security-realm', ['name':'jbws-test-https-realm'])
+def serverIdentities = securityRealm.appendNode('server-identities')
+def ssl = serverIdentities.appendNode('ssl')
+ssl.appendNode('keystore', ['path':project.properties['keystorePath'],'keystore-password':'changeit','alias':'tomcat'])
+
+def server = root.profile.subsystem.server[0]
+server.appendNode('https-listener', ['name':'jbws-test-https-listener','socket-binding':'https','security-realm':'jbws-test-https-realm'])
+
+/**
+ * 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())
10 years
JBossWS SVN: r19391 - stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 18:01:34 -0500 (Mon, 19 Jan 2015)
New Revision: 19391
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/DeploymentArchives.java
Log:
Removing useless file
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/DeploymentArchives.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/DeploymentArchives.java 2015-01-19 23:01:11 UTC (rev 19390)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/DeploymentArchives.java 2015-01-19 23:01:34 UTC (rev 19391)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.util.LinkedList;
-import java.util.List;
-
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
-
-public class DeploymentArchives
-{
- public static final String NAMES = JBossWSTestHelper.writeToFile(createDeployments());
-
- private static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-clientConfig.war") { {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.EndpointImpl.class);
- }
- });
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-clientConfig-inContainer-client.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");
- }
- });
- list.add(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");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
- }
-
-}
10 years
JBossWS SVN: r19390 - in stack/cxf/branches/arquillian/modules/testsuite: shared-tests and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 18:01:11 -0500 (Mon, 19 Jan 2015)
New Revision: 19390
Added:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java
Removed:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/pom.xml
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/pom.xml
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/arquillian.xml
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/container.properties
Log:
Turning JBWS2150 testcase into a non forked one
Modified: stack/cxf/branches/arquillian/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/pom.xml 2015-01-19 17:51:14 UTC (rev 19389)
+++ stack/cxf/branches/arquillian/modules/testsuite/pom.xml 2015-01-19 23:01:11 UTC (rev 19390)
@@ -37,6 +37,7 @@
<port-offset.cxf-tests.default-config-tests>10000</port-offset.cxf-tests.default-config-tests>
<port-offset.shared-tests.jboss>15000</port-offset.shared-tests.jboss>
<port-offset.shared-tests.default-config-tests>20000</port-offset.shared-tests.default-config-tests>
+ <port-offset.shared-tests.address-rewrite>25000</port-offset.shared-tests.address-rewrite>
</properties>
<!-- Modules -->
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/pom.xml 2015-01-19 17:51:14 UTC (rev 19389)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/pom.xml 2015-01-19 23:01:11 UTC (rev 19390)
@@ -89,6 +89,22 @@
</properties>
</configuration>
</execution>
+ <execution>
+ <id>testsuite-address-rewrite</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${basedir}/src/test/scripts/jbws-testsuite-shared-address-rewrite.groovy</source>
+ <properties>
+ <inputFile>${jboss.home}/standalone/configuration/standalone.xml</inputFile>
+ <outputFile>${jboss.home}/standalone/configuration/jbws-testsuite-shared-address-rewrite.xml</outputFile>
+ <serverLog>jbws-testsuite-shared-address-rewrite.log</serverLog>
+ <keystorePath>${project.build.directory}/test-classes/test.keystore</keystorePath>
+ </properties>
+ </configuration>
+ </execution>
</executions>
</plugin>
@@ -230,6 +246,19 @@
<port>29990</port> <!-- Keep in sync with the port-offset -->
</configuration>
</execution>
+ <execution>
+ <id>address-rewrite</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <jvmArgs>-server -XX:+UseCompressedOops -Xms32m -Xmx256m -XX:MaxPermSize=96m -Djboss.socket.binding.port-offset=${port-offset.shared-tests.address-rewrite} ${additionalJvmArgs}</jvmArgs>
+ <serverConfig>jbws-testsuite-shared-address-rewrite.xml</serverConfig>
+ <jbossHome>${jboss.home}</jbossHome>
+ <port>34990</port> <!-- Keep in sync with the port-offset -->
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/arquillian.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/arquillian.xml 2015-01-19 17:51:14 UTC (rev 19389)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/arquillian.xml 2015-01-19 23:01:11 UTC (rev 19390)
@@ -27,6 +27,18 @@
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
+ <container qualifier="address-rewrite" mode="manual">
+ <configuration>
+ <property name="jbossHome">${jboss.home}</property>
+ <property name="javaVmArguments">-server -XX:+UseCompressedOops -Xms32m -Xmx256m -XX:MaxPermSize=96m -Djboss.socket.binding.port-offset=${port-offset.shared-tests.address-rewrite} -Djavax.wsdl.factory.WSDLFactory=com.ibm.wsdl.factory.WSDLFactoryImpl</property>
+ <property name="serverConfig">jbws-testsuite-shared-address-rewrite.xml</property>
+ <property name="allowConnectingToRunningServer">true</property>
+ <property name="managementPort">${add_int(port-offset.shared-tests.address-rewrite,9990)}</property>
+ <!-- AS7-4070 -->
+ <property name="waitForPorts">${add_int(port-offset.shared-tests.address-rewrite,8787)} ${add_int(port-offset.shared-tests.address-rewrite,9990)}</property>
+ <property name="waitForPortsTimeoutInSeconds">8</property>
+ </configuration>
+ </container>
</group>
</arquillian>
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/container.properties
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/container.properties 2015-01-19 17:51:14 UTC (rev 19389)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/container.properties 2015-01-19 23:01:11 UTC (rev 19390)
@@ -4,4 +4,5 @@
port-offset.cxf-tests.ssl-mutual-auth=(a)port-offset.cxf-tests.ssl-mutual-auth@
port-offset.cxf-tests.default-config-tests=(a)port-offset.cxf-tests.default-config-tests@
port-offset.shared-tests.jboss=(a)port-offset.shared-tests.jboss@
-port-offset.shared-tests.default-config-tests=(a)port-offset.shared-tests.default-config-tests@
\ No newline at end of file
+port-offset.shared-tests.default-config-tests=(a)port-offset.shared-tests.default-config-tests@
+port-offset.shared-tests.address-rewrite=(a)port-offset.shared-tests.address-rewrite@
\ No newline at end of file
Added: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java (rev 0)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java 2015-01-19 23:01:11 UTC (rev 19390)
@@ -0,0 +1,1443 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, 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.jbws2150;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.management.Attribute;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.NamingException;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+
+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.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.spec.WebArchive;
+import org.jboss.ws.common.ObjectNameFactory;
+import org.jboss.wsf.spi.management.ServerConfig;
+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;
+
+import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
+
+/**
+ * [JBWS-2150] Migrate AddressRewritingTestCase to jaxws
+ *
+ * soap:address rewrite tests
+ *
+ * Note: most of the tests here perform additional checks when the testsuite configured server host
+ * is "localhost" (which is the default anyway) by getting wsdls and invoking endpoints using the
+ * equivalent 127.0.0.1 IP. This is basically a shortcut to avoid requiring to add DNS entries or
+ * binding the AS to multiple addresses before verifying address rewrite mechanism.
+ *
+ *
+ * @author richard.opalka(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
+ */
+(a)RunWith(Arquillian.class)
+public final class JBWS2150TestCase extends JBossWSTest
+{
+ private static final ObjectName SERVER_CONFIG_OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServerConfig");
+ private static final String NAMESPACE = "http://test.jboss.org/addressrewrite";
+ private static final String NAMESPACE_IMP = "http://test.jboss.org/addressrewrite/wsdlimp";
+ private static final String ADDRESS_REWRITE_SERVER = "address-rewrite";
+ private static final String DEP = "jaxws-jbws2150";
+ private static final String DEP_CODEFIRST = "jaxws-jbws2150-codefirst";
+ private static final String DEP_SEC = "jaxws-jbws2150-sec";
+
+ protected static Boolean modifySOAPAddress;
+ protected static String webServiceHost;
+ protected static int webServicePort;
+ protected static int webServiceSecurePort;
+ protected static String webServicePath;
+ protected static String webServiceUriScheme;
+
+ private static MBeanServerConnection mbeanServer;
+
+ @ArquillianResource
+ Deployer deployer;
+
+ @ArquillianResource
+ private ContainerController containerController;
+
+ @Deployment(testable = false, name= DEP, managed = false)
+ @TargetsContainer(ADDRESS_REWRITE_SERVER)
+ public static WebArchive createDeployment1() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidSecureService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidSecureService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidService.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/Service.wsdl"), "wsdl/Service.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/inner.wsdl"), "wsdl/inner.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/web.xml"));
+ return archive;
+ }
+
+ @Deployment(testable = false, name= DEP_CODEFIRST, managed = false)
+ @TargetsContainer(ADDRESS_REWRITE_SERVER)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP_CODEFIRST + ".war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.CodeFirstService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ServiceIface.class);
+ return archive;
+ }
+
+ @Deployment(testable = false, name= DEP_SEC, managed = false)
+ @TargetsContainer(ADDRESS_REWRITE_SERVER)
+ public static WebArchive createDeployment3() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP_SEC + ".war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidSecureService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidSecureService.class)
+ .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidService.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/Service.wsdl"), "wsdl/Service.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/inner.wsdl"), "wsdl/inner.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/web-sec.xml"));
+ return archive;
+ }
+
+ @Before
+ public void startContainerAndDeploy() throws Exception {
+ if (!containerController.isStarted(ADDRESS_REWRITE_SERVER)) {
+ containerController.start(ADDRESS_REWRITE_SERVER);
+ }
+ }
+
+ public void setUp() throws Exception {
+ modifySOAPAddress = (Boolean) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "ModifySOAPAddress");
+ webServiceHost = (String) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceHost");
+ webServicePort = (Integer) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServicePort");
+ webServiceSecurePort = (Integer) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceSecurePort");
+ webServicePath = (String) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServicePathRewriteRule");
+ webServiceUriScheme = (String) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceUriScheme");
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception
+ {
+ Attribute attr = new Attribute("ModifySOAPAddress", modifySOAPAddress);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ attr = new Attribute("WebServiceHost", webServiceHost);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ attr = new Attribute("WebServicePort", webServicePort);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ attr = new Attribute("WebServiceSecurePort", webServiceSecurePort);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ attr = new Attribute("WebServicePathRewriteRule", webServicePath);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ attr = new Attribute("WebServiceUriScheme", webServiceUriScheme);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private String getWebServiceHost() {
+ return webServiceHost;
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewrite() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
+ //avoid invoking on https endpoints as that would require getting the imported wsdl using https...
+ if (!wsdlLocation.contains("Secure")) {
+ ServiceIface endpoint = getEndpoint(wsdlLocation, "ValidURLService");
+ assertEquals(endpoint.echo("hello"), "hello");
+ }
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
+ if (!wsdlLocation.contains("Secure")) {
+ ServiceIface endpoint = getEndpoint(wsdlLocation, "InvalidURLService");
+ assertEquals(endpoint.echo("hello"), "hello");
+ }
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on and the webServiceHost set to a (fake) load balancer host
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteLoadBalancer() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String testWebServiceHost = "myloadbalancer.com";
+ setWebServiceHost(testWebServiceHost);
+ //deploy("jaxws-jbws2150.war");
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on and the webServiceHost set to jbossws.undefined.host
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testAutoRewrite() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
+
+ //no further checks on the ports forcing https even when getting the wsdl over http
+ //as there's no way to tell which port to use for the secure access given the invoked wsdl address (on http)
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ if (!wsdlLocation.contains("Secure")) {
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * [JBWS-454] Test soap:address URL rewrite according to transport guarantee
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testSecureRewrite() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ deployer.deploy(DEP_SEC);
+ try
+ {
+ final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
+ String wsdlLocationSec = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocationSec);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocationSec), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_SEC);
+ tearDown();
+ }
+ }
+
+ /**
+ * [JBWS-454] Test soap:address URL rewrite according to transport guarantee
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testSecureRewriteLoadBalancer() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String testWebServiceHost = "myloadbalancer.com";
+ setWebServiceHost(testWebServiceHost);
+ deployer.deploy(DEP_SEC);
+ try
+ {
+ final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", testWebServiceHost);
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", testWebServiceHost);
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", testWebServiceHost);
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", testWebServiceHost);
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", testWebServiceHost);
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", testWebServiceHost);
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", testWebServiceHost);
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", testWebServiceHost);
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
+ String wsdlLocationSec = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocationSec);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocationSec), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_SEC);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite when the rewrite engine is off
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testNoRewrite() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(false);
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://somehost:80/somepath?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://somehost:443/some-secure-path?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://somehost:80/somepath?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://somehost:443/some-secure-path?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://somehost:80/somepath", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://somehost:443/some-secure-path", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite; here we expect an address using the same base as the one for the port corresponding to the address used to fetch the wsdl
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine is on (code-first endpoint)
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteCodeFirst() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), getWebServiceHost(), false);
+ if (isTestsuiteServerHostLocalhost()) {
+ checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", getWebServiceHost(), false);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite when the rewrite engine is off (code-first endpoint)
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testNoRewriteCodeFirst() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(false);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), getWebServiceHost(), false);
+ if (isTestsuiteServerHostLocalhost()) {
+ checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", getWebServiceHost(), false);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on and the webServiceHost set to a (fake) load balancer host (code-first endpoint)
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteLoadBalancerCodeFirst() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String testWebServiceHost = "myloadbalancer.com";
+ setWebServiceHost(testWebServiceHost);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), testWebServiceHost, true);
+ if (isTestsuiteServerHostLocalhost()) {
+ checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", testWebServiceHost, true);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on , the webServiceHost set to a (fake) load balancer host (code-first endpoint) and forced https scheme
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteLoadBalancerCodeFirstForceHttps() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String testWebServiceHost = "myloadbalancer.com";
+ setWebServiceHost(testWebServiceHost);
+ setWebServiceSecurePort(443);
+ setWebServiceUriScheme("https");
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ Definition definition = getWSDLDefinition("http://" + getServerHost() + ":" + getServerPort() + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("https://" + testWebServiceHost + "/jaxws-jbws2150-codefirst/CodeFirstService", address);
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Basically the same as testRewriteLoadBalancerCodeFirst; even if rewrite is off, we still get the loadbalancer address in the wsdl
+ * for code-first endpoint, as there's no user provided wsdl with a different address in it.
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testNoRewriteLoadBalancerCodeFirst() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(false);
+ final String testWebServiceHost = "myloadbalancer2.com";
+ setWebServiceHost(testWebServiceHost);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), testWebServiceHost, true);
+ if (isTestsuiteServerHostLocalhost()) {
+ checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", testWebServiceHost, true);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on and the webServiceHost set to jbossws.undefined.host (code-first endpoint)
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testAutoRewriteCodeFirst() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), getServerHost(), true);
+ if (isTestsuiteServerHostLocalhost()) {
+ checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", "127.0.0.1", true);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite when a path rewrite rule is specified.
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteWithPathRule() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150";
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePathRewriteRule(sedCmd);
+ deployer.deploy(DEP);
+ try
+ {
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
+ final List<String> wsdlLocations = new LinkedList<String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
+
+ for (final String wsdlLocation : wsdlLocations)
+ {
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteCodeFirstPathRule() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150-codefirst";
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePathRewriteRule(sedCmd);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified and auto-rewrite is on
+ * (wsdl host prop set to ServerConfig.UNDEFINED_HOSTNAME)
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testAutoRewriteCodeFirstPathRule() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150-codefirst";
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePathRewriteRule(sedCmd);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ String serverHost = getServerHost();
+ int serverPort = getServerPort();
+ final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
+ if (isTestsuiteServerHostLocalhost()) {
+ definition = getWSDLDefinition("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
+ address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://127.0.0.1:" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with host configured to ServerConfig.UNDEFINED_HOSTNAME and path rewrite rule specified
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testAutoRewritePathRule() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150";
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePathRewriteRule(sedCmd);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; // 8080 + 363 = 8443
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ if (!wsdlLocation.contains("Secure")) {
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on and forced https scheme and secure port
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteForceHttpsSchemeAndPorts() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ setWebServiceUriScheme("https");
+ setWebServiceSecurePort(8192);
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ //avoid invoking on https endpoints as that would require getting the imported wsdl using https...
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("https://" + host + ":8192/jaxws-jbws2150/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("https://" + host + ":8192/jaxws-jbws2150/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + host + ":8192/jaxws-jbws2150/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":8192/jaxws-jbws2150/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on, the webServiceHost set to a (fake) load balancer host and forced https uri scheme
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteLoadBalancerForceHttps() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String testWebServiceHost = "myloadbalancer.com";
+ setWebServiceHost(testWebServiceHost);
+ setWebServiceUriScheme("https");
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with rewrite engine on, the webServiceHost set to jbossws.undefined.host and forced http uri scheme
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testAutoRewriteForceHttp() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deployer.deploy(DEP);
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL", address);
+
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address URL rewrite according to transport guarantee is overridden by forced http uri scheme
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testSecureRewriteOverriddenByForcedHttp() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ setWebServiceUriScheme("http");
+ setWebServicePort(80);
+ deployer.deploy(DEP_SEC);
+ try
+ {
+ final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
+ wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
+ String wsdlLocationSec = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocationSec);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + "/jaxws-jbws2150-sec/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + "/jaxws-jbws2150-sec/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("http://" + host + "/jaxws-jbws2150-sec/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("http://" + host + "/jaxws-jbws2150-sec/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocationSec), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_SEC);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite when a path rewrite rule is specified and https scheme is forced.
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testRewriteWithPathRuleAndForcedHttps() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150";
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePathRewriteRule(sedCmd);
+ setWebServiceUriScheme("https");
+ deployer.deploy(DEP);
+ try
+ {
+ final String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
+ final List<String> wsdlLocations = new LinkedList<String>();
+ final Map<String, String> importMap = new HashMap<String, String>();
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
+
+ for (final String wsdlLocation : wsdlLocations)
+ {
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
+
+ //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
+ assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP);
+ tearDown();
+ }
+ }
+
+ /**
+ * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified, auto-rewrite is on
+ * (wsdl host prop set to ServerConfig.UNDEFINED_HOSTNAME) and https scheme is forced
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ public void testAutoRewriteCodeFirstPathRuleAndForcedHttps() throws Exception
+ {
+ setUp();
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150-codefirst";
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePathRewriteRule(sedCmd);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ setWebServiceUriScheme("https");
+ deployer.deploy(DEP_CODEFIRST);
+ try
+ {
+ String serverHost = getServerHost();
+ final int serverPort = getServerPort();
+ final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
+ final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext +"/CodeFirstService", address);
+ if (isTestsuiteServerHostLocalhost()) {
+ definition = getWSDLDefinition("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
+ address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("https://127.0.0.1:" + serverSecurePort + "/" + expectedContext +"/CodeFirstService", address);
+ }
+ }
+ finally
+ {
+ deployer.undeploy(DEP_CODEFIRST);
+ tearDown();
+ }
+
+ }
+
+ private void checkWsdlAndInvokeCodeFirstEndpoint(String testHost, String expectedWsdlHost, boolean setTargetAddress) throws Exception {
+ final int serverPort = getServerPort();
+ final String addr = "http://" + testHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService";
+ final String wsdlLocation = addr + "?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + expectedWsdlHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService", address);
+
+ ServiceIface endpoint = getEndpoint(wsdlLocation, "CodeFirstService");
+ if (setTargetAddress) {
+ ((BindingProvider)endpoint).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addr);
+ }
+ assertEquals(endpoint.echo("hello"), "hello");
+ }
+
+ private static boolean isTestsuiteServerHostLocalhost() {
+ return "localhost".equals(getServerHost());
+ }
+
+ private void setModifySOAPAddress(Boolean value) throws Exception
+ {
+ Attribute attr = new Attribute("ModifySOAPAddress", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private void setWebServiceHost(String value) throws Exception
+ {
+ Attribute attr = new Attribute("WebServiceHost", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private void setWebServicePort(int value) throws Exception
+ {
+ Attribute attr = new Attribute("WebServicePort", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private void setWebServiceSecurePort(int value) throws Exception
+ {
+ Attribute attr = new Attribute("WebServiceSecurePort", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private void setWebServicePathRewriteRule(String value) throws Exception
+ {
+ Attribute attr = new Attribute("WebServicePathRewriteRule", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private void setWebServiceUriScheme(String value) throws Exception
+ {
+ Attribute attr = new Attribute("WebServiceUriScheme", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
+
+ private ServiceIface getEndpoint(String wsdlLocation, String serviceName) throws Exception
+ {
+ List<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
+ if (isIntegrationCXF()) {
+ //Setting UseNewBusFeature as the tests here deploy / undeploy endpoints with different wsdl at the same URL
+ //so we need to avoid caching issues related to the WSDLManager in the CXF Bus.
+
+ //Service service = Service.create(new URL(wsdlLocation), new QName(NAMESPACE, serviceName), new UseNewBusFeature())
+
+ Class<?> clazz = Class.forName("org.jboss.wsf.stack.cxf.client.UseNewBusFeature");
+ features.add((WebServiceFeature)clazz.newInstance());
+ }
+ Service service = Service.create(new URL(wsdlLocation), new QName(NAMESPACE, serviceName), features.toArray(new WebServiceFeature[features.size()]));
+ QName portName = service.getPorts().next();
+ return service.getPort(portName, ServiceIface.class);
+ }
+
+ private Definition getWSDLDefinition(String wsdlLocation) throws Exception
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.importDocuments", false);
+ wsdlReader.setFeature("javax.wsdl.verbose", false);
+
+ Definition definition = wsdlReader.readWSDL(null, wsdlLocation);
+ return definition;
+ }
+
+ private String getPortAddress(Definition definition, String serviceName, String portName)
+ {
+ Port port = definition.getService(new QName(NAMESPACE, serviceName)).getPort(portName);
+ return ((SOAPAddressImpl)port.getExtensibilityElements().get(0)).getLocationURI();
+ }
+
+ @SuppressWarnings("unchecked")
+ private String getWsdlImportAddress(Definition definition)
+ {
+ Collection<Import> imports = definition.getImports(NAMESPACE_IMP);
+ if (imports.size() == 1) {
+ return imports.iterator().next().getLocationURI();
+ }
+ return null;
+ }
+
+ public static MBeanServerConnection getServer() throws NamingException {
+ if (mbeanServer == null) {
+ mbeanServer = JBossWSTestHelper.getServer(SHARED_TESTS_GROUP_QUALIFIER, ADDRESS_REWRITE_SERVER);
+ }
+ return mbeanServer;
+ }
+
+ public static int getServerPort() {
+ return JBossWSTestHelper.getServerPort(SHARED_TESTS_GROUP_QUALIFIER, ADDRESS_REWRITE_SERVER);
+ }
+}
Property changes on: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Deleted: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2015-01-19 17:51:14 UTC (rev 19389)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2015-01-19 23:01:11 UTC (rev 19390)
@@ -1,1419 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.jbws2150;
-
-import java.io.File;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.management.Attribute;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.NamingException;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceFeature;
-
-import org.jboss.arquillian.container.test.api.Deployer;
-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.ws.common.ObjectNameFactory;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestHelper;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
-
-/**
- * [JBWS-2150] Migrate AddressRewritingTestCase to jaxws
- *
- * soap:address rewrite tests
- *
- * Note: most of the tests here perform additional checks when the testsuite configured server host
- * is "localhost" (which is the default anyway) by getting wsdls and invoking endpoints using the
- * equivalent 127.0.0.1 IP. This is basically a shortcut to avoid requiring to add DNS entries or
- * binding the AS to multiple addresses before verifying address rewrite mechanism.
- *
- *
- * @author richard.opalka(a)jboss.com
- * @author alessio.soldano(a)jboss.com
- */
-(a)RunWith(Arquillian.class)
-public final class JBWS2150TestCaseForked extends JBossWSTest
-{
- private static final ObjectName SERVER_CONFIG_OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServerConfig");
- private static final String NAMESPACE = "http://test.jboss.org/addressrewrite";
- private static final String NAMESPACE_IMP = "http://test.jboss.org/addressrewrite/wsdlimp";
-
- protected static Boolean modifySOAPAddress;
- protected static String webServiceHost;
- protected static int webServicePort;
- protected static int webServiceSecurePort;
- protected static String webServicePath;
- protected static String webServiceUriScheme;
-
- private static MBeanServerConnection mbeanServer;
-
- @ArquillianResource
- Deployer deployer;
-
- @Deployment(testable = false, name="dep-jaxws-jbws2150", managed = false)
- public static WebArchive createDeployment1() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-jbws2150.war");
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidSecureService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidSecureService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidService.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/Service.wsdl"), "wsdl/Service.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/inner.wsdl"), "wsdl/inner.wsdl")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/web.xml"));
- return archive;
- }
-
- @Deployment(testable = false, name="dep-jaxws-jbws2150-codefirst", managed = false)
- public static WebArchive createDeployment2() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-jbws2150-codefirst.war");
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.jbws2150.CodeFirstService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ServiceIface.class);
- return archive;
- }
-
- @Deployment(testable = false, name="dep-jaxws-jbws2150-sec", managed = false)
- public static WebArchive createDeployment3() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-jbws2150-sec.war");
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidSecureService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.InvalidService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidSecureService.class)
- .addClass(org.jboss.test.ws.jaxws.jbws2150.ValidService.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/Service.wsdl"), "wsdl/Service.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/wsdl/inner.wsdl"), "wsdl/inner.wsdl")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws2150/WEB-INF/web-sec.xml"));
- return archive;
- }
-
- public void setUp() throws Exception {
- modifySOAPAddress = (Boolean) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "ModifySOAPAddress");
- webServiceHost = (String) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceHost");
- webServicePort = (Integer) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServicePort");
- webServiceSecurePort = (Integer) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceSecurePort");
- webServicePath = (String) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServicePathRewriteRule");
- webServiceUriScheme = (String) getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceUriScheme");
- super.setUp();
- }
-
- public void tearDown() throws Exception
- {
- Attribute attr = new Attribute("ModifySOAPAddress", modifySOAPAddress);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- attr = new Attribute("WebServiceHost", webServiceHost);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- attr = new Attribute("WebServicePort", webServicePort);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- attr = new Attribute("WebServiceSecurePort", webServiceSecurePort);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- attr = new Attribute("WebServicePathRewriteRule", webServicePath);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- attr = new Attribute("WebServiceUriScheme", webServiceUriScheme);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private String getWebServiceHost() {
- return webServiceHost;
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewrite() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
- //avoid invoking on https endpoints as that would require getting the imported wsdl using https...
- if (!wsdlLocation.contains("Secure")) {
- ServiceIface endpoint = getEndpoint(wsdlLocation, "ValidURLService");
- assertEquals(endpoint.echo("hello"), "hello");
- }
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
- if (!wsdlLocation.contains("Secure")) {
- ServiceIface endpoint = getEndpoint(wsdlLocation, "InvalidURLService");
- assertEquals(endpoint.echo("hello"), "hello");
- }
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on and the webServiceHost set to a (fake) load balancer host
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteLoadBalancer() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String testWebServiceHost = "myloadbalancer.com";
- setWebServiceHost(testWebServiceHost);
- //deploy("jaxws-jbws2150.war");
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + testWebServiceHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on and the webServiceHost set to jbossws.undefined.host
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testAutoRewrite() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
-
- //no further checks on the ports forcing https even when getting the wsdl over http
- //as there's no way to tell which port to use for the secure access given the invoked wsdl address (on http)
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- if (!wsdlLocation.contains("Secure")) {
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * [JBWS-454] Test soap:address URL rewrite according to transport guarantee
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testSecureRewrite() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- deployer.deploy("dep-jaxws-jbws2150-sec");
- try
- {
- final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
- String wsdlLocationSec = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocationSec);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocationSec), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-sec");
- tearDown();
- }
- }
-
- /**
- * [JBWS-454] Test soap:address URL rewrite according to transport guarantee
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testSecureRewriteLoadBalancer() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String testWebServiceHost = "myloadbalancer.com";
- setWebServiceHost(testWebServiceHost);
- deployer.deploy("dep-jaxws-jbws2150-sec");
- try
- {
- final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", testWebServiceHost);
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", testWebServiceHost);
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", testWebServiceHost);
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", testWebServiceHost);
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", testWebServiceHost);
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", testWebServiceHost);
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", testWebServiceHost);
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", testWebServiceHost);
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
- String wsdlLocationSec = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocationSec);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocationSec), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-sec");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite when the rewrite engine is off
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testNoRewrite() throws Exception
- {
- setUp();
- setModifySOAPAddress(false);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://somehost:80/somepath?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://somehost:443/some-secure-path?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://somehost:80/somepath?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://somehost:443/some-secure-path?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://somehost:80/somepath", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://somehost:443/some-secure-path", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
-
- //check wsdl import address rewrite; here we expect an address using the same base as the one for the port corresponding to the address used to fetch the wsdl
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine is on (code-first endpoint)
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteCodeFirst() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), getWebServiceHost(), false);
- if (isTestsuiteServerHostLocalhost()) {
- checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", getWebServiceHost(), false);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite when the rewrite engine is off (code-first endpoint)
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testNoRewriteCodeFirst() throws Exception
- {
- setUp();
- setModifySOAPAddress(false);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), getWebServiceHost(), false);
- if (isTestsuiteServerHostLocalhost()) {
- checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", getWebServiceHost(), false);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on and the webServiceHost set to a (fake) load balancer host (code-first endpoint)
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteLoadBalancerCodeFirst() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String testWebServiceHost = "myloadbalancer.com";
- setWebServiceHost(testWebServiceHost);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), testWebServiceHost, true);
- if (isTestsuiteServerHostLocalhost()) {
- checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", testWebServiceHost, true);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on , the webServiceHost set to a (fake) load balancer host (code-first endpoint) and forced https scheme
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteLoadBalancerCodeFirstForceHttps() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String testWebServiceHost = "myloadbalancer.com";
- setWebServiceHost(testWebServiceHost);
- setWebServiceSecurePort(443);
- setWebServiceUriScheme("https");
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- Definition definition = getWSDLDefinition("http://" + getServerHost() + ":" + getServerPort() + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
- String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("https://" + testWebServiceHost + "/jaxws-jbws2150-codefirst/CodeFirstService", address);
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Basically the same as testRewriteLoadBalancerCodeFirst; even if rewrite is off, we still get the loadbalancer address in the wsdl
- * for code-first endpoint, as there's no user provided wsdl with a different address in it.
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testNoRewriteLoadBalancerCodeFirst() throws Exception
- {
- setUp();
- setModifySOAPAddress(false);
- final String testWebServiceHost = "myloadbalancer2.com";
- setWebServiceHost(testWebServiceHost);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), testWebServiceHost, true);
- if (isTestsuiteServerHostLocalhost()) {
- checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", testWebServiceHost, true);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on and the webServiceHost set to jbossws.undefined.host (code-first endpoint)
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testAutoRewriteCodeFirst() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- checkWsdlAndInvokeCodeFirstEndpoint(getServerHost(), getServerHost(), true);
- if (isTestsuiteServerHostLocalhost()) {
- checkWsdlAndInvokeCodeFirstEndpoint("127.0.0.1", "127.0.0.1", true);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite when a path rewrite rule is specified.
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteWithPathRule() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String expectedContext = "xx/jaxws-jbws2150";
- final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
- setWebServicePathRewriteRule(sedCmd);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8443 = 8080 + 363
- final List<String> wsdlLocations = new LinkedList<String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
-
- for (final String wsdlLocation : wsdlLocations)
- {
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteCodeFirstPathRule() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String expectedContext = "xx/jaxws-jbws2150-codefirst";
- final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
- setWebServicePathRewriteRule(sedCmd);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
-
- Definition definition = getWSDLDefinition(wsdlLocation);
- String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified and auto-rewrite is on
- * (wsdl host prop set to ServerConfig.UNDEFINED_HOSTNAME)
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testAutoRewriteCodeFirstPathRule() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String expectedContext = "xx/jaxws-jbws2150-codefirst";
- final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
- setWebServicePathRewriteRule(sedCmd);
- setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- String serverHost = getServerHost();
- int serverPort = getServerPort();
- final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
-
- Definition definition = getWSDLDefinition(wsdlLocation);
- String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
- if (isTestsuiteServerHostLocalhost()) {
- definition = getWSDLDefinition("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
- address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://127.0.0.1:" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with host configured to ServerConfig.UNDEFINED_HOSTNAME and path rewrite rule specified
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testAutoRewritePathRule() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String expectedContext = "xx/jaxws-jbws2150";
- final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
- setWebServicePathRewriteRule(sedCmd);
- setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; // 8080 + 363 = 8443
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://127.0.0.1:" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
- }
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- if (!wsdlLocation.contains("Secure")) {
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on and forced https scheme and secure port
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteForceHttpsSchemeAndPorts() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- setWebServiceUriScheme("https");
- setWebServiceSecurePort(8192);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":8192/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
- //avoid invoking on https endpoints as that would require getting the imported wsdl using https...
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("https://" + host + ":8192/jaxws-jbws2150/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("https://" + host + ":8192/jaxws-jbws2150/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + host + ":8192/jaxws-jbws2150/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":8192/jaxws-jbws2150/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on, the webServiceHost set to a (fake) load balancer host and forced https uri scheme
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteLoadBalancerForceHttps() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String testWebServiceHost = "myloadbalancer.com";
- setWebServiceHost(testWebServiceHost);
- setWebServiceUriScheme("https");
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite with rewrite engine on, the webServiceHost set to jbossws.undefined.host and forced http uri scheme
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testAutoRewriteForceHttp() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
- wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
- wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
- String wsdlLocation = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL", address);
-
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address URL rewrite according to transport guarantee is overridden by forced http uri scheme
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testSecureRewriteOverriddenByForcedHttp() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- setWebServiceUriScheme("http");
- setWebServicePort(80);
- deployer.deploy("dep-jaxws-jbws2150-sec");
- try
- {
- final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
- if (isTestsuiteServerHostLocalhost()) {
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
- wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
- }
-
- for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
- String wsdlLocationSec = entry.getKey();
- String host = entry.getValue();
- Definition definition = getWSDLDefinition(wsdlLocationSec);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + host + "/jaxws-jbws2150-sec/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + host + "/jaxws-jbws2150-sec/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("http://" + host + "/jaxws-jbws2150-sec/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("http://" + host + "/jaxws-jbws2150-sec/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocationSec), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-sec");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite when a path rewrite rule is specified and https scheme is forced.
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testRewriteWithPathRuleAndForcedHttps() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String expectedContext = "xx/jaxws-jbws2150";
- final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
- setWebServicePathRewriteRule(sedCmd);
- setWebServiceUriScheme("https");
- deployer.deploy("dep-jaxws-jbws2150");
- try
- {
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
- final List<String> wsdlLocations = new LinkedList<String>();
- final Map<String, String> importMap = new HashMap<String, String>();
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
- importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
-
- for (final String wsdlLocation : wsdlLocations)
- {
- Definition definition = getWSDLDefinition(wsdlLocation);
-
- String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL", address);
-
- address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL", address);
-
- address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
-
- address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
-
- //check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
- assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150");
- tearDown();
- }
- }
-
- /**
- * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified, auto-rewrite is on
- * (wsdl host prop set to ServerConfig.UNDEFINED_HOSTNAME) and https scheme is forced
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- public void testAutoRewriteCodeFirstPathRuleAndForcedHttps() throws Exception
- {
- setUp();
- setModifySOAPAddress(true);
- final String expectedContext = "xx/jaxws-jbws2150-codefirst";
- final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
- setWebServicePathRewriteRule(sedCmd);
- setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
- setWebServiceUriScheme("https");
- deployer.deploy("dep-jaxws-jbws2150-codefirst");
- try
- {
- String serverHost = getServerHost();
- final int serverPort = getServerPort();
- final int serverSecurePort = serverPort + 363; //8080 + 363 = 8443
- final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
-
- Definition definition = getWSDLDefinition(wsdlLocation);
- String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext +"/CodeFirstService", address);
- if (isTestsuiteServerHostLocalhost()) {
- definition = getWSDLDefinition("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
- address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("https://127.0.0.1:" + serverSecurePort + "/" + expectedContext +"/CodeFirstService", address);
- }
- }
- finally
- {
- deployer.undeploy("dep-jaxws-jbws2150-codefirst");
- tearDown();
- }
-
- }
-
- private void checkWsdlAndInvokeCodeFirstEndpoint(String testHost, String expectedWsdlHost, boolean setTargetAddress) throws Exception {
- final int serverPort = getServerPort();
- final String addr = "http://" + testHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService";
- final String wsdlLocation = addr + "?wsdl";
-
- Definition definition = getWSDLDefinition(wsdlLocation);
- String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://" + expectedWsdlHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService", address);
-
- ServiceIface endpoint = getEndpoint(wsdlLocation, "CodeFirstService");
- if (setTargetAddress) {
- ((BindingProvider)endpoint).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addr);
- }
- assertEquals(endpoint.echo("hello"), "hello");
- }
-
- private static boolean isTestsuiteServerHostLocalhost() {
- return "localhost".equals(getServerHost());
- }
-
- private void setModifySOAPAddress(Boolean value) throws Exception
- {
- Attribute attr = new Attribute("ModifySOAPAddress", value);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private void setWebServiceHost(String value) throws Exception
- {
- Attribute attr = new Attribute("WebServiceHost", value);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private void setWebServicePort(int value) throws Exception
- {
- Attribute attr = new Attribute("WebServicePort", value);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private void setWebServiceSecurePort(int value) throws Exception
- {
- Attribute attr = new Attribute("WebServiceSecurePort", value);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private void setWebServicePathRewriteRule(String value) throws Exception
- {
- Attribute attr = new Attribute("WebServicePathRewriteRule", value);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private void setWebServiceUriScheme(String value) throws Exception
- {
- Attribute attr = new Attribute("WebServiceUriScheme", value);
- getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
- }
-
- private ServiceIface getEndpoint(String wsdlLocation, String serviceName) throws Exception
- {
- List<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
- if (isIntegrationCXF()) {
- //Setting UseNewBusFeature as the tests here deploy / undeploy endpoints with different wsdl at the same URL
- //so we need to avoid caching issues related to the WSDLManager in the CXF Bus.
-
- //Service service = Service.create(new URL(wsdlLocation), new QName(NAMESPACE, serviceName), new UseNewBusFeature())
-
- Class<?> clazz = Class.forName("org.jboss.wsf.stack.cxf.client.UseNewBusFeature");
- features.add((WebServiceFeature)clazz.newInstance());
- }
- Service service = Service.create(new URL(wsdlLocation), new QName(NAMESPACE, serviceName), features.toArray(new WebServiceFeature[features.size()]));
- QName portName = service.getPorts().next();
- return service.getPort(portName, ServiceIface.class);
- }
-
- private Definition getWSDLDefinition(String wsdlLocation) throws Exception
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.importDocuments", false);
- wsdlReader.setFeature("javax.wsdl.verbose", false);
-
- Definition definition = wsdlReader.readWSDL(null, wsdlLocation);
- return definition;
- }
-
- private String getPortAddress(Definition definition, String serviceName, String portName)
- {
- Port port = definition.getService(new QName(NAMESPACE, serviceName)).getPort(portName);
- return ((SOAPAddressImpl)port.getExtensibilityElements().get(0)).getLocationURI();
- }
-
- @SuppressWarnings("unchecked")
- private String getWsdlImportAddress(Definition definition)
- {
- Collection<Import> imports = definition.getImports(NAMESPACE_IMP);
- if (imports.size() == 1) {
- return imports.iterator().next().getLocationURI();
- }
- return null;
- }
-
- public static MBeanServerConnection getServer() throws NamingException {
- if (mbeanServer == null) {
- mbeanServer = JBossWSTest.getServer();
- }
- return mbeanServer;
- }
-}
10 years
JBossWS SVN: r19389 - stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 12:51:14 -0500 (Mon, 19 Jan 2015)
New Revision: 19389
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml
Log:
Remove log category erroneously included in previous commit
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml 2015-01-19 17:49:53 UTC (rev 19388)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml 2015-01-19 17:51:14 UTC (rev 19389)
@@ -52,9 +52,6 @@
<priority value="DEBUG"/>
</category>
- <category name="org.jboss.as.controller">
- <priority value="TRACE"/>
- </category>
<category name="org.jboss.test.ws">
<priority value="TRACE"/>
</category>
10 years
JBossWS SVN: r19388 - in stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test: java/org/jboss/test/ws/jaxws/clientConfig and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 12:49:53 -0500 (Mon, 19 Jan 2015)
New Revision: 19388
Removed:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
Log:
Actually use the separate server instance that has been created for this scenario...
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml 2015-01-19 16:41:21 UTC (rev 19387)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/etc/log4j.xml 2015-01-19 17:49:53 UTC (rev 19388)
@@ -52,6 +52,9 @@
<priority value="DEBUG"/>
</category>
+ <category name="org.jboss.as.controller">
+ <priority value="TRACE"/>
+ </category>
<category name="org.jboss.test.ws">
<priority value="TRACE"/>
</category>
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2015-01-19 16:41:21 UTC (rev 19387)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2015-01-19 17:49:53 UTC (rev 19388)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2015, 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.
*
@@ -24,9 +24,12 @@
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;
@@ -36,6 +39,7 @@
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,12 +52,22 @@
@RunWith(Arquillian.class)
public class ClientConfigurationTestCase extends JBossWSTest
{
+ private static final String DEFAULT_CONFIG_TESTS_SERVER = "default-config-tests";
+ private static final String SERVER_DEPLOYMENT = "jaxws-clientConfig";
+ private static final String IN_CONTAINER_CLIENT_DEPLOYMENT = "jaxws-clientConfig-inContainer-client";
+
+ private final String baseURL = "http://" + getServerHost() + ":" + getServerPort(SHARED_TESTS_GROUP_QUALIFIER, DEFAULT_CONFIG_TESTS_SERVER);
+
@ArquillianResource
- private URL baseURL;
+ private Deployer deployer;
- @Deployment(name = "jaxws-clientConfig-inContainer-client", order = 1, testable = false)
+ @ArquillianResource
+ private ContainerController containerController;
+
+ @Deployment(name = IN_CONTAINER_CLIENT_DEPLOYMENT, order = 1, testable = false, managed = false)
+ @TargetsContainer(DEFAULT_CONFIG_TESTS_SERVER)
public static WebArchive createDeployment() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-clientConfig-inContainer-client.war");
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, IN_CONTAINER_CLIENT_DEPLOYMENT + ".war");
archive
.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ "Dependencies: org.jboss.ws.common\n"))
@@ -73,15 +87,25 @@
return archive;
}
- @Deployment(name = "jaxws-clientConfig", order = 2, testable = false)
+ @Deployment(name = SERVER_DEPLOYMENT, order = 2, testable = false, managed = false)
+ @TargetsContainer(DEFAULT_CONFIG_TESTS_SERVER)
public static WebArchive createDeployment2() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class,"jaxws-clientConfig.war");
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVER_DEPLOYMENT + ".war");
archive
.addManifest()
.addClass(org.jboss.test.ws.jaxws.clientConfig.Endpoint.class)
.addClass(org.jboss.test.ws.jaxws.clientConfig.EndpointImpl.class);
return archive;
}
+
+ @Before
+ public void startContainerAndDeploy() throws Exception {
+ if (!containerController.isStarted(DEFAULT_CONFIG_TESTS_SERVER)) {
+ containerController.start(DEFAULT_CONFIG_TESTS_SERVER);
+ deployer.deploy(SERVER_DEPLOYMENT);
+ deployer.deploy(IN_CONTAINER_CLIENT_DEPLOYMENT);
+ }
+ }
@Test
@RunAsClient
@@ -201,7 +225,89 @@
public void testConfigurationChangeOnDispatchInContainer() throws Exception {
assertEquals("1", runTestInContainer("testConfigurationChangeOnDispatch"));
}
+
+ // -------------- default conf tests -------------------
+
+ /**
+ * Verifies the default client configuration from AS model is used
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testDefaultClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
+ }
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testDefaultClientConfigurationOnDispatch"));
+ }
+
+ /**
+ * Verifies the SEI class FQN default client configuration from AS model is used
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testSEIClassDefaultClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testSEIClassDefaultClientConfiguration"));
+ }
+ //no corresponding test on Dispatch, as that has no SEI
+
+ /**
+ * Verifies the SEI class FQN client configuration from default conf file
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testSEIClassDefaultFileClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testSEIClassDefaultFileClientConfiguration"));
+ }
+ //no corresponding test on Dispatch, as that has no SEI
+
+ /**
+ * Verifies a client configuration from AS model can be set
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testCustomClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfiguration"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatch"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationUsingFeature"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
+ public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
+ }
+
+ // -----------------------------------
+
@Override
protected String getClientJarPaths() {
return JBossWSTestHelper.writeToFile(new JBossWSTestHelper.JarDeployment("jaxws-clientConfig-client.jar") { {
@@ -215,14 +321,14 @@
private Helper getHelper() {
Helper helper = new Helper();
- helper.setTargetEndpoint(baseURL + "/EndpointImpl");
+ helper.setTargetEndpoint(baseURL + "/jaxws-clientConfig/EndpointImpl");
return helper;
}
private String runTestInContainer(String test) throws Exception
{
URL url = new URL(baseURL
- + "?path=/jaxws-clientConfig/EndpointImpl&method=" + test
+ + "/jaxws-clientConfig-inContainer-client?path=/jaxws-clientConfig/EndpointImpl&method=" + test
+ "&helper=" + Helper.class.getName());
return IOUtils.readAndCloseStream(url.openStream());
}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java 2015-01-19 16:41:21 UTC (rev 19387)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java 2015-01-19 17:49:53 UTC (rev 19388)
@@ -1,172 +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.clientConfig;
-
-import java.io.File;
-import java.net.URL;
-
-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.JBossWSTestHelper;
-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 ClientConfigurationTestCaseForked extends JBossWSTest
-{
- @ArquillianResource
- private URL baseURL;
-
- @Deployment(name="jaxws-clientConfig-inContainer-client", testable = false)
- public static WebArchive createDeployment() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-clientConfig-inContainer-client.war");
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.common\n"))
- .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/clientConfig/META-INF/jaxws-client-config.xml"), "META-INF/jaxws-client-config.xml")
- .addClass(org.jboss.test.helper.ClientHelper.class)
- .addClass(org.jboss.test.helper.TestServlet.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.CustomHandler.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.Endpoint.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.Endpoint2.class)
- .addAsResource("org/jboss/test/ws/jaxws/clientConfig/jaxws-client-config.xml", "jaxws-client-config.xml")
- .addClass(org.jboss.test.ws.jaxws.clientConfig.Helper.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.LogHandler.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.RoutingHandler.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.TestUtils.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.UserHandler.class)
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/clientConfig/META-INF/permissions.xml"), "permissions.xml");
- return archive;
- }
-
- @Deployment(name = "jaxws-clientConfig", testable = false)
- public static WebArchive createDeployment1() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-clientConfig.war");
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.clientConfig.Endpoint.class)
- .addClass(org.jboss.test.ws.jaxws.clientConfig.EndpointImpl.class);
- return archive;
- }
-
- /**
- * Verifies the default client configuration from AS model is used
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testDefaultClientConfigurationInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
- }
-
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testDefaultClientConfigurationOnDispatch"));
- }
-
- /**
- * Verifies the SEI class FQN default client configuration from AS model is used
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testSEIClassDefaultClientConfigurationInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testSEIClassDefaultClientConfiguration"));
- }
- //no corresponding test on Dispatch, as that has no SEI
-
- /**
- * Verifies the SEI class FQN client configuration from default conf file
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testSEIClassDefaultFileClientConfigurationInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testSEIClassDefaultFileClientConfiguration"));
- }
- //no corresponding test on Dispatch, as that has no SEI
-
- /**
- * Verifies a client configuration from AS model can be set
- *
- * @throws Exception
- */
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testCustomClientConfigurationInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfiguration"));
- }
-
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatch"));
- }
-
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfigurationUsingFeature"));
- }
-
- @Test
- @RunAsClient
- @OperateOnDeployment("jaxws-clientConfig-inContainer-client")
- public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
- }
-
- // -------------------------
-
- private String runTestInContainer(String test) throws Exception
- {
- URL url = new URL(baseURL
- + "?path=/jaxws-clientConfig/EndpointImpl&method=" + test
- + "&helper=" + Helper.class.getName());
- return IOUtils.readAndCloseStream(url.openStream());
- }
-}
10 years
JBossWS SVN: r19387 - in stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws: smoke/tools and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 11:41:21 -0500 (Mon, 19 Jan 2015)
New Revision: 19387
Removed:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/WebServiceRefTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCaseForked.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCaseForked.java
Log:
Misc cleanup
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/WebServiceRefTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/WebServiceRefTestCase.java 2015-01-19 10:39:27 UTC (rev 19386)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/WebServiceRefTestCase.java 2015-01-19 16:41:21 UTC (rev 19387)
@@ -161,10 +161,7 @@
Object retObj = port.echo(helloWorld);
assertEquals(helloWorld, retObj);
}
- /** todo:
- * Arquillian does not have like function to deploy client app.
- * Need to create functionality to run this test in aqruillian.
- **/
+
@Test
@RunAsClient
@OperateOnDeployment(DEP_WAR)
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java 2015-01-19 10:39:27 UTC (rev 19386)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java 2015-01-19 16:41:21 UTC (rev 19387)
@@ -41,8 +41,6 @@
protected ClassLoader origClassLoader;
protected String origLog4jConf;
protected String oldCPProp;
- protected boolean integrationNative = false;
- protected boolean integrationCXF = false;
private static final String LOG4J_CONF = "log4j.configuration";
@@ -67,20 +65,10 @@
{
list.add(c.getName());
}
- if (list.contains(StackConfigurable.class.getName()))
- {
- clazz.getMethod("setIsNative", boolean.class).invoke(delegate, integrationNative);
- clazz.getMethod("setIsCXF", boolean.class).invoke(delegate, integrationCXF);
- }
}
protected void setupClasspath() throws Exception
{
- if (!(integrationCXF || integrationNative))
- {
- //the integration stack is not set yet, doing it before mangling with the classpath
- readIntegrationStack();
- }
String classpath = System.getProperty("surefire.test.class.path");
if (classpath == null) //no maven surefire classpath hacks required
return;
@@ -96,8 +84,6 @@
String s = st.nextToken();
if(s.endsWith(".jar")) // JBWS-2175: skip target/classes and target/test-classes
{
- if( filtered(s) )
- continue;
jarURLs.add( new File(s).toURI().toURL() );
jarURLString.append( s ).append(File.pathSeparator);
}
@@ -129,8 +115,6 @@
System.setProperty(LOG4J_CONF, log4jXmlUrl.toString());
}
- protected abstract boolean filtered(String jarName);
-
protected void restoreClasspath()
{
if(this.origClassLoader !=null)
@@ -148,10 +132,4 @@
}
}
}
-
- protected void readIntegrationStack()
- {
- this.integrationNative = false;
- this.integrationCXF = isIntegrationCXF();
- }
}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java 2015-01-19 10:39:27 UTC (rev 19386)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java 2015-01-19 16:41:21 UTC (rev 19387)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.smoke.tools;
-
-public interface StackConfigurable
-{
- public void setIsNative(boolean integrationNative);
-
- public void setIsCXF(boolean integrationCXF);
-}
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java 2015-01-19 10:39:27 UTC (rev 19386)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java 2015-01-19 16:41:21 UTC (rev 19387)
@@ -44,7 +44,7 @@
* @author Heiko.Braun <heiko.braun(a)jboss.com>
* @author alessio.soldano(a)jboss.com
*/
-public class WSConsumerPlugin extends JBossWSTest implements StackConfigurable
+public class WSConsumerPlugin extends JBossWSTest
{
// Tools delegate. Recreated for every test. See setup(...)
WSContractConsumer consumer;
@@ -57,11 +57,6 @@
private final File workDirectory;
- protected boolean integrationNative;
- protected boolean integrationMetro;
- protected boolean integrationCXF;
-
-
public WSConsumerPlugin()
{
// create a new consumer for every test case
@@ -311,16 +306,7 @@
System.out.println(messageOut);
System.out.println("--- End captured output --");
- if (getIsCXF())
- {
- assertTrue("Tools output not correctly redirected", messageOut.indexOf("wsdl2java -exsh false -p org.jboss.test.ws.tools.testMessageStream") != -1);
- }
- else
- {
- assertTrue("Tools output not correctly redirected",
- messageOut.replace('\\', '/').indexOf("org/jboss/test/ws/tools/testMessageStream/EndpointInterface.java")!=-1
- );
- }
+ assertTrue("Tools output not correctly redirected", messageOut.indexOf("wsdl2java -exsh false -p org.jboss.test.ws.tools.testMessageStream") != -1);
}
/**
@@ -448,26 +434,4 @@
return loader;
}
-
- public boolean getIsNative()
- {
- return integrationNative;
- }
-
- public boolean getIsCXF()
- {
- return integrationCXF;
- }
-
- @Override
- public void setIsNative(boolean integrationNative)
- {
- this.integrationNative = integrationNative;
- }
-
- @Override
- public void setIsCXF(boolean integrationCXF)
- {
- this.integrationCXF = integrationCXF;
- }
}
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCaseForked.java 2015-01-19 10:39:27 UTC (rev 19386)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerTestCaseForked.java 2015-01-19 16:41:21 UTC (rev 19387)
@@ -240,9 +240,4 @@
dispatch("testAdditionalHeaders");
tearDown();
}
-
- protected boolean filtered(String jarName)
- {
- return false;
- }
}
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCaseForked.java 2015-01-19 10:39:27 UTC (rev 19386)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCaseForked.java 2015-01-19 16:41:21 UTC (rev 19387)
@@ -146,14 +146,4 @@
tearDown();
}
- /**
- * Filter sun jaxws implementation because it clashes
- * with the native one (ServiceLoader...)
- * @param jarName
- * @return
- */
- protected boolean filtered(String jarName)
- {
- return false;
- }
}
10 years
JBossWS SVN: r19386 - stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3813.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-01-19 05:39:27 -0500 (Mon, 19 Jan 2015)
New Revision: 19386
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3813/JBWS3813AnnotationTestCase.java
Log:
Enabling passing test to avoid forgetting about it when merging back to trunk (the merge won't catch this, because of the different exclusion mechanism)
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3813/JBWS3813AnnotationTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3813/JBWS3813AnnotationTestCase.java 2015-01-19 07:03:46 UTC (rev 19385)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3813/JBWS3813AnnotationTestCase.java 2015-01-19 10:39:27 UTC (rev 19386)
@@ -31,7 +31,6 @@
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,7 +39,6 @@
*
* @author rsearls(a)redhat.com
*/
-@Ignore(value="[JBWS-3813] Add exception name to faultstring/detail/stackTrace")
@RunWith(Arquillian.class)
public class JBWS3813AnnotationTestCase extends JBossWSTest
{
10 years
JBossWS SVN: r19385 - stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3552.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-01-19 02:03:46 -0500 (Mon, 19 Jan 2015)
New Revision: 19385
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3552/JBWS3552TestCase.java
Log:
Use @Ignore to exclude test
Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3552/JBWS3552TestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3552/JBWS3552TestCase.java 2015-01-19 06:54:04 UTC (rev 19384)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3552/JBWS3552TestCase.java 2015-01-19 07:03:46 UTC (rev 19385)
@@ -35,6 +35,7 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -143,12 +144,9 @@
@Test
@RunAsClient
+ @Ignore(value="FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol")
public void testExceptionCA() throws Exception {
- if (true) {
- System.out.println("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol");
- return;
- }
- EndpointIface endpoint = getProxy();//FIXME [CXF-4600] Exception inheritance not working over SOAP protocol
+ EndpointIface endpoint = getProxy();
try {
endpoint.throwExceptionCA();
fail("Expected exception not thrown");
@@ -171,12 +169,9 @@
@Test
@RunAsClient
+ @Ignore("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol")
public void testExceptionFA() throws Exception {
- if (true) {
- System.out.println("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol");
- return;
- }
- EndpointIface endpoint = getProxy();//FIXME [CXF-4600] Exception inheritance not working over SOAP protocol
+ EndpointIface endpoint = getProxy();
try {
endpoint.throwExceptionFA();
fail("Expected exception not thrown");
@@ -199,12 +194,9 @@
@Test
@RunAsClient
+ @Ignore("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol")
public void testExceptionGA() throws Exception {
- if (true) {
- System.out.println("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol");
- return;
- }
- EndpointIface endpoint = getProxy();//FIXME [CXF-4600] Exception inheritance not working over SOAP protocol
+ EndpointIface endpoint = getProxy();
try {
endpoint.throwExceptionGA();
fail("Expected exception not thrown");
@@ -227,12 +219,9 @@
@Test
@RunAsClient
+ @Ignore("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol")
public void testExceptionMA() throws Exception {
- if (true) {
- System.out.println("FIXME: [CXF-4600] Exception inheritance not working over SOAP protocol");
- return;
- }
- EndpointIface endpoint = getProxy();//FIXME [CXF-4600] Exception inheritance not working over SOAP protocol
+ EndpointIface endpoint = getProxy();
try {
endpoint.throwExceptionMA();
fail("Expected exception not thrown");
10 years