Author: veithen
Date: Thu Dec  6 13:03:42 2012
New Revision: 1417821

URL: http://svn.apache.org/viewvc?rev=1417821&view=rev
Log:
Added code to load WSDD files.

Added:
    axis/axis1/java/branches/EMF/axis-model/src/test/
    axis/axis1/java/branches/EMF/axis-model/src/test/java/
    axis/axis1/java/branches/EMF/axis-model/src/test/java/org/
    axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/
    axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/
    axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/
    
axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/wsdd/
    
axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/wsdd/LoadTest.java
    axis/axis1/java/branches/EMF/axis-model/src/test/wsdd/
    axis/axis1/java/branches/EMF/axis-model/src/test/wsdd/schema2.wsdd
Modified:
    
axis/axis1/java/branches/EMF/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
    axis/axis1/java/branches/EMF/axis-model/pom.xml
    
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java

Modified: 
axis/axis1/java/branches/EMF/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaDeployWriter.java?rev=1417821&r1=1417820&r2=1417821&view=diff
==============================================================================
--- 
axis/axis1/java/branches/EMF/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
 (original)
+++ 
axis/axis1/java/branches/EMF/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
 Thu Dec  6 13:03:42 2012
@@ -155,7 +155,7 @@ public class JavaDeployWriter extends Ja
     protected void writeFileBody(PrintWriter pw) throws IOException {
         Deployment deployment = WSDDFactory.INSTANCE.createDeployment();
         writeDeployServices(deployment);
-        WSDDUtil.write(deployment, pw);
+        WSDDUtil.save(deployment, pw);
     }    // writeFileBody
 
     /**

Modified: axis/axis1/java/branches/EMF/axis-model/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/pom.xml?rev=1417821&r1=1417820&r2=1417821&view=diff
==============================================================================
--- axis/axis1/java/branches/EMF/axis-model/pom.xml (original)
+++ axis/axis1/java/branches/EMF/axis-model/pom.xml Thu Dec  6 13:03:42 2012
@@ -54,6 +54,11 @@
             <artifactId>xsd</artifactId>
             <version>2.2.3</version>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

Modified: 
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java?rev=1417821&r1=1417820&r2=1417821&view=diff
==============================================================================
--- 
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
 (original)
+++ 
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
 Thu Dec  6 13:03:42 2012
@@ -24,13 +24,25 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.axis.model.util.AxisXMLResource;
+import org.apache.axis.model.wsdd.impl.WSDDPackageImpl;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
 import org.eclipse.emf.ecore.xmi.XMLResource;
 import org.eclipse.emf.ecore.xmi.util.XMLProcessor;
+import org.xml.sax.InputSource;
 
 public final class WSDDUtil {
     private WSDDUtil() {}
 
-    public static void write(Deployment deployment, Writer writer) throws 
IOException {
+    public static Deployment load(InputSource is) throws IOException {
+        WSDDPackageImpl.eINSTANCE.eClass();
+        AxisXMLResource resource = new AxisXMLResource();
+        Map options = new HashMap();
+        options.put(XMLResource.OPTION_EXTENDED_META_DATA, 
ExtendedMetaData.INSTANCE);
+        resource.load(is, options);
+        return (Deployment)resource.getContents().get(0);        
+    }
+    
+    public static void save(Deployment deployment, Writer writer) throws 
IOException {
         AxisXMLResource resource = new AxisXMLResource();
         XMLProcessor processor = new XMLProcessor();
         resource.getContents().add(deployment);

Added: 
axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/wsdd/LoadTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/wsdd/LoadTest.java?rev=1417821&view=auto
==============================================================================
--- 
axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/wsdd/LoadTest.java
 (added)
+++ 
axis/axis1/java/branches/EMF/axis-model/src/test/java/org/apache/axis/model/wsdd/LoadTest.java
 Thu Dec  6 13:03:42 2012
@@ -0,0 +1,51 @@
+/*
+ * 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.axis.model.wsdd;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.xml.sax.InputSource;
+
+public class LoadTest extends TestCase {
+    private final File file;
+    
+    public LoadTest(File file) {
+        this.file = file;
+        setName(file.getName());
+    }
+    
+    protected void runTest() throws Throwable {
+        assertNotNull(WSDDUtil.load(new InputSource(file.toURL().toString())));
+    }
+    
+    public static TestSuite suite() {
+        TestSuite suite = new TestSuite();
+        File[] files = new File("src/test/wsdd").listFiles();
+        for (int i=0; i<files.length; i++) {
+            File file = files[i];
+            if (file.isFile()) {
+                suite.addTest(new LoadTest(file));
+            }
+        }
+        return suite;
+    }
+}

Added: axis/axis1/java/branches/EMF/axis-model/src/test/wsdd/schema2.wsdd
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/test/wsdd/schema2.wsdd?rev=1417821&view=auto
==============================================================================
--- axis/axis1/java/branches/EMF/axis-model/src/test/wsdd/schema2.wsdd (added)
+++ axis/axis1/java/branches/EMF/axis-model/src/test/wsdd/schema2.wsdd Thu Dec  
6 13:03:42 2012
@@ -0,0 +1,83 @@
+<!-- Use this file to deploy some handlers/chains and services      -->
+<!-- Two ways to do this:                                           -->
+<!--   java org.apache.axis.client.AdminClient deploy.wsdd          -->
+<!--      after the axis server is running                          -->
+<!-- or                                                             -->
+<!--   java org.apache.axis.utils.Admin client|server deploy.wsdd   -->
+<!--      from the same directory that the Axis engine runs         -->
+
+<deployment
+    xmlns="http://xml.apache.org/axis/wsdd/";
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
+
+  <!-- Services from Schema2Service WSDL service -->
+
+  <service name="Schema2Service" provider="java:RPC" style="document" 
use="literal">
+      <parameter name="wsdlTargetNamespace" value="urn:schema2.wsdl.test"/>
+      <parameter name="wsdlServiceElement" value="Schema2Service"/>
+      <parameter name="schemaQualified" value="urn:schema2.wsdl.test"/>
+      <parameter name="wsdlServicePort" value="Schema2Service"/>
+      <parameter name="className" 
value="test.wsdl.schema2.Schema2ServiceSoapBindingImpl"/>
+      <parameter name="wsdlPortType" value="Schema2Test"/>
+      <parameter name="typeMappingVersion" value="1.3"/>
+      <operation name="echoLanguageTypeTest" qname="echoLanguageTypeTest" 
returnQName="retNS:languageElem1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:language" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:languageElem" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:language" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoTokenTypeTest" qname="echoTokenTypeTest" 
returnQName="retNS:tokenElem1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:token" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:tokenElem" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:token" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoNameTypeTest" qname="echoNameTypeTest" 
returnQName="retNS:nameElem1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:Name" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:nameElem" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:Name" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoNCNameTypeTest" qname="echoNCNameTypeTest" 
returnQName="retNS:NCNameElem1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:NCName" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:NCNameElem" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:NCName" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoIDTypeTest" qname="echoIDTypeTest" 
returnQName="retNS:IDElem1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:ID" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:IDElem" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:ID" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoUnsignedShortTest" qname="echoUnsignedShortTest" 
returnQName="retNS:UnsignedShort1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:unsignedShort" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:UnsignedShort" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:unsignedShort" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoUnsignedIntTest" qname="echoUnsignedIntTest" 
returnQName="retNS:UnsignedInt1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:unsignedInt" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:UnsignedInt" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:unsignedInt" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoUnsignedByteTest" qname="echoUnsignedByteTest" 
returnQName="retNS:UnsignedByte1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:unsignedByte" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:UnsignedByte" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:unsignedByte" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoUnsignedLongTest" qname="echoUnsignedLongTest" 
returnQName="retNS:UnsignedLong1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:unsignedLong" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:UnsignedLong" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:unsignedLong" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoNonPositiveIntegerTest" 
qname="echoNonPositiveIntegerTest" returnQName="retNS:NonPositiveInteger1" 
xmlns:retNS="urn:schema2.wsdl.test" returnType="rtns:nonPositiveInteger" 
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:NonPositiveInteger" 
xmlns:pns="urn:schema2.wsdl.test" type="tns:nonPositiveInteger" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoNonNegativeIntegerTest" 
qname="echoNonNegativeIntegerTest" returnQName="retNS:NonNegativeInteger1" 
xmlns:retNS="urn:schema2.wsdl.test" returnType="rtns:nonNegativeInteger" 
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:NonNegativeInteger" 
xmlns:pns="urn:schema2.wsdl.test" type="tns:nonNegativeInteger" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoPositiveIntegerTest" 
qname="echoPositiveIntegerTest" returnQName="retNS:PositiveInteger1" 
xmlns:retNS="urn:schema2.wsdl.test" returnType="rtns:positiveInteger" 
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:PositiveInteger" 
xmlns:pns="urn:schema2.wsdl.test" type="tns:positiveInteger" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoNegativeIntegerTest" 
qname="echoNegativeIntegerTest" returnQName="retNS:NegativeInteger1" 
xmlns:retNS="urn:schema2.wsdl.test" returnType="rtns:negativeInteger" 
xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:NegativeInteger" 
xmlns:pns="urn:schema2.wsdl.test" type="tns:negativeInteger" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoTimeTest" qname="echoTimeTest" 
returnQName="retNS:Time1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:time" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:Time" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:time" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoDateTest" qname="echoDateTest" 
returnQName="retNS:Date1" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:date" xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
+        <parameter qname="pns:Date" xmlns:pns="urn:schema2.wsdl.test" 
type="tns:date" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
+      </operation>
+      <operation name="echoDocument" qname="echoDocument" 
returnQName="retNS:EchoDocumentResponse" xmlns:retNS="urn:schema2.wsdl.test" 
returnType="rtns:Document" xmlns:rtns="urn:schema2.wsdl.test" soapAction="" >
+        <parameter qname="pns:EchoDocumentRequest" 
xmlns:pns="urn:schema2.wsdl.test" type="tns:Document" 
xmlns:tns="urn:schema2.wsdl.test"/>
+      </operation>
+      <parameter name="allowedMethods" value="echoNonPositiveIntegerTest 
echoNCNameTypeTest echoIDTypeTest echoLanguageTypeTest echoUnsignedByteTest 
echoDocument echoNameTypeTest echoDateTest echoNonNegativeIntegerTest 
echoNegativeIntegerTest echoUnsignedShortTest echoUnsignedLongTest 
echoTokenTypeTest echoUnsignedIntTest echoTimeTest echoPositiveIntegerTest"/>
+      <parameter name="scope" value="Session"/>
+
+      <typeMapping
+        xmlns:ns="urn:schema2.wsdl.test"
+        qname="ns:Document"
+        type="java:test.wsdl.schema2.Document"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        encodingStyle=""
+      />
+  </service>
+</deployment>


Reply via email to