Monday, May 11, 2015

[SOAPUI] Generating an unique property per test case and referring it in multiple requests.


1) Create a SoapUI project and create a test case. 
2) Crete a Script test step and enter following code snippet. This should be the first test step of the test case. 

Node : this will create a property called id  in test case scope. So it won't get altered in multithreaded test.

Groovy Script

def key = java.util.UUID.randomUUID().toString()
context.getTestCase().getProperty( "id" ).setValue(key);



3) You can access property id in using following inline script. 

${=context.getTestCase().getPropertyValue( "id" )}

Example :






Tuesday, January 20, 2015

[Oracle] How to get raw counts of all tables at once


SQL Query : 

select
      table_name,
      to_number(
        extractvalue(
          xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name))
          ,'/ROWSET/ROW/C')
          )
          count
    from user_tables 
/



Saturday, November 8, 2014

[WSO2 ESB] [4.8.1] How to Convert XML to JSON Array

Following API Demonstrate this functionality.

Try above api with a rest client with following sample requests.

1)Multiple Stocks.
XML request: JSON response : 2) Single Stock
XML request: JSON response (As an array): This is with following message formatter and builder
        <messageformatter class="org.apache.synapse.commons.json.JsonStreamFormatter" contenttype="application/json" />

        <messageformatter class="org.apache.synapse.commons.json.JsonStreamFormatter" contenttype="application/json" />