Created
April 6, 2012 17:28
-
-
Save jsfeng/2321510 to your computer and use it in GitHub Desktop.
Groovy Service Test Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.net.http.HTTPBuilder | |
import static groovyx.net.http.Method.POST | |
import static groovyx.net.http.ContentType.JSON | |
import java.util.Random | |
String[] inputs=[ | |
'200', | |
'400', | |
'600', | |
'800', | |
'4343724', | |
'1156428', | |
'4343724', | |
'2001216', | |
'3002912', | |
'4238553' | |
] | |
Random rand = new Random() | |
int max = 9 | |
int index = rand.nextInt(max) | |
String mrn = inputs[index] | |
//log.info('random number is ' + index) | |
def http = new HTTPBuilder('http://svctst1:8080/patientService/rest/demographic/mrn/' + mrn +'.json' ) | |
http.request(GET, JSON ) { req -> | |
response.success = { resp, json -> | |
// log.info resp.status | |
//log.info xml | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment