cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r597708 - in /incubator/cxf/trunk/rt/javascript/src: main/java/org/apache/cxf/javascript/service/ test/java/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/fortest/ test/resources/ test/resources/org/apache/cxf/javascript/
Date Fri, 23 Nov 2007 18:01:52 GMT
Author: bimargulies
Date: Fri Nov 23 10:01:50 2007
New Revision: 597708

URL: http://svn.apache.org/viewvc?rev=597708&view=rev
Log:
Add test case for method without wrapper snails.

Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/BasicTypeFunctionReturnStringWrapper.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Fri Nov 23 10:01:50 2007
@@ -377,8 +377,7 @@
         getElementsForParts(elements, parts);
 
         // if not wrapped, the param array matches up with the parts. If
-        // wrapped, the members
-        // of it have to be packed into an object.
+        // wrapped, the members of it have to be packed into an object.
 
         if (isWrapped) {
             String partJavascriptVar = elements.get(0).getJavascriptName();

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
Fri Nov 23 10:01:50 2007
@@ -40,7 +40,7 @@
 import org.springframework.context.support.GenericApplicationContext;
 
 public class DocLitWrappedClientTest extends AbstractCXFSpringTest {
-    
+
     private static final Logger LOG = LogUtils.getL7dLogger(DocLitWrappedClientTest.class);
 
     // shadow declaration from base class.
@@ -75,19 +75,24 @@
     // just one test function to avoid muddles with engine startup/shutdown
     @Test
     public void runTests() throws Exception {
+        callMethodWithWrappers();
+        
+        callMethodWithoutWrappers();
+    }
+
+    private void callMethodWithoutWrappers() {
         testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
             public Void run(Context context) {
                 EndpointImpl endpoint = getBean(EndpointImpl.class, "dlw-service-endpoint");
-                LOG.info("About to call test1 " + endpoint.getAddress());
-
+                LOG.info("About to call test2 " + endpoint.getAddress());
                 Notifier notifier = 
-                    testUtilities.rhinoCallConvert("test1", Notifier.class, 
+                    testUtilities.rhinoCallConvert("test2", Notifier.class, 
                                                    testUtilities.javaToJS(endpoint.getAddress()),

-                                                   testUtilities.javaToJS(Double.valueOf(7.0)),
-                                                   testUtilities.javaToJS(Float.valueOf((float)11.0)),

-                                                   testUtilities.javaToJS(Integer.valueOf(42)),
-                                                   testUtilities.javaToJS(Long.valueOf(240000)),
-                                                   "This is the cereal shot from guns");
+                                                   testUtilities.javaToJS(Double.valueOf(17.0)),
+                                                   testUtilities.javaToJS(Float.valueOf((float)111.0)),
+                                                   testUtilities.javaToJS(Integer.valueOf(142)),
+                                                   testUtilities.javaToJS(Long.valueOf(1240000)),
+                                                   "This is the cereal shot from gnus");
                 boolean notified = notifier.waitForJavascript(1000 * 10);
                 assertTrue(notified);
                 Integer errorStatus = testUtilities.rhinoEvaluateConvert("globalErrorStatus",
Integer.class);
@@ -97,10 +102,44 @@
 
                 Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
                 assertNotNull(responseObject);
-                String returnString = 
-                    testUtilities.rhinoCallMethodInContext(String.class, responseObject,
"getReturnValue");
-                assertEquals("eels", returnString);
+                // by default, for doc/lit/wrapped, we end up with a part object with a slot
named 
+                // 'return'.
+                String returnString = testUtilities.rhinoCallMethodInContext(String.class,
responseObject,
+                                                                             "getReturn");
+                assertEquals("cetaceans", returnString);
+
                 return null; // well, null AND void.
+            }
+        });
+    }
+
+    private void callMethodWithWrappers() {
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+            public Void run(Context context) {
+                EndpointImpl endpoint = getBean(EndpointImpl.class, "dlw-service-endpoint");
+                LOG.info("About to call test1 " + endpoint.getAddress());
+
+                Notifier notifier = testUtilities.rhinoCallConvert("test1", Notifier.class,
testUtilities
+                    .javaToJS(endpoint.getAddress()), testUtilities.javaToJS(Double.valueOf(7.0)),
+                                                                   testUtilities.javaToJS(Float
+                                                                       .valueOf((float)11.0)),
testUtilities
+                                                                       .javaToJS(Integer.valueOf(42)),
+                                                                   testUtilities.javaToJS(Long
+                                                                       .valueOf(240000)),
+                                                                   "This is the cereal shot
from guns");
+                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);
+
+                Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
+                assertNotNull(responseObject);
+                String returnString = testUtilities.rhinoCallMethodInContext(String.class,
responseObject,
+                                                                             "getReturnValue");
+                assertEquals("eels", returnString);
+                return null;
             }
         });
     }

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/BasicTypeFunctionReturnStringWrapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/BasicTypeFunctionReturnStringWrapper.java?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/BasicTypeFunctionReturnStringWrapper.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/BasicTypeFunctionReturnStringWrapper.java
Fri Nov 23 10:01:50 2007
@@ -26,7 +26,8 @@
  * Wrapper class.
  */
 @XmlRootElement(namespace = "uri:org.apache.cxf.javascript.testns")
