Author: asoldano
Date: 2015-04-13 06:03:50 -0400 (Mon, 13 Apr 2015)
New Revision: 19628
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointReferenceTestCase.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
Log:
- [JBWS-3889] Fix some ipv6 testing issues
- Misc testsuite improvements / fixes
Thanks Jan Bliznak for the patch!
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -93,10 +93,17 @@
ProbeType pt = new ProbeType();
ScopesType scopes = new ScopesType();
pt.setScopes(scopes);
- List<ProbeMatchType> pmts = filterProbeMatchesForHost(client.probe(pt,
TIMEOUT).getProbeMatch(), getServerHost());
+ final String serverHost = getServerHost().replace("127.0.0.1",
"localhost");
+ final int serverPort = getServerPort();
+ List<ProbeMatchType> pmts = client.probe(pt, TIMEOUT).getProbeMatch();
+ assertFalse("There must be some services discovered, check that you have
allowed UDP broadcast on port 3072", pmts.isEmpty());
+ List<ProbeMatchType> pmtsForHost = filterProbeMatchesForHost(pmts,
serverHost);
+ assertFalse("There must be some services discovered for current host "
+ serverHost
+ + ", found only " + dbgProbeMatchTypeList(pmts),
pmtsForHost.isEmpty());
+
List<ResolveMatchType> rmts = new LinkedList<ResolveMatchType>();
- for (ProbeMatchType pmt : pmts) {
+ for (ProbeMatchType pmt : pmtsForHost) {
W3CEndpointReference epr = pmt.getEndpointReference();
ResolveMatchType rmt = client.resolve(epr, TIMEOUT);
assertNotNull("Could not resolve (timeout = " + TIMEOUT + "
ms) reference: " + epr, rmt);
@@ -104,8 +111,6 @@
}
final QName typeName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wsdd",
"ServiceIface");
- final String serverHost = getServerHost();
- final int serverPort = getServerPort();
checkResolveMatches(rmts, "http://" + serverHost + ":" +
serverPort + "/jaxws-samples-wsdd/WSDDService", typeName);
checkResolveMatches(rmts, "http://" + serverHost + ":" +
serverPort + "/jaxws-samples-wsdd2/WSDDService", typeName);
checkResolveMatches(rmts, "http://" + serverHost + ":" +
serverPort + "/jaxws-samples-wsdd2/AnotherWSDDService", typeName);
@@ -155,10 +160,16 @@
ProbeType pt = new ProbeType();
ScopesType scopes = new ScopesType();
pt.setScopes(scopes);
- List<ProbeMatchType> pmts = filterProbeMatchesForHost(client.probe(pt,
TIMEOUT).getProbeMatch(), getServerHost());
+ final String serverHost = getServerHost().replace("127.0.0.1",
"localhost");
+ List<ProbeMatchType> pmts = client.probe(pt, TIMEOUT).getProbeMatch();
+ assertFalse("There must be some services discovered, check that you have
allowed UDP broadcast on port 3072", pmts.isEmpty());
+ List<ProbeMatchType> pmtsForHost = filterProbeMatchesForHost(pmts,
serverHost.replace("127.0.0.1", "localhost"));
+
+ assertFalse("There must be some services discovered for current host "
+ serverHost, pmtsForHost.isEmpty());
+
List<ResolveMatchType> rmts = new LinkedList<ResolveMatchType>();
- for (ProbeMatchType pmt : pmts) {
+ for (ProbeMatchType pmt : pmtsForHost) {
W3CEndpointReference epr = pmt.getEndpointReference();
ResolveMatchType rmt = client.resolve(epr, TIMEOUT);
assertNotNull("Could not resolve (timeout = " + TIMEOUT + "
ms) reference: " + epr, rmt);
@@ -183,13 +194,48 @@
private void checkResolveMatches(List<ResolveMatchType> rmts, String address,
QName type) {
List<ResolveMatchType> rmtList = getByAddress(rmts, address);
- if (rmtList.size() > 0) {
- assertEquals(type, rmtList.get(0).getTypes().iterator().next());
- } else {
- assertTrue("Number of matches can not be 0.", (rmtList.size() >
0));
+ assertEquals("There must be exactly one webservice of type " + type +
" available at " + address + ", "
+ + "these where discovered: " + dbgDumpList(rmtList), 1,
rmtList.size());
+ assertEquals(type, rmtList.get(0).getTypes().iterator().next());
+ }
+
+ // tmp method for debugging jenkins runs.
+ // report uuid of the endpoint
+ private String dbgDumpList(List<ResolveMatchType> rmtList)
+ {
+ StringBuilder dbgStr = new StringBuilder().append("\n");
+
+ for (ResolveMatchType rmt : rmtList)
+ {
+ String tmpStr = rmt.getEndpointReference().toString();
+ int start = tmpStr.indexOf("<Address>");
+ int end = tmpStr.indexOf("</Address>");
+ if (start > -1 && end > -1)
+ {
+ String uuidStr = tmpStr.substring(start + 9, end);
+ dbgStr.append(rmt.getXAddrs().get(0) + " " + uuidStr +
"\n");
+ }
}
+ return dbgStr.toString();
}
+ // tmp method for debugging jenkins runs.
+ // report uuid of the endpoint
+ private String dbgProbeMatchTypeList(List<ProbeMatchType> pmtList){
+ StringBuilder dbgStr = new StringBuilder().append("\n");
+
+ for(ProbeMatchType rmt: pmtList){
+ String tmpStr = rmt.getEndpointReference().toString();
+ int start = tmpStr.indexOf("<Address>");
+ int end = tmpStr.indexOf("</Address>");
+ if (start > -1 && end > -1){
+ String uuidStr = tmpStr.substring(start + 9, end);
+ dbgStr.append(rmt.getXAddrs().get(0) +" " + uuidStr +
"\n");
+ }
+ }
+ return dbgStr.toString();
+ }
+
private List<ResolveMatchType> getByAddress(List<ResolveMatchType> rmts,
String address)
{
List<ResolveMatchType> list = new LinkedList<ResolveMatchType>();
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -83,6 +83,7 @@
+ "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl
required to extend STS impl
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler.class)
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.SampleSTS.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"),
"wsdl/ws-trust-1.4-service.wsdl")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"),
"classes/stsstore.jks")
@@ -172,6 +173,7 @@
+ "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl
required to extend STS impl
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsholderofkey.STSHolderOfKeyCallbackHandler.class)
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsholderofkey.SampleSTSHolderOfKey.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/holderofkey-ws-trust-1.4-service.wsdl"),
"wsdl/holderofkey-ws-trust-1.4-service.wsdl")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"),
"classes/stsstore.jks")
@@ -222,6 +224,7 @@
+ "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl
required to extend STS impl
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsbearer.STSBearerCallbackHandler.class)
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsbearer.SampleSTSBearer.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/bearer-ws-trust-1.4-service.wsdl"),
"wsdl/bearer-ws-trust-1.4-service.wsdl")
.addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"),
"classes/stsstore.jks")
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -0,0 +1,64 @@
+/*
+ * 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.samples.wsse.policy.trust.shared;
+
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ *
+ * User: rsearls
+ * Date: 2/5/14
+ */
+public class WSTrustAppUtils {
+
+ public static String getServerHost() {
+ final String host = System.getProperty("jboss.bind.address",
"localhost");
+ return toIPv6URLFormat(host);
+ }
+
+ private static String toIPv6URLFormat(final String host)
+ {
+ try
+ {
+ if (host.startsWith("[") || host.startsWith(":"))
+ {
+ if (System.getProperty("java.net.preferIPv4Stack") == null)
+ {
+ throw new IllegalStateException("always provide
java.net.preferIPv4Stack JVM property when using IPv6 address format");
+ }
+ if (System.getProperty("java.net.preferIPv6Addresses") == null)
+ {
+ throw new IllegalStateException("always provide
java.net.preferIPv6Addresses JVM property when using IPv6 address format");
+ }
+ }
+ final boolean isIPv6Address = InetAddress.getByName(host) instanceof
Inet6Address;
+ final boolean isIPv6Formatted = isIPv6Address &&
host.startsWith("[");
+ return isIPv6Address && !isIPv6Formatted ? "[" + host +
"]" : host;
+ }
+ catch (final UnknownHostException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -40,6 +40,8 @@
import org.apache.cxf.sts.token.validator.SAMLTokenValidator;
import org.apache.cxf.sts.token.validator.UsernameTokenValidator;
import org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.WSTrustTestUtils;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils;
@WebServiceProvider(serviceName = "SecurityTokenService",
portName = "UT_Port",
@@ -67,18 +69,11 @@
List<ServiceMBean> services = new LinkedList<ServiceMBean>();
StaticService service = new StaticService();
+ String serverHostRegexp = WSTrustAppUtils.getServerHost().replace("[",
"\\[").replace("]", "\\]").replace("127.0.0.1",
"localhost");
service.setEndpoints(Arrays.asList(
-
"http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
-
"http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
-
"http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
-
-
"http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
-
"http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
-
"http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
-
-
"http://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService",
-
"http://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService",
-
"http://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService"
+ "http://" + serverHostRegexp +
":(\\d)*/jaxws-samples-wsse-policy-trust/SecurityService",
+ "http://" + serverHostRegexp +
":(\\d)*/jaxws-samples-wsse-policy-trust-actas/ActAsService",
+ "http://" + serverHostRegexp +
":(\\d)*/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService"
));
services.add(service);
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -29,6 +29,7 @@
import org.apache.cxf.sts.service.StaticService;
import org.apache.cxf.sts.token.provider.SAMLTokenProvider;
import org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils;
import javax.xml.ws.WebServiceProvider;
import java.util.Arrays;
@@ -62,10 +63,9 @@
List<ServiceMBean> services = new LinkedList<ServiceMBean>();
StaticService service = new StaticService();
+ String serverHostRegexp = WSTrustAppUtils.getServerHost().replace("[",
"\\[").replace("]", "\\]").replace("127.0.0.1",
"localhost");
service.setEndpoints(Arrays.asList(
-
"https://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-bearer/BearerService",
-
"https://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-bearer/BearerService",
-
"https://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-bearer/BearerService"
+ "https://" + serverHostRegexp +
":(\\d)*/jaxws-samples-wsse-policy-trust-bearer/BearerService"
));
services.add(service);
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -29,6 +29,7 @@
import org.apache.cxf.sts.service.StaticService;
import org.apache.cxf.sts.token.provider.SAMLTokenProvider;
import org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils;
import javax.xml.ws.WebServiceProvider;
import java.util.Arrays;
@@ -65,10 +66,9 @@
List<ServiceMBean> services = new LinkedList<ServiceMBean>();
StaticService service = new StaticService();
+ String serverHostRegexp = WSTrustAppUtils.getServerHost().replace("[",
"\\[").replace("]", "\\]").replace("127.0.0.1",
"localhost");
service.setEndpoints(Arrays.asList(
-
"https://localhost:(\\d)*/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService",
-
"https://\\[::1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService",
-
"https://\\[0:0:0:0:0:0:0:1\\]:(\\d)*/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService"
+ "https://" + serverHostRegexp +
":(\\d)*/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService"
));
services.add(service);
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointReferenceTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointReferenceTestCase.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointReferenceTestCase.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.jaxws.endpointReference;
+import java.net.InetAddress;
import java.net.URL;
import javax.xml.namespace.QName;
@@ -154,10 +155,14 @@
assertEquals("http://www.w3.org/2005/08/addressing",
endpointReference.getAttribute("xmlns"));
NodeList addresses = endpointReference.getElementsByTagName("Address");
assertEquals(1, addresses.getLength());
- String eprAddress = addresses.item(0).getFirstChild().getNodeValue();
- eprAddress = eprAddress.replace("127.0.0.1", "localhost");
- String ENDPOINT_ADDRESS = baseURL.toString() +
"/jaxws-endpointReference";
- assertEquals(ENDPOINT_ADDRESS.replace("127.0.0.1",
"localhost"), eprAddress);
+ URL eprAddress = new URL(addresses.item(0).getFirstChild().getNodeValue());
+ URL ENDPOINT_ADDRESS = new URL(baseURL.toString() +
"/jaxws-endpointReference");
+
+ //compare hosts' IPs
+ String eprAddressHost =
InetAddress.getByName(eprAddress.getHost()).getHostAddress();
+ String endpointAddressHost =
InetAddress.getByName(ENDPOINT_ADDRESS.getHost()).getHostAddress();
+ assertEquals(eprAddressHost, endpointAddressHost);
+ assertEquals(ENDPOINT_ADDRESS.toString().replace(ENDPOINT_ADDRESS.getHost(),
eprAddress.getHost()), eprAddress.toString());
}
private static class MyEndpointReference extends EndpointReference
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -80,9 +80,11 @@
public void testAddressRewrite() throws Exception
{
String wsdl = IOUtils.readAndCloseStream(new URL(baseURL +
"/jaxws-jbws3736?wsdl").openStream());
+
+ String serverHost = getServerHost().replace("127.0.0.1",
"localhost"); //because of TCK workaround in
org.jboss.ws.common.management.AbstractServerConfig
//we expect the published wsdl to have the https protocol in the soap:address
because the original wsdl provided
//in the deployment has that. This shows that the reference to the wsdl in endpoint
interface has been processed
//when rewriting the soap:address. If we got http protocol here, the fix won't
be in place.
- assertTrue(wsdl.contains("https://" + getServerHost() + ":" +
(getServerPort() + 363) + "/jaxws-jbws3736"));
+ assertTrue(wsdl.contains("https://" + serverHost + ":" +
(getServerPort() + 363) + "/jaxws-jbws3736"));
}
}
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2015-04-13
09:43:56 UTC (rev 19627)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2015-04-13
10:03:50 UTC (rev 19628)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.management.recording;
+import java.net.InetAddress;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
@@ -147,9 +148,8 @@
port.echo1("Test getRecordsByClientHost");
- //We have client and server on the same host here...
- String host = "localhost".equals(getServerHost()) ? "127.0.0.1"
: getServerHost();
- if ("[::1]".equals(host)) host = "0:0:0:0:0:0:0:1"; // IPv6
hack
+ // MemoryBufferRecorder stores source host host as InetAddress IP format, eg. [::1]
will be stored as 0:0:0:0:0:0:0:1
+ String host = InetAddress.getByName(getServerHost()).getHostAddress();
Map<String, List<Record>> localhostRecords = (Map<String,
List<Record>>)server.invoke(oname, "getRecordsByClientHost", new
Object[] { host },
new String[] { "java.lang.String" });
@@ -172,11 +172,7 @@
OperationFilter operationFilter = new OperationFilter(new QName(targetNS,
"echo1"));
LinkedList<String> l = new LinkedList<String>();
- l.add("localhost");
- l.add("127.0.0.1");
- l.add("[::1]");
- l.add("[0:0:0:0:0:0:0:1]");
- l.add(getServerHost());
+ l.add(getServerHost().replace("127.0.0.1", "localhost"));
HostFilter hostFilter = new HostFilter(l,false); //destination
RecordFilter[] filters = new RecordFilter[] {operationFilter, hostFilter};
@@ -186,8 +182,10 @@
port.echo2("Test getMatchingRecords");
Map<String, List<Record>> stopRecords = (Map<String,
List<Record>>)server.invoke(oname, "getMatchingRecords", new Object[] {
filters }, new String[] { filters.getClass().getName() });
-
- assertEquals(1, stopRecords.keySet().size() - startRecords.keySet().size());
+ Map<String, List<Record>> allRecords = (Map<String,
List<Record>>) server.invoke(oname, "getMatchingRecords",
+ new Object[] { new RecordFilter[]{ operationFilter } }, new String[] {
filters.getClass().getName() });
+ assertTrue("No records for hosts " + l + ", all records found:
" + dumpInboundRecordsInfo(allRecords), stopRecords.size() > 0);
+ assertEquals("There must be only 1 record for echo1 operation", 1,
stopRecords.keySet().size() - startRecords.keySet().size());
}
@Test
@@ -249,4 +247,20 @@
Service service = Service.create(wsdlURL, serviceName);
return service.getPort(Endpoint.class);
}
+
+ private String dumpInboundRecordsInfo(Map<String, List<Record>> records)
{
+ StringBuilder sb = new StringBuilder();
+ for (String key : records.keySet()) {
+ sb.append(records.get(key)).append("\n");
+ for (Record record : records.get(key)) {
+ if(record.getMessageType() == Record.MessageType.INBOUND) {
+ sb.append("
").append(record.getGroupID()).append("\n");
+ sb.append(" Source host:
").append(record.getSourceHost()).append("\n");
+ sb.append(" Destination host:
").append(record.getDestinationHost()).append("\n");
+ }
+ }
+ }
+ return sb.toString();
+ }
+
}