cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r598099 - in /incubator/cxf/trunk/rt/javascript/src/test: java/org/apache/cxf/javascript/ java/org/apache/cxf/javascript/fortest/ resources/org/apache/cxf/javascript/
Date Mon, 26 Nov 2007 00:49:23 GMT
Author: bimargulies
Date: Sun Nov 25 16:49:21 2007
New Revision: 598099

URL: http://svn.apache.org/viewvc?rev=598099&view=rev
Log:
Add tests for simple cases of DocLitBare that pass.

Modified:
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java?rev=598099&r1=598098&r2=598099&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
Sun Nov 25 16:49:21 2007
@@ -45,7 +45,6 @@
  * but a complex type for an array of the element.
  */
 
-@org.junit.Ignore
 public class DocLitBareClientTest extends AbstractCXFSpringTest {
 
     private static final Logger LOG = LogUtils.getL7dLogger(DocLitBareClientTest.class);
@@ -121,7 +120,7 @@
         // this method returns void, which translated into a Javascript object with no properties.

         Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
         assertNotNull(responseObject);
-        SimpleDocLitWrappedImpl impl = getBean(SimpleDocLitWrappedImpl.class, "dlw-service");
+        SimpleDocLitWrappedImpl impl = getBean(SimpleDocLitWrappedImpl.class, "dlb-service");
         TestBean1 b1returned = impl.getLastBean1();
         assertEquals(b1, b1returned);
         TestBean1[] beansReturned = impl.getLastBean1Array();
@@ -129,12 +128,78 @@
         return null;
     }
     
+    private Void compliantCaller(Context context) {
+        TestBean1 b1 = new TestBean1(); 
+        b1.stringItem = "strung";
+
+        b1.beanTwoNotRequiredItem = new TestBean2("bean2");
+        
+        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
+        
+        LOG.info("About to call compliant" + endpoint.getAddress());
+        Notifier notifier = 
+            testUtilities.rhinoCallConvert("compliantTest", Notifier.class, 
+                                           testUtilities.javaToJS(endpoint.getAddress()),
+                                           jsBean1);
+        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 String
+        String response = (String)testUtilities.rhinoEvaluate("globalResponseObject");
+        assertEquals("strung", response);
+        return null;
+    }
+    
+    private Void compliantNoArgsCaller(Context context) {
+        LOG.info("About to call compliantNoArgs " + endpoint.getAddress());
+        Notifier notifier = 
+            testUtilities.rhinoCallConvert("compliantNoArgsTest", Notifier.class, 
+                                           testUtilities.javaToJS(endpoint.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 String
+        Scriptable response = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
+        String item = testUtilities.rhinoCallMethodConvert(String.class, response, "getStringItem");
+        assertEquals("horsefeathers", item);
+        return null;
+    }
+    @org.junit.Ignore
     @Test
     public void callFunctionWithBeans() {
         LOG.info("about to call beanFunctionTest");
         testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
             public Void run(Context context) {
                 return beanFunctionCaller(context);
+            }
+        });
+    }
+
+    @Test
+    public void callCompliant() {
+        LOG.info("about to call compliant");
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+            public Void run(Context context) {
+                return compliantCaller(context);
+            }
+        });
+    }
+
+    @Test
+    public void callCompliantNoArgs() {
+        LOG.info("about to call compliantNoArg");
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+            public Void run(Context context) {
+                return compliantNoArgsCaller(context);
             }
         });
     }

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java?rev=598099&r1=598098&r2=598099&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
Sun Nov 25 16:49:21 2007
@@ -47,4 +47,7 @@
     
     @WebMethod 
     String compliant(@WebParam(name = "beanParam") TestBean1 green);
+    
+    @WebMethod
+    TestBean2 compliantNoArgs();
 }

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java?rev=598099&r1=598098&r2=598099&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
Sun Nov 25 16:49:21 2007
@@ -65,6 +65,11 @@
         lastBean1 = green;
         return green.stringItem;
     }
+    
+
+    public TestBean2 compliantNoArgs() {
+        return new TestBean2("horsefeathers");
+    }
 
     public String getLastString() {
         return lastString;

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js?rev=598099&r1=598098&r2=598099&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
Sun Nov 25 16:49:21 2007
@@ -67,3 +67,37 @@
     // Return the notifier as a convenience to the Java code.
 	return globalNotifier;
 }
+
+function compliantTest(url, beanArg)
+{
+	org_apache_cxf_trace.trace("Enter compliantTest.");
+	resetGlobals();
+	globalNotifier = new org_apache_cxf_notifier();
+	
+	var intf;
+    intf = new org_apache_cxf_javascript_fortest_SimpleDocLitBare();
+	  
+	intf.url = url;
+	// param order from the interface
+    intf.compliant(test1SuccessCallback, test1ErrorCallback, beanArg); 
+    // Return the notifier as a convenience to the Java code.
+	return globalNotifier;
+}
+
+function compliantNoArgsTest(url)
+{
+	org_apache_cxf_trace.trace("Enter compliantArgsTest.");
+	resetGlobals();
+	globalNotifier = new org_apache_cxf_notifier();
+	
+	var intf;
+    intf = new org_apache_cxf_javascript_fortest_SimpleDocLitBare();
+	  
+	intf.url = url;
+	// param order from the interface
+    intf.compliantNoArgs(test1SuccessCallback, test1ErrorCallback); 
+    // Return the notifier as a convenience to the Java code.
+	return globalNotifier;
+}
+
+    
\ No newline at end of file



Mime
View raw message