You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2006/11/14 15:06:14 UTC

svn commit: r474793 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/phase/ common/common/src/main/java/org/apache/cxf/jaxb/ common/common/src/test/java/org/apache/cxf/jaxb/ rt/core/src/main/java...

Author: mmao
Date: Tue Nov 14 06:06:13 2006
New Revision: 474793

URL: http://svn.apache.org/viewvc?view=rev&rev=474793
Log:
CXF-182
Port schema-validation system test from celtix/pre_apache.
* Fixed the typo in DefaultValuePlugin which cause the tools/xjc failed with weird exception.
* Using a different property file in common utility module which has the conflicts in databinding/jaxb
  Should check all the same problems.
* Added the client side schema validation
  Added schema into data writer 
* Trying to add the exception into the exchange, so the returned message can check the exchange for exceptions.

Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/CommonUtilityMessages.properties
    incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/
      - copied from r474704, incubator/cxf/tags/celtix/pre_apache/systests/src/test/java/org/objectweb/celtix/systest/schema_validation/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml   (with props)
    incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/Messages.properties
Removed:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/Messages.properties
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/celtix-config.xml
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriterFactory.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
    incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriterFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriterFactory.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriterFactory.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriterFactory.java Tue Nov 14 06:06:13 2006
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.databinding;
 
+import javax.xml.validation.Schema;
+
 
 //REVISIT - need to move the Reader/Writer stuff, also probably 
 //need the MessageInfo/OperationInfo as a param 
@@ -27,5 +29,6 @@
     Class<?>[] getSupportedFormats();
     
     <T> DataWriter<T> createWriter(Class<T> cls);
+    void setSchema(Schema s);
 }
 

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Tue Nov 14 06:06:13 2006
@@ -161,6 +161,9 @@
                         LogUtils.log(LOG, Level.INFO, "Interceptor has thrown exception, unwinding now", ex);
                     }
                     message.setContent(Exception.class, ex);
