cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r610654 - in /incubator/cxf/trunk/rt/javascript/src: main/java/org/apache/cxf/javascript/types/ test/java/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/fortest/ test/java/org/apache/cxf/javascript/fortest/aegis/ test/resour...
Date Thu, 10 Jan 2008 03:03:51 GMT
Author: bimargulies
Date: Wed Jan  9 19:03:33 2008
New Revision: 610654

URL: http://svn.apache.org/viewvc?rev=610654&view=rev
Log:
Return to chew on anyType in javascript. Fix the dom-returning current implementation, and
set up test materials for something better.

Added:
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java
  (with props)
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java
  (with props)
Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Wed Jan  9 19:03:33 2008
@@ -593,7 +593,8 @@
         utils.startIf("!cxfjsutils.isElementNil(curElement)");
         if (itemInfo.isAnyType()) {
             // All I can think of to do is deliver the DOM.
-            utils.appendLine("value = curElement;");
+            // unless we have xsi:type
+            utils.appendLine(valueTarget + " = curElement;");
         } else if (simple) {
             utils.appendLine("value = cxfjsutils.getNodeText(curElement);");
             utils.appendLine(valueTarget 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
Wed Jan  9 19:03:33 2008
@@ -25,6 +25,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.javascript.JavascriptTestUtilities.JSRunnable;
+import org.apache.cxf.javascript.JavascriptTestUtilities.Notifier;
 import org.apache.cxf.javascript.fortest.AegisServiceImpl;
 import org.junit.Before;
 import org.junit.Test;
@@ -101,4 +102,35 @@
             }
         });
     }
+    
+    private Void returnBeanWithAnyTypeArray(Context context) {
+        Notifier notifier = 
+            testUtilities.rhinoCallConvert("testReturningBeanWithAnyTypeArray", Notifier.class,

+                                           testUtilities.javaToJS(getAddress()));
+        
+        boolean notified = notifier.waitForJavascript(1000 * 10);
+        assertTrue(notified);
+        Integer errorStatus = testUtilities.rhinoEvaluateConvert("globalErrorStatus", Integer.class);
+        assertNull(errorStatus);
+        String errorText = testUtilities.rhinoEvaluateConvert("globalErrorStatusText", String.class);
+        assertNull(errorText);
+
+        //This method returns a 'BeanWithAnyTypeArray'. 
+        //start by looking at the string.
+        String beanString = (String)testUtilities.rhinoEvaluate("globalResponseObject._return._string");
+        assertEquals("lima", beanString);
+        Object o1 = testUtilities.rhinoEvaluate("globalResponseObject._return._objects._anyType[0]");
+        assertTrue(o1 instanceof JsSimpleDomNode);
+        return null;
+    }
+    
+    @Test
+    public void callReturnBeanWithAnyTypeArray() {
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+            public Void run(Context context) {
+                return returnBeanWithAnyTypeArray(context);
+            }
+        });
+    }
+
 }

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
Wed Jan  9 19:03:33 2008
@@ -21,9 +21,12 @@
 
 import java.util.Collection;
 
+import org.apache.cxf.javascript.fortest.aegis.BeanWithAnyTypeArray;
+
 public interface AegisService {
     void acceptAny(String before, Collection<org.jdom.Element> anything);
     void acceptObjects(Collection<Object> anything);
     void acceptStrings(Collection<String> someStrings);
+    BeanWithAnyTypeArray returnBeanWithAnyTypeArray();
 }
 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
Wed Jan  9 19:03:33 2008
@@ -21,6 +21,10 @@
 
 import java.util.Collection;
 
+import org.apache.cxf.javascript.fortest.aegis.BeanWithAnyTypeArray;
+import org.apache.cxf.javascript.fortest.aegis.Mammal;
+import org.apache.cxf.javascript.fortest.aegis.Vegetable;
+
 /**
  * Service used to test out JavaScript talking to Aegis.
  */
@@ -63,7 +67,8 @@
         acceptedStrings = someStrings;
     }
 
