Example #1
0
 @BeforeTest
 public void setup() {
   server = new TJWSEmbeddedJaxrsServer();
   server.setPort(8080);
   server.start();
   server.getDeployment().getRegistry().addPerRequestResource(HelloWorld.class);
 }
  @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);
  }
  private static void addResources(TJWSEmbeddedJaxrsServer webServer) {

    webServer.getDeployment().getRegistry().addPerRequestResource(StaticResources.class);
    webServer.getDeployment().getRegistry().addPerRequestResource(SpatialDataResource.class);
    webServer.getDeployment().getRegistry().addPerRequestResource(TimeDataResource.class);
    webServer.getDeployment().getRegistry().addPerRequestResource(ContextResource.class);

    webServer.addServlet("/rest-js", new JSAPIServlet());
  }
  public static void main(final String[] args) {
    TJWSEmbeddedJaxrsServer webServer = new TJWSEmbeddedJaxrsServer();

    webServer.setPort(Config.getConfigInt("server_port"));
    webServer.setRootResourcePath("/");
    webServer.start();

    context = new Context();

    setContextFiresPortugal(webServer);
    Server_backup.addResources(webServer);

    System.out.print("Web server started...");
  }
Example #5
0
  protected static void startRestEasy(Class<?>... classes) throws Exception {
    server = new TJWSEmbeddedJaxrsServer();
    server.setPort(PORT);
    server.start();
    Registry registry = server.getDeployment().getRegistry();
    ResteasyProviderFactory factory = server.getDeployment().getDispatcher().getProviderFactory();

    if (classes != null) for (Class<?> clazz : classes) registry.addPerRequestResource(clazz);

    factory.addExceptionMapper(TMUnavailableMapper.class);
    factory.addExceptionMapper(TransactionStatusMapper.class);
    factory.addExceptionMapper(HttpResponseMapper.class);
    factory.addExceptionMapper(NotFoundMapper.class);
  }
 @AfterClass
 public static void tearDown() {
   if (TestConfig.isLocalServer()) {
     server.stop();
     System.clearProperty("java.naming.factory.initial");
   }
 }
 @AfterClass
 public static void tearDownAfterClass() throws Exception {
   if (server != null) {
     server.stop();
   }
   irodsFileSystem.closeAndEatExceptions();
 }
Example #8
0
  @AfterClass
  public static void afterClass() throws Exception {
    if (server != null) {
      server.stop();
      server = null;
    }

    if (threadSelector != null) {
      threadSelector.stopEndpoint();
      threadSelector = null;
    }
  }
  private static void startServer() throws Exception {
    System.setProperty(
        "java.naming.factory.initial", "bitronix.tm.jndi.BitronixInitialContextFactory");
    System.setProperty(KieServerConstants.CFG_BYPASS_AUTH_USER, "true");
    System.setProperty(KieServerConstants.CFG_HT_CALLBACK, "custom");
    System.setProperty(
        KieServerConstants.CFG_HT_CALLBACK_CLASS,
        "org.kie.server.integrationtests.jbpm.util.FixedUserGroupCallbackImpl");
    System.setProperty(KieServerConstants.CFG_PERSISTANCE_DS, "jdbc/jbpm-ds");
    System.setProperty(
        KieServerConstants.CFG_PERSISTANCE_TM,
        "org.hibernate.service.jta.platform.internal.BitronixJtaPlatform");
    server = new TJWSEmbeddedJaxrsServer();
    server.setPort(TestConfig.getAllocatedPort());
    server.start();
    KieServerEnvironment.setServerId(
        "target/"
            + KieServerBaseIntegrationTest.class.getSimpleName()
            + "@"
            + serverIdSuffixDateFormat.format(new Date()));
    server.getDeployment().getRegistry().addSingletonResource(new KieServerRestImpl());

    KieServerImpl kieServer = KieServerLocator.getInstance();
    List<KieServerExtension> extensions = kieServer.getServerExtensions();

    for (KieServerExtension extension : extensions) {
      List<Object> components = extension.getAppComponents(SupportedTransports.REST);
      for (Object component : components) {
        server.getDeployment().getRegistry().addSingletonResource(component);
      }
    }

    server
        .getDeployment()
        .setProviderFactory(JacksonRestEasyTestConfig.createRestEasyProviderFactory());
  }
Example #10
0
 @AfterTest
 public void tearDown() {
   server.stop();
 }