From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../generate/XMLfromXSDGeneratorTestCase.java | 125 +++++++++++++++ .../xmlfromxsd/src/test/resources/helloworld.wsdl | 118 ++++++++++++++ .../xmlfromxsd/src/test/resources/interopdoc.wsdl | 177 +++++++++++++++++++++ .../xmlfromxsd/src/test/resources/sequences.xsd | 97 +++++++++++ 4 files changed, 517 insertions(+) create mode 100644 sandbox/tools/xmlfromxsd/src/test/java/org/apache/tuscany/tools/xmlfromxsd/generate/XMLfromXSDGeneratorTestCase.java create mode 100644 sandbox/tools/xmlfromxsd/src/test/resources/helloworld.wsdl create mode 100644 sandbox/tools/xmlfromxsd/src/test/resources/interopdoc.wsdl create mode 100644 sandbox/tools/xmlfromxsd/src/test/resources/sequences.xsd (limited to 'sandbox/tools/xmlfromxsd/src/test') diff --git a/sandbox/tools/xmlfromxsd/src/test/java/org/apache/tuscany/tools/xmlfromxsd/generate/XMLfromXSDGeneratorTestCase.java b/sandbox/tools/xmlfromxsd/src/test/java/org/apache/tuscany/tools/xmlfromxsd/generate/XMLfromXSDGeneratorTestCase.java new file mode 100644 index 0000000000..e7024318dc --- /dev/null +++ b/sandbox/tools/xmlfromxsd/src/test/java/org/apache/tuscany/tools/xmlfromxsd/generate/XMLfromXSDGeneratorTestCase.java @@ -0,0 +1,125 @@ +package org.apache.tuscany.tools.xmlfromxsd.generate; + +import junit.framework.TestCase; + +public class XMLfromXSDGeneratorTestCase extends TestCase +{ + + protected void setUp() throws Exception + { + super.setUp(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + } + + public void testXMLInstance_SDO_based_1() + { + String[] arguments = new String[] { "-xsd", "F:\\TuscanySVN\\sca\\tools\\src\\test\\resources\\sequences.xsd", + "-st", "MixedQuote", + "-stn", "http://www.example.com/sequences", + "-o", "target/xmlFromxsd-source", + "-of", "sequences_sdo.xml" + }; + + XMLfromXSDGenerator.main(arguments); + /*File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile());*/ + } + + public void testXMLInstance_SDO_based_2() + { + try + { + XMLfromXSDConfiguration config = new XMLfromXSDConfiguration(); + config.setXsdFileName("interopdoc.wsdl"); + config.setSchemaTypeName("ComplexDocument"); + config.setSchemaTypeNamespaceURI("http://soapinterop.org/"); + config.setXmlOutputLocation("target/xmlFromxsd-source"); + config.setXmlFileName("interopdoc_sdo.xml"); + + XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.SDO_BASED).generateXML(config); + //XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED).generateXML(config); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + public void testXMLInstance_SDO_based_3() + { + try + { + XMLfromXSDConfiguration config = new XMLfromXSDConfiguration(); + config.setXsdFileName("helloworld.wsdl"); + //config.setSchemaTypeName("getGreetings"); + config.setSchemaTypeName("ComplexGreetings"); + config.setSchemaTypeNamespaceURI("http://helloworldaxis.samples.tuscany.apache.org"); + config.setXmlOutputLocation("target/xmlFromxsd-source"); + config.setXmlFileName("helloworld_sdo.xml"); + + XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.SDO_BASED).generateXML(config); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + public void testXMLInstance_XB_based_1() + { + String[] arguments = new String[] { "-xsd", "F:\\TuscanySVN\\sca\\tools\\src\\test\\resources\\sequences.xsd", + "-st", "mixedStockQuote", + "-stn", "http://www.example.com/sequences", + "-o", "target/xmlFromxsd-source", + "-of", "sequences_xb.xml" + }; + + XMLfromXSDGenerator.generatorType = XMLGenerator.XMLBEANS_BASED; + XMLfromXSDGenerator.main(arguments); + /*File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile());*/ + } + + public void testXMLInstance_XB_based_2() + { + try + { + XMLfromXSDConfiguration config = new XMLfromXSDConfiguration(); + config.setXsdFileName("interopdoc.wsdl"); + config.setSchemaTypeName("ComplexDocument"); + config.setSchemaTypeNamespaceURI("http://soapinterop.org/"); + config.setXmlOutputLocation("target/xmlFromxsd-source"); + config.setXmlFileName("interopdoc_xb.xml"); + + XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED).generateXML(config); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + public void testXMLInstance_XB_based_3() + { + try + { + XMLfromXSDConfiguration config = new XMLfromXSDConfiguration(); + config.setXsdFileName("helloworld.wsdl"); + config.setSchemaTypeName("getGreetings"); + //config.setSchemaTypeName("ComplexGreetings"); + config.setSchemaTypeNamespaceURI("http://helloworldaxis.samples.tuscany.apache.org"); + config.setXmlOutputLocation("target/xmlFromxsd-source"); + config.setXmlFileName("helloworld_xb.xml"); + + XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED).generateXML(config); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } +} diff --git a/sandbox/tools/xmlfromxsd/src/test/resources/helloworld.wsdl b/sandbox/tools/xmlfromxsd/src/test/resources/helloworld.wsdl new file mode 100644 index 0000000000..55867f3883 --- /dev/null +++ b/sandbox/tools/xmlfromxsd/src/test/resources/helloworld.wsdl @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/tools/xmlfromxsd/src/test/resources/interopdoc.wsdl b/sandbox/tools/xmlfromxsd/src/test/resources/interopdoc.wsdl new file mode 100644 index 0000000000..59352ec4f0 --- /dev/null +++ b/sandbox/tools/xmlfromxsd/src/test/resources/interopdoc.wsdl @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/tools/xmlfromxsd/src/test/resources/sequences.xsd b/sandbox/tools/xmlfromxsd/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..6e70ad528c --- /dev/null +++ b/sandbox/tools/xmlfromxsd/src/test/resources/sequences.xsd @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3