You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/10/13 10:54:20 UTC

svn commit: r1397804 - in /axis/axis1/java/trunk: axis/src/main/java/org/apache/axis/wsdl/toJava/ integration/ integration/src/test/java/test/wsdl/refattr/ integration/src/test/wsdl/refattr/ test/wsdl/refattr/

Author: veithen
Date: Sat Oct 13 08:54:19 2012
New Revision: 1397804

URL: http://svn.apache.org/viewvc?rev=1397804&view=rev
Log:
Migrated test/wsdl/refattr to the Maven build. Also fixed an issue in wsdl2java to make this test case compile (it still fails with a deserialization error on the server-side).

Added:
    axis/axis1/java/trunk/integration/src/test/java/test/wsdl/refattr/
    axis/axis1/java/trunk/integration/src/test/java/test/wsdl/refattr/RefTestServiceTestCase.java
      - copied, changed from r1396786, axis/axis1/java/trunk/test/wsdl/refattr/RefTestServiceTestCase.java
    axis/axis1/java/trunk/integration/src/test/wsdl/refattr/
    axis/axis1/java/trunk/integration/src/test/wsdl/refattr/refattr.wsdl
      - copied unchanged from r1396786, axis/axis1/java/trunk/test/wsdl/refattr/refattr.wsdl
Removed:
    axis/axis1/java/trunk/test/wsdl/refattr/
Modified:
    axis/axis1/java/trunk/axis/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
    axis/axis1/java/trunk/integration/pom.xml

