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

ResponseTemplateTransformer standalone #768

Closed
flyinfish opened this issue Oct 4, 2017 · 3 comments
Closed

ResponseTemplateTransformer standalone #768

flyinfish opened this issue Oct 4, 2017 · 3 comments

Comments

@flyinfish
Copy link

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


@tomakehurst
Copy link
Member

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

@flyinfish
Copy link
Author

still cannot see it!!?

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

not very elegant

@tomakehurst
Copy link
Member

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.

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

No branches or pull requests

2 participants