Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch Script not working #351

Closed
roxana-sterca opened this issue Feb 19, 2021 · 4 comments
Closed

Dispatch Script not working #351

roxana-sterca opened this issue Feb 19, 2021 · 4 comments

Comments

@roxana-sterca
Copy link

roxana-sterca commented Feb 19, 2021

Upload one of your sample files (microcks\samples\HelloAPI-soapui-project.xml) and the dispatching does not work in this case..
The dispatcher always returns the first loaded response instead of the response corresponding to the invoked request
image
image

09:25:52.596 INFO 1 --- [80-exec-10] i.github.microcks.web.RestController : Servicing mock response for service [Hello+API+Mock, 0.8] on uri /rest/Hello+API+Mock/0.8/v1/hello with verb GET
09:25:52.596 DEBUG 1 --- [80-exec-10] i.github.microcks.web.RestController : Request body: null
09:25:52.596 DEBUG 1 --- [80-exec-10] i.github.microcks.web.RestController : Found resourcePath: /v1/hello
09:25:52.600 DEBUG 1 --- [80-exec-10] i.github.microcks.web.RestController : Found a valid operation /v1/hello with rules: // Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body

// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString

if( queryString.contains("David") )
{
// return the name of the response you want to dispatch
return "David Response"
}
else if( queryString.contains("Gavin") )
{
// return the name of the response you want to dispatch
return "Gavin Response"
}
else return "Unknown Response"
09:25:52.609 INFO 1 --- [80-exec-10] i.g.m.u.s.SoapUIScriptEngineBinder : QueryString: user=David
09:25:52.610 DEBUG 1 --- [80-exec-10] i.github.microcks.web.RestController : Dispatch criteria for finding response is
09:25:52.615 DEBUG 1 --- [80-exec-10] i.github.microcks.web.RestController : No responses found so far, tempting with just bare operationId...
09:25:52.617 DEBUG 1 --- [80-exec-10] i.g.m.web.MockControllerCommons : Mock invocation event has been published
09:25:52.617 DEBUG 1 --- [ task-9] i.g.m.listener.DailyStatisticsFeeder : Received a MockInvocationEvent on Hello API Mock - v0.8
09:25:52.618 DEBUG 1 --- [ task-9] i.g.m.listener.DailyStatisticsFeeder : hourKey for statistic is 9
09:25:52.618 DEBUG 1 --- [ task-9] i.g.m.listener.DailyStatisticsFeeder : minuteKey for statistic is 565
09:25:52.621 DEBUG 1 --- [ task-9] i.g.m.listener.DailyStatisticsFeeder : Found an existing statistic document for 20210219
09:25:52.623 DEBUG 1 --- [ task-9] i.g.m.listener.DailyStatisticsFeeder : Processing of MockInvocationEvent done !
09:25:52.746 DEBUG 1 --- [ Thread-6] SoapUIMultiThreadedHttpConnectionManager : Closing expired connections
09:25:52.747 DEBUG 1 --- [ Thread-6] SoapUIMultiThreadedHttpConnectionManager : Closing connections idle longer than 30 SECONDS

@lbroudoux
Copy link
Member

Thanks for the issue. Pushing a fix asap.

lbroudoux added a commit that referenced this issue Feb 19, 2021
@lbroudoux
Copy link
Member

Now fixed.

@roxana-sterca
Copy link
Author

roxana-sterca commented Feb 22, 2021

Thank you. It works now with the latest version

@Pavan059
Copy link

Pavan059 commented Dec 29, 2021

Hi @lbroudoux , Still I am facing the issue with version : Version 1.4.2-SNAPSHOT of microcks
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants