svn commit r43940 - trunk/commons/qa/web-test-framework/esb/src/test/java/org/wso2/carbon/web/test/esb

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit r43940 - trunk/commons/qa/web-test-framework/esb/src/test/java/org/wso2/carbon/web/test/esb

Evanthika Amarasiri
Author: evanthika
Date: Fri Aug 21 02:37:16 2009
New Revision: 43940
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=43940

Log:
New clss to test extension mediators

Added:
   trunk/commons/qa/web-test-framework/esb/src/test/java/org/wso2/carbon/web/test/esb/ESBExtensionMediatorsTest.java

Added: trunk/commons/qa/web-test-framework/esb/src/test/java/org/wso2/carbon/web/test/esb/ESBExtensionMediatorsTest.java
URL: http://wso2.org/svn/browse/wso2/trunk/commons/qa/web-test-framework/esb/src/test/java/org/wso2/carbon/web/test/esb/ESBExtensionMediatorsTest.java?pathrev=43940
==============================================================================
--- (empty file)
+++ trunk/commons/qa/web-test-framework/esb/src/test/java/org/wso2/carbon/web/test/esb/ESBExtensionMediatorsTest.java Fri Aug 21 02:37:16 2009
@@ -0,0 +1,122 @@
+package org.wso2.carbon.web.test.esb;
+
+import org.wso2.carbon.web.test.common.SeleniumTestBase;
+import org.apache.commons.io.FileUtils;
+
+import java.io.FileInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+public class ESBExtensionMediatorsTest extends CommonSetup{
+    Properties properties = new Properties();
+
+    public ESBExtensionMediatorsTest(String text) {
+        super(text);
+    }
+
+    /*
+    Creating the local entry for the context.xml
+     */
+    public void addLocalEntry() throws Exception{
+        properties.load(new FileInputStream(".."+ File.separator+"esb"+File.separator+"src"+File.separator+"test"+File.separator+"resources"+File.separator+"esb.properties"));
+        SeleniumTestBase seleniumTestBase = new SeleniumTestBase(selenium);
+        String carbon_home = properties.getProperty("carbon.home");
+        ESBManageLocalEntriesTest esbManageLocalEntriesTest = new ESBManageLocalEntriesTest(selenium);
+        esbManageLocalEntriesTest.addSourceUrlEntry("context.xml","file:"+carbon_home+"/repository/samples/resources/spring/context.xml");
+        esbManageLocalEntriesTest.addSourceUrlEntry("stockquoteScript","file:"+carbon_home+"/repository/samples/resources/script/stockquoteTransform.js");        
+    }
+
+    /*
+    Adding the Spring mediator
+     */
+    public void addSpringMediator() throws Exception{
+        ESBCommon esbCommon = new ESBCommon(selenium);
+        ESBSpringMediatorTest esbSpringMediatorTest = new ESBSpringMediatorTest(selenium);
+        esbCommon.addRootLevelChildren("Add Child","Extension","Spring");
+        esbSpringMediatorTest.addSpringMediator("0","SimpleMathBean","context.xml");
+        esbCommon.mediatorUpdate();
+    }
+
+    /*
+    Adding the Script mediator
+     */
+    public void addScriptMediator() throws Exception{
+        ESBScriptMediatorTest esbScriptMediatorTest = new ESBScriptMediatorTest(selenium);
+        ESBCommon esbCommon = new ESBCommon(selenium);
+        String requestContent = null;
+        
+        try {
+            File file = new File(".." + File.separator + "esb" + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "requestJavaScript.js");
+            requestContent = FileUtils.readFileToString(file);
+        } catch (
+                IOException e) {
+        }
+
+        //Adding the Registry type script mediator
+        esbScriptMediatorTest.addRegistryScripts("1","Javascript","transformRequest","stockquoteScript");
+        esbCommon.mediatorUpdate();
+
+        //Adding the inline script mediator
+        esbScriptMediatorTest.addInlineScripts ("2","Javascript",requestContent);
+        esbScriptMediatorTest.addIncludeKeys("stockquoteScript");
+        esbCommon.mediatorUpdate();
+    }
+
+    /*
+    Adding the Class mediator
+     */
+    public void addClassMediator() throws Exception{
+
+    }
+
+    /*
+    Adding the Command mediator
+     */
+    public void addCommandMediator() throws Exception{
+
+    }
+
+    /*
+    This method will add all the mediators which are under the 'Extension' category to a sequence and update the Synapse confoguration
+     */
+    public void testAddExtensionMediators() throws Exception{
+        ESBCommon esbCommon = new ESBCommon(selenium);
+        SeleniumTestBase seleniumTestBase = new SeleniumTestBase(selenium);
+
+        boolean login = selenium.isTextPresent("Sign-out");
+
+        if (login){
+            seleniumTestBase.logOutUI();
+        }
+
+        seleniumTestBase.loginToUI("admin","admin");
+
+        addLocalEntry();
+        addSpringMediator();
+        addScriptMediator();
+        addClassMediator();
+        esbCommon.setupMainSeq();
+        esbCommon.addSequence("sequence_extension");
+        esbCommon.sequenceSave();
+        seleniumTestBase.logOutUI();
+    }
+
+}

_______________________________________________
Commons-dev mailing list
[hidden email]
https://wso2.org/cgi-bin/mailman/listinfo/commons-dev