Author: keith
Date: Thu Apr 17 08:39:06 2008
New Revision: 15759

Log:

Adding cleints for child(propertyName) methods



Modified:
   
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java

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
 Thu Apr 17 08:39:06 2008
@@ -111,4 +111,45 @@
         // Test weather the value of the attribute was returned correctly
         TestCase.assertEquals("0", result.getFirstElement().getText());
     }
+
+    /**
+     * Tests the child(propertyName) method of the E4X Impl
+     * Using an integer as the propertyName hence returns the child in that 
position.
+     * @throws Exception - Thrown in case an exception occurs
+     */
+    public void testChild1() throws Exception {
+        Options options = new Options();
+        options.setTo(endpointReference);
+        options.setAction(
+                
"http://services.mashup.wso2.org/E4XTest/ServiceInterface/child1Request";);
+        sender.setOptions(options);
+        OMElement result = sender.sendReceive(null);
+        // Test weather the correct element was returned correctly
+        TestCase.assertEquals(
+                "<employee id=\"0\"><name>Jim</name><age>25</age></employee>",
+                result.getFirstElement().getFirstElement().toString());
+    }
+
+    /**
+     * Tests the child(propertyName) method of the E4X Impl
+     * Using the elementName as the propertyName hence returns the children 
with that name.
+     * @throws Exception - Thrown in case an exception occurs
+     */
+    public void testChild2() throws Exception {
+        Options options = new Options();
+        options.setTo(endpointReference);
+        options.setAction(
+                
"http://services.mashup.wso2.org/E4XTest/ServiceInterface/child2Request";);
+        sender.setOptions(options);
+        OMElement result = sender.sendReceive(null);
+        // Test weather the correct 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().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