Created an extension to record states in between r...
# general
d
Created an extension to record states in between requests (needed this to build a sandbox). Plan to release it on maven central soon. Would appreciate any feedback: https://github.com/dirkbolte/wiremock-extension-state
👍 3
🎉 1
t
Hey @Dirk Bolte, we’ve been discussing this internally for a while, as users/customers periodically ask for the ability to store and retrieve state, so this is very interesting. A couple of comments I’d make: 1. The extensions architecture is about to get a major overhaul, including adding new extension points to contribute Handlebars helpers and template data suppliers. We’ll also add simple dependency injection so your extensions can get access to core services provided by WireMock. 2. I suggest rather than directly reading/writing to Caffeine you should consider using the new
Stores
abstraction (which will shortly be available via dependency injection per the previous point). That way if e.g. someone has written an alternative storage backend for horizontal scaling, your extension will work with that too.
d
happy adapt it . Is all this already in the 3.0.0 milestones? When you rework the extension architecture, it would be great to have just one extension to register multiple ones + don't have to register the handlebar extension explicitly - if possible.
t
I’ve done quite a lot of the work already on this branch, if you want to take a look: https://github.com/wiremock/wiremock/tree/new-extension-model-spike
o
Hi, nice one! Especially the documentation :) we are currently working on consolidation of the Community infrastructure to make it easier to develop and maintain the components. @Dirk Bolte would you potentially be interested in hosting this repository within the main GitHub organization? We haven't yet streamlined the process for the extensions but I think it would be a great exercise for us
t
One of the key changes is that all extensions are based on interfaces now, so you can have a single extension class that implements all the interfaces you care about. There isn’t a helper provider yet, but it’ll be very similar in style to
AdminApiExtension
.
And yes, to answer your question - all the things I’ve mentioned will be in 3.0 when it comes out of beta.
d
@Tom the interfaces change sounds promising. I can try to adapt my extension to your branch . @Oleg Nenashev I can definitely move the repository - whatever helps to make the extension useful 🙂
t
The branch is for review at the moment, so there’s a chance things will change a bit. But I think it would serve as a great review to try to integrate your stuff with it. Better than just eyeballing.
I can probably add the helper + data extension points pretty quickly if you’d like to try integrating with those also.
d
Posted an article on medium to advertise some features of wiremock, including extensions (the one above): https://betterprogramming.pub/more-than-just-stubs-b2a7ad3742b8 . Will adjust the example there as the plug-in evolves.
o
@Dirk Bolte if you are fine with that, let's move. I will change my priorities a bit to extend docs for extensions hosting and listing as was mentioned by @Lee Turner earlier. If you could start the transfer from the repo settings, I can do the rest