Modified: axis/axis1/java/trunk/axis/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java?rev=1397804&r1=1397803&r2=1397804&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java (original)
+++ axis/axis1/java/trunk/axis/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java Sat Oct 13 08:54:19 2012
@@ -1034,18 +1034,20 @@ public class JavaGeneratorFactory implem
                      (v.elementAt(1) instanceof Element &&
                       v.elementAt(0) instanceof Type))) {
                     Element e;
+                    Type t;
                     if (v.elementAt(0) instanceof Element) {
                         e = (Element) v.elementAt(0);
+                        t = (Type) v.elementAt(1);
                     } else {
                         e = (Element) v.elementAt(1);
+                        t = (Type) v.elementAt(0);
                     }
 
                     BooleanHolder forElement = new BooleanHolder();
                     QName eType = Utils.getTypeQName(e.getNode(),
                             forElement, false);
 
-                    if ((eType != null) 
-                            && !forElement.value) {
+                    if ((eType != null) && !forElement.value && eType.equals(t.getQName())) {
                         resolve = false;
                     }
                 }

Modified: axis/axis1/java/trunk/integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/pom.xml?rev=1397804&r1=1397803&r2=1397804&view=diff
==============================================================================
--- axis/axis1/java/trunk/integration/pom.xml (original)
+++ axis/axis1/java/trunk/integration/pom.xml Sat Oct 13 08:54:19 2012
@@ -1060,6 +1060,30 @@
                         </configuration>
                     </execution>
                     <execution>
+                        <id>refattr</id>
+                        <goals>
+                            <goal>generate-test-sources</goal>
+                        </goals>
+                        <configuration>
+                            <file>src/test/wsdl/refattr/refattr.wsdl</file>
+                            <generate>both</generate>
+                            <deployScope>session</deployScope>
+                            <skeleton>true</skeleton>
+                            <implementation>true</implementation>
+                            <deployWsdd>${project.build.directory}/wsdd/refattr.wsdl</deployWsdd>
+                            <mappings>
+                                <mapping>
+                                    <namespace>urn:ref.types.test</namespace>
+                                    <package>test.wsdl.refattr</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:ref.types</namespace>
+                                    <package>test.wsdl.refattr</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>rpcParams</id>
                         <goals>
                             <goal>generate-test-sources</goal>
@@ -1456,6 +1480,8 @@
                                 <exclude>test/functional/TestAutoTypes.java</exclude>
                                 <!-- TODO: fails on Java 1.6 because of AXIS-2876 -->
                                 <exclude>test/wsdl/echo/ComplexEchoServiceTestCase.java</exclude>
+                                <!-- TODO: deserialization fails on server side (note: the test was not enabled in Axis 1.4 either) -->
+                                <exclude>test/wsdl/refattr/RefTestServiceTestCase.java</exclude>
                                 <!-- These are not test cases -->
                                 <exclude>test/wsdl/date/TestdateSoapBinding*</exclude>
                                 <exclude>test/wsdl/inout/TestFailed.java</exclude>

Copied: axis/axis1/java/trunk/integration/src/test/java/test/wsdl/refattr/RefTestServiceTestCase.java (from r1396786, axis/axis1/java/trunk/test/wsdl/refattr/RefTestServiceTestCase.java)
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/src/test/java/test/wsdl/refattr/RefTestServiceTestCase.java?p2=axis/axis1/java/trunk/integration/src/test/java/test/wsdl/refattr/RefTestServiceTestCase.java&p1=axis/axis1/java/trunk/test/wsdl/refattr/RefTestServiceTestCase.java&r1=1396786&r2=1397804&rev=1397804&view=diff
==============================================================================
--- axis/axis1/java/trunk/test/wsdl/refattr/RefTestServiceTestCase.java (original)
+++ axis/axis1/java/trunk/integration/src/test/java/test/wsdl/refattr/RefTestServiceTestCase.java Sat Oct 13 08:54:19 2012
@@ -10,15 +10,18 @@ package test.wsdl.refattr;
 
 import org.apache.axis.utils.ClassUtils;
 
+import test.HttpTestUtil;
+
 public class RefTestServiceTestCase extends junit.framework.TestCase {
     public RefTestServiceTestCase(String name) {
         super(name);
     }
 
-    public void testRefTest() {
+    public void testRefTest() throws Exception {
         test.wsdl.refattr.RefTest binding;
         try {
-            binding = new RefTestServiceLocator().getRefTest();
+            RefTestServiceLocator loc = new RefTestServiceLocator();
+            binding = new RefTestServiceLocator().getRefTest(HttpTestUtil.getTestEndpoint(loc.getRefTestAddress()));
         }
         catch (javax.xml.rpc.ServiceException jre) {
             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre );
@@ -28,20 +31,39 @@ public class RefTestServiceTestCase exte
         // are generated by Wsdl2Java (not a mangled class like Phone_Type).
         Info info = new Info();
         Phone phone = new Phone();
-        Enum  enum  = Enum.fromValue("one");
-        info.setEnum(enum);
+        phone.setAreaCode(51);
+        phone.setExchange("555");
+        phone.setNumber(new PhoneNumber());
+        info.setPhone(new Phone[] { phone });
+        Enum en  = Enum.fromValue("one");
+        info.setEnum(en);
         Forward forward  = new Forward();
+        forward.setAddress("test");
+        info.setForward(forward);
         NoMangle noMangle  = new NoMangle();
+        noMangle.setAddress("test");
+        info.setNoMangle2(noMangle);
+        Example example = new Example();
+        example.setAddress("test");
+        example.setNumber(new ExampleNumber());
+        info.setNoMangle(example);
         
         // The following code ensures that mangling occurred for the Mangle class
-        Mangle_Type mangle_type = new Mangle_Type();
-        Mangle_ElemType mangle_elem_type = new Mangle_ElemType();
-        try {
-            Class cls = ClassUtils.forName("test.wsdl.refattr.Mangle");
-            assertTrue("Found unmangled class test.wsdl.refattr.Mangle", false);
-        } catch (Exception e) {
-            // Okay expect to get an exception
-        }
+//        Mangle_Type mangle_type = new Mangle_Type();
+        // TODO: Right now wsdl2java only changes the class name for the element, not the type.
+        //       The JAX-RPC spec doen't clearly say if all class names need to be changed or if
+        //       one of the conflicting classes can retain its original name.
+        Mangle mangle_type = new Mangle();
+        // JAX-RPC 1.1 specifies "_Element" as suffix
+        Mangle_Element mangle_element = new Mangle_Element();
+        mangle_element.setTwo("test");
+        info.setMangle(mangle_element);
+//        try {
+//            Class cls = ClassUtils.forName("test.wsdl.refattr.Mangle");
+//            assertTrue("Found unmangled class test.wsdl.refattr.Mangle", false);
+//        } catch (Exception e) {
+//            // Okay expect to get an exception
+//        }
 
         assertTrue("binding is null", binding != null);
         try {