Author: asoldano
Date: 2014-06-13 16:42:45 -0400 (Fri, 13 Jun 2014)
New Revision: 18734
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java
Log:
Ask to shutdown the bus *after* the client it has been created for has been run
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java 2014-06-13
20:28:00 UTC (rev 18733)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/actas/ActAsServiceImpl.java 2014-06-13
20:42:45 UTC (rev 18734)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -63,19 +63,7 @@
public class ActAsServiceImpl implements ActAsServiceIface
{
public String sayHello() {
- try {
- ServiceIface proxy = setupService();
- return "ActAs " + proxy.sayHello();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private ServiceIface setupService()throws MalformedURLException {
- ServiceIface proxy = null;
Bus bus = BusFactory.newInstance().createBus();
-
try {
BusFactory.setThreadDefaultBus(bus);
@@ -83,7 +71,7 @@
final QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
final URL wsdlURL = new URL(serviceURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
- proxy = (ServiceIface) service.getPort(ServiceIface.class);
+ ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
ctx.put(SecurityConstants.CALLBACK_HANDLER, new ActAsCallbackHandler());
@@ -106,11 +94,13 @@
ctx.put(SecurityConstants.STS_CLIENT, stsClient);
+ return "ActAs " + proxy.sayHello();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ return null;
} finally {
bus.shutdown(true);
}
-
- return proxy;
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java 2014-06-13
20:28:00 UTC (rev 18733)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/onbehalfof/OnBehalfOfServiceImpl.java 2014-06-13
20:42:45 UTC (rev 18734)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -61,26 +61,7 @@
public class OnBehalfOfServiceImpl implements OnBehalfOfServiceIface
{
public String sayHello() {
- try {
-
- ServiceIface proxy = setupService();
- return "OnBehalfOf " + proxy.sayHello();
-
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- *
- * @return
- * @throws MalformedURLException
- */
- private ServiceIface setupService()throws MalformedURLException {
- ServiceIface proxy = null;
Bus bus = BusFactory.newInstance().createBus();
-
try {
BusFactory.setThreadDefaultBus(bus);
@@ -88,7 +69,7 @@
final QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
final URL wsdlURL = new URL(serviceURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
- proxy = (ServiceIface) service.getPort(ServiceIface.class);
+ ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
ctx.put(SecurityConstants.CALLBACK_HANDLER, new OnBehalfOfCallbackHandler());
@@ -111,11 +92,13 @@
ctx.put(SecurityConstants.STS_CLIENT, stsClient);
+ return "OnBehalfOf " + proxy.sayHello();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ return null;
} finally {
bus.shutdown(true);
}
-
- return proxy;
}
}