svn commit r44120 - trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common

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

svn commit r44120 - trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common

Charitha Kankanamge
Author: charitha
Date: Tue Aug 25 01:53:03 2009
New Revision: 44120
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=44120

Log:
Security client to handle payloads with no inputs

Modified:
   trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common/SecurityClient.java

Modified: trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common/SecurityClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common/SecurityClient.java?rev=44120&r1=44119&r2=44120&view=diff
==============================================================================
--- trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common/SecurityClient.java (original)
+++ trunk/commons/qa/web-test-framework/commons/src/test/java/org/wso2/carbon/web/test/common/SecurityClient.java Tue Aug 25 01:53:03 2009
@@ -57,7 +57,7 @@
         String host_name = properties.getProperty("host.name");
         String http_port = properties.getProperty("http.port");
         String https_port = properties.getProperty("https.port");
-        String context_root =  properties.getProperty("context.root");
+        String context_root = properties.getProperty("context.root");
         System.setProperty("javax.net.ssl.trustStore", carbon_home + File.separator + "resources" + File.separator + "security" + File.separator + "wso2carbon.jks");
         System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
 
@@ -67,20 +67,17 @@
         sc.engageModule("addressing");
 
         Options opts = new Options();
-        if(context_root.equals(null))
-        {
+        if (context_root.equals(null)) {
             if (scenarioid.equals("scenario1")) {
-                opts.setTo(new EndpointReference("https://" + host_name + ":" + https_port +"/services/" + serviceName));
+                opts.setTo(new EndpointReference("https://" + host_name + ":" + https_port + "/services/" + serviceName));
             } else {
-                opts.setTo(new EndpointReference("http://" + host_name + ":" + http_port +"/services/" + serviceName));
+                opts.setTo(new EndpointReference("http://" + host_name + ":" + http_port + "/services/" + serviceName));
             }
-        }
-        else
-        {
-          if (scenarioid.equals("scenario1")) {
-                opts.setTo(new EndpointReference("https://" + host_name + ":" + https_port + context_root +"/services/" + serviceName));
+        } else {
+            if (scenarioid.equals("scenario1")) {
+                opts.setTo(new EndpointReference("https://" + host_name + ":" + https_port + context_root + "/services/" + serviceName));
             } else {
-                opts.setTo(new EndpointReference("http://" + host_name + ":" + http_port +  context_root +"/services/" + serviceName));
+                opts.setTo(new EndpointReference("http://" + host_name + ":" + http_port + context_root + "/services/" + serviceName));
             }
         }
         opts.setAction(SoapAction);
@@ -95,9 +92,15 @@
         }
         try {
             sc.setOptions(opts);
-            result = sc.sendReceive(CreateRequestReplyPayload(Namespace, operation, param));
-            System.out.println(result.getFirstElement().getText());
-            return result;
+            if (param.equals(null)) {
+                result = sc.sendReceive(CreateRequestReplynoInputsPayload(Namespace, operation));
+                System.out.println(result.getFirstElement().getText());
+                return result;
+            } else {
+                result = sc.sendReceive(CreateRequestReplyPayload(Namespace, operation, param));
+                System.out.println(result.getFirstElement().getText());
+                return result;
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -161,6 +164,15 @@
         return OP1;
     }
 
+    public OMElement CreateRequestReplynoInputsPayload(String NameSpace, String operation) throws Exception {
+
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omns = fac.createOMNamespace(NameSpace, "b");
+        OMElement OP1 = fac.createOMElement(operation, omns);
+        return OP1;
+
+    }
+
     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
 
         WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[0];

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