Skip to content

Instantly share code, notes, and snippets.

@jsfeng
Created April 6, 2012 17:28
Show Gist options
  • Save jsfeng/2321510 to your computer and use it in GitHub Desktop.
Save jsfeng/2321510 to your computer and use it in GitHub Desktop.
Groovy Service Test Script
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