use of io.joynr.common.JoynrPropertiesModule in project joynr by bmwcarit.
the class UrlResolverTest method setUp.
@Before
public void setUp() throws Exception {
Properties properties = new Properties();
properties.put(MessagingPropertyKeys.CHANNELID, channelId);
Injector injector = Guice.createInjector(new JoynrPropertiesModule(properties), new MessagingTestModule(), new AtmosphereMessagingModule(), new AbstractModule() {
@Override
protected void configure() {
bind(RequestConfig.class).toProvider(HttpDefaultRequestConfigProvider.class).in(Singleton.class);
bind(MessageRouter.class).toInstance(mockMessageRouter);
Multibinder.newSetBinder(binder(), new TypeLiteral<JoynrMessageProcessor>() {
});
}
});
urlResolver = injector.getInstance(UrlResolver.class);
}
use of io.joynr.common.JoynrPropertiesModule in project joynr by bmwcarit.
the class HttpCommunicationManagerTest method setUp.
@Before
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "correct use of RestAssured API")
public void setUp() throws Exception {
RestAssured.port = port;
String basePath = "/bounceproxy/";
RestAssured.basePath = basePath;
bounceProxyUrlString = "http://localhost:" + port + basePath;
Properties properties = new Properties();
properties.put(MessagingPropertyKeys.CHANNELID, testChannelId);
properties.put(MessagingPropertyKeys.BOUNCE_PROXY_URL, bounceProxyUrlString);
Injector injector = Guice.createInjector(new JoynrPropertiesModule(properties), new MessagingTestModule(), new AtmosphereMessagingModule(), new AbstractModule() {
@Override
protected void configure() {
bind(RequestConfig.class).toProvider(HttpDefaultRequestConfigProvider.class).in(Singleton.class);
bind(MessageRouter.class).toInstance(mockMessageRouter);
Multibinder.newSetBinder(binder(), new TypeLiteral<JoynrMessageProcessor>() {
});
}
});
longpollingMessageReceiver = injector.getInstance(LongPollingMessageReceiver.class);
}
use of io.joynr.common.JoynrPropertiesModule in project joynr by bmwcarit.
the class LongPollingChannelLifecycleTest method setUp.
@Before
public void setUp() throws Exception {
server = new LocalTestServer(null, null);
server.register(CHANNELPATH, new HttpRequestHandler() {
@Override
public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
response.setStatusCode(createChannelResponseCode);
response.setHeader("Location", bounceProxyUrl + "channels/" + channelId);
}
});
server.start();
serviceAddress = "http://" + server.getServiceAddress().getHostName() + ":" + server.getServiceAddress().getPort();
bounceProxyUrl = serviceAddress + BOUNCEPROXYPATH;
Properties properties = new Properties();
properties.put(MessagingPropertyKeys.CHANNELID, channelId);
properties.put(MessagingPropertyKeys.BOUNCE_PROXY_URL, bounceProxyUrl);
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
public void configure() {
bind(HttpRequestFactory.class).to(ApacheHttpRequestFactory.class);
bind(CloseableHttpClient.class).toProvider(HttpClientProvider.class).in(Singleton.class);
bind(RequestConfig.class).toProvider(HttpDefaultRequestConfigProvider.class).in(Singleton.class);
bind(MessagingSettings.class).to(ConfigurableMessagingSettings.class);
}
}, new JoynrPropertiesModule(properties), new JsonMessageSerializerModule(), new DummyDiscoveryModule());
longpollingChannelLifecycle = injector.getInstance(LongPollingChannelLifecycle.class);
}
Aggregations