Author: asoldano
Date: 2013-12-05 10:21:45 -0500 (Thu, 05 Dec 2013)
New Revision: 18143
Added:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java
Log:
[JBWS-3708] Restoring some tests disabled previously (and splitting
ClientConfigurationTestCase into two testcases)
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2013-12-05
14:50:42 UTC (rev 18142)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2013-12-05
15:21:45 UTC (rev 18143)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -116,52 +116,6 @@
assertEquals("1",
runTestInContainer("testConfigurationChangeOnDispatch"));
}
- /**
- * Verifies the default client configuration from AS model is used
- *
- * @throws Exception
- */
- public void testDefaultClientConfigurationInContainer() throws Exception {
- if (true) {
- System.out.println("[JBWS-3708] FIXME: refactor testcase");
- return;
- }
- if (!isTargetJBoss71()) {
- assertEquals("1",
runTestInContainer("testDefaultClientConfiguration"));
- }
- }
-
- public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
- if (true) {
- System.out.println("[JBWS-3708] FIXME: refactor testcase");
- return;
- }
- if (!isTargetJBoss71()) {
- assertEquals("1",
runTestInContainer("testDefaultClientConfigurationOnDispatch"));
- }
- }
-
- /**
- * Verifies a client configuration from AS model can be set
- *
- * @throws Exception
- */
- public void testCustomClientConfigurationInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfiguration"));
- }
-
- public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatch"));
- }
-
- public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfigurationUsingFeature"));
- }
-
- public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws
Exception {
- assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
- }
-
// -------------------------
private Helper getHelper() {
Added:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java
(rev 0)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java 2013-12-05
15:21:45 UTC (rev 18143)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, 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.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Verifies client configuration setup (in-container tests, relying on AS model)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 31-May-2012
+ */
+public class ClientConfigurationTestCaseForked extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(ClientConfigurationTestCaseForked.class,
"jaxws-clientConfig.war,jaxws-clientConfig-client.jar,
jaxws-clientConfig-inContainer-client.war");
+ }
+
+ /**
+ * Verifies the default client configuration from AS model is used
+ *
+ * @throws Exception
+ */
+ public void testDefaultClientConfigurationInContainer() throws Exception {
+ if (!isTargetJBoss71()) {
+ assertEquals("1",
runTestInContainer("testDefaultClientConfiguration"));
+ }
+ }
+
+ public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
+ if (!isTargetJBoss71()) {
+ assertEquals("1",
runTestInContainer("testDefaultClientConfigurationOnDispatch"));
+ }
+ }
+
+ /**
+ * Verifies a client configuration from AS model can be set
+ *
+ * @throws Exception
+ */
+ public void testCustomClientConfigurationInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfiguration"));
+ }
+
+ public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatch"));
+ }
+
+ public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationUsingFeature"));
+ }
+
+ public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws
Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
+ }
+
+ // -------------------------
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ 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();
+ }
+}
Property changes on:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCaseForked.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2013-12-05
14:50:42 UTC (rev 18142)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2013-12-05
15:21:45 UTC (rev 18143)
@@ -38,6 +38,7 @@
import org.jboss.ws.api.configuration.ClientConfigUtil;
import org.jboss.ws.api.configuration.ClientConfigurer;
import org.jboss.ws.common.DOMUtils;
+import org.jboss.wsf.spi.metadata.config.ClientConfig;
/**
* Verifies client configuration setup
@@ -211,69 +212,69 @@
*/
public boolean testDefaultClientConfiguration() throws Exception
{
- return false;
-// QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
-// URL wsdlURL = new URL(address + "?wsdl");
-//
-// // -- modify default conf --
-// try
-// {
-//
TestUtils.modifyDefaultClientConfiguration(TestUtils.getAndVerifyDefaultClientConfiguration());
-// // --
-//
-// 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");
-// return
("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
-// }
-// finally
-// {
-// // -- restore default conf --
-// TestUtils.cleanupClientConfig();
-// // --
-// }
+ QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+ final ClientConfig defaultClientConfig =
TestUtils.getAndVerifyDefaultClientConfiguration();
+
+ // -- modify default conf --
+ try
+ {
+ TestUtils.changeDefaultClientConfiguration();
+ // --
+
+ 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");
+ return
("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
+ }
+ finally
+ {
+ // -- restore default conf --
+ TestUtils.setClientConfigAndReload(defaultClientConfig);
+ // --
+ }
}
public boolean testDefaultClientConfigurationOnDispatch() throws Exception
{
- return false;
-// final String reqString = "<ns1:echo
xmlns:ns1=\"http://clientConfig.jaxws.ws.test.jboss.org/\">&...;
-// QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
-// QName portName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointPort");
-// URL wsdlURL = new URL(address + "?wsdl");
-//
-// // -- modify default conf --
-// try
-// {
-//
TestUtils.modifyDefaultClientConfiguration(TestUtils.getAndVerifyDefaultClientConfiguration());
-// // --
-//
-// Service service = Service.create(wsdlURL, serviceName);
-// Dispatch<Source> dispatch = service.createDispatch(portName,
Source.class, Mode.PAYLOAD);
-//
-// BindingProvider bp = (BindingProvider)dispatch;
-// @SuppressWarnings("rawtypes")
-// List<Handler> hc = bp.getBinding().getHandlerChain();
-// hc.add(new UserHandler());
-// bp.getBinding().setHandlerChain(hc);
-//
-// Source resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
-// String resStr =
DOMUtils.getTextContent(DOMUtils.sourceToElement(resSource).getElementsByTagName("return").item(0));
-// return
("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
-// }
-// finally
-// {
-// // -- restore default conf --
-// TestUtils.cleanupClientConfig();
-// // --
-// }
+ final String reqString = "<ns1:echo
xmlns:ns1=\"http://clientConfig.jaxws.ws.test.jboss.org/\">&...;
+ QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
+ QName portName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointPort");
+ URL wsdlURL = new URL(address + "?wsdl");
+ final ClientConfig defaultClientConfig =
TestUtils.getAndVerifyDefaultClientConfiguration();
+
+ // -- modify default conf --
+ try
+ {
+ TestUtils.changeDefaultClientConfiguration();
+ // --
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Dispatch<Source> dispatch = service.createDispatch(portName, Source.class,
Mode.PAYLOAD);
+
+ BindingProvider bp = (BindingProvider)dispatch;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ Source resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
+ String resStr =
DOMUtils.getTextContent(DOMUtils.sourceToElement(resSource).getElementsByTagName("return").item(0));
+ return
("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
+ }
+ finally
+ {
+ // -- restore default conf --
+ TestUtils.setClientConfigAndReload(defaultClientConfig);
+ // --
+ }
}
/**
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java 2013-12-05
14:50:42 UTC (rev 18142)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/TestUtils.java 2013-12-05
15:21:45 UTC (rev 18143)
@@ -58,42 +58,27 @@
return defaultConfig;
}
-// public static void modifyDefaultClientConfiguration(ClientConfig defaultConfig) {
-// UnifiedHandlerMetaData handler = new
UnifiedHandlerMetaData("org.jboss.test.ws.jaxws.clientConfig.LogHandler",
"Log Handler", null, null, null, null);
-// UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData(null, null,
null, Collections.singletonList(handler), false, null);
-// 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 changeDefaultClientConfiguration() {
+ UnifiedHandlerMetaData handler = new
UnifiedHandlerMetaData("org.jboss.test.ws.jaxws.clientConfig.LogHandler",
"Log Handler", null, null, null, null);
+ UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData(null, null,
null, Collections.singletonList(handler), false, null);
+ List<UnifiedHandlerChainMetaData> postHC = Collections.singletonList(uhcmd);
+
+ ClientConfig newDefaultClientConfig = new
ClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG, null, postHC, null, null);
+ setClientConfigAndReload(newDefaultClientConfig);
+ }
+ public static void setClientConfigAndReload(ClientConfig config) {
+ ServerConfig sc = getServerConfig();
+ sc.registerClientConfig(config);
+ sc.reloadClientConfigs();
+ }
+
public static void addTestCaseClientConfiguration(String testConfigName) {
UnifiedHandlerMetaData handler = new
UnifiedHandlerMetaData("org.jboss.test.ws.jaxws.clientConfig.RoutingHandler",
"Routing Handler", null, null, null, null);
UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData(null, null,
null, Collections.singletonList(handler), false, null);
List<UnifiedHandlerChainMetaData> preHC = new
LinkedList<UnifiedHandlerChainMetaData>();
preHC.add(uhcmd);
- ServerConfig sc = getServerConfig();
- sc.registerClientConfig(new ClientConfig(testConfigName, preHC, null, null,
null));
- sc.reloadClientConfigs();
+ setClientConfigAndReload(new ClientConfig(testConfigName, preHC, null, null,
null));
}
public static void removeTestCaseClientConfiguration(String testConfigName) {