Search in sources :

Example 1 with TetheringConf

use of io.cdap.cdap.internal.tethering.runtime.spi.provisioner.TetheringConf in project cdap by caskdata.

the class TetheringRuntimeJobManagerTest method setUp.

@BeforeClass
public static void setUp() throws IOException, TopicAlreadyExistsException {
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.Tethering.TOPIC_PREFIX, "prefix-");
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new InMemoryDiscoveryModule(), new LocalLocationModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
        }
    });
    messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        ((Service) messagingService).startAndWait();
    }
    TetheringConf conf = TetheringConf.fromProperties(PROPERTIES);
    topicId = new TopicId(NamespaceId.SYSTEM.getNamespace(), cConf.get(Constants.Tethering.TOPIC_PREFIX) + TETHERED_INSTANCE_NAME);
    messagingService.createTopic(new TopicMetadata(topicId, Collections.emptyMap()));
    messageFetcher = new MultiThreadMessagingContext(messagingService).getMessageFetcher();
    runtimeJobManager = new TetheringRuntimeJobManager(conf, cConf, messagingService);
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) MessagingService(io.cdap.cdap.messaging.MessagingService) Service(com.google.common.util.concurrent.Service) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) MessagingServerRuntimeModule(io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule) MultiThreadMessagingContext(io.cdap.cdap.messaging.context.MultiThreadMessagingContext) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) MessagingService(io.cdap.cdap.messaging.MessagingService) TopicMetadata(io.cdap.cdap.messaging.TopicMetadata) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) TetheringConf(io.cdap.cdap.internal.tethering.runtime.spi.provisioner.TetheringConf) Injector(com.google.inject.Injector) TopicId(io.cdap.cdap.proto.id.TopicId) BeforeClass(org.junit.BeforeClass)

Aggregations

Service (com.google.common.util.concurrent.Service)1 AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)1 CConfiguration (io.cdap.cdap.common.conf.CConfiguration)1 ConfigModule (io.cdap.cdap.common.guice.ConfigModule)1 InMemoryDiscoveryModule (io.cdap.cdap.common.guice.InMemoryDiscoveryModule)1 LocalLocationModule (io.cdap.cdap.common.guice.LocalLocationModule)1 NoOpMetricsCollectionService (io.cdap.cdap.common.metrics.NoOpMetricsCollectionService)1 TetheringConf (io.cdap.cdap.internal.tethering.runtime.spi.provisioner.TetheringConf)1 MessagingService (io.cdap.cdap.messaging.MessagingService)1 TopicMetadata (io.cdap.cdap.messaging.TopicMetadata)1 MultiThreadMessagingContext (io.cdap.cdap.messaging.context.MultiThreadMessagingContext)1 MessagingServerRuntimeModule (io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule)1 TopicId (io.cdap.cdap.proto.id.TopicId)1 BeforeClass (org.junit.BeforeClass)1