+                    if (message.getExchange() != null) {
+                        message.getExchange().put(Exception.class, ex);
+                    }                    
                     unwind(message);
                     
                     if (faultObserver != null) {

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/CommonUtilityMessages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/CommonUtilityMessages.properties?view=auto&rev=474793
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/CommonUtilityMessages.properties (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/CommonUtilityMessages.properties Tue Nov 14 06:06:13 2006
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+DATATYPE_FACTORY_INSTANTIATION_EXC = Failed to create DatatypeFactory.

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/DatatypeFactory.java Tue Nov 14 06:06:13 2006
@@ -34,7 +34,7 @@
 public final class DatatypeFactory {
     
     public static final Duration PT0S;
-    private static final Logger LOG = LogUtils.getL7dLogger(DatatypeFactory.class);
+    private static final Logger LOG = LogUtils.getL7dLogger(DatatypeFactory.class, "CommonUtilityMessages");
    
 
     static {

Added: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java?view=auto&rev=474793
==============================================================================
--- incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java (added)
+++ incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java Tue Nov 14 06:06:13 2006
@@ -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.jaxb;
+
+
+import junit.framework.TestCase;
+
+public class DatatypeFactoryTest extends TestCase {
+    
+    public void testNewFactory() throws Exception {
+        try {
+            Class.forName("org.apache.cxf.jaxb.DatatypeFactory");
+            assertEquals("PT0S", DatatypeFactory.PT0S.toString());
+        } catch (Exception e) {
+            fail("There should have no excpetion during loading of the class DatatypeFactory");
+        }
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue Nov 14 06:06:13 2006
@@ -133,6 +133,10 @@
         if (ex != null) {
             throw ex;
         }
+        ex = message.getExchange().get(Exception.class);
+        if (ex != null) {
+            throw ex;
+        }
         
         // Wait for a response if we need to
         if (!oi.getOperationInfo().isOneWay()) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java Tue Nov 14 06:06:13 2006
@@ -22,6 +22,7 @@
 import java.util.ResourceBundle;
 
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.validation.Schema;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataWriter;
@@ -30,6 +31,7 @@
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.ServiceModelUtil;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 public abstract class AbstractOutDatabindingInterceptor extends AbstractPhaseInterceptor<Message> {
     private static final ResourceBundle BUNDLE = BundleUtils
@@ -42,7 +44,7 @@
     protected DataWriter getDataWriter(Message message, Class<?> output) {
         Service service = ServiceModelUtil.getService(message.getExchange());
         DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-
+        setSchemaOutMessage(service, message);
         DataWriter dataWriter = null;
         for (Class<?> cls : factory.getSupportedFormats()) {
             if (cls == output) {
@@ -63,7 +65,7 @@
         
         Service service = ServiceModelUtil.getService(message.getExchange());
         DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-
+        setSchemaOutMessage(service, message);
         DataWriter<Message> dataWriter = null;
         for (Class<?> cls : factory.getSupportedFormats()) {
             if (cls == Message.class) {
@@ -83,7 +85,7 @@
     protected DataWriter<XMLStreamWriter> getDataWriter(Message message) {
         Service service = ServiceModelUtil.getService(message.getExchange());
         DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-
+        setSchemaOutMessage(service, message);
         DataWriter<XMLStreamWriter> dataWriter = null;
         for (Class<?> cls : factory.getSupportedFormats()) {
             if (cls == XMLStreamWriter.class) {
@@ -98,6 +100,14 @@
         }
 
         return dataWriter;
+    }
+    
+    private void setSchemaOutMessage(Service service, Message message) {
+        if (message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED) != null 
+                && Boolean.TRUE.equals(message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED))) {
+            Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfo());
+            service.getDataBinding().getDataWriterFactory().setSchema(schema);
+        }
     }
 
     protected XMLStreamWriter getXMLStreamWriter(Message message) {

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Tue Nov 14 06:06:13 2006
@@ -136,7 +136,14 @@
                 throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));
             }
         } catch (Exception ex) {
-            throw new Fault(new Message("MARSHAL_ERROR", BUNDLE), ex);
+            if (ex instanceof javax.xml.bind.MarshalException) {
+                javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
+                Message faultMessage = new Message("MARSHAL_ERROR",
+                                                   BUNDLE, marshalEx.getLinkedException().getMessage());
+                throw new Fault(faultMessage, ex); 
+            } else {
+                throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, ex.getMessage()), ex);
+            }                       
         }
     }
 
@@ -209,8 +216,8 @@
             } else {
                 throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));
             }
-        } catch (Exception ex) {
-            if (ex instanceof javax.xml.bind.UnmarshalException) {
+        } catch (Exception ex) {                        
+            if (ex instanceof javax.xml.bind.UnmarshalException) {                
                 javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;
                 throw new Fault(new Message("UNMARSHAL_ERROR", 
                                             BUNDLE, unmarshalEx.getLinkedException().getMessage()), ex); 

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Messages.properties Tue Nov 14 06:06:13 2006
@@ -21,7 +21,7 @@
 INIT_OBJ_CONTEXT_FAILED = ObjectMessageContext Intialisation Failed.
 SCHEMA_NOT_RESOLVED = Could not resolve URI: {0}
 UNKNOWN_SOURCE = Marshalling Error, unrecognized source {0}.
-MARSHAL_ERROR = Marshalling Error.
+MARSHAL_ERROR = Marshalling Error: {0}
 UNMARSHAL_ERROR = Unmarshalling Error : {0} 
 UNKNOWN_ELEMENT_NAME = Could not determine the element name for {0}.
 UNKNOWN_PACKAGE_NS = No package info found for class {0}. Cannot lookup default schema namespace.

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue Nov 14 06:06:13 2006
@@ -58,6 +58,7 @@
 import org.apache.cxf.jaxws.support.DummyImpl;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.AbstractBindingInfoFactoryBean;
 import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
@@ -238,6 +239,7 @@
 
         Service service = serviceFactory.create();
         configureObject(service);
+        service.put(Message.SCHEMA_VALIDATION_ENABLED, service.getEnableSchemaValidationForAllPort());
 
         QName pn = portName;
         ServiceInfo si = service.getServiceInfo();
@@ -271,7 +273,11 @@
         } catch (EndpointException e) {
             throw new WebServiceException(e);
         }
-        configureObject(jaxwsEndpoint);
+        configureObject(jaxwsEndpoint);        
+        
+        if (jaxwsEndpoint.getEnableSchemaValidation()) {
+            jaxwsEndpoint.put(Message.SCHEMA_VALIDATION_ENABLED, jaxwsEndpoint.getEnableSchemaValidation());
+        }
 
         Client client = new ClientImpl(bus, jaxwsEndpoint);
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java?view=diff&rev=474793&r1=474704&r2=474793
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java Tue Nov 14 06:06:13 2006
@@ -1,18 +1,37 @@
-package org.objectweb.celtix.systest.schema_validation;
+/**
+ * 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.systest.schema_validation;
 
 import java.io.Serializable;
 import java.util.List;
 
 import javax.jws.WebService;
 
-import org.objectweb.schema_validation.SchemaValidation;
-import org.objectweb.schema_validation.types.ComplexStruct;
-import org.objectweb.schema_validation.types.OccuringStruct;
+import org.apache.schema_validation.SchemaValidation;
+import org.apache.schema_validation.types.ComplexStruct;
+import org.apache.schema_validation.types.OccuringStruct;
 
 @WebService(serviceName = "SchemaValidationService", 
             portName = "SoapPort",
-            endpointInterface = "org.objectweb.schema_validation.SchemaValidation",
-            targetNamespace = "http://objectweb.org/schema_validation")
+            endpointInterface = "org.apache.schema_validation.SchemaValidation",
+            targetNamespace = "http://apache.org/schema_validation")
 public class SchemaValidationImpl implements SchemaValidation {
 
     public boolean setComplexStruct(ComplexStruct in) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java?view=diff&rev=474793&r1=474704&r2=474793
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java Tue Nov 14 06:06:13 2006
@@ -1,28 +1,46 @@
-package org.objectweb.celtix.systest.schema_validation;
+/**
+ * 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.systest.schema_validation;
 
 import java.io.Serializable;
 import java.net.URL;
 import java.util.List;
 
 import javax.xml.namespace.QName;
-import javax.xml.ws.ProtocolException;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.objectweb.celtix.systest.common.ClientServerSetupBase;
-import org.objectweb.celtix.systest.common.ClientServerTestBase;
-import org.objectweb.schema_validation.SchemaValidation;
-import org.objectweb.schema_validation.SchemaValidationService;
-import org.objectweb.schema_validation.types.ComplexStruct;
-import org.objectweb.schema_validation.types.OccuringStruct;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.systest.common.ClientServerSetupBase;
+import org.apache.cxf.systest.common.ClientServerTestBase;
+import org.apache.schema_validation.SchemaValidation;
+import org.apache.schema_validation.SchemaValidationService;
+import org.apache.schema_validation.types.ComplexStruct;
+import org.apache.schema_validation.types.OccuringStruct;
 
 public class ValidationClientServerTest extends ClientServerTestBase {
 
-    private final QName serviceName = new QName("http://objectweb.org/schema_validation",
-                                                "SchemaValidationService");    
-    private final QName portName = new QName("http://objectweb.org/schema_validation",
-                                             "SoapPort");
+    private final QName serviceName = new QName("http://apache.org/schema_validation",
+                                                "SchemaValidationService");
+    private final QName portName = new QName("http://apache.org/schema_validation", "SoapPort");
 
     public static Test suite() throws Exception {
         TestSuite suite = new TestSuite(ValidationClientServerTest.class);
@@ -30,12 +48,12 @@
             public void startServers() throws Exception {
                 assertTrue("server did not launch correctly", launchServer(ValidationServer.class));
             }
-            
+
             public void setUp() throws Exception {
                 // set up configuration to enable schema validation
-                URL url = getClass().getResource("celtix-config.xml"); 
+                URL url = getClass().getResource("cxf-config.xml");
                 assertNotNull("cannot find test resource", url);
-                configFileName = url.toString(); 
+                configFileName = url.toString();
                 super.setUp();
             }
         };
@@ -45,12 +63,13 @@
     // client and server with schema validation enabled/disabled...
     // Only tests client side validation enabled/server side disabled.
     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);
-        
+
         SchemaValidationService service = new SchemaValidationService(wsdl, serviceName);
         assertNotNull(service);
-        
+
         SchemaValidation validation = service.getPort(portName, SchemaValidation.class);
 
         ComplexStruct complexStruct = new ComplexStruct();
@@ -59,11 +78,14 @@
         // Client side validation should throw an exception.
         // complexStruct.setElem2("two");
         complexStruct.setElem3(3);
-        try {       
-            /*boolean result =*/ validation.setComplexStruct(complexStruct);
+        try {
+            /*boolean result =*/
+            validation.setComplexStruct(complexStruct);
             fail("Set ComplexStruct hould have thrown ProtocolException");
-        } catch (ProtocolException e) {
-            //System.out.println(e.getMessage()); 
+        } catch (Exception e) {
+            assertTrue(e instanceof Fault);
+            String expected = "'{\"http://apache.org/schema_validation/types\":elem2}' is expected.";
+            assertTrue(e.getMessage().indexOf(expected) != -1);
         }
 
         OccuringStruct occuringStruct = new OccuringStruct();
@@ -73,36 +95,45 @@
         floatIntStringList.add(new Integer(42));
         floatIntStringList.add(new Float(4.2f));
         floatIntStringList.add("Goofus and Gallant");
-        try {       
-            /*boolean result =*/ validation.setOccuringStruct(occuringStruct);
+        try {
+            /*boolean result =*/
+            validation.setOccuringStruct(occuringStruct);
             fail("Set OccuringStruct hould have thrown ProtocolException");
-        } catch (ProtocolException e) {
-            //System.out.println(e.getMessage());
+        } catch (Exception e) {
+            assertTrue(e instanceof Fault);
+            String expected = "'{\"http://apache.org/schema_validation/types\":varFloat}' is expected.";
+            assertTrue(e.getMessage().indexOf(expected) != -1);
         }
 
         try {
             // The server will attempt to return an invalid ComplexStruct
             // When validation is disabled on the server side, we'll get the
             // exception while unmarshalling the invalid response.
-            /*complexStruct =*/ validation.getComplexStruct("Hello");
-            fail("Get ComplexStruct should have thrown ProtocolException");
-        } catch (ProtocolException e) {
-            //System.out.println(e.getMessage()); 
+            /*complexStruct =*/
+            validation.getComplexStruct("Hello");
+            //fail("Get ComplexStruct should have thrown ProtocolException");
+        } catch (Exception e) {
+            assertTrue(e instanceof Fault);
+            String expected = "'{\"http://apache.org/schema_validation/types\":elem2}' is expected.";
+            assertTrue(e.getMessage().indexOf(expected) != -1);
         }
-        
+
         try {
             // The server will attempt to return an invalid OccuringStruct
             // When validation is disabled on the server side, we'll get the
             // exception while unmarshalling the invalid response.
-            /*occuringStruct =*/ validation.getOccuringStruct("World");
-            fail("Get OccuringStruct should have thrown ProtocolException");
-        } catch (ProtocolException e) {
-            //System.out.println(e.getMessage()); 
+            /*occuringStruct =*/
+            validation.getOccuringStruct("World");
+            //fail("Get OccuringStruct should have thrown ProtocolException");
+        } catch (Exception e) {
+            assertTrue(e instanceof Fault);
+            String expected = "'{\"http://apache.org/schema_validation/types\":elem2}' is expected.";
+            assertTrue(e.getMessage().indexOf(expected) != -1);
         }
-    } 
+    }
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(ValidationClientServerTest.class);
     }
