Author: asoldano
Date: 2013-12-05 09:50:42 -0500 (Thu, 05 Dec 2013)
New Revision: 18142
Added:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/Helper.java
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/TestUtils.java
Log:
[JBWS-3708] Restoring some tests disabled previously (and splitting
CXFClientConfigurationTestCase into two testcases)
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java 2013-12-05
14:49:08 UTC (rev 18141)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java 2013-12-05
14:50:42 UTC (rev 18142)
@@ -100,53 +100,7 @@
public void testConfigurationChangeOnDispatchInContainer() throws Exception {
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/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
(rev 0)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java 2013-12-05
14:50:42 UTC (rev 18142)
@@ -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.cxf.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 CXFClientConfigurationTestCaseForked extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(CXFClientConfigurationTestCaseForked.class,
"jaxws-cxf-clientConfig.war,jaxws-cxf-clientConfig-client.jar,jaxws-cxf-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-cxf-clientConfig-inContainer-client?path=/jaxws-cxf-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/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/Helper.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/Helper.java 2013-12-05
14:49:08 UTC (rev 18141)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/Helper.java 2013-12-05
14:50:42 UTC (rev 18142)
@@ -22,6 +22,8 @@
package org.jboss.test.ws.jaxws.cxf.clientConfig;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
@@ -34,6 +36,7 @@
import org.jboss.ws.api.configuration.ClientConfigFeature;
import org.jboss.ws.api.configuration.ClientConfigUtil;
import org.jboss.ws.api.configuration.ClientConfigurer;
+import org.jboss.wsf.spi.metadata.config.ClientConfig;
import org.jboss.wsf.test.ClientHelper;
/**
@@ -138,50 +141,55 @@
*/
public boolean testDefaultClientConfiguration() throws Exception
{
- return false; //TODO
-// final URL wsdlURL = new URL(address + "?wsdl");
-//
-// // -- modify default conf --
-// try
-// {
-//
TestUtils.getAndVerifyDefaultClientConfiguration().setProperty("propA",
"valueA");
-// // --
-//
-// Service service = Service.create(wsdlURL, serviceName);
-// Endpoint port = (Endpoint)service.getPort(Endpoint.class);
-//
-// return
(ClientProxy.getClient(port).getEndpoint().get("propA").equals("valueA"));
-// }
-// finally
-// {
-// // -- restore default conf --
-// TestUtils.cleanupClientConfig();
-// // --
-// }
+ final URL wsdlURL = new URL(address + "?wsdl");
+ final ClientConfig defaultClientConfig =
TestUtils.getAndVerifyDefaultClientConfiguration();
+
+ // -- modify default conf --
+ try
+ {
+
+ final Map<String, String> props = new HashMap<String, String>();
+ props.put("propA", "valueA");
+ TestUtils.registerClientConfigAndReload(new
ClientConfig(defaultClientConfig.getConfigName(), null, null, props, null));
+ // --
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ return
(ClientProxy.getClient(port).getEndpoint().get("propA").equals("valueA"));
+ }
+ finally
+ {
+ // -- restore default conf --
+ TestUtils.registerClientConfigAndReload(defaultClientConfig);
+ // --
+ }
}
public boolean testDefaultClientConfigurationOnDispatch() throws Exception
{
- return false; //TODO
-// final URL wsdlURL = new URL(address + "?wsdl");
-//
-// // -- modify default conf --
-// try
-// {
-//
TestUtils.getAndVerifyDefaultClientConfiguration().setProperty("propA",
"valueA");
-// // --
-//
-// Service service = Service.create(wsdlURL, serviceName);
-// Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Mode.MESSAGE);
-//
-// return
(((DispatchImpl<SOAPMessage>)dispatch).getClient().getEndpoint().get("propA").equals("valueA"));
-// }
-// finally
-// {
-// // -- restore default conf --
-// TestUtils.cleanupClientConfig();
-// // --
-// }
+ final URL wsdlURL = new URL(address + "?wsdl");
+ final ClientConfig defaultClientConfig =
TestUtils.getAndVerifyDefaultClientConfiguration();
+
+ // -- modify default conf --
+ try
+ {
+ final Map<String, String> props = new HashMap<String, String>();
+ props.put("propA", "valueA");
+ TestUtils.registerClientConfigAndReload(new
ClientConfig(defaultClientConfig.getConfigName(), null, null, props, null));
+ // --
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Mode.MESSAGE);
+
+ return
(((DispatchImpl<SOAPMessage>)dispatch).getClient().getEndpoint().get("propA").equals("valueA"));
+ }
+ finally
+ {
+ // -- restore default conf --
+ TestUtils.registerClientConfigAndReload(defaultClientConfig);
+ // --
+ }
}
/**
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/TestUtils.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/TestUtils.java 2013-12-05
14:49:08 UTC (rev 18141)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/TestUtils.java 2013-12-05
14:50:42 UTC (rev 18142)
@@ -52,24 +52,15 @@
return defaultConfig;
}
- public static void cleanupClientConfig() throws Exception {
+ public static void registerClientConfigAndReload(ClientConfig config) {
ServerConfig sc = getServerConfig();
- ClientConfig defaultConfig =
sc.getClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG);
- if (defaultConfig == null) {
- throw new Exception("Missing AS client config '" +
ClientConfig.STANDARD_CLIENT_CONFIG + "'!");
- }
- Map<String, String> props = defaultConfig.getProperties();
- if (props == null || props.isEmpty()) {
- throw new Exception("'" + ClientConfig.STANDARD_CLIENT_CONFIG +
"' property set is already empty!");
- }
- props.clear();
+ sc.registerClientConfig(config);
+ sc.reloadClientConfigs();
}
public static void addTestCaseClientConfiguration(String testConfigName) {
ClientConfig config = new ClientConfig(testConfigName, null, null,
Collections.singletonMap("propT", "valueT"), null);
- ServerConfig sc = getServerConfig();
- sc.registerClientConfig(config);
- sc.reloadClientConfigs();
+ registerClientConfigAndReload(config);
}
public static void removeTestCaseClientConfiguration(String testConfigName) {