use of co.cask.cdap.data.stream.service.StreamMetaStore in project cdap by caskdata.
the class BaseHiveExploreServiceTest method initialize.
protected static void initialize(CConfiguration cConf, TemporaryFolder tmpFolder, boolean useStandalone, boolean enableAuthorization) throws Exception {
if (!runBefore) {
return;
}
Configuration hConf = new Configuration();
if (enableAuthorization) {
LocationFactory locationFactory = new LocalLocationFactory(tmpFolder.newFolder());
Location authExtensionJar = AppJarHelper.createDeploymentJar(locationFactory, InMemoryAuthorizer.class);
cConf.setBoolean(Constants.Security.ENABLED, true);
cConf.setBoolean(Constants.Security.Authorization.ENABLED, true);
cConf.set(Constants.Security.Authorization.EXTENSION_JAR_PATH, authExtensionJar.toURI().getPath());
cConf.setBoolean(Constants.Security.KERBEROS_ENABLED, false);
cConf.setInt(Constants.Security.Authorization.CACHE_MAX_ENTRIES, 0);
}
List<Module> modules = useStandalone ? createStandaloneModules(cConf, hConf, tmpFolder) : createInMemoryModules(cConf, hConf, tmpFolder);
injector = Guice.createInjector(modules);
transactionManager = injector.getInstance(TransactionManager.class);
transactionManager.startAndWait();
transactionSystemClient = injector.getInstance(TransactionSystemClient.class);
dsOpService = injector.getInstance(DatasetOpExecutor.class);
dsOpService.startAndWait();
datasetService = injector.getInstance(DatasetService.class);
datasetService.startAndWait();
exploreExecutorService = injector.getInstance(ExploreExecutorService.class);
exploreExecutorService.startAndWait();
datasetFramework = injector.getInstance(DatasetFramework.class);
exploreClient = injector.getInstance(DiscoveryExploreClient.class);
exploreService = injector.getInstance(ExploreService.class);
exploreClient.ping();
notificationService = injector.getInstance(NotificationService.class);
notificationService.startAndWait();
streamService = injector.getInstance(StreamService.class);
streamService.startAndWait();
streamHttpService = injector.getInstance(StreamHttpService.class);
streamHttpService.startAndWait();
exploreTableManager = injector.getInstance(ExploreTableManager.class);
streamAdmin = injector.getInstance(StreamAdmin.class);
streamMetaStore = injector.getInstance(StreamMetaStore.class);
namespaceAdmin = injector.getInstance(NamespaceAdmin.class);
namespacedLocationFactory = injector.getInstance(NamespacedLocationFactory.class);
// create namespaces
// This happens when you create a namespace via REST APIs. However, since we do not start AppFabricServer in
// Explore tests, simulating that scenario by explicitly calling DatasetFramework APIs.
createNamespace(NamespaceId.DEFAULT);
createNamespace(NAMESPACE_ID);
createNamespace(OTHER_NAMESPACE_ID);
}
use of co.cask.cdap.data.stream.service.StreamMetaStore in project cdap by caskdata.
the class MDSStreamMetaStoreTest method init.
@BeforeClass
public static void init() throws Exception {
Injector injector = Guice.createInjector(new ConfigModule(CConfiguration.create(), new Configuration()), new DataSetServiceModules().getInMemoryModules(), new DataSetsModules().getStandaloneModules(), new DataFabricModules().getInMemoryModules(), new ExploreClientModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new LocationRuntimeModule().getInMemoryModules(), new NamespaceClientRuntimeModule().getInMemoryModules(), new NamespaceStoreModule().getStandaloneModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new AbstractModule() {
@Override
protected void configure() {
bind(StreamMetaStore.class).to(MDSStreamMetaStore.class).in(Scopes.SINGLETON);
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
bind(Store.class).to(DefaultStore.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(NoOpOwnerAdmin.class);
}
});
streamMetaStore = injector.getInstance(StreamMetaStore.class);
transactionManager = injector.getInstance(TransactionManager.class);
transactionManager.startAndWait();
datasetService = injector.getInstance(DatasetService.class);
datasetService.startAndWait();
store = injector.getInstance(NamespaceStore.class);
}
use of co.cask.cdap.data.stream.service.StreamMetaStore in project cdap by caskdata.
the class StreamMetaStoreTestBase method testStreamMetastore.
@Test
public void testStreamMetastore() throws Exception {
StreamMetaStore streamMetaStore = getStreamMetaStore();
streamMetaStore.addStream(new StreamId("foo", "bar"));
Assert.assertTrue(streamMetaStore.streamExists(new StreamId("foo", "bar")));
Assert.assertFalse(streamMetaStore.streamExists(new StreamId("foofoo", "bar")));
streamMetaStore.removeStream(new StreamId("foo", "bar"));
Assert.assertFalse(streamMetaStore.streamExists(new StreamId("foo", "bar")));
streamMetaStore.addStream(new StreamId("foo1", "bar"));
streamMetaStore.addStream(new StreamId("foo2", "bar"));
Assert.assertEquals(ImmutableList.of(new StreamSpecification.Builder().setName("bar").create()), streamMetaStore.listStreams(new NamespaceId("foo1")));
Assert.assertEquals(ImmutableMultimap.builder().put(new NamespaceId("foo1"), new StreamSpecification.Builder().setName("bar").create()).put(new NamespaceId("foo2"), new StreamSpecification.Builder().setName("bar").create()).build(), streamMetaStore.listStreams());
streamMetaStore.removeStream(new StreamId("foo2", "bar"));
Assert.assertFalse(streamMetaStore.streamExists(new StreamId("foo2", "bar")));
Assert.assertEquals(ImmutableMultimap.builder().put(new NamespaceId("foo1"), new StreamSpecification.Builder().setName("bar").create()).build(), streamMetaStore.listStreams());
streamMetaStore.removeStream(new StreamId("foo1", "bar"));
}
Aggregations