You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2007/10/18 22:14:49 UTC

svn commit: r586116 - in /incubator/cxf/trunk: buildtools/src/main/resources/ rt/core/src/main/java/org/apache/cxf/test/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ systests/ systests/src/test/generated/ systests/src/test/generated/org/ syst...

Author: bimargulies
Date: Thu Oct 18 13:14:46 2007
New Revision: 586116

URL: http://svn.apache.org/viewvc?rev=586116&view=rev
Log:
1) Refactor the AbstractCXFTest to move common utilities to a
new class where they can be used by tests that can't inherit from
AbstractCXFTest, like tests that use the Spring structure.

2) fix CXF-1118 by filtering the Exception object fields to only 
marshall public, non-static fields.

Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
    incubator/cxf/trunk/systests/src/test/generated/
    incubator/cxf/trunk/systests/src/test/generated/org/
    incubator/cxf/trunk/systests/src/test/generated/org/apache/
    incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/
    incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/
    incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/
    incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/
    incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java   (with props)
Modified:
    incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    incubator/cxf/trunk/systests/pom.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java

Modified: incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml (original)
+++ incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml Thu Oct 18 13:14:46 2007
@@ -44,7 +44,8 @@
     <!--<module name="StrictDuplicateCode"/>-->
 
     <module name="TreeWalker">
-
+ 	    <!-- Enable FileContentsHolder to allow us to in turn turn on suppression comments -->
+        <module name="FileContentsHolder"/>
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
         <!--
@@ -283,5 +284,5 @@
         </module>
         <!--<module name="RequiredRegexp">-->
     </module>
-
+    <module name="SuppressionCommentFilter"/>
 </module>

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java Thu Oct 18 13:14:46 2007
@@ -19,73 +19,45 @@
 
 package org.apache.cxf.test;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
 import java.io.Reader;
-import java.util.HashMap;
 import java.util.Map;
 
-import javax.wsdl.Definition;
 import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import org.xml.sax.SAXParseException;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.ConduitInitiatorManager;
-import org.apache.cxf.transport.MessageObserver;
-import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 
+
 /**
  * A basic test case meant for helping users unit test their services.
  */
 public class AbstractCXFTest extends Assert {
     
-    private static String basedirPath;
-    
+    protected TestUtilities testUtilities;
     protected Bus bus;
-    /**
-     * Namespaces for the XPath expressions.
-     */
-    private Map<String, String> namespaces = new HashMap<String, String>();
-
+    
+    protected AbstractCXFTest() {
+        testUtilities = new TestUtilities(getClass());
+        testUtilities.addDefaultNamespaces();
+    }
     
     @Before
     public void setUpBus() throws Exception {
         if (bus == null) {
             bus = createBus();
-            
-            addNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/");
-            addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
-            addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
-            addNamespace("wsdlsoap", "http://schemas.xmlsoap.org/wsdl/soap/");
-            addNamespace("soap", "http://schemas.xmlsoap.org/soap/");
-            addNamespace("soap12env", "http://www.w3.org/2003/05/soap-envelope");        
-            addNamespace("xml", "http://www.w3.org/XML/1998/namespace");
+            testUtilities.setBus(bus);
         }
     }
     
@@ -110,50 +82,13 @@
     protected byte[] invokeBytes(String address, 
                                  String transport,
                                  String message) throws Exception {
-        EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
-        ei.setAddress(address);
-
-        ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class);
-        ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport);
-        Conduit conduit = conduitInit.getConduit(ei);
-
-        TestMessageObserver obs = new TestMessageObserver();
-        conduit.setMessageObserver(obs);
-        
-        Message m = new MessageImpl();
-        conduit.prepare(m);
-
-        OutputStream os = m.getContent(OutputStream.class);
-        InputStream is = getResourceAsStream(message);
-        if (is == null) {
-            throw new RuntimeException("Could not find resource " + message);
-        }
-        
-        IOUtils.copy(is, os);
-
-        // TODO: shouldn't have to do this. IO caching needs cleaning
-        // up or possibly removal...
-        os.flush();
-        is.close();
-        os.close();
-        
-        byte[] bs = obs.getResponseStream().toByteArray();
-        
-        return bs;
+        return testUtilities.invokeBytes(address, transport, message);
     }
     
     protected Node invoke(String address, 
                           String transport,
                           String message) throws Exception {
-        byte[] bs = invokeBytes(address, transport, message);
-        
-        ByteArrayInputStream input = new ByteArrayInputStream(bs);
-        try {
-            return DOMUtils.readXml(input);
-        } catch (SAXParseException e) {
-            throw new IllegalStateException("Could not parse message:\n" 
-                                            + new String(bs));
-        }
+        return testUtilities.invoke(address, transport, message);
     }
 
     /**
@@ -163,7 +98,7 @@
      * @throws Exception 
      */
     public NodeList assertValid(String xpath, Node node) throws Exception {
-        return XPathAssert.assertValid(xpath, node, namespaces);
+        return testUtilities.assertValid(xpath, node);
     }
 
     /**
@@ -172,11 +107,11 @@
      * @param xpath
      */
     public NodeList assertInvalid(String xpath, Node node) throws Exception {
-        return XPathAssert.assertInvalid(xpath, node, namespaces);
+        return testUtilities.assertInvalid(xpath, node);
     }
 
     /**
-     * Asser that the text of the xpath node retrieved is equal to the value
+     * Assert that the text of the xpath node retrieved is equal to the value
      * specified.
      * 
      * @param xpath
@@ -184,11 +119,16 @@
      * @param node
      */
     public void assertXPathEquals(String xpath, String value, Node node) throws Exception {
-        XPathAssert.assertXPathEquals(xpath, value, node, namespaces);
+        testUtilities.assertXPathEquals(xpath, value, node);
     }
 
