Author: asoldano
Date: 2015-03-12 04:17:52 -0400 (Thu, 12 Mar 2015)
New Revision: 19554
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/Helper.java
Log:
Test using feature both the CXF and JAX-WS way...
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/Helper.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/Helper.java 2015-03-11
22:21:55 UTC (rev 19553)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/Helper.java 2015-03-12
08:17:52 UTC (rev 19554)
@@ -26,6 +26,7 @@
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
@@ -77,6 +78,7 @@
Bus bus = BusFactory.newInstance().createBus();
try
{
+ //CXF way
BusFactory.setThreadDefaultBus(bus);
HelloWorld port = getPort();
@@ -84,12 +86,32 @@
GZIPFeature gzipFeature = new GZIPFeature();
gzipFeature.setThreshold(0);
gzipFeature.initialize(client, null); //bus parameter not actually used
- return ("foo".equals(port.echo("foo")));
+ if(!"foo".equals(port.echo("foo"))) {
+ return false;
+ }
}
finally
{
bus.shutdown(true);
}
+ bus = BusFactory.newInstance().createBus();
+ try
+ {
+ //JAX-WS way
+ BusFactory.setThreadDefaultBus(bus);
+
+ GZIPFeature gzipFeature = new GZIPFeature();
+ gzipFeature.setThreshold(0);
+ HelloWorld port = getPort(gzipFeature);
+ if(!"foo".equals(port.echo("foo"))) {
+ return false;
+ }
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ return true;
}
public boolean testGZIPServerSideOnlyInterceptorOnClient() throws Exception
@@ -184,13 +206,13 @@
}
}
- private HelloWorld getPort() throws MalformedURLException
+ private HelloWorld getPort(WebServiceFeature... features) throws
MalformedURLException
{
URL wsdlURL = new URL(gzipFeatureEndpointURL + "?wsdl");
QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/gzip",
"HelloWorldService");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
QName portQName = new QName("http://org.jboss.ws/jaxws/cxf/gzip",
"HelloWorldImplPort");
- return (HelloWorld) service.getPort(portQName, HelloWorld.class);
+ return (HelloWorld) service.getPort(portQName, HelloWorld.class, features);
}
@Override
Show replies by date