I need to coordinate the responses of two or more mocks. One service provides planned vehicle route information and one or more other services provide "real-time" vehicle positions after the vehicle begins traveling from its departure to arrival location. I've thought about implementing a "coordinator" service that the others communicate with, but it isn't clear how I would discover the coordinator service's endpoint since we run these mocks both in SoapUI proper and in Tomcat.
Any ideas would be greatly appreciated.
Thanks for reaching out.
Community, can anyone assist Scott here please? Maybe has anyone faced a similar task?
Thank you in advance,
I am not sure I got the actual case...
By definition, (most of) web communication is stateless and HTTP is based on the request-response design.
The above means that web client and web server are required for the HTTP session and it is client who sends requests to the server and server responds to the request. As communication is stateless, this means that no coordination is needed.
Your scenario assumes two pairs of clients and servers. First client requests route from the server and the second client requests vehicle's position.
Web servers (and your mocks mimic web servers while they are absent) should not (and, usually, cannot) monitor whether the route for some vehicle was provided in order to start/allow provide coordinates for this given vehicle. If required, this must be a functionality of some intermediate back-end layer and I am not sure that you must implement its functionality. (As you are imitating web servers and their task is to provide the client with the route and current coordinates.)
Did I miss something essential in your scenario? What actual coordination you assumed?
P.S. Something that seems to be interesting and might appear to be relevant: https://restfulapi.net/hateoas/
I'll try to clarify my scenario.
A vehicle's route is planned by a user to occur at a particular time and submitted. When that vehicle is enroute, it's location is uploaded. A client requests the planned route from one service and requests enroute locations from a second service.
The planned route service's mock modifies a template response with times that are a short time in the future. The enroute track service's mock needs to modify it's templated responses to be within the the window defined by the planned route service's mock. This is the coordination I'm looking for.
OK... How these services are expected to coordinate in the real life?
> times that are a short time in the future.
Just curious, whether these services are expected to be used within the same time zone? What if the route starts in one time zone and end in another one?
Meanwhile, if both mocks are implemented within the same SoapUI project, why not to create a custom project property and use it for coordination?
Coordination in real life is a matter of process. A vehicle doesn't report its current position until it is enroute sometime after its planned time of departure.
All times are UTC.
The mocks are developed in a single SoapUI project, but are deployed as .war files during testing. Is it possible to deploy the project as a .war file?
> Is it possible to deploy the project as a .war file?
I believe that yes it is: https://www.soapui.org/soap-mocking/deploying-mock-services-as-war-files.html
> Coordination in real life is a matter of process. [...]
Sounds unreliable (what if the first service is out of order? Does this mean that the second service will not be contacted/will not provide information until the first one is back to service?), but this seems to be irrelevant...
I am already able to deploy individual mocks as .war files. I misinterpreted your comment about project variables that they were shareable between mocks, not used within a mock.
Yes, that is irrelevant.
> I am already able to deploy individual mocks as .war files.
Despite link address, the referenced article talks about project deployment.
> shareable between mocks, not used within a mock.
Actually, the idea was to share betweek mocks and use within them to set/get coordination data.
Get a full Raw JMS request
Compare an expected JSON value and actual response in Events
Fetch value/data from JSON response using Groovy Script
Get data from Petstore and add it to Excel sheets