Search in sources :

Example 1 with ClientMessagingService

use of co.cask.cdap.messaging.client.ClientMessagingService in project cdap by caskdata.

the class MessagingHttpServiceTest method init.

@BeforeClass
public static void init() throws IOException {
    cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    cConf.setInt(Constants.MessagingSystem.HTTP_SERVER_CONSUME_CHUNK_SIZE, 128);
    // Set max life time to a high value so that dummy tx ids that we create in the tests still work
    cConf.setLong(TxConstants.Manager.CFG_TX_MAX_LIFETIME, 10000000000L);
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new DiscoveryRuntimeModule().getInMemoryModules(), new MessagingServerRuntimeModule().getInMemoryModules(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).toInstance(new NoOpMetricsCollectionService());
        }
    });
    httpService = injector.getInstance(MessagingHttpService.class);
    httpService.startAndWait();
    client = new ClientMessagingService(injector.getInstance(DiscoveryServiceClient.class));
}
Also used : Injector(com.google.inject.Injector) ConfigModule(co.cask.cdap.common.guice.ConfigModule) MessagingServerRuntimeModule(co.cask.cdap.messaging.guice.MessagingServerRuntimeModule) ClientMessagingService(co.cask.cdap.messaging.client.ClientMessagingService) NoOpMetricsCollectionService(co.cask.cdap.common.metrics.NoOpMetricsCollectionService) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) AbstractModule(com.google.inject.AbstractModule) BeforeClass(org.junit.BeforeClass)

Aggregations

ConfigModule (co.cask.cdap.common.guice.ConfigModule)1 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)1 NoOpMetricsCollectionService (co.cask.cdap.common.metrics.NoOpMetricsCollectionService)1 ClientMessagingService (co.cask.cdap.messaging.client.ClientMessagingService)1 MessagingServerRuntimeModule (co.cask.cdap.messaging.guice.MessagingServerRuntimeModule)1 AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 BeforeClass (org.junit.BeforeClass)1