JBossWS SVN: r19629 - in stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite: cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd and 7 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-04-13 06:11:22 -0400 (Mon, 13 Apr 2015)
New Revision: 19629
Modified:
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2307/WebServiceRefMTOMTestCase.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java
stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
Log:
Applying test patch from Jan Bliznak
Modified: stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2015-04-13 10:03:50 UTC (rev 19628)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2015-04-13 10:11:22 UTC (rev 19629)
@@ -447,6 +447,7 @@
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/STSCallbackHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
<include name="wsdl/ws-trust*"/>
@@ -550,6 +551,7 @@
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/STSBearerCallbackHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
<include name="wsdl/bearer-ws-trust*"/>
@@ -592,6 +594,7 @@
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/STSHolderOfKeyCallbackHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/trust/shared/WSTrustAppUtils.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/trust/WEB-INF">
<include name="wsdl/holderofkey-ws-trust*"/>
Modified: stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/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)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -66,20 +66,27 @@
ProbeType pt = new ProbeType();
ScopesType scopes = new ScopesType();
pt.setScopes(scopes);
- List<ProbeMatchType> pmts = filterProbeMatchesForHost(client.probe(pt, TIMEOUT).getProbeMatch(), getServerHost());
-
+
+ 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);
+ assertFalse("There must be some services discovered for server 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);
rmts.add(rmt);
}
-
+
final QName typeName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsdd", "ServiceIface");
- checkResolveMatches(rmts, "http://" + getServerHost() + ":8080/jaxws-samples-wsdd/WSDDService", typeName);
- checkResolveMatches(rmts, "http://" + getServerHost() + ":8080/jaxws-samples-wsdd2/WSDDService", typeName);
- checkResolveMatches(rmts, "http://" + getServerHost() + ":8080/jaxws-samples-wsdd2/AnotherWSDDService", typeName);
+ checkResolveMatches(rmts, "http://" + serverHost + ":8080/jaxws-samples-wsdd/WSDDService", typeName);
+ checkResolveMatches(rmts, "http://" + serverHost + ":8080/jaxws-samples-wsdd2/WSDDService", typeName);
+ checkResolveMatches(rmts, "http://" + serverHost + ":8080/jaxws-samples-wsdd2/AnotherWSDDService", typeName);
client.close();
} finally {
bus.shutdown(true);
@@ -124,7 +131,7 @@
ProbeType pt = new ProbeType();
ScopesType scopes = new ScopesType();
pt.setScopes(scopes);
- List<ProbeMatchType> pmts = filterProbeMatchesForHost(client.probe(pt, TIMEOUT).getProbeMatch(), getServerHost());
+ List<ProbeMatchType> pmts = filterProbeMatchesForHost(client.probe(pt, TIMEOUT).getProbeMatch(), getServerHost().replace("127.0.0.1", "localhost"));
List<ResolveMatchType> rmts = new LinkedList<ResolveMatchType>();
for (ProbeMatchType pmt : pmts) {
@@ -162,20 +169,35 @@
private String dbgDumpList(List<ResolveMatchType> rmtList){
StringBuilder dbgStr = new StringBuilder().append("\n");
- if(rmtList.size() > 1){
- 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");
- }
+ 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/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/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)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/sts/SampleSTS.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -40,6 +40,7 @@
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.shared.WSTrustAppUtils;
@WebServiceProvider(serviceName = "SecurityTokenService",
portName = "UT_Port",
@@ -67,18 +68,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/OnBeha...",
- "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/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/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)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsbearer/SampleSTSBearer.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -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/BearerSer...",
- "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/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/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)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/stsholderofkey/SampleSTSHolderOfKey.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -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/Hold...",
- "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/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2015-04-13 10:03:50 UTC (rev 19628)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -86,14 +86,8 @@
transport = soapBinding.getTransportURI();
}
}
- if (isIntegrationCXF())
- {
- System.out.println("FIXME: [CXF-2531] Wrong \"transport\" attribute in soap12:binding");
- }
- else
- {
- assertEquals("Invalid transport uri", "http://schemas.xmlsoap.org/soap/http", transport);
- }
+
+ assertEquals("Invalid transport uri", "http://schemas.xmlsoap.org/soap/http", transport);
}
public void testClientAccess() throws Exception
Modified: stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2307/WebServiceRefMTOMTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2307/WebServiceRefMTOMTestCase.java 2015-04-13 10:03:50 UTC (rev 19628)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2307/WebServiceRefMTOMTestCase.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -69,7 +69,9 @@
assertEquals(500, c.getResponseCode());
String error = IOUtils.readAndCloseStream(c.getErrorStream());
c.disconnect();
- assertTrue(error.contains("Could not instantiate ClientServlet2") || error.contains("Error instantiating servlet class org.jboss.test.ws.jaxws.jbws2307.ClientServlet2"));
+ if (error.contains("error-text-div")) { //the actual error exception does not seem to be always returned by web layer
+ assertTrue(error.contains("Could not instantiate ClientServlet2") || error.contains("Error instantiating servlet class org.jboss.test.ws.jaxws.jbws2307.ClientServlet2"));
+ }
} finally {
JBossWSTestHelper.undeploy(DeploymentArchives.CLIENT_2);
}
Modified: stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java 2015-04-13 10:03:50 UTC (rev 19628)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3736/JBWS3736TestCase.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -61,9 +61,11 @@
public void testAddressRewrite() throws Exception
{
String wsdl = IOUtils.readAndCloseStream(new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl").openStream());
+
+ String serverHost = getServerHost().replace("127.0.0.1", "localhost"); //because https://issues.jboss.org/browse/CTS-11
//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() + ":8443/jaxws-jbws3736"));
+ assertTrue(wsdl, wsdl.contains("https://" + serverHost + ":" +"8443/jaxws-jbws3736"));
}
}
Modified: stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2015-04-13 10:03:50 UTC (rev 19628)
+++ stack/cxf/branches/jbossws-cxf-4.3.x/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2015-04-13 10:11:22 UTC (rev 19629)
@@ -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;
@@ -132,16 +133,14 @@
setRecording(true);
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 as InetAddress IP format, eg. [::1] will be considered 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" });
Map<String, List<Record>> amazonRecords = (Map<String, List<Record>>)server.invoke(oname, "getRecordsByClientHost", new Object[] { "72.21.203.1" },
new String[] { "java.lang.String" });
-
assertTrue("No records for " + host, localhostRecords.size() > 0);
assertTrue("There are records for 72.21.203.1", amazonRecords.size() == 0);
}
@@ -156,10 +155,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().replace("127.0.0.1", "localhost"));
HostFilter hostFilter = new HostFilter(l,false); //destination
RecordFilter[] filters = new RecordFilter[] {operationFilter, hostFilter};
@@ -170,7 +166,10 @@
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());
}
public void testAddRemoveFilter() throws Exception
@@ -230,4 +229,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();
+ }
+
}
9 years, 9 months
JBossWS SVN: r19628 - in stack/cxf/trunk/modules/testsuite: cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust and 7 other directories.
by jbossws-commits@lists.jboss.org
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/OnBeha...",
- "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/BearerSer...",
- "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/Hold...",
- "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();
+ }
+
}
9 years, 9 months
JBossWS SVN: r19627 - stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-04-13 05:43:56 -0400 (Mon, 13 Apr 2015)
New Revision: 19627
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java
Log:
Use recent api
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java 2015-04-13 09:36:38 UTC (rev 19626)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java 2015-04-13 09:43:56 UTC (rev 19627)
@@ -31,7 +31,7 @@
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
-import junit.framework.Assert;
+import org.junit.Assert;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
9 years, 9 months
JBossWS SVN: r19626 - stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-04-13 05:36:38 -0400 (Mon, 13 Apr 2015)
New Revision: 19626
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java
Log:
Change JBWS2150TestCase to use getWebServiceHost() instead of getServerHost() for getting the host value to use as test expected value. This is required for testing when -Djboss.bind.address=127.0.0.1 is specified as we need (for now...) to cope with a tck hack in the server configuration.
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java 2015-04-08 10:17:38 UTC (rev 19625)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCase.java 2015-04-13 09:36:38 UTC (rev 19626)
@@ -754,32 +754,34 @@
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> wsdlLocationsMap = new HashMap<String, 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");
+ 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 + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
- for (final String wsdlLocation : wsdlLocations)
+ 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://" + serverHost + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
+ assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
+ assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
+ assertEquals("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
+ assertEquals("https://" + host + ":" + 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));
@@ -813,7 +815,7 @@
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
+ assertEquals("http://" + getWebServiceHost() + ":" + serverPort + "/" + expectedContext +"/CodeFirstService", address);
}
finally
{
@@ -1208,32 +1210,34 @@
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> wsdlLocationsMap = new HashMap<String, 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");
+ 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() + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
+ importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
- for (final String wsdlLocation : wsdlLocations)
+ 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://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL", address);
+ assertEquals("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL", address);
+ assertEquals("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
+ assertEquals("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("https://" + serverHost + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
+ assertEquals("https://" + host + ":" + 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));
9 years, 9 months
JBossWS SVN: r19625 - in stack/cxf/branches/management/modules: server/src/main/java/org/jboss/wsf/stack/cxf/interceptor and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-04-08 06:17:38 -0400 (Wed, 08 Apr 2015)
New Revision: 19625
Added:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/JBossWSSchemaValidationFeature.java
Modified:
stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java
Log:
[JBWS-3897]:Properly log and return error message in endpoint runtime management interceptors;[JBWS-3898]:Add schemaValidation feature
Modified: stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
===================================================================
--- stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -52,6 +52,7 @@
Loggers SECURITY_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.ws.cxf.security");
Loggers METADATA_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.ws.cxf.metadata");
Loggers DEPLOYMENT_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.ws.cxf.deployment");
+ Loggers INTERCEPTOR_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.wsf.stack.cxf.interceptor");
@LogMessage(level = INFO)
@Message(id = 24015, value = "Cannot use the bus associated to the current deployment for starting a new endpoint, creating a new bus...")
Modified: stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
===================================================================
--- stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.stack.cxf;
+import static org.jboss.logging.Logger.Level.ERROR;
+
import java.io.File;
import java.net.URL;
@@ -31,6 +33,7 @@
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Cause;
+import org.jboss.logging.LogMessage;
import org.jboss.logging.Message;
import org.jboss.logging.MessageBundle;
import org.jboss.wsf.spi.WSFException;
@@ -217,4 +220,8 @@
@Message(id = 24104, value = "Service class %s is missing required JAX-WS 2.2 additional constructors")
WSFException missingJAXWS22ServiceConstructor(String className, @Cause Throwable cause);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 24106, value = "Could not create output result elements for endpoint: %s")
+ WSFException unableToCreateEndpointResultElement(String endpoint, @Cause Throwable cause);
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -35,7 +35,6 @@
public AbstractManagementInterceptor(String phase)
{
super(phase);
- // TODO Auto-generated constructor stub
}
protected String getEncoding(Message message)
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -63,9 +63,6 @@
protected void cleanUpOutInterceptors(Message outMessage)
{
- // TODO - how can I improve this to provide a specific interceptor chain that just has the
- // stax, gzip and message sender components, while also ensuring that GZIP is only provided
- // if its already configured for the endpoint.
Iterator<Interceptor<? extends Message>> iterator = outMessage.getInterceptorChain().iterator();
while (iterator.hasNext())
{
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -21,8 +21,10 @@
*/
package org.jboss.wsf.stack.cxf.interceptor;
+import java.io.BufferedOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.util.Map;
import org.apache.cxf.common.util.StringUtils;
@@ -34,7 +36,11 @@
import org.codehaus.jettison.AbstractXMLStreamWriter;
import org.codehaus.jettison.mapped.MappedNamespaceConvention;
import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.Loggers;
+
/**
* Out Interceptor to get json format endpoint config info. This interceptor is only
* responds to get url like http://localhost:8080/context/wsendpoint/management?config
@@ -89,11 +95,16 @@
}
mappedWriter.writeEndDocument();
out.flush();
+ }catch (Exception e)
+ {
+ String endpointName = message.getExchange().get(Endpoint.class).getShortName();
+ WSFException wsfException = org.jboss.wsf.stack.cxf.Messages.MESSAGES.unableToCreateEndpointResultElement(endpointName, e);
+ Loggers.INTERCEPTOR_LOGGER.error(wsfException);
+ message.put(Message.RESPONSE_CODE, 500);
+ PrintWriter outWriter =new PrintWriter(new BufferedOutputStream(out));
+ outWriter.write(wsfException.getLocalizedMessage());
+ outWriter.flush();
}
- catch (Exception e)
- {
- throw new Fault(e);
- }
finally
{
StaxUtils.close(mappedWriter);
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -21,8 +21,10 @@
*/
package org.jboss.wsf.stack.cxf.interceptor;
+import java.io.BufferedOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.MessageSenderInterceptor;
@@ -32,6 +34,9 @@
import org.codehaus.jettison.AbstractXMLStreamWriter;
import org.codehaus.jettison.mapped.MappedNamespaceConvention;
import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.Loggers;
/**
* Out Interceptor to write json format endpoint config set result. This interceptor is added to interceptorchain by
@@ -43,6 +48,7 @@
{
public static final EndpointConfigsOutIntercetpor INSTANCE = new EndpointConfigsOutIntercetpor();
public static final String CONFIG_RESULT = EndpointConfigsOutIntercetpor.class.getName() + ".ConfigResult";
+
public EndpointConfigsOutIntercetpor()
{
super(Phase.PREPARE_SEND);
@@ -80,7 +86,13 @@
}
catch (Exception e)
{
- throw new Fault(e);
+ String endpointName = message.getExchange().get(Endpoint.class).getShortName();
+ WSFException wsfException = org.jboss.wsf.stack.cxf.Messages.MESSAGES.unableToCreateEndpointResultElement(endpointName, e);
+ Loggers.INTERCEPTOR_LOGGER.error(wsfException);
+ message.put(Message.RESPONSE_CODE, 500);
+ PrintWriter outWriter = new PrintWriter(new BufferedOutputStream(out));
+ outWriter.write(wsfException.getLocalizedMessage());
+ outWriter.flush();
}
finally
{
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -28,15 +28,15 @@
import java.util.Set;
import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
-import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.OutgoingChainInterceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
-import org.apache.cxf.transport.common.gzip.GZIPFeature;
import org.jboss.wsf.stack.cxf.interceptor.util.RemovableFeature;
+import org.jboss.wsf.stack.cxf.interceptor.util.RemovableGZIPFeature;
import org.jboss.wsf.stack.cxf.interceptor.util.RemovableLoggingFeature;
+import org.jboss.wsf.stack.cxf.interceptor.util.RemovableSchemaValidatonFeature;
/**
* Interceptor to allow dynamically enalbe cxf features
@@ -55,8 +55,9 @@
httpMethods = new HashSet<String>(4);
httpMethods.add("PUT");
httpMethods.add("GET");
- featureClassMap.put("logging", new RemovableLoggingFeature(new LoggingFeature()));
- featureClassMap.put("gzip", new RemovableLoggingFeature(new GZIPFeature()));
+ featureClassMap.put("logging", new RemovableLoggingFeature());
+ featureClassMap.put("gzip", new RemovableGZIPFeature());
+ featureClassMap.put("schemaValidation", new RemovableSchemaValidatonFeature());
}
public EndpointFeaturePutInterceptor()
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -61,8 +61,7 @@
public EndpointMetricsGetInterceptor(Interceptor<Message> outInterceptor)
{
this();
- // Let people override the EndpointConfigsGetOutIntercetpor
- //configsOutInteceptor = outInterceptor;
+ metricsOutInteceptor = outInterceptor;
}
public void handleMessage(Message message) throws Fault
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -21,8 +21,10 @@
*/
package org.jboss.wsf.stack.cxf.interceptor;
+import java.io.BufferedOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.MessageSenderInterceptor;
@@ -32,7 +34,10 @@
import org.codehaus.jettison.AbstractXMLStreamWriter;
import org.codehaus.jettison.mapped.MappedNamespaceConvention;
import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.management.EndpointMetrics;
+import org.jboss.wsf.stack.cxf.Loggers;
/**
* Out Interceptor to write json format endpoint metrics result. This interceptor is added to interceptorchain by
@@ -83,7 +88,13 @@
}
catch (Exception e)
{
- throw new Fault(e);
+ String endpointName = message.getExchange().get(Endpoint.class).getShortName();
+ WSFException wsfException = org.jboss.wsf.stack.cxf.Messages.MESSAGES.unableToCreateEndpointResultElement(endpointName, e);
+ Loggers.INTERCEPTOR_LOGGER.error(wsfException);
+ message.put(Message.RESPONSE_CODE, 500);
+ PrintWriter outWriter =new PrintWriter(new BufferedOutputStream(out));
+ outWriter.write(wsfException.getLocalizedMessage());
+ outWriter.flush();
}
finally
{
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -21,8 +21,10 @@
*/
package org.jboss.wsf.stack.cxf.interceptor;
+import java.io.BufferedOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
@@ -35,6 +37,9 @@
import org.codehaus.jettison.mapped.MappedNamespaceConvention;
import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
import org.jboss.ws.api.monitoring.Record;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.Loggers;
/**
* Out Interceptor to write json format endpoint request records. This interceptor is added to interceptorchain by
@@ -93,7 +98,13 @@
}
catch (Exception e)
{
- throw new Fault(e);
+ String endpointName = message.getExchange().get(Endpoint.class).getShortName();
+ WSFException wsfException = org.jboss.wsf.stack.cxf.Messages.MESSAGES.unableToCreateEndpointResultElement(endpointName, e);
+ Loggers.INTERCEPTOR_LOGGER.error(wsfException);
+ message.put(Message.RESPONSE_CODE, 500);
+ PrintWriter outWriter =new PrintWriter(new BufferedOutputStream(out));
+ outWriter.write(wsfException.getLocalizedMessage());
+ outWriter.flush();
}
finally
{
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/JBossWSSchemaValidationFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/JBossWSSchemaValidationFeature.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/JBossWSSchemaValidationFeature.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -0,0 +1,54 @@
+/*
+ * 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.wsf.stack.cxf.interceptor.util;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.annotations.SchemaValidation.SchemaValidationType;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.BindingOperationInfo;
+/**
+ * Another simple schema validation feature implementation, it enables BOTH SchemaValidationType for all opearation
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class JBossWSSchemaValidationFeature extends AbstractFeature
+{
+ public JBossWSSchemaValidationFeature()
+ {
+
+ }
+ public void initialize(Endpoint endpoint, Bus bus)
+ {
+ initialise(endpoint);
+ }
+
+ private void initialise(Endpoint endpoint)
+ {
+ for (BindingOperationInfo bop : endpoint.getEndpointInfo().getBinding().getOperations())
+ {
+ bop.getOperationInfo().setProperty(Message.SCHEMA_VALIDATION_TYPE, SchemaValidationType.BOTH);
+ }
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/JBossWSSchemaValidationFeature.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -36,8 +36,12 @@
*/
public abstract class RemovableFeature
{
- private AbstractFeature cxfFeature;
-
+ protected AbstractFeature cxfFeature;
+
+ public RemovableFeature()
+ {
+ }
+
public RemovableFeature(AbstractFeature feature)
{
cxfFeature = feature;
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -22,7 +22,7 @@
package org.jboss.wsf.stack.cxf.interceptor.util;
import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.transport.common.gzip.GZIPFeature;
import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
@@ -33,9 +33,14 @@
*/
public class RemovableGZIPFeature extends RemovableFeature
{
-
- public RemovableGZIPFeature(AbstractFeature feature)
+
+ public RemovableGZIPFeature()
{
+ super(new GZIPFeature());
+ }
+
+ public RemovableGZIPFeature(GZIPFeature feature)
+ {
super(feature);
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java 2015-04-07 08:47:00 UTC (rev 19624)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java 2015-04-08 10:17:38 UTC (rev 19625)
@@ -22,7 +22,7 @@
package org.jboss.wsf.stack.cxf.interceptor.util;
import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
@@ -33,11 +33,15 @@
*/
public class RemovableLoggingFeature extends RemovableFeature
{
- public RemovableLoggingFeature(AbstractFeature feature)
+ public RemovableLoggingFeature()
{
- super(feature);
-
+ super(new LoggingFeature());
}
+
+ public RemovableLoggingFeature(LoggingFeature loggingFeature)
+ {
+ super(loggingFeature);
+ }
public void remove(Endpoint endpoint)
{
9 years, 9 months
JBossWS SVN: r19624 - in stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf: interceptor and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-04-07 04:47:00 -0400 (Tue, 07 Apr 2015)
New Revision: 19624
Added:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java
Removed:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java
Log:
[JBWS-3898]:Add interceptors to dynamically configure logging and gzip feature
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-04-03 20:49:04 UTC (rev 19623)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -77,6 +77,7 @@
import org.jboss.wsf.stack.cxf.interceptor.EndpointAssociationInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointConfigsGetInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointConfigsPutInterceptor;
+import org.jboss.wsf.stack.cxf.interceptor.EndpointFeaturePutInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointMetricsGetInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointRecordGetInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.HandlerAuthInterceptor;
@@ -220,6 +221,7 @@
bus.getInInterceptors().add(new EndpointConfigsPutInterceptor());
bus.getInInterceptors().add(new EndpointMetricsGetInterceptor());
bus.getInInterceptors().add(new EndpointRecordGetInterceptor());
+ bus.getInInterceptors().add(new EndpointFeaturePutInterceptor());
bus.getInInterceptors().add(new NsCtxSelectorStoreInterceptor());
final String p = (props != null) ? props.get(Constants.JBWS_CXF_DISABLE_HANDLER_AUTH_CHECKS) : null;
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -0,0 +1,92 @@
+/*
+ * 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.wsf.stack.cxf.interceptor;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.codehaus.jettison.AbstractXMLStreamWriter;
+import org.codehaus.jettison.mapped.MappedNamespaceConvention;
+import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
+
+/**
+ * Out Interceptor to write json format endpoint config set result. This interceptor is added to interceptorchain by
+ * @see org.jboss.wsf.stack.cxf.interceptor.EndpointsConfigsPutInterceptor
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class EndpointConfigsOutIntercetpor extends AbstractManagementInterceptor
+{
+ public static final EndpointConfigsOutIntercetpor INSTANCE = new EndpointConfigsOutIntercetpor();
+ public static final String CONFIG_RESULT = EndpointConfigsOutIntercetpor.class.getName() + ".ConfigResult";
+ public EndpointConfigsOutIntercetpor()
+ {
+ super(Phase.PREPARE_SEND);
+ this.addAfter(MessageSenderInterceptor.class.getName());
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ String configResult = (String)message.get(CONFIG_RESULT);
+ if (configResult == null)
+ {
+ return;
+ }
+ message.remove(CONFIG_RESULT);
+ OutputStream out = message.getContent(OutputStream.class);
+ if (out == null)
+ {
+ return;
+ }
+ setContentType(message);
+ OutputStreamWriter writer = null;
+ AbstractXMLStreamWriter mappedWriter = null;
+ try
+ {
+ writer = new OutputStreamWriter(out, getEncoding(message));
+ mappedWriter = new MappedXMLStreamWriter(new MappedNamespaceConvention(), writer);
+ mappedWriter.writeStartDocument();
+
+ mappedWriter.writeStartElement("result");
+ mappedWriter.writeCharacters(configResult);
+ mappedWriter.writeEndElement();
+
+ mappedWriter.writeEndDocument();
+ out.flush();
+ }
+ catch (Exception e)
+ {
+ throw new Fault(e);
+ }
+ finally
+ {
+ StaxUtils.close(mappedWriter);
+ }
+
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsOutIntercetpor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java 2015-04-03 20:49:04 UTC (rev 19623)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -42,9 +42,8 @@
public class EndpointConfigsPutInterceptor extends AbstractMangementInInterceptor
{
public static final EndpointConfigsPutInterceptor INSTANCE = new EndpointConfigsPutInterceptor();
- public static final String CONFIG_RESULT = EndpointConfigsPutInterceptor.class.getName() + ".EndpointConfigPutResult";
public static final Set<String> httpMethods;
- private Interceptor<Message> configPutOutInteceptor = EndpointConfigsPutOutIntercetpor.INSTANCE;
+ private Interceptor<Message> configPutOutInteceptor = EndpointConfigsOutIntercetpor.INSTANCE;
static
{
@@ -91,7 +90,7 @@
listenerManager.getListeners(key).configChange(message, queryMaps.get(key));
}
}
- mout.put(CONFIG_RESULT, "Successfully set endpoint runtime configurations.");
+ mout.put(EndpointConfigsOutIntercetpor.CONFIG_RESULT, "Successfully set endpoint runtime configurations.");
cleanUpOutInterceptors(mout);
mout.getInterceptorChain().add(configPutOutInteceptor);
message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName());
Deleted: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java 2015-04-03 20:49:04 UTC (rev 19623)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -1,92 +0,0 @@
-/*
- * 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.wsf.stack.cxf.interceptor;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.MessageSenderInterceptor;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.Phase;
-import org.apache.cxf.staxutils.StaxUtils;
-import org.codehaus.jettison.AbstractXMLStreamWriter;
-import org.codehaus.jettison.mapped.MappedNamespaceConvention;
-import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
-
-/**
- * Out Interceptor to write json format endpoint config set result. This interceptor is added to interceptorchain by
- * @see org.jboss.wsf.stack.cxf.interceptor.EndpointsConfigsPutInterceptor
- * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
- *
- */
-public class EndpointConfigsPutOutIntercetpor extends AbstractManagementInterceptor
-{
- public static final EndpointConfigsPutOutIntercetpor INSTANCE = new EndpointConfigsPutOutIntercetpor();
-
- public EndpointConfigsPutOutIntercetpor()
- {
- super(Phase.PREPARE_SEND);
- this.addAfter(MessageSenderInterceptor.class.getName());
- }
-
- public void handleMessage(Message message) throws Fault
- {
- String configResult = (String)message.get(EndpointConfigsPutInterceptor.CONFIG_RESULT);
- if (configResult == null)
- {
- return;
- }
- message.remove(EndpointConfigsPutInterceptor.CONFIG_RESULT);
- OutputStream out = message.getContent(OutputStream.class);
- if (out == null)
- {
- return;
- }
- setContentType(message);
- OutputStreamWriter writer = null;
- AbstractXMLStreamWriter mappedWriter = null;
- try
- {
- writer = new OutputStreamWriter(out, getEncoding(message));
- mappedWriter = new MappedXMLStreamWriter(new MappedNamespaceConvention(), writer);
- mappedWriter.writeStartDocument();
-
- mappedWriter.writeStartElement("result");
- mappedWriter.writeCharacters(configResult);
- mappedWriter.writeEndElement();
-
- mappedWriter.writeEndDocument();
- out.flush();
- }
- catch (Exception e)
- {
- throw new Fault(e);
- }
- finally
- {
- StaxUtils.close(mappedWriter);
- }
-
- }
-
-}
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -0,0 +1,124 @@
+/*
+ * 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.wsf.stack.cxf.interceptor;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.OutgoingChainInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.transport.common.gzip.GZIPFeature;
+import org.jboss.wsf.stack.cxf.interceptor.util.RemovableFeature;
+import org.jboss.wsf.stack.cxf.interceptor.util.RemovableLoggingFeature;
+
+/**
+ * Interceptor to allow dynamically enalbe cxf features
+ * responds to url like http://localhost:8080/context/wsendpoint/management?logging=true
+ * We now support Logging and GZIP feature
+ * @author <a href="mailto:ema@redhat.com>Jim Ma</a>
+ *
+ */
+public class EndpointFeaturePutInterceptor extends AbstractMangementInInterceptor
+{
+ public static final Set<String> httpMethods;
+ public static final Map<String, RemovableFeature> featureClassMap = new HashMap<String, RemovableFeature>(4);
+ private Interceptor<Message> configOutInteceptor = EndpointConfigsOutIntercetpor.INSTANCE;
+ static
+ {
+ httpMethods = new HashSet<String>(4);
+ httpMethods.add("PUT");
+ httpMethods.add("GET");
+ featureClassMap.put("logging", new RemovableLoggingFeature(new LoggingFeature()));
+ featureClassMap.put("gzip", new RemovableLoggingFeature(new GZIPFeature()));
+ }
+
+ public EndpointFeaturePutInterceptor()
+ {
+ super(Phase.READ);
+ getAfter().add(EndpointSelectionInterceptor.class.getName());
+ }
+ public EndpointFeaturePutInterceptor(Interceptor<Message> outInterceptor)
+ {
+ this();
+ configOutInteceptor = outInterceptor;
+ }
+
+ @Override
+ public void handleMessage(Message message) throws Fault
+ {
+ if (!isAllowed(message))
+ {
+ return;
+ }
+ if (isRecognizedQuery(getQueryMap(message)))
+ {
+ Map<String, String> queryMap = getQueryMap(message);
+ for (Entry<String, String> entry : queryMap.entrySet())
+ {
+ if (entry.getValue().equals("true"))
+ {
+ featureClassMap.get(entry.getKey()).initialize(message.getExchange().getEndpoint(), message.getExchange().getBus());
+ }
+ else
+ {
+ featureClassMap.get(entry.getKey()).remove(message.getExchange().getEndpoint());
+ }
+ }
+ Message mout = this.createOutMessage(message);
+ mout.put(EndpointConfigsOutIntercetpor.CONFIG_RESULT, "Successfully set feature to endpoint");
+ cleanUpOutInterceptors(mout);
+ mout.getInterceptorChain().add(configOutInteceptor);
+ message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName());
+ }
+
+ }
+
+ @Override
+ protected Set<String> getAllowedMethod()
+ {
+ return httpMethods;
+ }
+
+ private boolean isRecognizedQuery(Map<String, String> map)
+ {
+ if (map.isEmpty())
+ {
+ return false;
+ }
+ for (String key : map.keySet())
+ {
+ if (!featureClassMap.containsKey(key) || !("true").toLowerCase().equals(map.get(key)) && !("false").toLowerCase().equals(map.get(key)))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointFeaturePutInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -0,0 +1,64 @@
+/*
+ * 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.wsf.stack.cxf.interceptor.util;
+
+import java.util.List;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Message;
+
+/**
+ * Abstract feature to initialize and remove the added interceptors by cxf's AbstractFeature
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public abstract class RemovableFeature
+{
+ private AbstractFeature cxfFeature;
+
+ public RemovableFeature(AbstractFeature feature)
+ {
+ cxfFeature = feature;
+ }
+
+ public void initialize(Endpoint endpoint, Bus bus)
+ {
+ cxfFeature.initialize(endpoint, bus);
+ }
+
+ public abstract void remove(Endpoint endpoint);
+
+
+ public void removeInterceptor(final List<Interceptor<? extends Message>> interceptors, final Class<? extends Interceptor<? extends Message>> interceptorClass) {
+ for (int i = 0; i < interceptors.size(); i++)
+ {
+ if (interceptorClass.isInstance(interceptors.get(i)))
+ {
+ interceptors.remove(i);
+ }
+ }
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableFeature.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -0,0 +1,51 @@
+/*
+ * 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.wsf.stack.cxf.interceptor.util;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
+import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
+
+/**
+ * Add and remove GZIP interceptors provided by GZIPFeature
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class RemovableGZIPFeature extends RemovableFeature
+{
+
+ public RemovableGZIPFeature(AbstractFeature feature)
+ {
+ super(feature);
+ }
+
+ @Override
+ public void remove(Endpoint endpoint)
+ {
+ removeInterceptor(endpoint.getInInterceptors(), GZIPInInterceptor.class);
+ removeInterceptor(endpoint.getInFaultInterceptors(), GZIPInInterceptor.class);
+ removeInterceptor(endpoint.getOutInterceptors(), GZIPOutInterceptor.class);
+ removeInterceptor(endpoint.getOutFaultInterceptors(), GZIPOutInterceptor.class);
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableGZIPFeature.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java 2015-04-07 08:47:00 UTC (rev 19624)
@@ -0,0 +1,50 @@
+/*
+ * 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.wsf.stack.cxf.interceptor.util;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+
+/**
+ * Class to add or remove interceptors provided by LoggingFeature
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class RemovableLoggingFeature extends RemovableFeature
+{
+ public RemovableLoggingFeature(AbstractFeature feature)
+ {
+ super(feature);
+
+ }
+
+ public void remove(Endpoint endpoint)
+ {
+ removeInterceptor(endpoint.getInInterceptors(), LoggingInInterceptor.class);
+ removeInterceptor(endpoint.getInFaultInterceptors(), LoggingInInterceptor.class);
+ removeInterceptor(endpoint.getOutInterceptors(), LoggingOutInterceptor.class);
+ removeInterceptor(endpoint.getOutFaultInterceptors(), LoggingOutInterceptor.class);
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/RemovableLoggingFeature.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
9 years, 9 months
JBossWS SVN: r19623 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-04-03 16:49:04 -0400 (Fri, 03 Apr 2015)
New Revision: 19623
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
Use latest resources-plugin-filter for allowing overriding maven project properties with system properties
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2015-04-03 20:46:47 UTC (rev 19622)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2015-04-03 20:49:04 UTC (rev 19623)
@@ -30,7 +30,7 @@
<org.slf4j.version>1.6.1</org.slf4j.version>
<gnu.getopt.version>1.0.13</gnu.getopt.version>
<bc.version>1.49</bc.version>
- <resources-plugin-filters.version>1.0.0.Beta1</resources-plugin-filters.version>
+ <resources-plugin-filters.version>1.0.0.Beta2</resources-plugin-filters.version>
<log4j.version>1.2.14</log4j.version>
<port-offset.cxf-tests.jboss>0</port-offset.cxf-tests.jboss>
<port-offset.cxf-tests.ssl-mutual-auth>5000</port-offset.cxf-tests.ssl-mutual-auth>
9 years, 9 months
JBossWS SVN: r19622 - stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-04-03 16:46:47 -0400 (Fri, 03 Apr 2015)
New Revision: 19622
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
Log:
Properly use offset in arquillian.xml management port for default cxf tests
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2015-04-03 20:44:14 UTC (rev 19621)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2015-04-03 20:46:47 UTC (rev 19622)
@@ -11,9 +11,9 @@
<property name="allowConnectingToRunningServer">true</property>
<property name="managementAddress">${jboss.bind.address:localhost}</property>
<property name="jbossArguments">${jbossArguments}</property>
- <property name="managementPort">${as.managementPort:9990}</property> <!-- Keep in sync with the port-offset -->
+ <property name="managementPort">${add_int(port-offset.cxf-tests.jboss,9990)}</property>
<!-- AS7-4070 -->
- <property name="waitForPorts">${as.debug.port:8787} ${as.managementPort:9990}</property> <!-- Keep in sync with the port-offset -->
+ <property name="waitForPorts">${add_int(port-offset.cxf-tests.jboss,8787)} ${add_int(port-offset.cxf-tests.jboss,9990)}</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
9 years, 9 months
JBossWS SVN: r19621 - in stack/cxf/trunk/modules/testsuite/cxf-tests/src/test: resources/jaxws/cxf/jbws3792/wsImpl/WEB-INF and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-04-03 16:44:14 -0400 (Fri, 03 Apr 2015)
New Revision: 19621
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/JBWS3805TestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3792/wsImpl/WEB-INF/webservices.xml
Log:
Fixing two test issues with port offsets
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/JBWS3805TestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/JBWS3805TestCase.java 2015-04-03 20:28:44 UTC (rev 19620)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/JBWS3805TestCase.java 2015-04-03 20:44:14 UTC (rev 19621)
@@ -77,7 +77,7 @@
{
if (line.contains("address location"))
{
- assertTrue("Unexpected uri scheme", line.contains("https://foo:8443/jaxws-cxf-JBWS3805/HelloService"));
+ assertTrue("Unexpected uri scheme", line.contains("https://foo:" + (baseURL.getPort() + 8443 - 8080) + "/jaxws-cxf-JBWS3805/HelloService"));
return;
}
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3792/wsImpl/WEB-INF/webservices.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3792/wsImpl/WEB-INF/webservices.xml 2015-04-03 20:28:44 UTC (rev 19620)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3792/wsImpl/WEB-INF/webservices.xml 2015-04-03 20:44:14 UTC (rev 19621)
@@ -2,7 +2,7 @@
<webservices xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://Hello.org" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd" version="1.2">
<webservice-description>
<webservice-description-name>JBWS3792WSService</webservice-description-name>
- <wsdl-file>http://@jboss.bind.address@:8080/jbws3792-external-wsdl/jbws3792.wsdl</wsdl-file>
+ <wsdl-file>http://@jboss.bind.address@:@add_int(port-offset.cxf-tests.jboss,8080)@/jbws3792-external-wsdl/jbws3792.wsdl</wsdl-file>
<port-component>
<service-impl-bean>
<servlet-link>org.jboss.test.ws.jaxws.cxf.jbws3792.wsImpl.JBWS3792WSImpl</servlet-link>
9 years, 9 months