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()); }
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); }
@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 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()); }