Author: keith
Date: Mon Apr 21 02:00:25 2008
New Revision: 15889

Log:

Adding clients to text elements method of E4X impl


Modified:
   trunk/mashup/java/modules/integration/test-resources/scripts/E4XTest.js
   
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java

Modified: 
trunk/mashup/java/modules/integration/test-resources/scripts/E4XTest.js
==============================================================================
--- trunk/mashup/java/modules/integration/test-resources/scripts/E4XTest.js     
(original)
+++ trunk/mashup/java/modules/integration/test-resources/scripts/E4XTest.js     
Mon Apr 21 02:00:25 2008
@@ -119,5 +119,5 @@
                        <employee id="0" 
><name>Jim</name><age>25</age></employee>
                        <employee id="1" 
><name>Joe</name><age>20</age></employee>
                </employees>;
-       return e.elements("name");
+       return e.employee[0].elements("name");
 }
\ No newline at end of file

Modified: 
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java
==============================================================================
--- 
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java
 (original)
+++ 
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java
 Mon Apr 21 02:00:25 2008
@@ -180,6 +180,52 @@
         sender.setOptions(options);
         OMElement result = sender.sendReceive(null);
         // Test weather the index of the element was returned correctly
-        TestCase.assertEquals("<return 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; 
xmlns:js=\"http://www.wso2.org/ns/jstype\"; js:type=\"xmlList\" 
xsi:type=\"xs:anyType\"><name>Jim</name><age>25</age></return>", 
result.getFirstElement().toString());
+        TestCase.assertEquals("<return 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; " +
+                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
+                "xmlns:js=\"http://www.wso2.org/ns/jstype\"; 
js:type=\"xmlList\" " +
+                
"xsi:type=\"xs:anyType\"><name>Jim</name><age>25</age></return>",
+                              result.getFirstElement().toString());
+    }
+
+    /**
+     * Tests the elements() method of the E4X Impl
+     * Calling this function with no parameters hence it returns all child 
elements of thisXML object.
+     * @throws Exception - Thrown in case an exception occurs
+     */
+    public void testElements1() throws Exception {
+        Options options = new Options();
+        options.setTo(endpointReference);
+        options.setAction(
+                
"http://services.mashup.wso2.org/E4XTest/ServiceInterface/elements1Request";);
+        sender.setOptions(options);
+        OMElement result = sender.sendReceive(null);
+        // Test weather the index of the element was returned correctly
+        TestCase.assertEquals("<return 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; " +
+                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
+                "xmlns:js=\"http://www.wso2.org/ns/jstype\"; 
js:type=\"xmlList\" " +
+                "xsi:type=\"xs:anyType\"><employee 
id=\"0\"><name>Jim</name><age>25</age></employee>" +
+                "<employee 
id=\"1\"><name>Joe</name><age>20</age></employee></return>",
+                              result.getFirstElement().toString());
+    }
+
+    /**
+     * Tests the elements(propertyName) method of the E4X Impl
+     * Calling this function "name" as the parameters hence it returns all 
child elements with the
+     * name "name" of thisXML object.
+     * @throws Exception - Thrown in case an exception occurs
+     */
+    public void testElements2() throws Exception {
+        Options options = new Options();
+        options.setTo(endpointReference);
+        options.setAction(
+                
"http://services.mashup.wso2.org/E4XTest/ServiceInterface/elements2Request";);
+        sender.setOptions(options);
+        OMElement result = sender.sendReceive(null);
+        // Test weather the index of the element was returned correctly
+        TestCase.assertEquals("<return 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; " +
+                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
+                "xmlns:js=\"http://www.wso2.org/ns/jstype\"; 
js:type=\"xmlList\" " +
+                "xsi:type=\"xs:anyType\"><name>Jim</name></return>",
+                              result.getFirstElement().toString());
     }
 }
\ No newline at end of file

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to