Forum Discussion

adymlincoln's avatar
adymlincoln
New Contributor
12 years ago

MockService Property - How to get, set...

Hi all,

First time on this board. I'm working on a Dynamic Mock Service and I need help.

I have the Mock Service up and running and it works fine. I'm using a Start Script on the MockService that creates a random 6 digit number as a ticket number...sort of a starting counter value. This is working and the property gets set in the MockService properties.

Then in my mockOperation (open), I'm trying to pick up the MockService ticket number, add one to the number, put that in my Response and finally update the MockService ticket number with the new ticket.

The basic idea is to maintain a running counter for as long as the MockService is running...

My Question, How do I Get/Set the MockService property from the mockOperation...I've tried a number of differing variations with no luck:

//def mockService = mockRunner.mockService("ebond-ipsoft")
//def strEbondTicket = context.mockService.getProperty( "next-ticket" )
//def project = mockOperation.mockService.project
//def request = project.interfaces["ebond-ipsoft"].operations["open"].getRequestByName("Request 2")
//def request = project.interfaces["ebond-ipsoft"]
def strEbondTicket = context.getProperty( "next-ticket" )
//def strEbondTicket = context.expand( '${#MockService#next-ticket}')
//def intEbondTicket = String.parseInt ( strEbondTicket )
//def i6 = new Integer(strEbondTicket)
//def i7 = Integer.parseInt(strEbondTicket)

//def nextTicket = intEbondTicket + 1

P.S. At this point I'm just trying to Get the property value...


thx in advance,

adym