Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 37213 invoked from network); 5 Jan 2010 22:38:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jan 2010 22:38:02 -0000 Received: (qmail 68123 invoked by uid 500); 5 Jan 2010 22:38:02 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 68035 invoked by uid 500); 5 Jan 2010 22:38:02 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 68026 invoked by uid 99); 5 Jan 2010 22:38:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jan 2010 22:38:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jan 2010 22:37:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 13F6B23889D7; Tue, 5 Jan 2010 22:37:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r896255 - in /cxf/branches/2.1.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/ rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/ systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ systests/dat... Date: Tue, 05 Jan 2010 22:37:32 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100105223733.13F6B23889D7@eris.apache.org> Author: dkulp Date: Tue Jan 5 22:37:31 2010 New Revision: 896255 URL: http://svn.apache.org/viewvc?rev=896255&view=rev Log: Merged revisions 896251 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes ................ r896251 | dkulp | 2010-01-05 17:30:30 -0500 (Tue, 05 Jan 2010) | 9 lines Merged revisions 896248 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r896248 | dkulp | 2010-01-05 17:25:39 -0500 (Tue, 05 Jan 2010) | 1 line [CXF-2601] Fix problems with XmlBeans and non-document fault infos ........ ................ Modified: cxf/branches/2.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java cxf/branches/2.1.x-fixes/systests/databinding/src/test/resources/wsdl_systest_databinding/xmlbeans/hello_world.wsdl Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Tue Jan 5 22:37:31 2010 @@ -0,0 +1,2 @@ +/cxf/branches/2.2.x-fixes:896251 +/cxf/trunk:896248 Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java?rev=896255&r1=896254&r2=896255&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java (original) +++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java Tue Jan 5 22:37:31 2010 @@ -147,7 +147,7 @@ } public void setDefaultNamespace(String ns) throws XMLStreamException { - writeNamespace("", ns); + curContext.addNs("", ns); } Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=896255&r1=896254&r2=896255&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original) +++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Tue Jan 5 22:37:31 2010 @@ -453,6 +453,19 @@ // System.out.println("STAXUTILS:writeStartElement : node name : " + local + " namespace URI" + uri); boolean writeElementNS = false; + + // Write out the element name + if (uri != null) { + if (prefix.length() == 0 && StringUtils.isEmpty(uri)) { + writer.writeStartElement(local); + } else { + writer.writeStartElement(prefix, local, uri); + } + } else { + writer.writeStartElement(local); + } + + if (uri != null) { writeElementNS = true; Iterator it = CastUtils.cast(writer.getNamespaceContext().getPrefixes(uri)); @@ -467,20 +480,6 @@ } } - // Write out the element name - if (uri != null) { - if (prefix.length() == 0 && StringUtils.isEmpty(uri)) { - writer.writeStartElement(local); - writer.setDefaultNamespace(uri); - - } else { - writer.writeStartElement(prefix, local, uri); - writer.setPrefix(prefix, uri); - } - } else { - writer.writeStartElement(local); - } - // Write out the namespaces for (int i = 0; i < reader.getNamespaceCount(); i++) { String nsURI = reader.getNamespaceURI(i); Modified: cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java?rev=896255&r1=896254&r2=896255&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java Tue Jan 5 22:37:31 2010 @@ -144,8 +144,13 @@ reader = source.newCursor().newXMLStreamReader(options); } SchemaType st = (SchemaType)part.getProperty(SchemaType.class.getName()); - - if (st != null && !st.isDocumentType()) { + int i = reader.getEventType(); + if (i == XMLStreamReader.START_DOCUMENT) { + i = reader.next(); + } + + if (st != null && !st.isDocumentType() + || reader.getEventType() == XMLStreamReader.CHARACTERS) { if (StringUtils.isEmpty(part.getConcreteName().getNamespaceURI())) { output.writeStartElement(part.getConcreteName().getLocalPart()); Modified: cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java?rev=896255&r1=896254&r2=896255&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java (original) +++ cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/ClientServerXmlBeansTest.java Tue Jan 5 22:37:31 2010 @@ -35,22 +35,23 @@ import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.helloWorldSoapHttp.xmlbeans.types.FaultDetailDocument; import org.apache.helloWorldSoapHttp.xmlbeans.types.FaultDetailDocument.FaultDetail; +import org.apache.hello_world_soap_http.xmlbeans.GreetMeFault; import org.apache.hello_world_soap_http.xmlbeans.Greeter; import org.apache.hello_world_soap_http.xmlbeans.PingMeFault; import org.apache.hello_world_soap_http.xmlbeans.SOAPService; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; /** * */ -@Ignore("randomly fails on Hudson, but dkulp cannot reproduce yet") +//@org.junit.Ignore("randomly fails on Hudson, but dkulp cannot reproduce yet") public class ClientServerXmlBeansTest extends AbstractBusClientServerTestBase { private static final QName SERVICE_NAME = new QName("http://apache.org/hello_world_soap_http/xmlbeans", "SOAPService"); + @BeforeClass public static void startServers() throws Exception { assertTrue("server did not launch correctly", launchServer(Server.class, true)); @@ -71,11 +72,18 @@ ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor()); ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor()); resp = port.sayHi(); - assertEquals("We should get the right response", resp, "Bonjour"); + assertEquals("We should get the right response", "Bonjour", resp); resp = port.greetMe("Willem"); - assertEquals("We should get the right response", resp, "Hello Willem"); - + assertEquals("We should get the right response", "Hello Willem", resp); + + try { + port.greetMe("fault"); + fail("Should have been a fault"); + } catch (GreetMeFault ex) { + assertEquals("Some fault detail", ex.getFaultInfo().getStringValue()); + } + try { resp = port.greetMe("Invoking greetMe with invalid length string, expecting exception..."); fail("We expect exception here"); @@ -85,8 +93,6 @@ indexOf("string length (67) is greater than maxLength facet (30)") >= 0); } - port.greetMeOneWay(System.getProperty("user.name")); - try { port.pingMe(); fail("We expect exception here"); @@ -95,7 +101,8 @@ FaultDetail detail = detailDocument.getFaultDetail(); assertEquals("Wrong faultDetail major", detail.getMajor(), 2); assertEquals("Wrong faultDetail minor", detail.getMinor(), 1); - } + } + } @Test @@ -128,8 +135,6 @@ indexOf("string length (67) is greater than maxLength facet (30)") >= 0); } - port.greetMeOneWay(System.getProperty("user.name")); - try { port.pingMe(); fail("We expect exception here"); @@ -138,7 +143,14 @@ FaultDetail detail = detailDocument.getFaultDetail(); assertEquals("Wrong faultDetail major", detail.getMajor(), 2); assertEquals("Wrong faultDetail minor", detail.getMinor(), 1); - } + } + try { + port.greetMe("fault"); + fail("Should have been a fault"); + } catch (GreetMeFault ex) { + assertEquals("Some fault detail", ex.getFaultInfo().getStringValue()); + } + } } Modified: cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java?rev=896255&r1=896254&r2=896255&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java (original) +++ cxf/branches/2.1.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/xmlbeans/GreeterImpl.java Tue Jan 5 22:37:31 2010 @@ -24,6 +24,7 @@ import org.apache.cxf.common.logging.LogUtils; import org.apache.helloWorldSoapHttp.xmlbeans.types.FaultDetailDocument; import org.apache.helloWorldSoapHttp.xmlbeans.types.FaultDetailDocument.FaultDetail; +import org.apache.hello_world_soap_http.xmlbeans.GreetMeFault; import org.apache.hello_world_soap_http.xmlbeans.Greeter; import org.apache.hello_world_soap_http.xmlbeans.PingMeFault; @@ -37,7 +38,12 @@ /* (non-Javadoc) * @see org.apache.hello_world_soap_http.Greeter#greetMe(java.lang.String) */ - public String greetMe(String me) { + public String greetMe(String me) throws GreetMeFault { + if ("fault".equals(me)) { + org.apache.xmlbeans.XmlString st = org.apache.xmlbeans.XmlString.Factory.newInstance(); + st.setStringValue("Some fault detail"); + throw new GreetMeFault("Fault String", st); + } LOG.info("Executing operation greetMe"); return "Hello " + me; } Modified: cxf/branches/2.1.x-fixes/systests/databinding/src/test/resources/wsdl_systest_databinding/xmlbeans/hello_world.wsdl URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/databinding/src/test/resources/wsdl_systest_databinding/xmlbeans/hello_world.wsdl?rev=896255&r1=896254&r2=896255&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/systests/databinding/src/test/resources/wsdl_systest_databinding/xmlbeans/hello_world.wsdl (original) +++ cxf/branches/2.1.x-fixes/systests/databinding/src/test/resources/wsdl_systest_databinding/xmlbeans/hello_world.wsdl Tue Jan 5 22:37:31 2010 @@ -17,23 +17,23 @@ specific language governing permissions and limitations under the License. --> - - - - - - - + + + + + @@ -80,6 +80,7 @@ + @@ -102,22 +103,29 @@ - + - + + + + + + + + @@ -126,11 +134,12 @@ - + + @@ -141,6 +150,7 @@ + @@ -149,8 +159,12 @@ + + + + @@ -171,6 +185,7 @@ +