Author: keith
Date: Thu Apr 17 07:59:12 2008
New Revision: 15753

Log:

Adding an integration test to test out the E4X stuff



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

Added: trunk/mashup/java/modules/integration/test-resources/scripts/E4XTest.js
==============================================================================
--- (empty file)
+++ trunk/mashup/java/modules/integration/test-resources/scripts/E4XTest.js     
Thu Apr 17 07:59:12 2008
@@ -0,0 +1,9 @@
+function addNamespace(){
+       var e = <employees>
+                       <employee id="0" 
><name>Jim</name><age>25</age></employee>
+                       <employee id="1" 
><name>Joe</name><age>20</age></employee>
+               </employees>;
+       var namespace = new Namespace("test","http://wso2.com";);
+       e.employee.(name == "Jim").addNamespace(namespace);
+       return e;
+}

Added: 
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java
==============================================================================
--- (empty file)
+++ 
trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/E4XTest.java
 Thu Apr 17 07:59:12 2008
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007,2008 WSO2, Inc. http://www.wso2.org
+ *
+ * Licensed 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.wso2.mashup.integration;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+
+public class E4XTest extends IntegrationTestSuite{
+
+    private EndpointReference endpointReference;
+
+    private ServiceClient sender;
+
+    public void setUp() throws java.lang.Exception {
+        super.setUp();
+        sender = new ServiceClient();
+        endpointReference =
+                new EndpointReference(host + ":" + port + "/" + serviceRoot + 
"/system/E4XTest");
+        IntegrationTestSuite.testConnect(
+                new EndpointReference(host + ":" + port + "/" + serviceRoot + 
"/system/E4XTest"));
+    }
+
+    public void testAddNamespace() throws Exception {
+        Options options = new Options();
+        options.setTo(endpointReference);
+        options.setAction(
+                
"http://services.mashup.wso2.org/E4XTest/ServiceInterface/addNamespaceRequest";);
+        sender.setOptions(options);
+        OMElement result = sender.sendReceive(null);
+        TestCase.assertEquals(
+                "<employee xmlns:test=\"http://wso2.com\"; 
id=\"0\"><name>Jim</name><age>25</age></employee>",
+                
result.getFirstElement().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