Closed jordi133 closed 8 years ago
can you add an example of ProgrammedStub.scala?
do we need to compile the file ourselves, or do we get a jar?
does the ProgrammedStub.scala contain Main object? does it take any parameters? how do we know which method to execute?
Is the program supposed to return a json content or send the reply to the requester already?
Let's assume that there is a .class file (for example ProgrammedStub.class) available on the classpath of castalia and that the stub config contains "source" = "ProgrammedStub"
There should be a trait that mixes in a function process(httpRequest: HttpRequest): StubResponse (or a RequestMatch, which will be enriched with the httpRequest.
background: given that the stubserver is started and configured to use a stub called "programmedstub" and that a stub config file with name "programmedstub.json" is on the classpath and "programmedstub.json" contains a property "endpoint" equal to "programmedstub"
given that "programmedstub.json" contains a property "behaviorSource" equal to "ProgrammedStub.class" and "ProgrammedStub.class" is on the classpath when I do a HTTP GET to .../castalia/stubs/programmedstub/
then the logic programmed in ProgrammedStub.scala should be used for creating the response