use of co.cask.cdap.data.view.ViewAdminModules in project cdap by caskdata.
the class DFSStreamHeartbeatsTest method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
zkServer = InMemoryZKServer.builder().setDataDir(TEMP_FOLDER.newFolder()).build();
zkServer.startAndWait();
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.Zookeeper.QUORUM, zkServer.getConnectionStr());
cConf.setInt(Constants.Stream.CONTAINER_INSTANCE_ID, 0);
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
Injector injector = Guice.createInjector(Modules.override(new ZKClientModule(), new DataFabricModules().getInMemoryModules(), new ConfigModule(cConf, new Configuration()), new DiscoveryRuntimeModule().getInMemoryModules(), new NonCustomLocationUnitTestModule().getModule(), new ExploreClientModule(), new DataSetServiceModules().getInMemoryModules(), new DataSetsModules().getStandaloneModules(), new NotificationFeedServiceRuntimeModule().getInMemoryModules(), new NotificationServiceRuntimeModule().getInMemoryModules(), new MetricsClientRuntimeModule().getInMemoryModules(), new ViewAdminModules().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), // that performs heartbeats aggregation
new StreamServiceRuntimeModule().getDistributedModules(), new StreamAdminModules().getInMemoryModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
install(new NamespaceClientRuntimeModule().getInMemoryModules());
bind(StreamConsumerStateStoreFactory.class).to(LevelDBStreamConsumerStateStoreFactory.class).in(Singleton.class);
bind(StreamAdmin.class).to(FileStreamAdmin.class).in(Singleton.class);
bind(StreamConsumerFactory.class).to(LevelDBStreamFileConsumerFactory.class).in(Singleton.class);
bind(StreamFileWriterFactory.class).to(LocationStreamFileWriterFactory.class).in(Singleton.class);
bind(StreamFileJanitorService.class).to(LocalStreamFileJanitorService.class).in(Scopes.SINGLETON);
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class).in(Scopes.SINGLETON);
bind(HeartbeatPublisher.class).to(MockHeartbeatPublisher.class).in(Scopes.SINGLETON);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
}));
zkClient = injector.getInstance(ZKClientService.class);
txManager = injector.getInstance(TransactionManager.class);
datasetService = injector.getInstance(DatasetService.class);
notificationService = injector.getInstance(NotificationService.class);
streamHttpService = injector.getInstance(StreamHttpService.class);
streamService = injector.getInstance(StreamService.class);
heartbeatPublisher = (MockHeartbeatPublisher) injector.getInstance(HeartbeatPublisher.class);
namespacedLocationFactory = injector.getInstance(NamespacedLocationFactory.class);
streamAdmin = injector.getInstance(StreamAdmin.class);
zkClient.startAndWait();
txManager.startAndWait();
datasetService.startAndWait();
notificationService.startAndWait();
streamHttpService.startAndWait();
streamService.startAndWait();
hostname = streamHttpService.getBindAddress().getHostName();
port = streamHttpService.getBindAddress().getPort();
Locations.mkdirsIfNotExists(namespacedLocationFactory.get(NamespaceId.DEFAULT));
}
use of co.cask.cdap.data.view.ViewAdminModules in project cdap by caskdata.
the class InMemoryQueueTest method init.
@BeforeClass
public static void init() throws Exception {
injector = Guice.createInjector(new ConfigModule(), new NonCustomLocationUnitTestModule().getModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new DataSetsModules().getInMemoryModules(), new DataFabricModules().getInMemoryModules(), new TransactionMetricsModule(), new ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), Modules.override(new StreamAdminModules().getInMemoryModules()).with(new AbstractModule() {
@Override
protected void configure() {
// The tests are actually testing stream on queue implementation, hence bind it to the queue implementation
bind(StreamAdmin.class).to(InMemoryStreamAdmin.class);
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
}
}));
// transaction manager is a "service" and must be started
transactionManager = injector.getInstance(TransactionManager.class);
transactionManager.startAndWait();
txSystemClient = injector.getInstance(TransactionSystemClient.class);
queueClientFactory = injector.getInstance(QueueClientFactory.class);
queueAdmin = injector.getInstance(QueueAdmin.class);
executorFactory = injector.getInstance(TransactionExecutorFactory.class);
}
use of co.cask.cdap.data.view.ViewAdminModules in project cdap by caskdata.
the class LocalQueueTest method testInjection.
@Test
public void testInjection() throws IOException {
Injector injector = Guice.createInjector(new ConfigModule(conf), new NonCustomLocationUnitTestModule().getModule(), new DiscoveryRuntimeModule().getStandaloneModules(), new TransactionMetricsModule(), new DataFabricModules().getStandaloneModules(), new DataSetsModules().getStandaloneModules(), new ExploreClientModule(), new ViewAdminModules().getStandaloneModules(), new AuthorizationEnforcementModule().getStandaloneModules(), new AuthenticationContextModules().getMasterModule(), new NamespaceClientRuntimeModule().getStandaloneModules(), new AuthorizationTestModule(), Modules.override(new StreamAdminModules().getStandaloneModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
bind(NotificationFeedManager.class).to(NoOpNotificationFeedManager.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
}));
QueueClientFactory factory = injector.getInstance(QueueClientFactory.class);
QueueProducer producer = factory.createProducer(QueueName.fromFlowlet(NamespaceId.DEFAULT.getNamespace(), "app", "my", "flowlet", "output"));
Assert.assertTrue(producer instanceof InMemoryQueueProducer);
}
use of co.cask.cdap.data.view.ViewAdminModules in project cdap by caskdata.
the class DistributedStreamCoordinatorClientTest method init.
@BeforeClass
public static void init() throws Exception {
zkServer = InMemoryZKServer.builder().setDataDir(tmpFolder.newFolder()).build();
zkServer.startAndWait();
Configuration hConf = new Configuration();
hConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, tmpFolder.newFolder().getAbsolutePath());
dfsCluster = new MiniDFSCluster.Builder(hConf).numDataNodes(1).build();
dfsCluster.waitClusterUp();
final LocationFactory lf = new FileContextLocationFactory(dfsCluster.getFileSystem().getConf());
final NamespacedLocationFactory nlf = new NamespacedLocationFactoryTestClient(cConf, lf);
cConf.set(Constants.Zookeeper.QUORUM, zkServer.getConnectionStr());
Injector injector = Guice.createInjector(new ConfigModule(cConf), new ZKClientModule(), new DiscoveryRuntimeModule().getDistributedModules(), new DataFabricModules().getDistributedModules(), Modules.override(new DataSetsModules().getDistributedModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(MetadataStore.class).to(NoOpMetadataStore.class);
// bind to an in mem implementation for this test since the DefaultOwnerStore uses transaction and in this
// test we are not starting a transaction service
bind(OwnerStore.class).to(InMemoryOwnerStore.class).in(Scopes.SINGLETON);
}
}), new TransactionMetricsModule(), new NotificationFeedServiceRuntimeModule().getInMemoryModules(), new AbstractModule() {
@Override
protected void configure() {
bind(LocationFactory.class).toInstance(lf);
bind(NamespacedLocationFactory.class).toInstance(nlf);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
}, new ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), Modules.override(new StreamAdminModules().getDistributedModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
}
}), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule());
zkClient = injector.getInstance(ZKClientService.class);
zkClient.startAndWait();
setupNamespaces(injector.getInstance(NamespacedLocationFactory.class));
streamAdmin = injector.getInstance(StreamAdmin.class);
coordinatorClient = injector.getInstance(StreamCoordinatorClient.class);
coordinatorClient.startAndWait();
}
use of co.cask.cdap.data.view.ViewAdminModules in project cdap by caskdata.
the class InMemoryStreamCoordinatorClientTest method init.
@BeforeClass
public static void init() throws Exception {
cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
Injector injector = Guice.createInjector(new ConfigModule(cConf), new DiscoveryRuntimeModule().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), Modules.override(new DataSetsModules().getInMemoryModules()).with(new AbstractModule() {
@Override
protected void configure() {
// bind to an in mem implementation for this test since the DefaultOwnerStore uses transaction and in this
// test we are not starting a transaction service
bind(OwnerStore.class).to(InMemoryOwnerStore.class).in(Scopes.SINGLETON);
}
}), new DataFabricModules().getInMemoryModules(), new NonCustomLocationUnitTestModule().getModule(), new TransactionMetricsModule(), new NotificationFeedServiceRuntimeModule().getInMemoryModules(), new ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), new AuthorizationTestModule(), new AuthenticationContextModules().getNoOpModule(), new AuthorizationEnforcementModule().getInMemoryModules(), Modules.override(new StreamAdminModules().getInMemoryModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
}
}));
setupNamespaces(injector.getInstance(NamespacedLocationFactory.class));
streamAdmin = injector.getInstance(StreamAdmin.class);
coordinatorClient = injector.getInstance(StreamCoordinatorClient.class);
coordinatorClient.startAndWait();
}
Aggregations