+    /**
+     * Assert that this node is not a SOAP fault part.
+     * @param node
+     * @throws Exception
+     */
     public void assertNoFault(Node node) throws Exception {
-        XPathAssert.assertNoFault(node);
+        testUtilities.assertNoFault(node);
     }
     
     /**
@@ -198,86 +138,37 @@
      * @param uri The namespace uri.
      */
     public void addNamespace(String ns, String uri) {
-        namespaces.put(ns, uri);
+        testUtilities.addNamespace(ns, uri);
     }
 
     public Map<String, String> getNamespaces() {
-        return namespaces;
+        return testUtilities.getNamespaces();
     }
 
     protected InputStream getResourceAsStream(String resource) {
-        return getClass().getResourceAsStream(resource);
+        return testUtilities.getResourceAsStream(resource);
     }
 
     protected Reader getResourceAsReader(String resource) {
-        return new InputStreamReader(getResourceAsStream(resource));
+        return testUtilities.getResourceAsReader(resource);
     }
 
     public File getTestFile(String relativePath) {
-        return new File(getBasedir(), relativePath);
+        return testUtilities.getTestFile(relativePath);
     }
 
     public static String getBasedir() {
-        if (basedirPath != null) {
-            return basedirPath;
-        }
-
-        basedirPath = System.getProperty("basedir");
-
-        if (basedirPath == null) {
-            basedirPath = new File("").getAbsolutePath();
-        }
-
-        return basedirPath;
+        return TestUtilities.getBasedir();
     }
 
     protected Document getWSDLDocument(Server server) throws WSDLException {
-        Service service = server.getEndpoint().getService();
-        
-        ServiceWSDLBuilder wsdlBuilder = 
-            new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0));
-        wsdlBuilder.setUseSchemaImports(false);
-        Definition definition = wsdlBuilder.build();
-        WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
-        
-        return writer.getDocument(definition);
+        return testUtilities.getWSDLDocument(server);
     }
     
