JBossWS SVN: r16406 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-06-10 02:50:44 -0400 (Sun, 10 Jun 2012)
New Revision: 16406
Modified:
stack/cxf/trunk/pom.xml
Log:
Apache CXF 2.6.1 -> 2.7.0-SNAPSHOT
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2012-06-08 20:23:00 UTC (rev 16405)
+++ stack/cxf/trunk/pom.xml 2012-06-10 06:50:44 UTC (rev 16406)
@@ -73,7 +73,7 @@
<jboss712.version>7.1.2.Final</jboss712.version>
<jboss720.version>7.2.0.Alpha1-SNAPSHOT</jboss720.version>
<ejb.api.version>1.0.1.Final</ejb.api.version>
- <cxf.version>2.6.1</cxf.version>
+ <cxf.version>2.7.0-SNAPSHOT</cxf.version>
<cxf.asm.version>3.3.1</cxf.asm.version>
<cxf.xjcplugins.version>2.6.0</cxf.xjcplugins.version>
<fastinfoset.api.version>1.2.9</fastinfoset.api.version>
12 years, 6 months
JBossWS SVN: r16405 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2012-06-08 16:23:00 -0400 (Fri, 08 Jun 2012)
New Revision: 16405
Modified:
stack/cxf/trunk/pom.xml
Log:
don't use httpserver spi snapshot until necessary
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2012-06-08 13:36:40 UTC (rev 16404)
+++ stack/cxf/trunk/pom.xml 2012-06-08 20:23:00 UTC (rev 16405)
@@ -83,7 +83,7 @@
<jboss.security.sx.version>2.0.4</jboss.security.sx.version>
<jboss.xb.version>2.0.3.GA</jboss.xb.version>
<picketlink.version>2.1.1.Final</picketlink.version>
- <jaxws-jboss-httpserver-httpspi.version>1.0.2-SNAPSHOT</jaxws-jboss-httpserver-httpspi.version>
+ <jaxws-jboss-httpserver-httpspi.version>1.0.1.GA</jaxws-jboss-httpserver-httpspi.version>
<httpserver.version>1.0.0.Final</httpserver.version>
<jaxb.api.version>1.0.3.Final</jaxb.api.version>
<jaxb.impl.version>2.2.5</jaxb.impl.version>
12 years, 7 months
JBossWS SVN: r16404 - in shared-testsuite/trunk/testsuite/src/test: java/org/jboss/test/ws/jaxws/clientConfig and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 09:36:40 -0400 (Fri, 08 Jun 2012)
New Revision: 16404
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java
Modified:
shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
Log:
[JBWS-3335] Synch with latest jbossws-api + modify testcase to show how to only leverage jbossws-api for client configuration setup
Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-06-08 13:34:27 UTC (rev 16403)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-06-08 13:36:40 UTC (rev 16404)
@@ -125,15 +125,13 @@
<include name="org/jboss/test/ws/jaxws/clientConfig/Endpoint.class" />
<include name="org/jboss/test/ws/jaxws/clientConfig/*Handler.class" />
<include name="org/jboss/test/ws/jaxws/clientConfig/Helper.class" />
+ <include name="org/jboss/test/ws/jaxws/clientConfig/TestUtils.class" />
<include name="org/jboss/test/helper/TestServlet.class"/>
<include name="org/jboss/test/helper/ClientHelper.class"/>
</classes>
<classes dir="${tests.output.dir}/test-resources/jaxws/clientConfig">
<include name="META-INF/jaxws-client-config.xml"/>
</classes>
- <manifest>
- <attribute name="Dependencies" value="org.jboss.ws.common services"/>
- </manifest>
</war>
<!-- jaxws-clientConfig-client -->
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2012-06-08 13:34:27 UTC (rev 16403)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2012-06-08 13:36:40 UTC (rev 16404)
@@ -22,10 +22,7 @@
package org.jboss.test.ws.jaxws.clientConfig;
import java.net.URL;
-import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
-import java.util.ServiceLoader;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -33,15 +30,8 @@
import javax.xml.ws.handler.Handler;
import org.jboss.test.helper.ClientHelper;
+import org.jboss.ws.api.configuration.ClientConfigUtil;
import org.jboss.ws.api.configuration.ClientConfigurer;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.metadata.config.ClientConfig;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
/**
* Verifies client configuration setup
@@ -55,11 +45,7 @@
public boolean testClientConfigurer()
{
- Iterator<ClientConfigurer> it = ServiceLoader.load(ClientConfigurer.class).iterator();
- if (!it.hasNext()) {
- return false;
- }
- ClientConfigurer configurer = it.next();
+ ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
if (configurer == null) {
return false;
}
@@ -80,8 +66,7 @@
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
- ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
- configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
+ ClientConfigUtil.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
String resStr = port.echo("Kermit");
return ("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr));
@@ -101,15 +86,15 @@
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
- ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
- configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
+ ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
+ configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
String resStr = port.echo("Kermit");
if (!"Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr)) {
return false;
}
- configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Another Client Config");
+ configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Another Client Config");
resStr = port.echo("Kermit");
return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
@@ -128,13 +113,10 @@
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
- ServerConfig sc = getServerConfig();
- ClientConfig defaultConfig = getAndVerifyDefaultClientConfiguration(sc);
-
+ // -- modify default conf --
try
{
- // -- modify default conf --
- modifyDefaultClientConfiguration(defaultConfig);
+ TestUtils.modifyDefaultClientConfiguration(TestUtils.getAndVerifyDefaultClientConfiguration());
// --
Service service = Service.create(wsdlURL, serviceName);
@@ -147,14 +129,12 @@
bp.getBinding().setHandlerChain(hc);
String resStr = port.echo("Kermit");
- System.out.println("--> ** " + resStr);
return ("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
}
finally
{
// -- restore default conf --
- defaultConfig.setPostHandlerChains(null);
- defaultConfig.setPreHandlerChains(null);
+ TestUtils.cleanupClientConfig();
// --
}
}
@@ -171,12 +151,11 @@
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
- ServerConfig sc = getServerConfig();
final String testConfigName = "MyTestConfig";
try
{
//-- add test client configuration
- addTestCaseClientConfiguration(sc, testConfigName);
+ TestUtils.addTestCaseClientConfiguration(testConfigName);
// --
Service service = Service.create(wsdlURL, serviceName);
@@ -188,8 +167,7 @@
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
- ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
- configurer.addConfigHandlers(bp, null, testConfigName);
+ ClientConfigUtil.setConfigHandlers(bp, null, testConfigName);
String resStr = port.echo("Kermit");
return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
@@ -197,72 +175,11 @@
finally
{
// -- remove test client configuration --
- removeTestCaseClientConfiguration(sc, testConfigName);
+ TestUtils.removeTestCaseClientConfiguration(testConfigName);
// --
}
}
- private ClientConfig getAndVerifyDefaultClientConfiguration(ServerConfig sc) throws Exception {
- ClientConfig defaultConfig = null;
- for (ClientConfig c : sc.getClientConfigs()) {
- if (ClientConfig.STANDARD_CLIENT_CONFIG.equals(c.getConfigName())) {
- defaultConfig = c;
- }
- }
- if (defaultConfig == null) {
- throw new Exception("Missing AS client config '" + ClientConfig.STANDARD_CLIENT_CONFIG + "'!");
- }
- List<UnifiedHandlerChainMetaData> preHC = defaultConfig.getPreHandlerChains();
- List<UnifiedHandlerChainMetaData> postHC = defaultConfig.getPostHandlerChains();
- if ((preHC != null && !preHC.isEmpty()) || (postHC != null && !postHC.isEmpty())) {
- throw new Exception("'" + ClientConfig.STANDARD_CLIENT_CONFIG + "' is not empty!");
- }
- return defaultConfig;
- }
-
- private void modifyDefaultClientConfiguration(ClientConfig defaultConfig) {
- UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData();
- UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData();
- handler.setHandlerClass("org.jboss.test.ws.jaxws.clientConfig.LogHandler");
- handler.setHandlerName("Log Handler");
- uhcmd.addHandler(handler);
- List<UnifiedHandlerChainMetaData> postHC = new LinkedList<UnifiedHandlerChainMetaData>();
- postHC.add(uhcmd);
- defaultConfig.setPostHandlerChains(postHC);
- }
-
- private void addTestCaseClientConfiguration(ServerConfig sc, String testConfigName) {
- UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData();
- UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData();
- handler.setHandlerClass("org.jboss.test.ws.jaxws.clientConfig.RoutingHandler");
- handler.setHandlerName("Routing Handler");
- uhcmd.addHandler(handler);
- ClientConfig config = new ClientConfig();
- config.setConfigName(testConfigName);
- List<UnifiedHandlerChainMetaData> preHC = new LinkedList<UnifiedHandlerChainMetaData>();
- preHC.add(uhcmd);
- config.setPreHandlerChains(preHC);
- sc.addClientConfig(config);
- }
-
- private void removeTestCaseClientConfiguration(ServerConfig sc, String testConfigName) {
- Iterator<ClientConfig> it = sc.getClientConfigs().iterator();
- while (it.hasNext()) {
- ClientConfig c = it.next();
- if (testConfigName.equals(c.getConfigName())) {
- it.remove();
- break;
- }
- }
- }
-
- private ServerConfig getServerConfig()
- {
- final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
- SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
- return spiProvider.getSPI(ServerConfigFactory.class, cl).getServerConfig();
- }
-
@Override
public void setTargetEndpoint(String address)
{
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java 2012-06-08 13:36:40 UTC (rev 16404)
@@ -0,0 +1,128 @@
+/*
+ * 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.clientConfig;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.metadata.config.ClientConfig;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+
+/**
+ * Support utils for client config testcase; this basically collects methods
+ * for test purposes only to allow having a clean testcase without dependencies
+ * the user is not actually going to need.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 08-Jun-2012
+ */
+public class TestUtils
+{
+ public static ClientConfig getAndVerifyDefaultClientConfiguration() throws Exception {
+ ServerConfig sc = getServerConfig();
+ ClientConfig defaultConfig = null;
+ for (ClientConfig c : sc.getClientConfigs()) {
+ if (ClientConfig.STANDARD_CLIENT_CONFIG.equals(c.getConfigName())) {
+ defaultConfig = c;
+ }
+ }
+ if (defaultConfig == null) {
+ throw new Exception("Missing AS client config '" + ClientConfig.STANDARD_CLIENT_CONFIG + "'!");
+ }
+ List<UnifiedHandlerChainMetaData> preHC = defaultConfig.getPreHandlerChains();
+ List<UnifiedHandlerChainMetaData> postHC = defaultConfig.getPostHandlerChains();
+ if ((preHC != null && !preHC.isEmpty()) || (postHC != null && !postHC.isEmpty())) {
+ throw new Exception("'" + ClientConfig.STANDARD_CLIENT_CONFIG + "' is not empty!");
+ }
+ return defaultConfig;
+ }
+
+ public static void modifyDefaultClientConfiguration(ClientConfig defaultConfig) {
+ UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData();
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData();
+ handler.setHandlerClass("org.jboss.test.ws.jaxws.clientConfig.LogHandler");
+ handler.setHandlerName("Log Handler");
+ uhcmd.addHandler(handler);
+ List<UnifiedHandlerChainMetaData> postHC = new LinkedList<UnifiedHandlerChainMetaData>();
+ postHC.add(uhcmd);
+ defaultConfig.setPostHandlerChains(postHC);
+ }
+
+ public static void cleanupClientConfig() throws Exception {
+ ServerConfig sc = getServerConfig();
+ ClientConfig defaultConfig = null;
+ for (ClientConfig c : sc.getClientConfigs()) {
+ if (ClientConfig.STANDARD_CLIENT_CONFIG.equals(c.getConfigName())) {
+ defaultConfig = c;
+ }
+ }
+ if (defaultConfig == null) {
+ throw new Exception("Missing AS client config '" + ClientConfig.STANDARD_CLIENT_CONFIG + "'!");
+ }
+ List<UnifiedHandlerChainMetaData> preHC = defaultConfig.getPreHandlerChains();
+ List<UnifiedHandlerChainMetaData> postHC = defaultConfig.getPostHandlerChains();
+ if ((preHC == null || preHC.isEmpty()) && (postHC == null || postHC.isEmpty())) {
+ throw new Exception("'" + ClientConfig.STANDARD_CLIENT_CONFIG + "' is already empty!");
+ }
+ defaultConfig.setPostHandlerChains(null);
+ defaultConfig.setPreHandlerChains(null);
+ }
+
+ public static void addTestCaseClientConfiguration(String testConfigName) {
+ UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData();
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData();
+ handler.setHandlerClass("org.jboss.test.ws.jaxws.clientConfig.RoutingHandler");
+ handler.setHandlerName("Routing Handler");
+ uhcmd.addHandler(handler);
+ ClientConfig config = new ClientConfig();
+ config.setConfigName(testConfigName);
+ List<UnifiedHandlerChainMetaData> preHC = new LinkedList<UnifiedHandlerChainMetaData>();
+ preHC.add(uhcmd);
+ config.setPreHandlerChains(preHC);
+ getServerConfig().addClientConfig(config);
+ }
+
+ public static void removeTestCaseClientConfiguration(String testConfigName) {
+ Iterator<ClientConfig> it = getServerConfig().getClientConfigs().iterator();
+ while (it.hasNext()) {
+ ClientConfig c = it.next();
+ if (testConfigName.equals(c.getConfigName())) {
+ it.remove();
+ break;
+ }
+ }
+ }
+
+ private static ServerConfig getServerConfig()
+ {
+ final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ return spiProvider.getSPI(ServerConfigFactory.class, cl).getServerConfig();
+ }
+}
12 years, 7 months
JBossWS SVN: r16403 - common/trunk/src/main/java/org/jboss/ws/common/configuration.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 09:34:27 -0400 (Fri, 08 Jun 2012)
New Revision: 16403
Modified:
common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
Log:
[JBWS-3335] Synch with latest jbossws-api
Modified: common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-06-08 13:33:49 UTC (rev 16402)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-06-08 13:34:27 UTC (rev 16403)
@@ -74,7 +74,7 @@
}
@Override
- public void addConfigHandlers(BindingProvider port, String configFile, String configName)
+ public void setConfigHandlers(BindingProvider port, String configFile, String configName)
{
ClientConfig config = readConfig(configFile, configName);
setupConfigHandlers(port.getBinding(), config);
12 years, 7 months
JBossWS SVN: r16402 - api/trunk/src/main/java/org/jboss/ws/api/configuration.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 09:33:49 -0400 (Fri, 08 Jun 2012)
New Revision: 16402
Added:
api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigUtil.java
Modified:
api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java
Log:
[JBWS-3335] Refactoring ClientConfigurer interface now that there's way for changing a previously set client configuration + providing a utility class to further simplify configuration setup
Added: api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigUtil.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigUtil.java (rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigUtil.java 2012-06-08 13:33:49 UTC (rev 16402)
@@ -0,0 +1,83 @@
+/*
+ * 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.ws.api.configuration;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import javax.xml.ws.BindingProvider;
+
+/**
+ * A facility for setting a JBossWS Client Configuration
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+public abstract class ClientConfigUtil
+{
+ /**
+ * Reads a client configuration and setups the handlers in the provided BindingProvider accordingly.
+ * This leverages the resolveClientConfigurer() method for getting the ClientConfigure to use.
+ *
+ * @param bp The BindingProvider instance to setup
+ * @param configFile The configuration file
+ * @param configName The configuration name
+ */
+ public static void setConfigHandlers(BindingProvider bp, String configFile, String configName) {
+ ClientConfigurer configurer = resolveClientConfigurer();
+ configurer.setConfigHandlers(bp, configFile, configName);
+ }
+
+ /**
+ * Resolves a ClientConfigurer instance by first using the defining classloader and
+ * failing that by using the current thread context classloader.
+ *
+ * @return A ClientConfigurer instance
+ */
+ public static ClientConfigurer resolveClientConfigurer() {
+ Iterator<ClientConfigurer> it = ServiceLoader.load(ClientConfigurer.class, ClientConfigUtil.class.getClassLoader()).iterator();
+ if (!it.hasNext()) {
+ it = ServiceLoader.load(ClientConfigurer.class, getContextClassLoader()).iterator();
+ }
+ return it.next();
+ }
+
+ private static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+}
Modified: api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java 2012-06-08 13:30:59 UTC (rev 16401)
+++ api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java 2012-06-08 13:33:49 UTC (rev 16402)
@@ -24,19 +24,19 @@
import javax.xml.ws.BindingProvider;
/**
- * A facility for setting a JBossWS Client Configuration
+ * JBossWS Client Configuration interface
*
* @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
public interface ClientConfigurer
{
/**
- * Reads a client configuration and setups the specified BindingProvider accordingly
+ * Reads a client configuration and setups the handlers in the provided BindingProvider accordingly.
*
* @param bp The BindingProvider instance to setup
* @param configFile The configuration file
* @param configName The configuration name
*/
- public void addConfigHandlers(BindingProvider bp, String configFile, String configName);
+ public void setConfigHandlers(BindingProvider bp, String configFile, String configName);
}
12 years, 7 months
JBossWS SVN: r16401 - in stack/cxf/trunk/modules/resources/src/main/resources/modules: jboss720/org/jboss/ws/api/main and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 09:30:59 -0400 (Fri, 08 Jun 2012)
New Revision: 16401
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss710/org/jboss/ws/api/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss720/org/jboss/ws/api/main/module.xml
Log:
[JBWS-3335] Allow jbossws-common service resolution from jbossws-api
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss710/org/jboss/ws/api/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss710/org/jboss/ws/api/main/module.xml 2012-06-08 09:57:54 UTC (rev 16400)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss710/org/jboss/ws/api/main/module.xml 2012-06-08 13:30:59 UTC (rev 16401)
@@ -34,6 +34,7 @@
<module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.modules"/>
+ <module name="org.jboss.ws.common" services="import"/>
</dependencies>
</module>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss720/org/jboss/ws/api/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss720/org/jboss/ws/api/main/module.xml 2012-06-08 09:57:54 UTC (rev 16400)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/jboss720/org/jboss/ws/api/main/module.xml 2012-06-08 13:30:59 UTC (rev 16401)
@@ -34,6 +34,7 @@
<module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.modules"/>
+ <module name="org.jboss.ws.common" services="import"/>
</dependencies>
</module>
12 years, 7 months
JBossWS SVN: r16400 - in shared-testsuite/trunk/testsuite/src/test: resources/jaxws/clientConfig/META-INF and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 05:57:54 -0400 (Fri, 08 Jun 2012)
New Revision: 16400
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml
Log:
[JBWS-3335] Adding testcase for client configuration change
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-06-08 09:57:08 UTC (rev 16399)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-06-08 09:57:54 UTC (rev 16400)
@@ -43,25 +43,48 @@
return new JBossWSTestSetup(ClientConfigurationTestCase.class, "jaxws-clientConfig.war,jaxws-clientConfig-client.jar, jaxws-clientConfig-inContainer-client.war");
}
+ /**
+ * Verifies the client configurer is properly resolved
+ */
public void testClientConfigurer() {
- Helper helper = new Helper();
- assertTrue(helper.testClientConfigurer());
+ assertTrue(getHelper().testClientConfigurer());
}
-
- public void testCustomClientConfiguration() throws Exception {
- Helper helper = new Helper();
- helper.setTargetEndpoint("http://" + getServerHost() + ":8080/jaxws-clientConfig/EndpointImpl");
- assertTrue(helper.testCustomClientConfigurationFromFile());
- }
public void testClientConfigurerInContainer() throws Exception {
assertEquals("1", runTestInContainer("testClientConfigurer"));
}
+ /**
+ * Verifies a custom client configuration can be read from conf file and set
+ *
+ * @throws Exception
+ */
+ public void testCustomClientConfigurationFromFile() throws Exception {
+ assertTrue(getHelper().testCustomClientConfigurationFromFile());
+ }
+
public void testCustomClientConfigurationFromFileInContainer() throws Exception {
assertEquals("1", runTestInContainer("testCustomClientConfigurationFromFile"));
}
+ /**
+ * Verifies a client configuration can be changed after another one has been set
+ *
+ * @throws Exception
+ */
+ public void testConfigurationChange() throws Exception {
+ assertTrue(getHelper().testConfigurationChange());
+ }
+
+ public void testConfigurationChangeInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testConfigurationChange"));
+ }
+
+ /**
+ * Verifies the default client configuration from AS model is used
+ *
+ * @throws Exception
+ */
public void testDefaultClientConfigurationInContainer() throws Exception {
if (true) {
System.out.println("FIXME: [JBWS-3335] Add client-configuration to AS7 domain model");
@@ -70,10 +93,23 @@
assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
}
+ /**
+ * Verifies a client configuration from AS model can be set
+ *
+ * @throws Exception
+ */
public void testCustomClientConfigurationInContainer() throws Exception {
assertEquals("1", runTestInContainer("testCustomClientConfiguration"));
}
+ // -------------------------
+
+ private Helper getHelper() {
+ Helper helper = new Helper();
+ helper.setTargetEndpoint("http://" + getServerHost() + ":8080/jaxws-clientConfig/EndpointImpl");
+ return helper;
+ }
+
private String runTestInContainer(String test) throws Exception
{
URL url = new URL("http://" + getServerHost()
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2012-06-08 09:57:08 UTC (rev 16399)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2012-06-08 09:57:54 UTC (rev 16400)
@@ -87,6 +87,34 @@
return ("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr));
}
+ public boolean testConfigurationChange() throws Exception
+ {
+ QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
+ configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
+
+ String resStr = port.echo("Kermit");
+ if (!"Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr)) {
+ return false;
+ }
+
+ configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Another Client Config");
+
+ resStr = port.echo("Kermit");
+ return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
+ }
+
/**
* This test hacks the current ServerConfig temporarily adding an handler from this testcase deployment
* into the AS default client configuration, verifies the handler is picked up and finally restores the
Modified: shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml 2012-06-08 09:57:08 UTC (rev 16399)
+++ shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml 2012-06-08 09:57:54 UTC (rev 16400)
@@ -26,5 +26,16 @@
</javaee:handler-chain>
</post-handler-chains>
</client-config>
+ <client-config>
+ <config-name>Another Client Config</config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name>Routing Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.RoutingHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ </client-config>
</jaxws-config>
\ No newline at end of file
12 years, 7 months
JBossWS SVN: r16399 - common/trunk/src/main/java/org/jboss/ws/common/configuration.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 05:57:08 -0400 (Fri, 08 Jun 2012)
New Revision: 16399
Modified:
common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
Log:
[JBWS-3335] Allow client configuration change by cleaning up config handlers before setting a handlers from another config
Modified: common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-06-08 09:48:28 UTC (rev 16398)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-06-08 09:57:08 UTC (rev 16399)
@@ -125,20 +125,33 @@
public void setupConfigHandlers(Binding binding, CommonConfig config)
{
if (config != null) {
- List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding, true); //PRE
- handlers.addAll(binding.getHandlerChain()); //ENDPOINT
- handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding, false)); //POST
+ //start with the use handlers only to remove the previously set configuration
+ List<Handler> userHandlers = getNonConfigHandlers(binding.getHandlerChain());
+ List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding.getBindingID(), true); //PRE
+ handlers.addAll(userHandlers); //ENDPOINT
+ handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding.getBindingID(), false)); //POST
binding.setHandlerChain(handlers);
}
}
+ @SuppressWarnings("rawtypes")
+ private static List<Handler> getNonConfigHandlers(List<Handler> handlerChain) {
+ List<Handler> list = new LinkedList<Handler>();
+ for (Handler h : handlerChain) {
+ if (!(h instanceof ConfigDelegateHandler)) {
+ list.add(h);
+ }
+ }
+ return list;
+ }
+
@SuppressWarnings({"rawtypes", "unchecked"})
- private static List<Handler> convertToHandlers(List<UnifiedHandlerChainMetaData> handlerChains, Binding binding, boolean isPre)
+ private static List<Handler> convertToHandlers(List<UnifiedHandlerChainMetaData> handlerChains, String bindingID, boolean isPre)
{
List<Handler> handlers = new LinkedList<Handler>();
if (handlerChains != null && !handlerChains.isEmpty())
{
- final String protocolBinding = bindingIDs.get(binding.getBindingID());
+ final String protocolBinding = bindingIDs.get(bindingID);
for (UnifiedHandlerChainMetaData handlerChain : handlerChains)
{
if (handlerChain.getPortNamePattern() != null || handlerChain.getServiceNamePattern() != null)
12 years, 7 months
JBossWS SVN: r16398 - shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3140.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-08 05:48:28 -0400 (Fri, 08 Jun 2012)
New Revision: 16398
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3140/JBWS3140TestCase.java
Log:
Fixing missing undeploy of test client jar
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3140/JBWS3140TestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3140/JBWS3140TestCase.java 2012-06-07 17:05:59 UTC (rev 16397)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3140/JBWS3140TestCase.java 2012-06-08 09:48:28 UTC (rev 16398)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -26,11 +26,9 @@
import java.net.HttpURLConnection;
import java.net.URL;
-import junit.framework.Test;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestSetup;
public class JBWS3140TestCase extends JBossWSTest
{
@@ -48,6 +46,7 @@
assertTrue("Expected message wasn't found in response: " + result, result.indexOf(expectedDetail) > -1);
} finally {
JBossWSTestHelper.undeploy("jbws3140-responses-server.war");
+ JBossWSTestHelper.undeploy("jbws3140-client.war");
}
}
@@ -62,6 +61,7 @@
assertTrue("Expected string wasn't found in response: " + result, result.indexOf(expected) > -1);
} finally {
JBossWSTestHelper.undeploy("jbws3140-server.war");
+ JBossWSTestHelper.undeploy("jbws3140-client.war");
}
}
12 years, 7 months
JBossWS SVN: r16397 - in shared-testsuite/trunk/testsuite/src/test: java/org/jboss/test/ws/jaxws/clientConfig and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-07 13:05:59 -0400 (Thu, 07 Jun 2012)
New Revision: 16397
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
Modified:
shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
Log:
[JBWS-3335] Enhancing testcase
Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-06-07 17:04:59 UTC (rev 16396)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-06-07 17:05:59 UTC (rev 16397)
@@ -119,6 +119,23 @@
</classes>
</war>
+ <!-- jaxws-clientConfig-inContainer-client -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-clientConfig-inContainer-client.war" needxmlfile="false">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/clientConfig/Endpoint.class" />
+ <include name="org/jboss/test/ws/jaxws/clientConfig/*Handler.class" />
+ <include name="org/jboss/test/ws/jaxws/clientConfig/Helper.class" />
+ <include name="org/jboss/test/helper/TestServlet.class"/>
+ <include name="org/jboss/test/helper/ClientHelper.class"/>
+ </classes>
+ <classes dir="${tests.output.dir}/test-resources/jaxws/clientConfig">
+ <include name="META-INF/jaxws-client-config.xml"/>
+ </classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.common services"/>
+ </manifest>
+ </war>
+
<!-- jaxws-clientConfig-client -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-clientConfig-client.jar">
<metainf dir="${tests.output.dir}/test-resources/jaxws/clientConfig/META-INF">
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-06-07 17:04:59 UTC (rev 16396)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-06-07 17:05:59 UTC (rev 16397)
@@ -21,19 +21,12 @@
*/
package org.jboss.test.ws.jaxws.clientConfig;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ServiceLoader;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.handler.Handler;
-
import junit.framework.Test;
-import org.jboss.ws.api.configuration.ClientConfigurer;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
@@ -45,40 +38,48 @@
*/
public class ClientConfigurationTestCase extends JBossWSTest
{
- private static final String targetNS = "http://clientConfig.jaxws.ws.test.jboss.org/";
-
public static Test suite()
{
- return new JBossWSTestSetup(ClientConfigurationTestCase.class, "jaxws-clientConfig.war,jaxws-clientConfig-client.jar");
+ return new JBossWSTestSetup(ClientConfigurationTestCase.class, "jaxws-clientConfig.war,jaxws-clientConfig-client.jar, jaxws-clientConfig-inContainer-client.war");
}
- public void testClientConfigurer()
- {
- Iterator<ClientConfigurer> it = ServiceLoader.load(ClientConfigurer.class).iterator();
- assertTrue(it.hasNext());
- ClientConfigurer configurer = it.next();
- assertNotNull(configurer);
- assertEquals("org.jboss.ws.common.configuration.ConfigHelper", configurer.getClass().getName());
+ public void testClientConfigurer() {
+ Helper helper = new Helper();
+ assertTrue(helper.testClientConfigurer());
}
- public void testCustomClientConfiguration() throws Exception
+ public void testCustomClientConfiguration() throws Exception {
+ Helper helper = new Helper();
+ helper.setTargetEndpoint("http://" + getServerHost() + ":8080/jaxws-clientConfig/EndpointImpl");
+ assertTrue(helper.testCustomClientConfigurationFromFile());
+ }
+
+ public void testClientConfigurerInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testClientConfigurer"));
+ }
+
+ public void testCustomClientConfigurationFromFileInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationFromFile"));
+ }
+
+ public void testDefaultClientConfigurationInContainer() throws Exception {
+ if (true) {
+ System.out.println("FIXME: [JBWS-3335] Add client-configuration to AS7 domain model");
+ return;
+ }
+ assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
+ }
+
+ public void testCustomClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfiguration"));
+ }
+
+ private String runTestInContainer(String test) throws Exception
{
- QName serviceName = new QName(targetNS, "EndpointImplService");
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-clientConfig/EndpointImpl?wsdl");
-
- Service service = Service.create(wsdlURL, serviceName);
- Endpoint port = (Endpoint)service.getPort(Endpoint.class);
-
- BindingProvider bp = (BindingProvider)port;
- @SuppressWarnings("rawtypes")
- List<Handler> hc = bp.getBinding().getHandlerChain();
- hc.add(new UserHandler());
- bp.getBinding().setHandlerChain(hc);
-
- ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
- configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
-
- String resStr = port.echo("Kermit");
- assertEquals("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn", resStr);
+ URL url = new URL("http://" + getServerHost()
+ + ":8080/jaxws-clientConfig-inContainer-client?path=/jaxws-clientConfig/EndpointImpl&method=" + test
+ + "&helper=" + Helper.class.getName());
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ return br.readLine();
}
}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2012-06-07 17:05:59 UTC (rev 16397)
@@ -0,0 +1,243 @@
+/*
+ * 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.clientConfig;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ServiceLoader;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.test.helper.ClientHelper;
+import org.jboss.ws.api.configuration.ClientConfigurer;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.metadata.config.ClientConfig;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+
+/**
+ * Verifies client configuration setup
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 06-Jun-2012
+ */
+public class Helper implements ClientHelper
+{
+ private String address;
+
+ public boolean testClientConfigurer()
+ {
+ Iterator<ClientConfigurer> it = ServiceLoader.load(ClientConfigurer.class).iterator();
+ if (!it.hasNext()) {
+ return false;
+ }
+ ClientConfigurer configurer = it.next();
+ if (configurer == null) {
+ return false;
+ }
+ return "org.jboss.ws.common.configuration.ConfigHelper".equals(configurer.getClass().getName());
+ }
+
+ public boolean testCustomClientConfigurationFromFile() throws Exception
+ {
+ QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
+ configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
+
+ String resStr = port.echo("Kermit");
+ return ("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr));
+ }
+
+ /**
+ * This test hacks the current ServerConfig temporarily adding an handler from this testcase deployment
+ * into the AS default client configuration, verifies the handler is picked up and finally restores the
+ * original default client configuration.
+ *
+ * @return
+ * @throws Exception
+ */
+ public boolean testDefaultClientConfiguration() throws Exception
+ {
+ QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+
+ ServerConfig sc = getServerConfig();
+ ClientConfig defaultConfig = getAndVerifyDefaultClientConfiguration(sc);
+
+ try
+ {
+ // -- modify default conf --
+ modifyDefaultClientConfiguration(defaultConfig);
+ // --
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ String resStr = port.echo("Kermit");
+ System.out.println("--> ** " + resStr);
+ return ("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
+ }
+ finally
+ {
+ // -- restore default conf --
+ defaultConfig.setPostHandlerChains(null);
+ defaultConfig.setPreHandlerChains(null);
+ // --
+ }
+ }
+
+ /**
+ * This test hacks the current ServerConfig temporarily adding a test client configuration, uses that
+ * for the test client and finally removes it from the ServerConfig.
+ *
+ * @return
+ * @throws Exception
+ */
+ public boolean testCustomClientConfiguration() throws Exception
+ {
+ QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+
+ ServerConfig sc = getServerConfig();
+ final String testConfigName = "MyTestConfig";
+ try
+ {
+ //-- add test client configuration
+ addTestCaseClientConfiguration(sc, testConfigName);
+ // --
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
+ configurer.addConfigHandlers(bp, null, testConfigName);
+
+ String resStr = port.echo("Kermit");
+ return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
+ }
+ finally
+ {
+ // -- remove test client configuration --
+ removeTestCaseClientConfiguration(sc, testConfigName);
+ // --
+ }
+ }
+
+ private ClientConfig getAndVerifyDefaultClientConfiguration(ServerConfig sc) throws Exception {
+ ClientConfig defaultConfig = null;
+ for (ClientConfig c : sc.getClientConfigs()) {
+ if (ClientConfig.STANDARD_CLIENT_CONFIG.equals(c.getConfigName())) {
+ defaultConfig = c;
+ }
+ }
+ if (defaultConfig == null) {
+ throw new Exception("Missing AS client config '" + ClientConfig.STANDARD_CLIENT_CONFIG + "'!");
+ }
+ List<UnifiedHandlerChainMetaData> preHC = defaultConfig.getPreHandlerChains();
+ List<UnifiedHandlerChainMetaData> postHC = defaultConfig.getPostHandlerChains();
+ if ((preHC != null && !preHC.isEmpty()) || (postHC != null && !postHC.isEmpty())) {
+ throw new Exception("'" + ClientConfig.STANDARD_CLIENT_CONFIG + "' is not empty!");
+ }
+ return defaultConfig;
+ }
+
+ private void modifyDefaultClientConfiguration(ClientConfig defaultConfig) {
+ UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData();
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData();
+ handler.setHandlerClass("org.jboss.test.ws.jaxws.clientConfig.LogHandler");
+ handler.setHandlerName("Log Handler");
+ uhcmd.addHandler(handler);
+ List<UnifiedHandlerChainMetaData> postHC = new LinkedList<UnifiedHandlerChainMetaData>();
+ postHC.add(uhcmd);
+ defaultConfig.setPostHandlerChains(postHC);
+ }
+
+ private void addTestCaseClientConfiguration(ServerConfig sc, String testConfigName) {
+ UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData();
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData();
+ handler.setHandlerClass("org.jboss.test.ws.jaxws.clientConfig.RoutingHandler");
+ handler.setHandlerName("Routing Handler");
+ uhcmd.addHandler(handler);
+ ClientConfig config = new ClientConfig();
+ config.setConfigName(testConfigName);
+ List<UnifiedHandlerChainMetaData> preHC = new LinkedList<UnifiedHandlerChainMetaData>();
+ preHC.add(uhcmd);
+ config.setPreHandlerChains(preHC);
+ sc.addClientConfig(config);
+ }
+
+ private void removeTestCaseClientConfiguration(ServerConfig sc, String testConfigName) {
+ Iterator<ClientConfig> it = sc.getClientConfigs().iterator();
+ while (it.hasNext()) {
+ ClientConfig c = it.next();
+ if (testConfigName.equals(c.getConfigName())) {
+ it.remove();
+ break;
+ }
+ }
+ }
+
+ private ServerConfig getServerConfig()
+ {
+ final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ return spiProvider.getSPI(ServerConfigFactory.class, cl).getServerConfig();
+ }
+
+ @Override
+ public void setTargetEndpoint(String address)
+ {
+ this.address = address;
+ }
+}
12 years, 7 months