I am trying to set up unit tests with my resource provider deployed to CXF jaxrs server. The code example is like the following
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(MyResource.class);
List<Object> providers = new ArrayList<Object>();
providers.add( new RuntimeExceptionMapper());
sf.setProviders(providers);
sf.setAddress(SERVER_URL);
sf.setResourceProvider(MyResource.class,
new SingletonResourceProvider(resourceInstance, true));
server = sf.create();
My question is I need to plug in different service mock to my resource provider for tests of different branches. Right now I am shutting down the server after each test method, recreate the resource provider with desired service mock and recreate the server. I am just wondering if I can grab the resource provider after the server is up, and change the service mock used there. Or there exists any other not as expensive operations to achieve what I have right now.
Hope I explain it well. Thank you for any helps/hints
Aucun commentaire:
Enregistrer un commentaire