[jboss-svn-commits] JBossWS SVN: r666 - in trunk/src/test/java/org/jboss/test/ws: jbws434 xop xop/doclit
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Aug 3 04:53:37 EDT 2006
Author: heiko.braun at jboss.com
Date: 2006-08-03 04:53:32 -0400 (Thu, 03 Aug 2006)
New Revision: 666
Added:
trunk/src/test/java/org/jboss/test/ws/jbws434/ArrayOfAny2.java
trunk/src/test/java/org/jboss/test/ws/jbws434/TypeOfAny3.java
trunk/src/test/java/org/jboss/test/ws/xop/XOPTypeDefTestCase.java
trunk/src/test/java/org/jboss/test/ws/xop/doclit/InlineHandler.java
Log:
merge from 1.0.3.DEV
Added: trunk/src/test/java/org/jboss/test/ws/jbws434/ArrayOfAny2.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jbws434/ArrayOfAny2.java 2006-08-03 08:53:17 UTC (rev 665)
+++ trunk/src/test/java/org/jboss/test/ws/jbws434/ArrayOfAny2.java 2006-08-03 08:53:32 UTC (rev 666)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jbws434;
+
+import javax.xml.soap.SOAPElement;
+
+
+public class ArrayOfAny2 {
+ protected SOAPElement[] _any;
+
+ public ArrayOfAny2() {
+ }
+
+ public ArrayOfAny2(SOAPElement[] _any) {
+ this._any = _any;
+ }
+
+ public SOAPElement[] get_any() {
+ return _any;
+ }
+
+ public void set_any(SOAPElement[] _any) {
+ this._any = _any;
+ }
+}
Property changes on: trunk/src/test/java/org/jboss/test/ws/jbws434/ArrayOfAny2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/test/java/org/jboss/test/ws/jbws434/TypeOfAny3.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jbws434/TypeOfAny3.java 2006-08-03 08:53:17 UTC (rev 665)
+++ trunk/src/test/java/org/jboss/test/ws/jbws434/TypeOfAny3.java 2006-08-03 08:53:32 UTC (rev 666)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jbws434;
+
+import javax.xml.soap.SOAPElement;
+
+
+public class TypeOfAny3 {
+
+ protected SOAPElement _any;
+
+ public TypeOfAny3() {
+ }
+
+ public TypeOfAny3(SOAPElement _any) {
+ this._any = _any;
+ }
+
+ public SOAPElement get_any() {
+ return _any;
+ }
+
+ public void set_any(SOAPElement _any) {
+ this._any = _any;
+ }
+}
+
Property changes on: trunk/src/test/java/org/jboss/test/ws/jbws434/TypeOfAny3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/test/java/org/jboss/test/ws/xop/XOPTypeDefTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/xop/XOPTypeDefTestCase.java 2006-08-03 08:53:17 UTC (rev 665)
+++ trunk/src/test/java/org/jboss/test/ws/xop/XOPTypeDefTestCase.java 2006-08-03 08:53:32 UTC (rev 666)
@@ -0,0 +1,90 @@
+package org.jboss.test.ws.xop;
+
+import junit.framework.TestCase;
+import org.apache.xerces.xs.XSComplexTypeDefinition;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils;
+import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
+import org.jboss.ws.xop.XOPScanner;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+import java.io.File;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @since Jun 9, 2006
+ */
+public class XOPTypeDefTestCase extends TestCase {
+
+ public XOPTypeDefTestCase(String string) {
+ super(string);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testCircularReferences() throws Exception{
+ SchemaUtils utils = SchemaUtils.getInstance();
+ //String prefix = "C:/dev/prj/jbossws/branches/jbossws-1.0_SchemaBindingMarshaller/src/test/";
+ File f = new File("resources/xop/circular.xsd");
+ assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());
+
+ XSModel xsModel = utils.parseSchema(f.toURL());
+ assertNotNull(xsModel);
+ WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://complex.jsr181.ws.test.jboss.org/jaws");
+ JBossXSModel schemaModel= wsUtil.getJBossXSModel(xsModel);
+
+ XSTypeDefinition xsType = schemaModel.getTypeDefinition("Customer", "http://complex.jsr181.ws.test.jboss.org/jaws");
+
+ assertNotNull("Root type def not found", xsType);
+ XOPScanner scanner = new XOPScanner();
+
+ if (xsType instanceof XSComplexTypeDefinition)
+ {
+ XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
+ XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);
+
+ // it fails when getting a stack overflow ;)
+ }
+ }
+
+ public void testXOPElementScan() throws Exception
+ {
+ SchemaUtils utils = SchemaUtils.getInstance();
+ //String prefix = "C:/dev/prj/jbossws/branches/jbossws-1.0_SchemaBindingMarshaller/src/test/";
+ File f = new File("resources/xop/schema.xsd");
+ assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());
+
+ XSModel xsModel = utils.parseSchema(f.toURL());
+ assertNotNull(xsModel);
+ WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://jboss.org/test/ws/xop/doclit");
+ JBossXSModel schemaModel= wsUtil.getJBossXSModel(xsModel);
+
+ XSTypeDefinition xsType = schemaModel.getTypeDefinition(">PingMsg", "http://jboss.org/test/ws/xop/doclit");
+
+ assertNotNull("Root type def not found", xsType);
+ XOPScanner scanner = new XOPScanner();
+
+ if (xsType instanceof XSComplexTypeDefinition)
+ {
+ XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
+ XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);
+ assertNotNull("Unable to find xop typedef in schema", resultType);
+ }
+
+ scanner.reset();
+
+ xsType = schemaModel.getTypeDefinition(">PingMsgResponse", "http://jboss.org/test/ws/xop/doclit");
+ assertNotNull("Root type def not found", xsType);
+ if (xsType instanceof XSComplexTypeDefinition)
+ {
+ XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
+ XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);
+ assertNotNull("Unable to find XOP typedef in schema", resultType);
+ }
+
+ }
+}
Property changes on: trunk/src/test/java/org/jboss/test/ws/xop/XOPTypeDefTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/test/java/org/jboss/test/ws/xop/doclit/InlineHandler.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/xop/doclit/InlineHandler.java 2006-08-03 08:53:17 UTC (rev 665)
+++ trunk/src/test/java/org/jboss/test/ws/xop/doclit/InlineHandler.java 2006-08-03 08:53:32 UTC (rev 666)
@@ -0,0 +1,56 @@
+package org.jboss.test.ws.xop.doclit;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMWriter;
+import org.jboss.ws.soap.NameImpl;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPBody;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @since Jun 16, 2006
+ */
+public class InlineHandler extends GenericHandler {
+
+ private static Logger log = Logger.getLogger(InlineHandler.class);
+
+ public QName[] getHeaders() {
+ return new QName[0];
+ }
+
+ public boolean handleRequest(MessageContext messageContext) {
+ //dumpMessage(messageContext);
+ return true;
+ }
+
+ public boolean handleResponse(MessageContext messageContext) {
+ dumpMessage(messageContext);
+ return true;
+ }
+
+ private void dumpMessage(MessageContext messageContext) {
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)messageContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ String msg = DOMWriter.printNode(soapBody, true);
+ log.info(msg);
+
+ SOAPElement response = (SOAPElement) soapBody.getChildElements().next();
+ SOAPElement xopElement = (SOAPElement)response.getChildElements(new NameImpl("imagejpeg")).next();
+ messageContext.setProperty("xop.expected", xopElement.getFirstChild().getNodeValue());
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ }
+}
Property changes on: trunk/src/test/java/org/jboss/test/ws/xop/doclit/InlineHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jboss-svn-commits
mailing list