-@XmlType(namespace = "uri:org.apache.cxf.javascript.testns")
+// specify alphabetical order explicitly to remind us that there is JavaScript code that
knows this order!
+@XmlType(namespace = "uri:org.apache.cxf.javascript.testns", propOrder = {"d", "f", "i",
"l", "s" })
 public class BasicTypeFunctionReturnStringWrapper {
     private String s;
     private int i;

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
Fri Nov 23 10:01:50 2007
@@ -39,6 +39,13 @@
                                          @WebParam(name = "l") long l, 
                                          @WebParam(name = "f") float f, 
                                          @WebParam(name = "d") double d);
+    
+    String basicTypeFunctionReturnStringNoWrappers(@WebParam(name = "s") String s, 
+                                                   @WebParam(name = "i") int i, 
+                                                   @WebParam(name = "l") long l, 
+                                                   @WebParam(name = "f") float f, 
+                                                   @WebParam(name = "d") double d);
+
     @WebMethod
     TestBean1 functionReturnTestBean1();
     int basicTypeFunctionReturnInt(@WebParam(name = "s") String s, 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
Fri Nov 23 10:01:50 2007
@@ -56,6 +56,16 @@
     }
 
     /** {@inheritDoc}*/
+    public String basicTypeFunctionReturnStringNoWrappers(String s, int i, long l, float
f, double d) {
+        lastString = s;
+        lastInt = i;
+        lastLong = l;
+        lastFloat = f;
+        lastDouble = d;
+        return "cetaceans"; 
+    }
+
+    /** {@inheritDoc}*/
     public void beanFunction(TestBean1 bean, TestBean1[] beans) {
         lastBean1 = bean;
         lastBean1Array = beans;

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties Fri Nov 23 10:01:50
2007
@@ -23,7 +23,7 @@
 .level= INFO
 java.util.logging.ConsoleHandler.level = FINEST
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-org.apache.cxf.javascript.service.ServiceJavascriptBuilder.level=FINE
-org.apache.cxf.javascript.JavascriptTestUtilities.level=FINE
-org.apache.cxf.javascript.JsXMLHttpRequest.level = FINE
+#org.apache.cxf.javascript.service.ServiceJavascriptBuilder.level=FINE
+#org.apache.cxf.javascript.JavascriptTestUtilities.level=FINE
+#org.apache.cxf.javascript.JsXMLHttpRequest.level = FINE
 

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js?rev=597708&r1=597707&r2=597708&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
Fri Nov 23 10:01:50 2007
@@ -29,7 +29,7 @@
 
 function test1ErrorCallback(httpStatus, httpStatusText) 
 {
-    org_apache_cxf_trace.trace("test1 error");
+    org_apache_cxf_trace.trace("test1/2 error");
 	globalErrorStatus = httpStatus;
 	globalStatusText = httpStatusText;
 	globalNotifier.notify();
@@ -40,7 +40,7 @@
 // from Java, I think.
 function test1SuccessCallback(responseObject) 
 {
-    org_apache_cxf_trace.trace("test1 success");
+    org_apache_cxf_trace.trace("test1/2 success");
 	globalResponseObject = responseObject;
 	globalNotifier.notify();
 }
@@ -52,8 +52,24 @@
 	
 	var intf = new org_apache_cxf_javascript_fortest_SimpleDocLitWrapped();
 	intf.url = url;
-	intf.basicTypeFunctionReturnString(test1SuccessCallback, test1ErrorCallback, 
-	                                   doubleArg, floatArg, intArg, longArg, stringArg);
+	// param order is from propOrder on the wrapper class.
+	intf.basicTypeFunctionReturnString(test1SuccessCallback, test1ErrorCallback,
+									   doubleArg, floatArg, intArg, longArg, stringArg
+									   ); 
+    // Return the notifier as a convenience to the Java code.
+	return globalNotifier;
+}
+
+function test2(url, doubleArg, floatArg, intArg, longArg, stringArg) 
+{
+	org_apache_cxf_trace.trace("Enter test2.");
+	globalNotifier = new org_apache_cxf_notifier();
+	
+	var intf = new org_apache_cxf_javascript_fortest_SimpleDocLitWrapped();
+	intf.url = url;
+	// param order from the interface
+	intf.basicTypeFunctionReturnStringNoWrappers(test1SuccessCallback, test1ErrorCallback, 
+	                                   			 stringArg, intArg, longArg, floatArg, doubleArg);
     // Return the notifier as a convenience to the Java code.
 	return globalNotifier;
 }



Mime
View raw message