Author: seanoc
Date: Mon Dec  1 09:02:35 2008
New Revision: 722129

URL: http://svn.apache.org/viewvc?rev=722129&view=rev
Log:
Added xmlbeans binding codegen test.

Added:
    
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/xmlbeans/
    
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/xmlbeans/XmlbeansBindingTest.java
    
cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xmlbeanstest.wsdl
Modified:
    cxf/trunk/tools/wsdlto/test/pom.xml
    
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java

Modified: cxf/trunk/tools/wsdlto/test/pom.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/pom.xml?rev=722129&r1=722128&r2=722129&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/pom.xml (original)
+++ cxf/trunk/tools/wsdlto/test/pom.xml Mon Dec  1 09:02:35 2008
@@ -94,6 +94,13 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-databinding-xmlbeans</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
 
         <dependency>
             <groupId>com.sun.xml.bind</groupId>

Modified: 
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java?rev=722129&r1=722128&r2=722129&view=diff
==============================================================================
--- 
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
 (original)
+++ 
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
 Mon Dec  1 09:02:35 2008
@@ -34,7 +34,7 @@
     @Test
     public void testLoadPlugins() throws Exception {
         PluginLoader loader = PluginLoader.getInstance();
-        assertEquals(2, loader.getPlugins().size());
+        assertEquals(3, loader.getPlugins().size());
 
         Plugin plugin = getPlugin(loader, 0);
         assertNotNull(plugin.getName());
@@ -59,7 +59,7 @@
                   
         Map<String, DataBinding> databindings = loader.getDataBindings();
         assertNotNull(databindings);
-        assertEquals(1, databindings.size());
+        assertEquals(2, databindings.size());
         
         DataBinding databinding = getDataBinding(databindings, 0);
         assertEquals("jaxb", databinding.getName());

Added: 
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/xmlbeans/XmlbeansBindingTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/xmlbeans/XmlbeansBindingTest.java?rev=722129&view=auto
==============================================================================
--- 
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/xmlbeans/XmlbeansBindingTest.java
 (added)
+++ 
cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/xmlbeans/XmlbeansBindingTest.java
 Mon Dec  1 09:02:35 2008
@@ -0,0 +1,71 @@
+/**
+ * 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.tools.wsdlto.xmlbeans;
+
+import java.io.File;
+
+import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.wsdlto.WSDLToJava;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class XmlbeansBindingTest extends ProcessorTestBase {
+    
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        File classFile = new java.io.File(output.getCanonicalPath() + 
"/classes");
+        classFile.mkdir();
+        System.setProperty("java.class.path", getClassPath() + 
classFile.getCanonicalPath()
+                                              + File.separatorChar);
+
+    }
+
+    @After
+    public void tearDown() {
+        //super.tearDown();
+    }
+    
+    @Test
+    public void testEmbeddedSchema() throws Exception {
+        
+        try {
+            String[] args = new String[] {"-classdir",
+                                          output.getCanonicalPath() + 
"/classes", "-d",
+                                          output.getCanonicalPath(), "-db", 
"xmlbeans",
+                                          
getLocation("/wsdl2java_wsdl/xmlbeanstest.wsdl")};
+            WSDLToJava.main(args);       
+            
+            File file = new File(output, 
"classes/schemaorg_apache_xmlbeans/system/");
+            file = new File(file.getAbsoluteFile(), file.list()[0]);
+            assertTrue(file.exists());
+            File stringListXSB = new File(file, "stringlisttype428ftype.xsb"); 
         
+            String contents = FileUtils.getStringFromFile(stringListXSB);
+            
//assertTrue(contents.indexOf("URI_SHA_1_EA71EF943F0B49ADA611FB92B3BB95A7D57BE89B"
 
+            //                            + "/xmlbeanstest.wsdl") != -1);
+            assertTrue(contents.indexOf("/xmlbeanstest.wsdl") != -1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        
+    }
+}

Added: 
cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xmlbeanstest.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xmlbeanstest.wsdl?rev=722129&view=auto
==============================================================================
--- 
cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xmlbeanstest.wsdl 
(added)
+++ 
cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xmlbeanstest.wsdl 
Mon Dec  1 09:02:35 2008
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<wsdl:definitions name="HelloWorld" 
targetNamespace="http://cxf.apache.org/xmlbeans/wsdltest"; 
+    xmlns="http://schemas.xmlsoap.org/wsdl/"; 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
+    xmlns:tns="http://cxf.apache.org/xmlbeans/wsdltest";
+    xmlns:x1="http://cxf.apache.org/xmlbeans/wsdltest";
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
+
+
+    <wsdl:types>        
+        <schema xmlns="http://www.w3.org/2001/XMLSchema";
+               targetNamespace="http://cxf.apache.org/xmlbeans/wsdltest";
+               xmlns:x1="http://cxf.apache.org/xmlbeans/wsdltest";
+               elementFormDefault="qualified">
+       
+               <complexType name="StringListType">
+                       <all>
+                               <element minOccurs="1" maxOccurs="1" 
name="myname" type="string" />
+                               <element minOccurs="1" maxOccurs="1" 
name="myaddress" type="string" />
+                       </all>
+               </complexType>
+       
+               <element name="sayHi2Message" type="x1:StringListType" />
+       
+        </schema> 
+    </wsdl:types>
+
+  <wsdl:message name="sayHiRequest2">
+    <wsdl:part element="x1:sayHi2Message" name="in"/>
+  </wsdl:message> 
+    
+    <wsdl:portType name="GreeterMine">
+        <wsdl:operation name="sayHi2">
+             <wsdl:input message="tns:sayHiRequest2" name="sayHiRequest2"/>
+        </wsdl:operation>
+        
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:GreeterMine">
+        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="sayHi2">
+            <soap:operation soapAction="sayHi2" style="document"/>
+            <wsdl:input name="sayHiRequest2">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>        
+    </wsdl:binding>
+    <wsdl:service name="SOAPMineService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address 
location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+


Reply via email to