Author: dkulp
Date: Thu Aug 6 21:21:49 2009
New Revision: 801819
URL: http://svn.apache.org/viewvc?rev=801819&view=rev
Log:
Add a BUNCH of events from the factories and create a listener interface
to get the events.
Start defining some useful annotations. @SchemaValidation now works.
@WSDLDocumentation is started (lots more work needed).
May convert some of the other annotation processing to new framework
once I start nailing it down some more.
Added:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java
(with props)
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
(with props)
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
(with props)
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
(with props)
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
(with props)
Removed:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
cxf/trunk/rt/core/src/main/resources/META-INF/cxf/bus-extensions.xml
cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
Added:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java?rev=801819&view=auto
==============================================================================
---
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java
(added)
+++
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java
Thu Aug 6 21:21:49 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Enables SchemaValidation
+ */
+...@retention(RetentionPolicy.RUNTIME)
+...@target({ ElementType.TYPE })
+public @interface SchemaValidation {
+ boolean enabled() default true;
+}
+
Propchange:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/SchemaValidation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java?rev=801819&view=auto
==============================================================================
---
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
(added)
+++
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
Thu Aug 6 21:21:49 2009
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ *
+ */
+...@retention(RetentionPolicy.RUNTIME)
+...@target({ ElementType.TYPE })
+public @interface WSDLDocumentation {
+ String value();
+}
Propchange:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/api/src/main/java/org/apache/cxf/annotations/WSDLDocumentation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
(original)
+++
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
Thu Aug 6 21:21:49 2009
@@ -32,6 +32,15 @@
private AtomicReference<Map<String, Object>> propertyMap = new
AtomicReference<Map<String, Object>>();
private AtomicReference<Object[]> extensors = new
AtomicReference<Object[]>();
private Map<QName, Object> extensionAttributes;
+ private String documentation;
+
+
+ public String getDocumentation() {
+ return documentation;
+ }
+ public void setDocumentation(String s) {
+ documentation = s;
+ }
public Object getProperty(String name) {
if (null == propertyMap.get()) {
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
Thu Aug 6 21:21:49 2009
@@ -19,6 +19,11 @@
package org.apache.cxf.service.factory;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
import org.apache.cxf.Bus;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
@@ -30,9 +35,25 @@
private Bus bus;
private DataBinding dataBinding;
private Service service;
+ private List<FactoryBeanListener> listeners = new
LinkedList<FactoryBeanListener>();
+ private Map<String, Object> sessionState = new HashMap<String, Object>();
public abstract Service create();
-
+
+ /**
+ * Returns a map that is useful for ServiceFactoryBeanListener to store
state across
+ * events during processing.
+ */
+ public Map<String, Object> getSessionState() {
+ return sessionState;
+ }
+
+ public void sendEvent(FactoryBeanListener.Event ev, Object ... args) {
+ for (FactoryBeanListener l : listeners) {
+ l.handleEvent(ev, this, args);
+ }
+ }
+
protected void initializeDefaultInterceptors() {
service.getInInterceptors().add(new ServiceInvokerInterceptor());
service.getInInterceptors().add(new OutgoingChainInterceptor());
@@ -40,9 +61,10 @@
}
protected void initializeDataBindings() {
- dataBinding.initialize(getService());
+ getDataBinding().initialize(getService());
- service.setDataBinding(dataBinding);
+ service.setDataBinding(getDataBinding());
+ sendEvent(FactoryBeanListener.Event.DATABINDING_INITIALIZED,
dataBinding);
}
public Bus getBus() {
@@ -51,6 +73,10 @@
public void setBus(Bus bus) {
this.bus = bus;
+ FactoryBeanListenerManager m =
bus.getExtension(FactoryBeanListenerManager.class);
+ if (m != null) {
+ listeners.addAll(m.getListeners());
+ }
}
public DataBinding getDataBinding() {
Added:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=801819&view=auto
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
(added)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
Thu Aug 6 21:21:49 2009
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.service.factory;
+
+import org.apache.cxf.annotations.SchemaValidation;
+import org.apache.cxf.annotations.WSDLDocumentation;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.InterfaceInfo;
+
+/**
+ *
+ */
+public class AnnotationsFactoryBeanListener implements FactoryBeanListener {
+
+ /** {...@inheritdoc}*/
+ public void handleEvent(Event ev, AbstractServiceFactoryBean factory,
Object... args) {
+ switch (ev) {
+ case INTERFACE_CREATED: {
+ Class<?> cls = (Class<?>)args[1];
+ WSDLDocumentation doc = cls.getAnnotation(WSDLDocumentation.class);
+ if (doc != null) {
+ InterfaceInfo info = (InterfaceInfo)args[0];
+ info.setDocumentation(doc.value());
+ }
+ break;
+ }
+ case ENDPOINT_SELECTED: {
+ Class<?> cls = (Class<?>)args[2];
+ SchemaValidation val = cls.getAnnotation(SchemaValidation.class);
+ if (val != null && val.enabled()) {
+ ((Endpoint)args[1]).put(Message.SCHEMA_VALIDATION_ENABLED,
Boolean.TRUE);
+ }
+ break;
+ }
+ case SERVER_CREATED: {
+ Class<?> cls = (Class<?>)args[2];
+ SchemaValidation val = cls.getAnnotation(SchemaValidation.class);
+ if (val != null && val.enabled()) {
+
((Server)args[0]).getEndpoint().put(Message.SCHEMA_VALIDATION_ENABLED,
Boolean.TRUE);
+ }
+ WSDLDocumentation doc = cls.getAnnotation(WSDLDocumentation.class);
+ if (doc != null) {
+ ((Server)args[0]).getEndpoint().getService().getServiceInfos()
+ .get(0).setDocumentation(doc.value());
+ }
+ break;
+ }
+ default:
+ //do nothing
+ }
+ }
+
+}
Propchange:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java?rev=801819&view=auto
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
(added)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
Thu Aug 6 21:21:49 2009
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.service.factory;
+
+/**
+ *
+ */
+public interface FactoryBeanListener {
+ enum Event {
+ /**
+ * Event fired at the very start of processing. No parameters. Useful
+ * for setting up any state the listener may need to maintain.
+ */
+ START_CREATE,
+
+ /**
+ * Event fired at the very end of processing. One parameter is passed
+ * in which is the Service object that was created.
+ */
+ END_CREATE,
+
+ /**
+ * Called at the start of processing when it detects that the service
+ * is to be created based on a wsdl contract. One String parameter
+ * of the URL of the wsdl.
+ */
+ CREATE_FROM_WSDL,
+
+ /**
+ * Called at the start of processing when it detects that the service
+ * is to be created based on a Java class. One Class<?> parameter
+ * of the class that is being analyzed.
+ */
+ CREATE_FROM_CLASS,
+
+ /**
+ * Called after the wsdl is loaded/parsed. Single parameter of the
+ * WSS4J Definition of the WSDL.
+ */
+ WSDL_LOADED,
+
+ /**
+ * Called after the Service is set into the Factory after which the
getService()
+ * call will return a valid value. One parameter of the Service
object.
+ */
+ SERVICE_SET,
+
+
+ /**
+ * OperationInfo, Method
+ */
+ INTERFACE_OPERATION_BOUND,
+
+ /**
+ * OperationInfo, Method, MessageInfo
+ */
+ OPERATIONINFO_IN_MESSAGE_SET,
+ OPERATIONINFO_OUT_MESSAGE_SET,
+
+ /**
+ * OperationInfo, Class<? extends Throwable>, FaultInfo
+ */
+ OPERATIONINFO_FAULT,
+
+ /**
+ * InterfaceInfo, Class<?>
+ */
+ INTERFACE_CREATED,
+
+ /**
+ * DataBinding
+ */
+ DATABINDING_INITIALIZED,
+
+ /**
+ * EndpointInfo, Endpoint, Class
+ */
+ ENDPOINT_CREATED,
+
+ /**
+ * Server, targetObject, Class
+ */
+ SERVER_CREATED,
+
+ /**
+ * BindingInfo, BindingOperationInfo
+ */
+ BINDING_OPERATION_CREATED,
+
+ /**
+ * BindingInfo
+ */
+ BINDING_CREATED,
+
+ /**
+ * Endpoint, Client
+ */
+ CLIENT_CREATED,
+
+ /**
+ * EndpointInfo, Endpoint, Class
+ */
+ ENDPOINT_SELECTED,
+
+ /**
+ * EndpointInfo
+ */
+ ENDPOINTINFO_CREATED,
+
+ /**
+ * Class[], InvokationHandler, Proxy
+ */
+ PROXY_CREATED,
+ };
+
+
+ void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object ...
args);
+}
Propchange:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java?rev=801819&view=auto
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
(added)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
Thu Aug 6 21:21:49 2009
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.service.factory;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+
+/**
+ *
+ */
+public class FactoryBeanListenerManager {
+ List<FactoryBeanListener> listeners
+ = new CopyOnWriteArrayList<FactoryBeanListener>();
+
+ public FactoryBeanListenerManager() {
+ listeners.add(new AnnotationsFactoryBeanListener());
+ }
+
+ @Resource
+ public void setBus(Bus bus) {
+ bus.setExtension(this, FactoryBeanListenerManager.class);
+ }
+
+ public List<FactoryBeanListener> getListeners() {
+ return listeners;
+ }
+
+ public void addListener(FactoryBeanListener l) {
+ listeners.add(l);
+ }
+
+ public void removeListener(FactoryBeanListener l) {
+ listeners.remove(l);
+ }
+
+}
Propchange:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
Thu Aug 6 21:21:49 2009
@@ -44,6 +44,7 @@
import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.wsdl.Types;
+import javax.wsdl.WSDLElement;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.AttributeExtensible;
import javax.wsdl.extensions.ElementExtensible;
@@ -96,6 +97,7 @@
private int xsdCount;
private final Bus bus;
private final NSManager nsMan;
+ private Document docDoc;
/**
* Sets up the builder on a bus with a list of services.
@@ -220,6 +222,21 @@
return holder.getExtensors(ExtensibilityElement.class);
}
+ protected void addDocumentation(WSDLElement wsdlel, String text) {
+ if (text == null) {
+ return;
+ }
+ if (docDoc == null) {
+ try {
+ docDoc = XMLUtils.newDocument();
+ } catch (ParserConfigurationException e) {
+ //ignore
+ }
+ }
+ Element el = docDoc.createElementNS(WSDLConstants.NS_WSDL11,
"wsdl:documentation");
+ el.setTextContent(text);
+ wsdlel.setDocumentationElement(el);
+ }
protected void addExtensibilityElements(ElementExtensible
elementExtensible,
List<ExtensibilityElement> extensibilityElements) {
if (extensibilityElements != null) {
@@ -403,6 +420,7 @@
}
Service serv = definition.createService();
+ addDocumentation(serv, serviceInfo.getDocumentation());
serv.setQName(serviceInfo.getName());
addNamespace(serviceInfo.getName().getNamespaceURI());
definition.addService(serv);
@@ -428,6 +446,7 @@
if (portType == null) {
portType = def.createPortType();
portType.setQName(intf.getName());
+ addDocumentation(portType, intf.getDocumentation());
addNamespace(intf.getName().getNamespaceURI(), def);
portType.setUndefined(false);
buildPortTypeOperation(portType, intf.getOperations(), def);
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
Thu Aug 6 21:21:49 2009
@@ -98,6 +98,11 @@
public void setEndpointName(QName qn) {
endpointName = qn;
}
+
+ public Definition getDefinition() {
+ return definition;
+ }
+
public Service create() {
List<ServiceInfo> services;
Modified: cxf/trunk/rt/core/src/main/resources/META-INF/cxf/bus-extensions.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/bus-extensions.xml?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/resources/META-INF/cxf/bus-extensions.xml
(original)
+++ cxf/trunk/rt/core/src/main/resources/META-INF/cxf/bus-extensions.xml Thu
Aug 6 21:21:49 2009
@@ -43,5 +43,6 @@
interface="org.apache.cxf.headers.HeaderManager"/>
<extension class="org.apache.cxf.catalog.OASISCatalogManager"
interface="org.apache.cxf.catalog.OASISCatalogManager"/>
+ <extension
class="org.apache.cxf.service.factory.FactoryBeanListenerManager"/>
</extensions>
Modified: cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Thu Aug 6
21:21:49 2009
@@ -122,7 +122,9 @@
<bean id="org.apache.cxf.catalog.OASISCatalogManager"
class="org.apache.cxf.catalog.OASISCatalogManager">
<property name="bus" ref="cxf"/>
</bean>
-
+ <bean id="org.apache.cxf.service.factory.FactoryBeanListenerManager"
class="org.apache.cxf.service.factory.FactoryBeanListenerManager">
+ <property name="bus" ref="cxf"/>
+ </bean>
<bean id="org.apache.cxf.endpoint.ServiceContractResolverRegistry"
class="org.apache.cxf.endpoint.ServiceContractResolverRegistryImpl">
<property name="bus" ref="cxf"/>
</bean>
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Thu Aug 6 21:21:49 2009
@@ -64,6 +64,7 @@
import org.apache.cxf.jaxws.WrapperClassGenerator;
import org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor;
import org.apache.cxf.service.factory.AbstractServiceConfiguration;
+import org.apache.cxf.service.factory.FactoryBeanListener;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.model.BindingInfo;
@@ -185,8 +186,10 @@
@Override
public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException {
- return new JaxWsEndpointImpl(getBus(), getService(), ei, implInfo,
wsFeatures,
+ Endpoint ep = new JaxWsEndpointImpl(getBus(), getService(), ei,
implInfo, wsFeatures,
this.getFeatures(), this.isFromWsdl());
+ sendEvent(FactoryBeanListener.Event.ENDPOINT_CREATED, ei, ep);
+ return ep;
}
@Override
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
Thu Aug 6 21:21:49 2009
@@ -35,6 +35,7 @@
import org.apache.cxf.interceptor.AnnotationInterceptors;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.factory.AbstractServiceConfiguration;
+import org.apache.cxf.service.factory.FactoryBeanListener;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.model.BindingInfo;
@@ -189,6 +190,8 @@
if (getOutFaultInterceptors() != null) {
ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
}
+ serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED,
ei, ep,
+ serviceFactory.getServiceClass());
return ep;
}
private void modifyTransportIdPerAddress(EndpointInfo ei) {
@@ -326,6 +329,8 @@
wsdlEndpointFactory.createPortExtensors(ei, service);
}
service.getServiceInfos().get(0).addEndpoint(ei);
+
+
serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINTINFO_CREATED, ei);
return ei;
}
@@ -399,7 +404,9 @@
for (BindingOperationInfo boi : inf.getOperations()) {
serviceFactory.updateBindingOperation(boi);
+
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED,
inf, boi);
}
+
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, inf);
return inf;
} catch (BusException ex) {
throw new ServiceConstructionException(
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
Thu Aug 6 21:21:49 2009
@@ -29,6 +29,7 @@
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.service.factory.FactoryBeanListener;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.factory.ServiceConstructionException;
@@ -64,6 +65,7 @@
protected void createClient(Endpoint ep) {
client = new ClientImpl(getBus(), ep, getConduitSelector());
+
this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED,
client, ep);
}
protected void applyFeatures() {
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
Thu Aug 6 21:21:49 2009
@@ -34,6 +34,7 @@
import org.apache.cxf.endpoint.ConduitSelector;
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
+import org.apache.cxf.service.factory.FactoryBeanListener;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
/**
@@ -115,10 +116,13 @@
ClientProxy handler = clientClientProxy(c);
+ Class classes[] = getImplementingClasses();
Object obj =
Proxy.newProxyInstance(clientFactoryBean.getServiceClass().getClassLoader(),
- getImplementingClasses(),
+ classes,
handler);
+
this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PROXY_CREATED,
+ classes, handler, obj);
return obj;
}
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Thu Aug 6 21:21:49 2009
@@ -43,6 +43,7 @@
import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.resource.ResourceManager;
import org.apache.cxf.resource.URIResolver;
+import org.apache.cxf.service.factory.FactoryBeanListener;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.invoker.BeanInvoker;
@@ -128,9 +129,6 @@
}
}
- if (start) {
- server.start();
- }
} catch (EndpointException e) {
throw new ServiceConstructionException(e);
} catch (BusException e) {
@@ -146,8 +144,17 @@
initializeAnnotationInterceptors(server.getEndpoint(),
getServiceClass());
}
-
applyFeatures();
+
+
getServiceFactory().sendEvent(FactoryBeanListener.Event.SERVER_CREATED, server,
serviceBean,
+ serviceBean == null
+ ? getServiceClass() == null
+ ?
getServiceFactory().getServiceClass() : getServiceClass()
+ :
ClassHelper.getRealClass(getServiceBean()));
+
+ if (start) {
+ server.start();
+ }
return server;
}
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=801819&r1=801818&r2=801819&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
Thu Aug 6 21:21:49 2009
@@ -86,6 +86,7 @@
import org.apache.cxf.service.Service;
import org.apache.cxf.service.ServiceImpl;
import org.apache.cxf.service.ServiceModelSchemaValidator;
+import org.apache.cxf.service.factory.FactoryBeanListener.Event;
import org.apache.cxf.service.invoker.FactoryInvoker;
import org.apache.cxf.service.invoker.Invoker;
import org.apache.cxf.service.invoker.SingletonFactory;
@@ -190,6 +191,7 @@
@Override
public Service create() {
+ sendEvent(Event.START_CREATE);
initializeServiceConfigurations();
initializeServiceModel();
@@ -215,7 +217,9 @@
fillInSchemaCrossreferences();
- return getService();
+ Service serv = getService();
+ sendEvent(Event.END_CREATE, serv);
+ return serv;
}
/**
@@ -292,7 +296,9 @@
}
public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException {
- return new EndpointImpl(getBus(), getService(), ei);
+ Endpoint ep = new EndpointImpl(getBus(), getService(), ei);
+ sendEvent(Event.ENDPOINT_CREATED, ei, ep, getServiceClass());
+ return ep;
}
protected void initializeServiceConfigurations() {
@@ -310,6 +316,8 @@
}
protected void buildServiceFromWSDL(String url) {
+ sendEvent(Event.CREATE_FROM_WSDL, url);
+
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Creating Service " + getServiceQName() + " from WSDL: "
+ url);
}
@@ -326,10 +334,12 @@
if (setEPName) {
factory.setEndpointName(getEndpointName(false));
}
+ sendEvent(Event.WSDL_LOADED, factory.getDefinition());
setService(factory.create());
-
setServiceProperties();
+ sendEvent(Event.SERVICE_SET, getService());
+
EndpointInfo epInfo = getEndpointInfo();
if (epInfo != null) {
serviceConfigurations.add(new
WSDLBasedServiceConfiguration(getEndpointInfo().getBinding()));
@@ -343,7 +353,7 @@
si.setProperty(EXTRA_CLASS, cls);
}
}
- getDataBinding().initialize(getService());
+ initializeDataBindings();
}
protected void buildServiceFromClass() {
@@ -355,6 +365,9 @@
if (Proxy.isProxyClass(this.getServiceClass())) {
LOG.log(Level.WARNING, "USING_PROXY_FOR_SERVICE",
getServiceClass());
}
+
+ sendEvent(Event.CREATE_FROM_CLASS, getServiceClass());
+
ServiceInfo serviceInfo = new ServiceInfo();
SchemaCollection col = serviceInfo.getXmlSchemaCollection();
col.getXmlSchemaCollection().setSchemaResolver(new
CatalogXmlSchemaURIResolver(this.getBus()));
@@ -362,12 +375,13 @@
ServiceImpl service = new ServiceImpl(serviceInfo);
setService(service);
-
setServiceProperties();
serviceInfo.setName(getServiceQName());
serviceInfo.setTargetNamespace(serviceInfo.getName().getNamespaceURI());
+ sendEvent(Event.SERVICE_SET, getService());
+
createInterface(serviceInfo);
@@ -377,8 +391,7 @@
si.setProperty(EXTRA_CLASS, wrapperClasses);
}
}
-
- getDataBinding().initialize(service);
+ initializeDataBindings();
boolean isWrapped = isWrapped() ||
hasWrappedMethods(serviceInfo.getInterface());
if (isWrapped) {
@@ -609,6 +622,7 @@
}
}
}
+ sendEvent(Event.INTERFACE_CREATED, intf, getServiceClass());
}
protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo
o, Method method) {
@@ -622,6 +636,7 @@
} else {
LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
}
+ sendEvent(Event.INTERFACE_OPERATION_BOUND, o, method);
}
/**
@@ -631,6 +646,7 @@
* @param method
*/
protected boolean initializeClassInfo(OperationInfo o, Method method,
List<String> paramOrder) {
+ OperationInfo origOp = o;
if (isWrapped(method)) {
if (o.getUnwrappedOperation() == null) {
//the "normal" algorithm didn't allow for unwrapping,
@@ -679,7 +695,7 @@
return false;
}
}
-
+ sendEvent(Event.OPERATIONINFO_IN_MESSAGE_SET, origOp, method,
origOp.getInput());
// Initialize return type
Class paramType = method.getReturnType();
Type genericType = method.getGenericReturnType();
@@ -688,6 +704,9 @@
&& !initializeParameter(o, method, -1, paramType, genericType)) {
return false;
}
+ if (origOp.hasOutput()) {
+ sendEvent(Event.OPERATIONINFO_OUT_MESSAGE_SET, origOp, method,
origOp.getOutput());
+ }
setFaultClassInfo(o, method);
return true;
@@ -779,6 +798,7 @@
&& name.getNamespaceURI().equals(ns)) {
fi.setProperty(Class.class.getName(), exClass);
mpi.setTypeClass(beanClass);
+ sendEvent(Event.OPERATIONINFO_FAULT, o, exClass, fi);
}
}
}
@@ -818,7 +838,7 @@
createOperation(serviceInfo, intf, m);
}
}
-
+ sendEvent(Event.INTERFACE_CREATED, intf, getServiceClass());
return intf;
}
@@ -870,6 +890,7 @@
bindOperation(op, m);
+ sendEvent(Event.INTERFACE_OPERATION_BOUND, op, m);
return op;
}
@@ -1385,7 +1406,8 @@
part.setIndex(j);
}
}
-
+ sendEvent(Event.OPERATIONINFO_IN_MESSAGE_SET, op, method, inMsg);
+
boolean hasOut = hasOutMessage(method);
if (hasOut) {
// Setup the output message
@@ -1458,6 +1480,7 @@
}
}
}
+ sendEvent(Event.OPERATIONINFO_OUT_MESSAGE_SET, op, method, outMsg);
}
//setting the parameterOrder that
@@ -1906,6 +1929,7 @@
.getSimpleName()));
mpi.setElementQName(faultName);
mpi.setTypeClass(beanClass);
+ sendEvent(Event.OPERATIONINFO_FAULT, op, exClass, fi);
return fi;
}
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Thu Aug 6 21:21:49 2009
@@ -49,6 +49,7 @@
import org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names;
import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.jaxb_element_test.JaxbElementTest;
@@ -73,6 +74,14 @@
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
launchServer(ServerMisc.class));
}
+
+ @Test
+ public void testWSDLDocs() throws Exception {
+ String s =
IOUtils.toString(this.getHttpConnection(ServerMisc.DOCLIT_CODEFIRST_URL +
"?wsdl")
+ .getInputStream());
+ assertTrue(s.contains("DocLitWrappedCodeFirstService impl"));
+ assertTrue(s.contains("DocLitWrappedCodeFirstService interface"));
+ }
@Test
public void testDocLitBare() throws Exception {
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
Thu Aug 6 21:21:49 2009
@@ -38,6 +38,7 @@
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
+import org.apache.cxf.annotations.WSDLDocumentation;
import org.apache.cxf.feature.Features;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.systest.jaxws.types.Bar;
@@ -49,6 +50,7 @@
//@Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
@Features(features = { "org.apache.cxf.transport.http.gzip.GZIPFeature",
"org.apache.cxf.feature.FastInfosetFeature" })
+...@wsdldocumentation("DocLitWrappedCodeFirstService interface")
public interface DocLitWrappedCodeFirstService {
@Oneway
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
Thu Aug 6 21:21:49 2009
@@ -29,6 +29,7 @@
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceContext;
+import org.apache.cxf.annotations.WSDLDocumentation;
import org.apache.cxf.feature.Features;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.Foo;
@@ -42,6 +43,7 @@
//@Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
@Features(features = { "org.apache.cxf.transport.http.gzip.GZIPFeature",
"org.apache.cxf.feature.FastInfosetFeature" })
+...@wsdldocumentation("DocLitWrappedCodeFirstService impl")
public class DocLitWrappedCodeFirstServiceImpl implements
DocLitWrappedCodeFirstService {
public static final String DATA[] = new String[] {"string1", "string2",
"string3"};
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
Thu Aug 6 21:21:49 2009
@@ -32,6 +32,7 @@
portName = "SoapPort",
endpointInterface =
"org.apache.schema_validation.SchemaValidation",
targetNamespace = "http://apache.org/schema_validation")
[email protected]
public class SchemaValidationImpl implements SchemaValidation {
public boolean setComplexStruct(ComplexStruct in) {
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
Thu Aug 6 21:21:49 2009
@@ -24,8 +24,10 @@
import java.util.List;
import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceException;
+import org.apache.cxf.message.Message;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.schema_validation.SchemaValidation;
import org.apache.schema_validation.SchemaValidationService;
@@ -43,12 +45,7 @@
@BeforeClass
public static void startservers() throws Exception {
- // set up configuration to enable schema validation
- URL url =
ValidationClientServerTest.class.getResource("cxf-config.xml");
- assertNotNull("cannot find test resource", url);
- defaultConfigFileName = url.toString();
-
- assertTrue("server did not launch correctly",
launchServer(ValidationServer.class));
+ assertTrue("server did not launch correctly",
launchServer(ValidationServer.class, true));
}
// TODO : Change this test so that we test the combinations of
@@ -56,7 +53,6 @@
// Only tests client side validation enabled/server side disabled.
@Test
public void testSchemaValidation() throws Exception {
- System.setProperty("cxf.config.file.url",
getClass().getResource("cxf-config.xml").toString());
URL wsdl = getClass().getResource("/wsdl/schema_validation.wsdl");
assertNotNull(wsdl);
@@ -64,6 +60,8 @@
assertNotNull(service);
SchemaValidation validation = service.getPort(portName,
SchemaValidation.class);
+ ((BindingProvider)validation).getRequestContext()
+ .put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
ComplexStruct complexStruct = new ComplexStruct();
complexStruct.setElem1("one");
@@ -74,7 +72,7 @@
try {
/*boolean result =*/
validation.setComplexStruct(complexStruct);
- fail("Set ComplexStruct hould have thrown ProtocolException");
+ fail("Set ComplexStruct should have thrown ProtocolException");
} catch (WebServiceException e) {
String expected =
"'{\"http://apache.org/schema_validation/types\":elem2}' is expected.";
assertTrue(e.getMessage(), e.getMessage().indexOf(expected) != -1);
@@ -90,11 +88,13 @@
try {
/*boolean result =*/
validation.setOccuringStruct(occuringStruct);
- fail("Set OccuringStruct hould have thrown ProtocolException");
+ fail("Set OccuringStruct should have thrown ProtocolException");
} catch (WebServiceException e) {
String expected =
"'{\"http://apache.org/schema_validation/types\":varFloat}' is expected.";
assertTrue(e.getMessage().indexOf(expected) != -1);
}
+ ((BindingProvider)validation).getRequestContext()
+ .put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
try {
// The server will attempt to return an invalid ComplexStruct
@@ -109,6 +109,8 @@
e.getMessage().indexOf(expected) != -1);
}
+ ((BindingProvider)validation).getRequestContext()
+ .put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
try {
// The server will attempt to return an invalid OccuringStruct
// When validation is disabled on the server side, we'll get the
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java?rev=801819&r1=801818&r2=801819&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
Thu Aug 6 21:21:49 2009
@@ -19,7 +19,6 @@
package org.apache.cxf.systest.schema_validation;
-import java.net.URL;
import javax.xml.ws.Endpoint;
@@ -27,14 +26,7 @@
public class ValidationServer extends AbstractBusTestServerBase {
- private String oldConfig;
-
public ValidationServer() {
- oldConfig = System.getProperty("cxf.config.file.url");
- URL url = getClass().getResource("cxf-config.xml");
- if (url != null) {
- System.setProperty("cxf.config.file.url", url.toString());
- }
}
protected void run() {
@@ -43,12 +35,7 @@
Endpoint.publish(address, implementor);
}
- public boolean stopInProcess() throws Exception {
- if (oldConfig != null) {
- System.setProperty("cxf.config.file.url", oldConfig);
- }
- return super.stopInProcess();
- }
+
public static void main(String[] args) {
try {