Author: dkulp
Date: Tue Aug 30 20:56:35 2011
New Revision: 1163374
URL: http://svn.apache.org/viewvc?rev=1163374&view=rev
Log:
[CXF-3593] Provide a config setting to require a wsdl
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=1163374&r1=1163373&r2=1163374&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Tue Aug
30 20:56:35 2011
@@ -244,6 +244,10 @@ public class CXFBusImpl extends Abstract
}
public void setProperty(String s, Object o) {
- properties.put(s, o);
+ if (o == null) {
+ properties.remove(s);
+ } else {
+ properties.put(s, o);
+ }
}
}
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1163374&r1=1163373&r2=1163374&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Tue Aug 30 20:56:35 2011
@@ -401,6 +401,12 @@ public class ReflectionServiceFactoryBea
}
protected void buildServiceFromClass() {
+ Object o = getBus().getProperty("requireExplicitContractLocation");
+ if (o != null
+ && ("true".equals(o) || Boolean.TRUE.equals(o))) {
+ throw new ServiceConstructionException(new
Message("NO_WSDL_PROVIDED", LOG,
+
getServiceClass().getName()));
+ }
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Creating Service " + getServiceQName() + " from class "
+ getServiceClass().getName());
}
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties?rev=1163374&r1=1163373&r2=1163374&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
Tue Aug 30 20:56:35 2011
@@ -33,4 +33,4 @@ INTRACTABLE_PART= Message part {0} of Me
JAXWS_ANNOTATION_FOUND=A JAX-WS Annotation was found on {0} while using the
Simple frontend. For better results, use the JAX-WS frontend.
XSD_VALIDATION_ERROR= Error in W3C XML Schema associated with service: {0}
COULD_NOT_UNWRAP=Could not unwrap Operation {0} to match method "{1}"
-
+NO_WSDL_PROVIDED=WSDL is required for services created from class {0}, but no
WSDL location specified.
Modified:
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java?rev=1163374&r1=1163373&r2=1163374&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
Tue Aug 30 20:56:35 2011
@@ -132,7 +132,19 @@ public class ReflectionServiceFactoryTes
return serviceFactory.create();
}
-
+ @Test
+ public void testWSDLRequired() throws Exception {
+
+ getBus().setProperty("requireExplicitContractLocation", Boolean.TRUE);
+ try {
+ createService(true);
+ fail("Should have failed");
+ } catch (ServiceConstructionException ex) {
+ getBus().setProperty("requireExplicitContractLocation", null);
+ }
+
+
+ }
@Test
public void testServerFactoryBean() throws Exception {
Service service = createService(true);