-    
+
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java?view=diff&rev=474793&r1=474704&r2=474793
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java Tue Nov 14 06:06:13 2006
@@ -1,42 +1,61 @@
-package org.objectweb.celtix.systest.schema_validation;
+/**
+ * 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.systest.schema_validation;
 
 import java.net.URL;
 
 import javax.xml.ws.Endpoint;
 
-import org.objectweb.celtix.systest.common.TestServerBase;
+import org.apache.cxf.systest.common.TestServerBase;
 
 public class ValidationServer extends TestServerBase {
-    
+
     private String oldConfig;
-    
+
     public ValidationServer() {
-        oldConfig = System.getProperty("celtix.config.file");
-        URL url = getClass().getResource("celtix-config.xml"); 
+        oldConfig = System.getProperty("cxf.config.file.url");
+        URL url = getClass().getResource("cxf-config.xml");
         if (url != null) {
-            System.setProperty("celtix.config.file", url.toString());
+            System.setProperty("cxf.config.file.url", url.toString());
         }
     }
-    
-    protected void run()  {
+
+    protected void run() {
         Object implementor = new SchemaValidationImpl();
         String address = "http://localhost:9900/SoapContext/SoapPort";
         Endpoint.publish(address, implementor);
     }
-    
+
     public boolean stopInProcess() throws Exception {
-        System.setProperty("celtix.config.file", oldConfig);
+        System.setProperty("cxf.config.file.url", oldConfig);
         return super.stopInProcess();
     }
 
     public static void main(String[] args) {
-        try { 
-            ValidationServer s = new ValidationServer(); 
+        try {
+            ValidationServer s = new ValidationServer();
             s.start();
         } catch (Exception ex) {
             ex.printStackTrace();
             System.exit(-1);
-        } finally { 
+        } finally {
             System.out.println("done!");
         }
     }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml?view=auto&rev=474793
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml Tue Nov 14 06:06:13 2006
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="{http://apache.org/schema_validation}SchemaValidationService" abstract="true">
+	<property name="enableSchemaValidationForAllPort">
+	    <value>true</value>
+	</property>
+    </bean>
+
+    <bean id="{http://apache.org/schema_validation}SoapPort" abstract="true">
+	<property name="enableSchemaValidation">
+	    <value>true</value>
+	</property>
+    </bean>
+
+</beans>

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/cxf-config.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java?view=diff&rev=474793&r1=474792&r2=474793
==============================================================================
--- incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java (original)
+++ incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java Tue Nov 14 06:06:13 2006
@@ -61,7 +61,7 @@
  */
 public class DefaultValuePlugin extends Plugin {
     
-    private static final Logger LOG = LogUtils.getL7dLogger(DatatypeFactory.class);
+    private static final Logger LOG = LogUtils.getL7dLogger(DefaultValuePlugin.class);
     
     public DefaultValuePlugin() {
     }

Added: incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/Messages.properties?view=auto&rev=474793
==============================================================================
--- incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/Messages.properties (added)
+++ incubator/cxf/trunk/tools/xjc/dv/src/main/java/org/apache/cxf/xjc/dv/Messages.properties Tue Nov 14 06:06:13 2006
@@ -0,0 +1,20 @@
+#
+#
+#    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.
+#
+#