@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);
  }
예제 #2
0
 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);
 }
예제 #3
0
 public ResteasyHandlerMapping(ResteasyDeployment deployment) {
   super();
   this.dispatcher = (SynchronousDispatcher) deployment.getDispatcher();
 }