quarkiverse / quarkus-wiremock

Quarkus extension for launching an in-process Wiremock server
https://wiremock.org/
Apache License 2.0
16 stars 12 forks source link

Can WireMock gRPC extension be used with this? #58

Open ranjanashish opened 1 year ago

ranjanashish commented 1 year ago

https://mvnrepository.com/artifact/org.wiremock/wiremock-grpc-extension

chberger commented 1 year ago

HI @ranjanashish Thanks for your question. Actually, I'm not familiar with the referenced extension yet. However, if I get some time I'll investigate it.

ranjanashish commented 1 year ago

Hi Christian, Thank you for looking into it. I recently attended a talk at SF Java group where Tom presented this extension. I am sharing the link to the talk here in case you find it helpful - https://youtu.be/RDZTDsNXeLw?si=63GwV7U8G87ikj6O

chberger commented 1 year ago

I've watched the video - thanks for sharing it. The main challenge is the gRPC extension comes via an additional dependency. It's not part of the core WireMock library. So this Quarkus extension would need to load that extension on demand, which seems to be a little bit tricky. Let me think about it, maybe I'll come up with an idea how to support such extensions in a practical manner.

oleg-nenashev commented 12 months ago

I think the best possible solution would be creating a WireMock Dev Service, based on https://github.com/wiremock/wiremock-testcontainers-java that supports extensions, etc.. Happy to cooperate on that @chberger

tomakehurst commented 12 months ago

@chberger WireMock can automatically load extensions via Java's service loader mechanism. There's a config flag you need to enable on WireMock's startup options, but otherwise placing the extension JAR file on the classpath would be enough.

chberger commented 12 months ago

Hi @tomakehurst, thanks for pointing this out. I'm already aware of this feature. Your documentation is quite good. Btw: I am honored that you are interested in this extension :-)

So personally I think there is no need to introduce testcontainers just to accomplish this integration. Anyhow, I would need a little bit more time to understand the Quarkus gRPC approach. The idea is that this extension should work with the Quarkus gRPC extension seamlessly. I don't think the integration would be complex or somehow tight coupled, but I just need a little bit more time to familiarize myself with the gRPC examples:

Since @oleg-nenashev offered some support, we maybe could share some work. wdyt?

oleg-nenashev commented 12 months ago

Work in progress, I guess!

github-actions[bot] commented 10 months ago

@chberger This is being labeled as stale.

chberger commented 10 months ago

Yeah, it's on on my list. I'll implement it as soon as all the basic issues are solved.

edeandrea commented 8 months ago

@chberger I'm happy to collaborate on this if you would like. I would like to be able to combine the WIremock gRPC extension with this dev service, as I would like to have this capability in the Quarkus Superheroes.

Note though that the application in question doesn't necessarily have to implement a gRPC service. It's more likely that because it wants to use Wiremock it is a consumer of a gRPC service that wants to mock a gRPC backend.

I've also contributed to the Wiremock gRPC extension, so I have history with both.

Today I'm doing this: https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/src/test/java/io/quarkus/sample/superheroes/fight/LocationsWiremockGrpcServerResource.java and consuming it in https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/src/test/java/io/quarkus/sample/superheroes/fight/rest/FightResourceIT.java

But because its not part of the DevService it can only be used in tests.

The rest-fights service hasn't yet been converted to use the Wiremock Quarkus extension at all. Basically I create 2 WireMock instances - 1 for the REST clients and 1 for the gRPC client.

chberger commented 7 months ago

Hi @edeandrea,

Firstly, I want to extend my apologies for the delayed response. I've been quite busy with my full-time job lately, but I deeply appreciate your offer to help. 💪

Your proposal sounds incredibly valuable, and I am very much open to collaborating. 👍

Regarding the Wiremock gRPC extension integration: IMHO the Quarkus Wiremock extension should ideally work seamlessly with the Quarkus gRPC extension. It appears that the Quarkus gRPC extension offers its own Devservice, which might reduce the necessity for an additional tool like this extension in this context. However, I might have overlooked something, as my assessment was rather brief. In light of this, do you think it's still advantageous to pursue mocking gRPC services with the Wiremock gRPC extension?

Your insights would be incredibly valuable here.

Thank you once again for your patience and willingness to assist. I look forward to your thoughts on this matter.

@geoand also contributed the extension scanning mechanism via the Java's service loader mechanism: https://github.com/quarkiverse/quarkus-wiremock/pull/111. I guess this might be helpful as mentioned here https://github.com/quarkiverse/quarkus-wiremock/issues/58#issuecomment-1825367297

edeandrea commented 7 months ago

No worries at all @chberger !

Regarding the Wiremock gRPC extension integration: IMHO the Quarkus Wiremock extension should ideally work seamlessly with the Quarkus gRPC extension. It appears that the Quarkus gRPC extension offers its own Devservice, which might reduce the necessity for an additional tool like this extension in this context. However, I might have overlooked something, as my assessment was rather brief. In light of this, do you think it's still advantageous to pursue mocking gRPC services with the Wiremock gRPC extension?

I'm not sure what you mean? I'm not familiar with any gRPC Dev service that provides mocking like the Wiremock gRPC service does. I know the Microcks extension can, & we use that in one of the apps in the superheroes.

github-actions[bot] commented 5 months ago

@chberger This is being labeled as stale.

github-actions[bot] commented 3 months ago

@chberger This is being labeled as stale.

github-actions[bot] commented 1 month ago

@chberger This is being labeled as stale.

github-actions[bot] commented 1 month ago

@chberger This is being closed due to inactivity.

ranjanashish commented 1 month ago

Please reopen this.

chberger commented 1 month ago

Not stale