Wiremock: ResponseTemplateTransformer standalone

Created on 4 Oct 2017  路  3Comments  路  Source: tomakehurst/wiremock

Transformer cannot be used standalone!!?

following arg results in exeption
--extensions com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer

would be solved by adding default-constructor "this(true)"?

https://github.com/tomakehurst/wiremock/blob/master/src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/ResponseTemplateTransformer.java#L50

Exception in thread "main" java.lang.InstantiationException: com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer
at java.lang.Class.newInstance(Class.java:427)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader$2.apply(ExtensionLoader.java:61)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader$2.apply(ExtensionLoader.java:57)
at wiremock.com.google.common.collect.Iterators$8.transform(Iterators.java:799)
at wiremock.com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at wiremock.com.google.common.collect.Maps.uniqueIndex(Maps.java:1163)
at wiremock.com.google.common.collect.Maps.uniqueIndex(Maps.java:1140)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader.asMap(ExtensionLoader.java:43)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader.loadExtension(ExtensionLoader.java:32)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader.load(ExtensionLoader.java:39)
at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.extensionsOfType(CommandLineOptions.java:277)
at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:80)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:69)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:65)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.main(WireMockServerRunner.java:113)
Caused by: java.lang.NoSuchMethodException: com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 14 more


Most helpful comment

Good grief. From the page I linked to:

--global-response-templating: Render all response definitions using Handlebars templates.

--local-response-templating: Enable rendering of response definitions using Handlebars templates for specific stub mappings.

Please post future questions on the mailing list as per the README.

All 3 comments

...or by following the instructions in the docs:
http://wiremock.org/docs/running-standalone/#command-line-options

still cannot see it!!?

--extensions my.bloody.NonGlobalResponseTemplateTransformer
public class NonGlobalResponseTemplateTransformer extends ResponseTemplateTransformer {
    public NonGlobalResponseTemplateTransformer() {
        super(false);
    }
}

not very elegant

Good grief. From the page I linked to:

--global-response-templating: Render all response definitions using Handlebars templates.

--local-response-templating: Enable rendering of response definitions using Handlebars templates for specific stub mappings.

Please post future questions on the mailing list as per the README.

Was this page helpful?
0 / 5 - 0 ratings