Search in sources :

Example 1 with MessagingTestModule

use of io.joynr.messaging.MessagingTestModule 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);
}
Also used : RequestConfig(org.apache.http.client.config.RequestConfig) TypeLiteral(com.google.inject.TypeLiteral) Injector(com.google.inject.Injector) JoynrPropertiesModule(io.joynr.common.JoynrPropertiesModule) Singleton(com.google.inject.Singleton) Properties(java.util.Properties) MessagingTestModule(io.joynr.messaging.MessagingTestModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 2 with MessagingTestModule

use of io.joynr.messaging.MessagingTestModule 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);
}
Also used : RequestConfig(org.apache.http.client.config.RequestConfig) TypeLiteral(com.google.inject.TypeLiteral) Injector(com.google.inject.Injector) JoynrPropertiesModule(io.joynr.common.JoynrPropertiesModule) Singleton(com.google.inject.Singleton) Matchers.containsString(org.hamcrest.Matchers.containsString) Properties(java.util.Properties) MessagingTestModule(io.joynr.messaging.MessagingTestModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Aggregations

AbstractModule (com.google.inject.AbstractModule)2 Injector (com.google.inject.Injector)2 Singleton (com.google.inject.Singleton)2 TypeLiteral (com.google.inject.TypeLiteral)2 JoynrPropertiesModule (io.joynr.common.JoynrPropertiesModule)2 AtmosphereMessagingModule (io.joynr.messaging.AtmosphereMessagingModule)2 MessagingTestModule (io.joynr.messaging.MessagingTestModule)2 Properties (java.util.Properties)2 RequestConfig (org.apache.http.client.config.RequestConfig)2 Before (org.junit.Before)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1