-    public static class TestMessageObserver implements MessageObserver {
-        ByteArrayOutputStream response = new ByteArrayOutputStream();
-        boolean written;
-        String contentType;
-        
-        public ByteArrayOutputStream getResponseStream() throws Exception {
-            synchronized (this) {
-                if (!written) {
-                    wait(1000000000);
-                }
-            }
-            return response;
-        }
-        
-        public String getResponseContentType() {
-            return contentType;
-        }
+    public static class TestMessageObserver extends TestUtilities.TestMessageObserver {
 
-        public void onMessage(Message message) {
-            try {
-                contentType = (String) message.get(Message.CONTENT_TYPE);
-                InputStream is = message.getContent(InputStream.class);
-                IOUtils.copy(is, response);
-                
-                is.close();
-                response.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-                fail();
-            } finally {
-                synchronized (this) {
-                    written = true;
-                    notifyAll();
-                }
-            }
+        public TestMessageObserver() {
+            super();
         }
     }
 }

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java?rev=586116&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java Thu Oct 18 13:14:46 2007
@@ -0,0 +1,318 @@
+/**
+ * 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.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.xml.sax.SAXParseException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.test.AbstractCXFTest.TestMessageObserver;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+
+/**
+ * This class provides unit test support for tests that look at generated WSDL contents. 
+ */
+public class TestUtilities {
+    
+    private static String basedirPath;
+    protected Bus bus;
+    protected Class<?> classpathAnchor;
+
+    /**
+     * Namespaces for the XPath expressions.
+     */
+    private Map<String, String> namespaces = new HashMap<String, String>();
+    
+    /**
+     * This class provides utilities to several conflicting inheritance stacks of test
+     * support. Thus, it can't be a base class, and so can't use getClass() to find resources.
+     * Users should pass getClass() to this constructor instead.
+     * @param classpathReference
+     */
+    public TestUtilities(Class<?> classpathReference) {
+        classpathAnchor = classpathReference;
+    }
+    
+    public void addDefaultNamespaces() {
+        addNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/");
+        addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
+        addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+        addNamespace("wsdlsoap", "http://schemas.xmlsoap.org/wsdl/soap/");
+        addNamespace("soap", "http://schemas.xmlsoap.org/soap/");
+        addNamespace("soap12env", "http://www.w3.org/2003/05/soap-envelope");        
+        addNamespace("xml", "http://www.w3.org/XML/1998/namespace");
+    }
+    
+    /**
+     * Assert that the following XPath query selects one or more nodes.
+     * 
+     * @param xpath
+     * @throws Exception 
+     */
+    public NodeList assertValid(String xpath, Node node) throws Exception {
+        return XPathAssert.assertValid(xpath, node, namespaces);
+    }
+
+    /**
+     * Assert that the following XPath query selects no nodes.
+     * 
+     * @param xpath
+     */
+    public NodeList assertInvalid(String xpath, Node node) throws Exception {
+        return XPathAssert.assertInvalid(xpath, node, namespaces);
+    }
+    
+    /**
+     * Assert that the text of the xpath node retrieved is equal to the value
+     * specified.
+     * 
+     * @param xpath
+     * @param value
+     * @param node
+     */
+    public void assertXPathEquals(String xpath, String value, Node node) throws Exception {
+        XPathAssert.assertXPathEquals(xpath, value, node, namespaces);
+    }
+
+    /**
+     * Assert that this node is not a Soap fault body.
+     * @param node
+     * @throws Exception
+     */
+    public void assertNoFault(Node node) throws Exception {
+        XPathAssert.assertNoFault(node);
+    }
+
+    public byte[] invokeBytes(String address, 
+                                 String transport,
+                                 String message) throws Exception {
+        EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
+        ei.setAddress(address);
+
+        ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class);
+        ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport);
+        Conduit conduit = conduitInit.getConduit(ei);
+
+        TestMessageObserver obs = new TestMessageObserver();
+        conduit.setMessageObserver(obs);
+        
+        Message m = new MessageImpl();
+        conduit.prepare(m);
+
+        OutputStream os = m.getContent(OutputStream.class);
+        InputStream is = getResourceAsStream(message);
+        if (is == null) {
+            throw new RuntimeException("Could not find resource " + message);
+        }
+        
+        IOUtils.copy(is, os);
+
+        // TODO: shouldn't have to do this. IO caching needs cleaning
+        // up or possibly removal...
+        os.flush();
+        is.close();
+        os.close();
+        
+        byte[] bs = obs.getResponseStream().toByteArray();
+        
+        return bs;
+    }
+    
+    public Node invoke(String address, 
+                          String transport,
+                          String message) throws Exception {
+        byte[] bs = invokeBytes(address, transport, message);
+        
+        ByteArrayInputStream input = new ByteArrayInputStream(bs);
+        try {
+            return DOMUtils.readXml(input);
+        } catch (SAXParseException e) {
+            throw new IllegalStateException("Could not parse message:\n" 
+                                            + new String(bs));
+        }
+    }
+    
+    public InputStream getResourceAsStream(String resource) {
+        return classpathAnchor.getResourceAsStream(resource);
+    }
+
+    public Reader getResourceAsReader(String resource) {
+        return new InputStreamReader(getResourceAsStream(resource));
+    }
+
+    public File getTestFile(String relativePath) {
+        return new File(getBasedir(), relativePath);
+    }
+
+    public static String getBasedir() {
+        if (basedirPath != null) {
+            return basedirPath;
+        }
+
+        basedirPath = System.getProperty("basedir");
+
+        if (basedirPath == null) {
+            basedirPath = new File("").getAbsolutePath();
+        }
+
+        return basedirPath;
+    }
+
+    /**
+     * Return a DOM tree for the WSDL for a server. 
+     * @param server the server.
+     * @return the DOM tree.
+     * @throws WSDLException
+     */
+    public Document getWSDLDocument(Server server) throws WSDLException {
+        Definition definition = getWSDLDefinition(server);
+        WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+        return writer.getDocument(definition);
+    }
+    
+    /**
+     * Return a WSDL definition model for a server.
+     * @param server the server. 
+     * @return the definition.
+     * @throws WSDLException
+     */
+    public Definition getWSDLDefinition(Server server) throws WSDLException {
+        Service service = server.getEndpoint().getService();
+        
+        ServiceWSDLBuilder wsdlBuilder = 
+            new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0));
+        wsdlBuilder.setUseSchemaImports(false);
+        return wsdlBuilder.build();
+    }
+    
+    public Server getServerForService(QName serviceName) throws WSDLException {
+        ServerRegistry svrMan = bus.getExtension(ServerRegistry.class);
+        for (Server s : svrMan.getServers()) {
+            Service svc = s.getEndpoint().getService();
+            if (svc.getName().equals(serviceName)) {
+                return s;
+            }
+        }
+        return null;
+    }
+
+    public static class TestMessageObserver implements MessageObserver {
+        ByteArrayOutputStream response = new ByteArrayOutputStream();
+        boolean written;
+        String contentType;
+        
+        public ByteArrayOutputStream getResponseStream() throws Exception {
+            synchronized (this) {
+                if (!written) {
+                    wait(1000000000);
+                }
+            }
+            return response;
+        }
+        
+        public String getResponseContentType() {
+            return contentType;
+        }
+
+        public void onMessage(Message message) {
+            try {
+                contentType = (String) message.get(Message.CONTENT_TYPE);
+                InputStream is = message.getContent(InputStream.class);
+                try {
+                    IOUtils.copy(is, response);
+                    is.close();
+                    response.close();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+            } finally {
+                synchronized (this) {
+                    written = true;
+                    notifyAll();
+                }
+            }
+        }
+    }
+
+    /**
+     * Add a namespace that will be used for XPath expressions.
+     * 
+     * @param ns Namespace name.
+     * @param uri The namespace uri.
+     */
+    public void addNamespace(String ns, String uri) {
+        namespaces.put(ns, uri);
+    }
+
+    /**
+     * retrieve the entire namespace map.
+     * @return
+     */
+    public Map<String, String> getNamespaces() {
+        return namespaces;
+    }
+    
+    /**
+     * Return the CXF bus used.
+     * @return
+     */
+    public Bus getBus() {
+        return bus;
+    }
+    
+    /**
+     * Set the CXF bus.
+     * @param bus
+     */
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
+}

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Thu Oct 18 13:14:46 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.jaxb;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 import java.util.Iterator;
 import java.util.logging.Logger;
 
