Author: asoldano
Date: 2013-12-05 11:09:03 -0500 (Thu, 05 Dec 2013)
New Revision: 18144
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/Helper.java
Log:
[JBWS-3708] Restoring testcase
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java 2013-12-05
15:21:45 UTC (rev 18143)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java 2013-12-05
16:09:03 UTC (rev 18144)
@@ -35,7 +35,6 @@
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.junit.Ignore;
/**
* A testcase for verifying default schema validation configured
@@ -43,7 +42,6 @@
*
* @author alessio.soldano(a)jboss.com
*/
-@Ignore(value = "[JBWS-3708] FIXME: refactor testcase")
public class DefaultSchemaValidationTestCaseForked extends JBossWSTest
{
public static Test suite()
Modified:
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/Helper.java
===================================================================
---
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/Helper.java 2013-12-05
15:21:45 UTC (rev 18143)
+++
stack/cxf/branches/JBWS-3739/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/Helper.java 2013-12-05
16:09:03 UTC (rev 18144)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.jaxws.samples.schemavalidation;
import java.net.URL;
+import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -47,6 +48,8 @@
{
private String address;
+ private static final EndpointConfig defaultEndpointConfig =
getServerConfig().getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
+
public boolean testDefaultClientValidation() throws Exception
{
// first verify schema validation is not enabled yet: a wsdl with schema
restrictions is used on client side,
@@ -68,10 +71,11 @@
return false;
}
+ final ClientConfig defClientConfig =
(ClientConfig)getAndVerifyDefaultConfiguration(true);
// then modify default conf to enable default client schema validation
try
{
- modifyDefaultClientConfiguration(getAndVerifyDefaultConfiguration(true));
+ modifyDefaultConfiguration(true);
service = Service.create(wsdlURL, serviceName);
proxy = (Hello) service.getPort(portName, Hello.class);
@@ -94,18 +98,19 @@
finally
{
// -- restore default conf --
- cleanupConfig(true);
+ registerClientConfigAndReload(defClientConfig);
// --
}
}
public boolean enableDefaultEndpointSchemaValidation() throws Exception {
- modifyDefaultClientConfiguration(getAndVerifyDefaultConfiguration(false));
+ getAndVerifyDefaultConfiguration(false);
+ modifyDefaultConfiguration(false);
return true;
}
public boolean disableDefaultEndpointSchemaValidation() throws Exception {
- cleanupConfig(false);
+ registerEndpointConfigAndReload(defaultEndpointConfig);
return true;
}
@@ -115,10 +120,9 @@
this.address = address;
}
- protected static AbstractCommonConfig getAndVerifyDefaultConfiguration(boolean client)
throws Exception {
- ServerConfig sc = getServerConfig();
+ protected AbstractCommonConfig getAndVerifyDefaultConfiguration(boolean client) throws
Exception {
final String DEFCFG = client ? ClientConfig.STANDARD_CLIENT_CONFIG :
EndpointConfig.STANDARD_ENDPOINT_CONFIG;
- final AbstractCommonConfig defaultConfig = client ? sc.getClientConfig(DEFCFG) :
sc.getEndpointConfig(DEFCFG);
+ final AbstractCommonConfig defaultConfig = client ?
getServerConfig().getClientConfig(DEFCFG) : defaultEndpointConfig;
if (defaultConfig == null) {
throw new Exception("Missing AS config '" + DEFCFG +
"'!");
}
@@ -129,25 +133,28 @@
return defaultConfig;
}
- protected static void modifyDefaultClientConfiguration(AbstractCommonConfig
defaultConfig) {
- //TODO
-// defaultConfig.setProperty("schema-validation-enabled",
"true");
+ protected static void modifyDefaultConfiguration(final boolean client) {
+ final Map<String, String> props = new HashMap<String, String>();
+ props.put("schema-validation-enabled", "true");
+ if (client) {
+ registerClientConfigAndReload(new
ClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG, null, null, props, null));
+ } else {
+ registerEndpointConfigAndReload(new
EndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG, null, null, props, null));
+ }
}
- protected static void cleanupConfig(boolean client) throws Exception {
+ protected static void registerClientConfigAndReload(ClientConfig config) {
ServerConfig sc = getServerConfig();
- final String DEFCFG = client ? ClientConfig.STANDARD_CLIENT_CONFIG :
EndpointConfig.STANDARD_ENDPOINT_CONFIG;
- final AbstractCommonConfig defaultConfig = client ? sc.getClientConfig(DEFCFG) :
sc.getEndpointConfig(DEFCFG);
- if (defaultConfig == null) {
- throw new Exception("Missing AS config '" + DEFCFG +
"'!");
- }
- Map<String, String> props = defaultConfig.getProperties();
- if (props == null || props.isEmpty()) {
- throw new Exception("'" + DEFCFG + "' is already
empty!");
- }
- props.clear();
+ sc.registerClientConfig(config);
+ sc.reloadClientConfigs();
}
+ protected static void registerEndpointConfigAndReload(EndpointConfig config) {
+ ServerConfig sc = getServerConfig();
+ sc.registerEndpointConfig(config);
+ sc.reloadEndpointConfigs();
+ }
+
private static ServerConfig getServerConfig()
{
final ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
Show replies by date