@Before public void setUp() throws Exception { if (server != null) { return; } int port = testingPropertiesHelper.getPropertyValueAsInt( testingProperties, RestTestingProperties.REST_PORT_PROPERTY); server = new TJWSEmbeddedJaxrsServer(); server.setPort(port); ResteasyDeployment deployment = server.getDeployment(); server.start(); Dispatcher dispatcher = deployment.getDispatcher(); SpringBeanProcessor processor = new SpringBeanProcessor( dispatcher, deployment.getRegistry(), deployment.getProviderFactory()); ((ConfigurableApplicationContext) applicationContext).addBeanFactoryPostProcessor(processor); SpringResourceFactory noDefaults = new SpringResourceFactory("userService", applicationContext, UserService.class); dispatcher.getRegistry().addResourceFactory(noDefaults); }
public static void before(Hashtable<String, String> contextParams) throws Exception { Hashtable<String, String> initParams = new Hashtable<String, String>(); deployment = EmbeddedContainer.start(initParams, contextParams); dispatcher = deployment.getDispatcher(); deployment.getRegistry().addPerRequestResource(TestResource.class); deployment.getProviderFactory().register(TestExceptionMapper.class); }
public ResteasyHandlerMapping(ResteasyDeployment deployment) { super(); this.dispatcher = (SynchronousDispatcher) deployment.getDispatcher(); }