JBossWS SVN: r18961 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-10-01 08:35:14 -0400 (Wed, 01 Oct 2014)
New Revision: 18961
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3832] Excluding test for WFLY900
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-10-01 12:27:58 UTC (rev 18960)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-10-01 12:35:14 UTC (rev 18961)
@@ -856,6 +856,9 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
+
+ <!-- # [JBWS-3832] WFLY master still to be updated -->
+ <exclude>org/jboss/test/ws/jaxws/cxf/in_container_client/CustomBusServletTestCaseForked*</exclude>
</excludes>
</configuration>
</plugin>
10 years, 2 months
JBossWS SVN: r18960 - in stack/cxf/trunk/modules: testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-10-01 08:27:58 -0400 (Wed, 01 Oct 2014)
New Revision: 18960
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/CustomBusServletTestCaseForked.java
Modified:
stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java
Log:
[JBWS-3832] Adding testcase
Modified: stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2014-10-01 12:23:59 UTC (rev 18959)
+++ stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2014-10-01 12:27:58 UTC (rev 18960)
@@ -396,6 +396,11 @@
return getDeployer().setSystemProperty(propName, propValue);
}
+ public static void restartServer() throws Exception
+ {
+ getDeployer().restart();
+ }
+
public static abstract class BaseDeployment<T extends org.jboss.shrinkwrap.api.Archive<T>>
{
protected T archive;
Added: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/CustomBusServletTestCaseForked.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/CustomBusServletTestCaseForked.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/CustomBusServletTestCaseForked.java 2014-10-01 12:27:58 UTC (rev 18960)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.in_container_client;
+import static org.jboss.wsf.stack.cxf.client.Constants.JBWS_CXF_JAXWS_CLIENT_BUS_SELECTOR;
+
+import java.io.File;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.ws.common.IOUtils;
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+
+/**
+ * [JBWS-3832] Different default Spring descriptor name
+ * for creating client and server Bus instances
+ *
+ */
+public class CustomBusServletTestCaseForked extends JBossWSTest
+{
+ public static BaseDeployment<?>[] createDeployments() {
+
+ List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
+ list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-in_container_client-client_spring.war") { {
+ archive
+ .addManifest()
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/in_container_client/cxf.xml"), "cxf.xml")
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/in_container_client/cxf-client.xml"), "cxf-client.xml")
+ .addClass(org.jboss.test.ws.jaxws.cxf.in_container_client.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.in_container_client.Helper.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/in_container_client/WEB-INF/jboss-deployment-structure.xml"), "jboss-deployment-structure.xml");
+ }
+ });
+ list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-in_container_client_spring.war") { {
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.in_container_client.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.in_container_client.HelloWorldImpl.class);
+ }
+ });
+ return list.toArray(new BaseDeployment<?>[list.size()]);
+ }
+
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(CustomBusServletTestCaseForked.class, JBossWSTestHelper.writeToFile(createDeployments())) {
+ /// see https://issues.jboss.org/browse/JBWS-3832
+ private static final String PROPERTY_NAME = JBWS_CXF_JAXWS_CLIENT_BUS_SELECTOR;
+ private static final String SPRING_BUS_SELECTOR = "org.jboss.wsf.stack.cxf.client.SpringCustomClientBusSelector";
+
+ private String formerValue;
+
+ @Override
+ public void setUp() throws Exception {
+ formerValue = JBossWSTestHelper.setSystemProperty(PROPERTY_NAME, SPRING_BUS_SELECTOR);
+ JBossWSTestHelper.restartServer();
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ JBossWSTestHelper.setSystemProperty(PROPERTY_NAME, formerValue);
+ JBossWSTestHelper.restartServer();
+ formerValue = null;
+ }
+ };
+ }
+
+ public void test() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testSpringBus"));
+ }
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL("http://" + getServerHost()
+ + ":8080/jaxws-cxf-in_container_client-client_spring?path=/jaxws-cxf-in_container_client_spring/HelloWorldService&method=" + test
+ + "&helper=" + Helper.class.getName());
+ return IOUtils.readAndCloseStream(url.openStream());
+ }
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/CustomBusServletTestCaseForked.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java 2014-10-01 12:23:59 UTC (rev 18959)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java 2014-10-01 12:27:58 UTC (rev 18960)
@@ -30,6 +30,7 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.jboss.logging.Logger;
+import org.jboss.wsf.stack.cxf.client.ClientBusSelector;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
import org.jboss.wsf.test.ClientHelper;
@@ -56,6 +57,8 @@
return false;
}
Bus bus = ((JBossWSBusFactory)factory).createBus("cxf.xml"); //force Spring bus construction
+ assert bus.getOutInterceptors().isEmpty() == true; // cxf-client.xml bus has at least one outinterceptor
+
try
{
BusFactory.setThreadDefaultBus(bus);
@@ -70,6 +73,29 @@
}
+ public boolean testSpringBus() throws Exception
+ {
+ BusFactory factory = BusFactory.newInstance();
+ if (!(factory instanceof JBossWSBusFactory)) { //check jbossws-cxf integration is on
+ log.error("Expected instance of " + JBossWSBusFactory.class + " but got: " + factory.getClass());
+ return false;
+ }
+ Bus bus = ClientBusSelector.getInstance().createNewBus(); //force Spring bus construction
+ assert bus.getOutInterceptors().isEmpty() == false; // cxf-client.xml bus has at least one outinterceptor
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ HelloWorld port = getPort();
+ return ("foo".equals(port.echo("foo")));
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+
+ }
+
private HelloWorld getPort() throws MalformedURLException
{
URL wsdlURL = new URL(targetEndpointURL + "?wsdl");
10 years, 2 months
JBossWS SVN: r18959 - in stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf: client and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-10-01 08:23:59 -0400 (Wed, 01 Oct 2014)
New Revision: 18959
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SpringCustomClientBusSelector.java
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ClientBusSelector.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSBusFactory.java
Log:
[JBWS-3832] Factor out jaxws client bus creation into client bus selector; add system property based mechanism to setup custom client bus selector; provide a client bus selector for reading a different spring bus descriptor.
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java 2014-10-01 10:51:22 UTC (rev 18958)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Loggers.java 2014-10-01 12:23:59 UTC (rev 18959)
@@ -232,4 +232,8 @@
@LogMessage(level = DEBUG)
@Message(id = 24103, value = "Could not load BouncyCastle security provider; either setup your classpath properly or prevent loading by using the '%s' system property.")
void cannotLoadBouncyCastleProvider(String property, @Cause Throwable cause);
+
+ @LogMessage(level = WARN)
+ @Message(id = 24105, value = "Could not create instance of specified ClientBusSelector: %s")
+ void couldNotLoadClientBusSelector(String selector, @Cause Throwable cause);
}
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ClientBusSelector.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ClientBusSelector.java 2014-10-01 10:51:22 UTC (rev 18958)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ClientBusSelector.java 2014-10-01 12:23:59 UTC (rev 18959)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2013, 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.
*
@@ -21,6 +21,7 @@
*/
package org.jboss.wsf.stack.cxf.client;
+import static org.jboss.wsf.stack.cxf.client.Constants.JBWS_CXF_JAXWS_CLIENT_BUS_SELECTOR;
import static org.jboss.wsf.stack.cxf.client.Constants.JBWS_CXF_JAXWS_CLIENT_BUS_STRATEGY;
import static org.jboss.wsf.stack.cxf.client.Constants.NEW_BUS_STRATEGY;
import static org.jboss.wsf.stack.cxf.client.Constants.TCCL_BUS_STRATEGY;
@@ -28,9 +29,11 @@
import javax.xml.ws.WebServiceFeature;
+import org.apache.cxf.Bus;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.stack.cxf.Loggers;
import org.jboss.wsf.stack.cxf.Messages;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
/**
* A class selecting the proper bus to be used for creating a
@@ -40,8 +43,9 @@
* @since 03-Oct-2013
*
*/
-public abstract class ClientBusSelector
+public class ClientBusSelector
{
+ private static final ClientBusSelector instance;
private static final String sysPropStrategy;
static {
final String propValue = SecurityActions.getSystemProperty(JBWS_CXF_JAXWS_CLIENT_BUS_STRATEGY, ClassLoaderProvider.isSet() ? TCCL_BUS_STRATEGY : THREAD_BUS_STRATEGY);
@@ -54,9 +58,23 @@
Loggers.ROOT_LOGGER.unknownJAXWSClientBusStrategy(propValue);
sysPropStrategy = THREAD_BUS_STRATEGY;
}
+ final String selectorPropValue = SecurityActions.getSystemProperty(JBWS_CXF_JAXWS_CLIENT_BUS_SELECTOR, ClientBusSelector.class.getName());
+ ClientBusSelector cbs;
+ try {
+ Class<?> clazz = Class.forName(selectorPropValue);
+ cbs = (ClientBusSelector)clazz.newInstance();
+ } catch (Exception e) {
+ Loggers.ROOT_LOGGER.couldNotLoadClientBusSelector(selectorPropValue, e);
+ cbs = new ClientBusSelector();
+ }
+ instance = cbs;
}
- public static String selectStrategy(WebServiceFeature... features) {
+ public static ClientBusSelector getInstance() {
+ return instance;
+ }
+
+ public String selectStrategy(WebServiceFeature... features) {
boolean createNewBus = false;
boolean tcclBoundBus = false;
boolean threadBus = false;
@@ -104,6 +122,10 @@
return featureStrategy != null ? featureStrategy : sysPropStrategy;
}
+ public Bus createNewBus() {
+ return new JBossWSBusFactory().createBus();
+ }
+
public static String getDefaultStrategy() {
return sysPropStrategy;
}
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java 2014-10-01 10:51:22 UTC (rev 18958)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java 2014-10-01 12:23:59 UTC (rev 18959)
@@ -50,4 +50,6 @@
public static final String THREAD_BUS_STRATEGY = "THREAD_BUS";
public static final String NEW_BUS_STRATEGY = "NEW_BUS";
public static final String TCCL_BUS_STRATEGY = "TCCL_BUS";
+ public static final String JBWS_CXF_JAXWS_CLIENT_BUS_SELECTOR = "org.jboss.ws.cxf.jaxws-client.bus.selector";
+ public static final String JBWS_CXF_JAXWS_CLIENT_BUS_SPRING_DESCRIPTOR = "org.jboss.ws.cxf.jaxws-client.bus.spring.descriptor";
}
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2014-10-01 10:51:22 UTC (rev 18958)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2014-10-01 12:23:59 UTC (rev 18959)
@@ -236,7 +236,7 @@
@Override
public ServiceDelegate createServiceDelegate(URL url, QName qname, Class cls)
{
- final String busStrategy = ClientBusSelector.selectStrategy();
+ final String busStrategy = ClientBusSelector.getInstance().selectStrategy();
ClassLoader origClassLoader = getContextClassLoader();
boolean restoreTCCL = false;
Bus orig = null;
@@ -267,7 +267,7 @@
}
}
- final String busStrategy = ClientBusSelector.selectStrategy(features);
+ final String busStrategy = ClientBusSelector.getInstance().selectStrategy(features);
ClassLoader origClassLoader = getContextClassLoader();
boolean restoreTCCL = false;
Bus orig = null;
@@ -285,15 +285,15 @@
}
}
- private static Bus getOrCreateBus(String strategy, ClassLoader threadContextClassLoader) {
+ private Bus getOrCreateBus(String strategy, ClassLoader threadContextClassLoader) {
Bus bus = null;
if (THREAD_BUS_STRATEGY.equals(strategy))
{
- bus = ProviderImpl.setValidThreadDefaultBus();
+ bus = setValidThreadDefaultBus();
}
else if (NEW_BUS_STRATEGY.equals(strategy))
{
- bus = new JBossWSBusFactory().createBus();
+ bus = ClientBusSelector.getInstance().createNewBus();
//to prevent issues with CXF code using the default thread bus instead of the one returned here,
//set the new bus as thread one, given the line above could have not done this if the current
//thread is already assigned a bus
@@ -301,7 +301,7 @@
}
else if (TCCL_BUS_STRATEGY.equals(strategy))
{
- bus = JBossWSBusFactory.getClassLoaderDefaultBus(threadContextClassLoader);
+ bus = JBossWSBusFactory.getClassLoaderDefaultBus(threadContextClassLoader, ClientBusSelector.getInstance());
//to prevent issues with CXF code using the default thread bus instead of the one returned here,
//set the bus as thread one, given the line above could have not done this if we already had a
//bus for the classloader and hence we did not create a new one
@@ -310,7 +310,7 @@
return bus;
}
- private static void restoreThreadDefaultBus(final String busStrategy, final Bus origBus) {
+ private void restoreThreadDefaultBus(final String busStrategy, final Bus origBus) {
if (origBus != null || !busStrategy.equals(Constants.THREAD_BUS_STRATEGY))
{
BusFactory.setThreadDefaultBus(origBus);
@@ -352,7 +352,7 @@
return false;
}
- static Bus setValidThreadDefaultBus()
+ private Bus setValidThreadDefaultBus()
{
//we need to prevent using the default bus when the current
//thread is not already associated to a bus. In those situations we create
@@ -360,7 +360,7 @@
Bus bus = BusFactory.getThreadDefaultBus(false);
if (bus == null)
{
- bus = new JBossWSBusFactory().createBus(); //this also set thread local bus internally as it's not set yet
+ bus = ClientBusSelector.getInstance().createNewBus(); //this also set thread local bus internally as it's not set yet
}
return bus;
}
Added: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SpringCustomClientBusSelector.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SpringCustomClientBusSelector.java (rev 0)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SpringCustomClientBusSelector.java 2014-10-01 12:23:59 UTC (rev 18959)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * 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.
+ *
+ * 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.client;
+
+import static org.jboss.wsf.stack.cxf.client.Constants.JBWS_CXF_JAXWS_CLIENT_BUS_SPRING_DESCRIPTOR;
+
+import org.apache.cxf.Bus;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
+
+/**
+ * A ClientBusSelector extension to be used with Spring integration for processing
+ * a different (cxf-client.xml) Bus descriptor when building JAX-WS clients.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Oct-2014
+ *
+ */
+public class SpringCustomClientBusSelector extends ClientBusSelector
+{
+ private static final String clientBusDescriptor = SecurityActions.getSystemProperty(JBWS_CXF_JAXWS_CLIENT_BUS_SPRING_DESCRIPTOR, "cxf-client.xml");
+
+ @Override
+ public Bus createNewBus() {
+ return new JBossWSBusFactory().createBus(clientBusDescriptor);
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SpringCustomClientBusSelector.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSBusFactory.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSBusFactory.java 2014-10-01 10:51:22 UTC (rev 18958)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSBusFactory.java 2014-10-01 12:23:59 UTC (rev 18959)
@@ -30,6 +30,7 @@
import org.apache.cxf.BusFactory;
import org.apache.cxf.buslifecycle.BusLifeCycleListener;
import org.apache.cxf.buslifecycle.BusLifeCycleManager;
+import org.jboss.wsf.stack.cxf.client.ClientBusSelector;
import org.jboss.wsf.stack.cxf.client.util.SpringUtils;
/**
@@ -166,6 +167,29 @@
}
/**
+ * Gets the default bus for the given classloader; if a new Bus is needed,
+ * the creation is delegated to the specified ClientBusSelector instance.
+ *
+ * @param classloader
+ * @param clientBusSelector
+ * @return
+ */
+ public static Bus getClassLoaderDefaultBus(final ClassLoader classloader, final ClientBusSelector clientBusSelector) {
+ Bus classLoaderBus;
+ synchronized (classLoaderBusses) {
+ classLoaderBus = classLoaderBusses.get(classloader);
+ if (classLoaderBus == null) {
+ classLoaderBus = clientBusSelector.createNewBus();
+ //register a listener for cleaning up the bus from the classloader association in the JBossWSBusFactory
+ BusLifeCycleListener listener = new ClassLoaderDefaultBusLifeCycleListener(classLoaderBus);
+ classLoaderBus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
+ classLoaderBusses.put(classloader, classLoaderBus);
+ }
+ }
+ return classLoaderBus;
+ }
+
+ /**
* Gets the default bus for the given classloader
*
* @param classloader
10 years, 2 months
JBossWS SVN: r18958 - container/wildfly81/branches/jbossws-wildfly810/tests-integration/src/main/java/org/jboss/as/webservices/deployer.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-10-01 06:51:22 -0400 (Wed, 01 Oct 2014)
New Revision: 18958
Modified:
container/wildfly81/branches/jbossws-wildfly810/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java
Log:
[JBWS-3835] Add mechanism for restarting target container while running JBossWS tests
Modified: container/wildfly81/branches/jbossws-wildfly810/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java
===================================================================
--- container/wildfly81/branches/jbossws-wildfly810/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java 2014-10-01 10:50:21 UTC (rev 18957)
+++ container/wildfly81/branches/jbossws-wildfly810/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java 2014-10-01 10:51:22 UTC (rev 18958)
@@ -71,9 +71,11 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELEASE_VERSION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUIRED;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESTART;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESULT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ROLLBACK_ON_RUNTIME_FAILURE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SERVER_IDENTITY;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SHUTDOWN;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SSL;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STEPS;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
@@ -417,6 +419,15 @@
}
@Override
+ public void restart() throws Exception {
+ ModelNode op = new ModelNode();
+ op.get("operation").set(SHUTDOWN);
+ op.get(RESTART).set("true");
+ applyUpdate(op);
+ waitForServerToRestart(TIMEOUT);
+ }
+
+ @Override
public String setSystemProperty(String propName, String propValue) throws Exception {
if (propName == null || propName.trim().length() == 0) {
throw new IllegalArgumentException("Empty system property name specified!");
@@ -520,6 +531,36 @@
return op;
}
+ private void waitForServerToRestart(int timeout) throws Exception {
+ Thread.sleep(1000);
+ long start = System.currentTimeMillis();
+ long now;
+ do {
+ final ModelControllerClient client = newModelControllerClient(timeout / 10);
+ ModelNode operation = new ModelNode();
+ operation.get(OP_ADDR).setEmptyList();
+ operation.get(OP).set(READ_ATTRIBUTE_OPERATION);
+ operation.get(NAME).set("server-state");
+ try {
+ ModelNode result = client.execute(operation);
+ boolean normal = "running".equals(result.get(RESULT).asString());
+ if (normal) {
+ return;
+ }
+ } catch (Exception e) {
+ //NOOP
+ } finally {
+ client.close();
+ }
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ now = System.currentTimeMillis();
+ } while (now - start < timeout);
+ throw new Exception("Server did not restart!");
+ }
+
private static String getSystemProperty(final String name, final String defaultValue) {
PrivilegedAction<String> action = new PrivilegedAction<String>() {
public String run() {
@@ -530,9 +571,13 @@
}
private static ModelControllerClient newModelControllerClient() throws Exception {
- return ModelControllerClient.Factory.create(protocol, address.getHostAddress(), port, callbackHandler, null, TIMEOUT);
+ return newModelControllerClient(TIMEOUT);
}
+ private static ModelControllerClient newModelControllerClient(int timeout) throws Exception {
+ return ModelControllerClient.Factory.create(protocol, address.getHostAddress(), port, callbackHandler, null, timeout);
+ }
+
private static ServerDeploymentManager newDeploymentManager(ModelControllerClient client) throws Exception {
return ServerDeploymentManager.Factory.create(client);
}
10 years, 2 months
JBossWS SVN: r18957 - container/wildfly80/branches/jbossws-wildfly800/tests-integration/src/main/java/org/jboss/as/webservices/deployer.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-10-01 06:50:21 -0400 (Wed, 01 Oct 2014)
New Revision: 18957
Modified:
container/wildfly80/branches/jbossws-wildfly800/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java
Log:
[JBWS-3835] Add mechanism for restarting target container while running JBossWS tests
Modified: container/wildfly80/branches/jbossws-wildfly800/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java 2014-10-01 09:24:11 UTC (rev 18956)
+++ container/wildfly80/branches/jbossws-wildfly800/tests-integration/src/main/java/org/jboss/as/webservices/deployer/RemoteDeployer.java 2014-10-01 10:50:21 UTC (rev 18957)
@@ -71,9 +71,11 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELEASE_VERSION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUIRED;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESTART;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESULT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ROLLBACK_ON_RUNTIME_FAILURE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SERVER_IDENTITY;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SHUTDOWN;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SSL;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STEPS;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
@@ -417,6 +419,15 @@
}
@Override
+ public void restart() throws Exception {
+ ModelNode op = new ModelNode();
+ op.get("operation").set(SHUTDOWN);
+ op.get(RESTART).set("true");
+ applyUpdate(op);
+ waitForServerToRestart(TIMEOUT);
+ }
+
+ @Override
public String setSystemProperty(String propName, String propValue) throws Exception {
if (propName == null || propName.trim().length() == 0) {
throw new IllegalArgumentException("Empty system property name specified!");
@@ -520,6 +531,36 @@
return op;
}
+ private void waitForServerToRestart(int timeout) throws Exception {
+ Thread.sleep(1000);
+ long start = System.currentTimeMillis();
+ long now;
+ do {
+ final ModelControllerClient client = newModelControllerClient(timeout / 10);
+ ModelNode operation = new ModelNode();
+ operation.get(OP_ADDR).setEmptyList();
+ operation.get(OP).set(READ_ATTRIBUTE_OPERATION);
+ operation.get(NAME).set("server-state");
+ try {
+ ModelNode result = client.execute(operation);
+ boolean normal = "running".equals(result.get(RESULT).asString());
+ if (normal) {
+ return;
+ }
+ } catch (Exception e) {
+ //NOOP
+ } finally {
+ client.close();
+ }
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ now = System.currentTimeMillis();
+ } while (now - start < timeout);
+ throw new Exception("Server did not restart!");
+ }
+
private static String getSystemProperty(final String name, final String defaultValue) {
PrivilegedAction<String> action = new PrivilegedAction<String>() {
public String run() {
@@ -530,9 +571,13 @@
}
private static ModelControllerClient newModelControllerClient() throws Exception {
- return ModelControllerClient.Factory.create(protocol, address.getHostAddress(), port, callbackHandler, null, TIMEOUT);
+ return newModelControllerClient(TIMEOUT);
}
+ private static ModelControllerClient newModelControllerClient(int timeout) throws Exception {
+ return ModelControllerClient.Factory.create(protocol, address.getHostAddress(), port, callbackHandler, null, timeout);
+ }
+
private static ServerDeploymentManager newDeploymentManager(ModelControllerClient client) throws Exception {
return ServerDeploymentManager.Factory.create(client);
}
10 years, 2 months
JBossWS SVN: r18956 - spi/trunk/src/main/java/org/jboss/wsf/spi/deployer.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-10-01 05:24:11 -0400 (Wed, 01 Oct 2014)
New Revision: 18956
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/deployer/Deployer.java
Log:
[JBWS-3835] Adding restartServer method
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployer/Deployer.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployer/Deployer.java 2014-09-30 12:30:10 UTC (rev 18955)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployer/Deployer.java 2014-10-01 09:24:11 UTC (rev 18956)
@@ -85,4 +85,11 @@
* @throws Exception
*/
public String setSystemProperty(String propName, String propValue) throws Exception;
+
+ /**
+ * Restart the server
+ *
+ * @throws Exception
+ */
+ public void restart() throws Exception;
}
10 years, 2 months