Search in sources :

Example 1 with JoynrBaseModule

use of io.joynr.runtime.JoynrBaseModule in project joynr by bmwcarit.

the class LocalDiscoveryTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    when(localDiscoveryEntryStoreMock.hasDiscoveryEntry(any(DiscoveryEntry.class))).thenReturn(true);
    // use default freshnessUpdateIntervalMs: 3600000ms (1h)
    final LocalCapabilitiesDirectoryImpl localCapabilitiesDirectory = new LocalCapabilitiesDirectoryImpl(capabilitiesProvisioningMock, globalAddressProviderMock, localDiscoveryEntryStoreMock, globalDiscoveryEntryCacheMock, messageRouterMock, globalCapabilitiesDirectoryClientMock, expiredDiscoveryEntryCacheCleanerMock, 3600000, capabilitiesFreshnessUpdateExecutorMock, defaultDiscoveryRetryIntervalMs, shutdownNotifier);
    Module testModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(JoynrMessagingConnectorFactory.class).annotatedWith(Names.named("connectorFactoryMock")).toInstance(joynrMessagingConnectorFactoryMock);
            bind(LocalCapabilitiesDirectory.class).toInstance(localCapabilitiesDirectory);
            bind(LocalCapabilitiesDirectoryImpl.class).toInstance(localCapabilitiesDirectory);
            bind(ProxyInvocationHandlerFactory.class).to(ProxyInvocationHandlerFactoryImpl.class);
        }
    });
    Properties joynrProperties = new Properties();
    Injector injector = new JoynrInjectorFactory(new JoynrBaseModule(joynrProperties, testModule)).getInjector();
    runtime = injector.getInstance(JoynrRuntime.class);
}
Also used : TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) LocalCapabilitiesDirectoryImpl(io.joynr.capabilities.LocalCapabilitiesDirectoryImpl) JoynrBaseModule(io.joynr.runtime.JoynrBaseModule) Properties(java.util.Properties) AbstractModule(com.google.inject.AbstractModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) JoynrRuntime(io.joynr.runtime.JoynrRuntime) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrMessagingConnectorFactory(io.joynr.proxy.JoynrMessagingConnectorFactory) Injector(com.google.inject.Injector) Module(com.google.inject.Module) JoynrBaseModule(io.joynr.runtime.JoynrBaseModule) TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Aggregations

AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 LocalCapabilitiesDirectoryImpl (io.joynr.capabilities.LocalCapabilitiesDirectoryImpl)1 TestGlobalAddressModule (io.joynr.messaging.routing.TestGlobalAddressModule)1 JoynrMessagingConnectorFactory (io.joynr.proxy.JoynrMessagingConnectorFactory)1 CCInProcessRuntimeModule (io.joynr.runtime.CCInProcessRuntimeModule)1 JoynrBaseModule (io.joynr.runtime.JoynrBaseModule)1 JoynrInjectorFactory (io.joynr.runtime.JoynrInjectorFactory)1 JoynrRuntime (io.joynr.runtime.JoynrRuntime)1 Properties (java.util.Properties)1 DiscoveryEntry (joynr.types.DiscoveryEntry)1 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)1 Before (org.junit.Before)1