Closed jarekczek closed 10 months ago
Thanks for reporting @jarekczek . It went missing in the 3.0 review
Hi @oleg-nenashev, I'd like to help out. How can I begin this task?
@TomerPacific thanks for the interest. I would recommend exploring this functionality in WireMock 2 by following the existing docs, and then updating to WireMock 3 and fixing the documentation accordingly
Thanks @oleg-nenashev for the quick response. I've done some digging and have found out that the API changed drastically. Since I am unfamiliar with WireMock, it is kind of hard for me to connect all the pieces together. Here is what I have so far:
This is the constructor for ResponseTemplateTransformer
public ResponseTemplateTransformer(
TemplateEngine templateEngine,
boolean global,
FileSource files,
List<TemplateModelDataProviderExtension> templateModelDataProviders) {
this.templateEngine = templateEngine;
this.global = global;
this.files = files;
this.templateModelDataProviders = templateModelDataProviders;
}
The TemplateEngine and global arguments I can infer
The argument called files, which is in fact a FileSource object is a bit obscure
And so are the TemplateModelDataProviderExtension
Since there is no javadoc at all in the project, I'm having trouble connecting the dots here.
This is what I have written so far in the relevant documentation place:
If you want to add permitted extensions to your rule,
then you can use the ResponseTemplateTransformer
when constructing the response template extension.
The ResponseTemplateTransformer
accepts four arguments:
TemplateEngine
FileSource
TemplateModelDataProviderExtension
objects@Rule
public WireMockRule wm = new WireMockRule(options()
.dynamicPort()
.withRootDirectory(defaultTestFilesRoot())
.extensions(new ResponseTemplateTransformer(
getTemplateEngine(),
options.getResponseTemplatingGlobal(),
getFiles(),
templateModelProviders
)
)
);
Could you help me out by explaining these arguments?
@oleg-nenashev - Can you provide some feedback regarding what I wrote above? I opened a draft PR.
Hi. Catching up with my backlog, will respond asap. Please note the better way to get more feedback is bringing it up in #help-contributing
because there are more folks who can respond
In the example there is a method getTemplateEngine()
. Where does it come from?
@jarekczek , did you find an answer. I see a defaultTemplateEngine() static method in TemplateEngine class.
Summary
I am facing a task of upgrading from wiremock 2.26. I have problems with creating ResponseTemplateTransformer. Seems like the Response Templating section uses ResponseTemplateTransformer.Builder, which is now removed. Could you please document the way this transformer should be created?
References
No response