wiremock / wiremock-grpc-extension

WireMock Extension: gRPC mocking
https://wiremock.org/docs/grpc/
Apache License 2.0
14 stars 8 forks source link

Add option to read multiple desc files from multiple URLs #70

Open gertz167 opened 4 months ago

gertz167 commented 4 months ago

Proposal

Currently there must be defined an additional sub directory named "grpc" in wiremock directory.

In our case the grpc desc files are part of a maven-third-party lib. That means we can not easily copy the desc files from a maven library to a subdirecty wiremock/grpc.

It would be great that the class GrpcExtensionFactory/GrpcHttpServerFactory supports URLs. That would allow us to read the grpc desc files directly from the third-party-lib.

Here is an example how it would look like:

 @Test
    void testExecuteWiremockTest()  {
        // read myexample.com from third-party-maven-lib
        URL resource = this.getClass().getClassLoader().getResource("myexample.desc");
        System.out.println(resource.getFile());

        WireMockConfiguration options = WireMockConfiguration.options();
        options
            .dynamicPort()
            .extensions(new GrpcExtensionFactory(Collections.singletonList(resource)));
        wireMockServer = new com.github.tomakehurst.wiremock.WireMockServer(options);
        wireMockServer.start();
    }

References

No response

gertz167 commented 4 months ago

I added the main change in PR https://github.com/wiremock/wiremock-grpc-extension/pull/71