-    /** * @return Returns the acceptedStrings.
+    /**
+     * @return Returns the acceptedStrings.
      */
     public Collection<String> getAcceptedStrings() {
         return acceptedStrings;
@@ -71,5 +76,16 @@
 
     public void acceptObjects(Collection<Object> anything) {
         acceptedObjects = anything;
+    }
+
+    public BeanWithAnyTypeArray returnBeanWithAnyTypeArray() {
+        BeanWithAnyTypeArray bwata = new BeanWithAnyTypeArray();
+        bwata.setString("lima");
+        Object[] obs = new Object[3];
+        obs[0] = new Mammal();
+        obs[1] = new Integer(42);
+        obs[2] = new Vegetable(); // this is NOT in the WSDL.
+        bwata.setObjects(obs);
+        return bwata;
     }
 }

Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java?rev=610654&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java
Wed Jan  9 19:03:33 2008
@@ -0,0 +1,40 @@
+/**
+ * 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.javascript.fortest.aegis;
+
+/**
+ * 
+ */
+public class BeanWithAnyTypeArray {
+    private String string;
+    private Object[] objects;
+    public String getString() {
+        return string;
+    }
+    public void setString(String string) {
+        this.string = string;
+    }
+    public Object[] getObjects() {
+        return objects;
+    }
+    public void setObjects(Object[] objects) {
+        this.objects = objects;
+    }
+}

Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/BeanWithAnyTypeArray.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Mammal.java
Wed Jan  9 19:03:33 2008
@@ -24,6 +24,10 @@
  */
 public class Mammal {
     private String name;
+    
+    public Mammal() {
+        name = "shrew";
+    }
 
     public String getName() {
         return name;

Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java?rev=610654&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java
Wed Jan  9 19:03:33 2008
@@ -0,0 +1,40 @@
+/**
+ * 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.javascript.fortest.aegis;
+
+/**
+ * 
+ */
+public class Vegetable {
+    
+    private String family;
+    
+    public Vegetable() {
+        family = "brasica";
+    }
+    
+    public String getFamily() {
+        return family;
+    }
+
+    public void setFamily(String family) {
+        this.family = family;
+    }
+}

Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/aegis/Vegetable.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml Wed Jan  9 19:03:33
2008
@@ -31,8 +31,8 @@
 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
-	<import
-		resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-javascript-client.xml" />
 
 	<simple:server id="aegis-service"
 		serviceClass="org.apache.cxf.javascript.fortest.AegisService"

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js?rev=610654&r1=610653&r2=610654&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
Wed Jan  9 19:03:33 2008
@@ -34,14 +34,17 @@
 	globalResponseObject = null;
 }
 
-// aegis/simple doesn't understand 'oneway'
-
+// aegis/simple doesn't understand 'oneway', so we have a dummy success function.
 function success()
 {
 }
 
-function error()
+function error(httpStatus, httpStatusText) 
 {
+    org_apache_cxf_trace.trace("error");
+	globalErrorStatus = httpStatus;
+	globalStatusText = httpStatusText;
+	globalNotifier.notify();
 }
 
 function testAnyNToServerRaw(url)
@@ -76,5 +79,23 @@
 	holderArray.push(holder);
 	arrayItem.setAnyType(holderArray);
 	service.acceptObjects(success, error, arrayItem);
+}
+
+function returnBeanWithAnyTypeArraySuccess(bean)
+{
+	// let the Java code sort out what we got.
+	globalResponseObject = bean;
+	globalNotifier.notify();
+}
+
+function testReturningBeanWithAnyTypeArray(url) 
+{
+    resetGlobals();
+	globalNotifier = new org_apache_cxf_notifier();
+
+	var service = new fortest_javascript_cxf_apache_org__AegisServicePortType();
+	service.url = url;
+	service.returnBeanWithAnyTypeArray(returnBeanWithAnyTypeArraySuccess, error);
+	return globalNotifier; 
 }
 



Mime
View raw message