@@ -281,6 +282,14 @@
         ct.setParticle(seq);
         String namespace = part.getElementQName().getNamespaceURI();
         for (Field f : cls.getDeclaredFields()) {
+            // This code takes all the fields that are public and not static.
+            // It is arguable that it should be looking at get/is properties and all those
+            // bean-like things.
+            int modifiers = f.getModifiers();
+            if (!Modifier.isPublic(modifiers) || Modifier.isStatic(modifiers)) {
+                continue;
+            }
+        
             JaxBeanInfo<?> beanInfo = context.getBeanInfo(f.getType());
             if (beanInfo != null) {
                 el = new XmlSchemaElement();

Modified: incubator/cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/pom.xml?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/pom.xml (original)
+++ incubator/cxf/trunk/systests/pom.xml Thu Oct 18 13:14:46 2007
@@ -38,6 +38,25 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${basedir}/src/test/generated</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.cxf</groupId>
                 <artifactId>cxf-codegen-plugin</artifactId>
                 <version>${project.version}</version>

Added: incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java?rev=586116&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java (added)
+++ incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java Thu Oct 18 13:14:46 2007
@@ -0,0 +1,43 @@
+/**
+ * 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.jaxb.service;
+
+/**
+ * Class used to test for unwanted serialization of exception fields. 
+ */
+public class TestServiceException extends Exception {
+
+    static final long serialVersionUID = 4948446750312293907L;
+    // CHECKSTYLE:OFF
+    public String publicString;
+    // CHECKSTYLE:ON
+    @SuppressWarnings("unused")
+    private int privateInt;
+    
+
+    public TestServiceException() {
+        privateInt = 2;
+        publicString = "strung";
+    }
+
+    public TestServiceException(String message) {
+        super(message);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/systests/src/test/generated/org/apache/cxf/systest/jaxb/service/TestServiceException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java Thu Oct 18 13:14:46 2007
@@ -21,10 +21,17 @@
 
 import java.net.URL;
 
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.systest.jaxb.model.ExtendedWidget;
 import org.apache.cxf.systest.jaxb.model.Widget;
 import org.apache.cxf.systest.jaxb.service.TestService;
+import org.apache.cxf.test.TestUtilities;
 import org.junit.Test;
 import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
 
@@ -32,12 +39,13 @@
 public class TestServiceTest extends AbstractDependencyInjectionSpringContextTests {
 
     private TestService testClient;
+    private TestUtilities testUtilities;
 
     public TestServiceTest() {
         setAutowireMode(AbstractDependencyInjectionSpringContextTests.AUTOWIRE_BY_NAME);
+        testUtilities = new TestUtilities(getClass());
     }
 
-
     @Test
     public void testExtraSubClassWithJaxb() throws Throwable {
         Widget expected = new ExtendedWidget(42, "blah", "blah", true, true);
@@ -53,6 +61,22 @@
         String s = IOUtils.toString(url.openStream());
         assertTrue(s, s.contains("application/octet-stream"));
     }
+    
+    @Test
+    public void testAutoFaultBeanProperties() throws Exception {
+        testUtilities.setBus((Bus)applicationContext.getBean("cxf"));
+        testUtilities.addDefaultNamespaces();
+        testUtilities.addNamespace("ts", "http://cxf.org.apache/service");
+        Server s = testUtilities.getServerForService(new QName("http://cxf.org.apache/service", 
+                                                               "TestServiceService"));
+        Document wsdl = testUtilities.getWSDLDocument(s);
+        testUtilities.assertInvalid("//xsd:complexType[@name='TestServiceException']"
+                                    + "/xsd:sequence/xsd:element[@name='serialVersionUID']", wsdl);
+        testUtilities.assertInvalid("//xsd:complexType[@name='TestServiceException']"
+                                    + "/xsd:sequence/xsd:element[@name='privateInt']", wsdl);
+        testUtilities.assertValid("//xsd:complexType[@name='TestServiceException']"
+                                    + "/xsd:sequence/xsd:element[@name='publicString']", wsdl);
+    }
 
     /*
      * (non-Javadoc)
@@ -77,5 +101,4 @@
     public void setTestClient(TestService testClient) {
         this.testClient = testClient;
     }
-
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java Thu Oct 18 13:14:46 2007
@@ -31,5 +31,8 @@
     @WebMethod(operationName = "getWidgetById")
     Widget getWidgetById(@WebParam(name = "id")
                          long id);
+    
+    @WebMethod
+    void testExceptionMarshalling() throws TestServiceException;
 
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java?rev=586116&r1=586115&r2=586116&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java Thu Oct 18 13:14:46 2007
@@ -33,6 +33,10 @@
         return new ExtendedWidget(id, "blah", "blah", true, true);
     }
 
+    public void testExceptionMarshalling() throws TestServiceException {
+        throw new TestServiceException("Your hovercraft is full of eels.");
+    }
+
     
 
 }