Wednesday, July 4, 2012

jaggeryjs.org/tryitview.jag

Today I am going to introduce http://jaggeryjs.org/tryitview tool.

Tryit tool has always been a part of  WSO2 products. It is a client application which lets you invoke and test a service after providing data to the payload that the tool itself is generating by looking at the service source.

http://jaggeryjs.org/tryitview is available in WSO2 Jaggery Runtime.  It is to test jaggery applications.  You need to simply paste the application source on the editor and invoke using tryit button. The results pane will display the outcome with any available HTML also rendered.

Now that we know what it is, lets have a tour (a technical tour :) )

  • Access tryit tool
    • You can do this by simply hitting  http://jaggeryjs.org/tryitview OR
    • By accessing jaggery run-time server. For this you need to;
      •  download WSO2 Jaggery alpha pack
      •  extract it
      •  run bin/server.sh.  
      •  access http://localhost:9763/tryitview.jag

  •  In the tryit view, paste your code and invoke using the 'tryit' button at the left corner.
  • Sample code segment is here


<%
 print('Hi, 

Jaggery

') var obj = {"name": "Madhuka", "company":"WSO2"}; print(obj); %>
  • In the above you don't have to pass any query params along with your request. But if you do, then you can use "Add Query String' option in the top.


  • Lets try this using following code. 
<% 

 var content = request.getParameter("cont");
 var to = request.getParameter("to");
 var subject = request.getParameter("sub");
 
 var email = require("email");
 //Add valid credentials
 var sender = new email.Sender("smtp.gmail.com", "25", "yumani@wso2.com", "ssfsdfsdfsdfd1");
 
 //Fill the correct information
 sender.from = "yumani@wso2.com";
 sender.to = to;
 sender.cc = to;
 sender.bcc = to;
 sender.subject = subject;
 sender.text = content;
 sender.send();
 
 print("email successfully sent to " + to); 
 %>


  • My query string for the source is - 
  • cont=xwww&to=yumani@wso2.com&sub=test  


    Guess you enjoyed !! You are open to try out various samples we have in  http://jaggeryjs.org/documentation.jag




    Featured

    Selenium - Page Object Model and Action Methods

      How we change this code to PageObjectModel and action classes. 1 2 3 driver . findElement ( By . id ( "userEmail" )). sendKeys (...

    Popular Posts