use of co.cask.cdap.common.namespace.DefaultNamespacedLocationFactory in project cdap by caskdata.
the class DFSStreamFileJanitorTest method init.
@BeforeClass
public static void init() throws IOException {
Configuration hConf = new Configuration();
hConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, tmpFolder.newFolder().getAbsolutePath());
dfsCluster = new MiniDFSCluster.Builder(hConf).numDataNodes(1).build();
dfsCluster.waitClusterUp();
namespaceAdmin = new InMemoryNamespaceClient();
final LocationFactory lf = new FileContextLocationFactory(dfsCluster.getFileSystem().getConf());
final NamespacedLocationFactory nlf = new DefaultNamespacedLocationFactory(cConf, lf, namespaceAdmin);
Injector injector = Guice.createInjector(new ConfigModule(cConf, hConf), new ZKClientModule(), new AbstractModule() {
@Override
protected void configure() {
bind(LocationFactory.class).toInstance(lf);
bind(NamespacedLocationFactory.class).toInstance(nlf);
bind(NamespaceAdmin.class).toInstance(namespaceAdmin);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
bind(UGIProvider.class).to(RemoteUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
}, new TransactionMetricsModule(), new DiscoveryRuntimeModule().getInMemoryModules(), 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 memory 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 ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), Modules.override(new StreamAdminModules().getDistributedModules()).with(new AbstractModule() {
@Override
protected void configure() {
// Tests are running in same process, hence no need to have ZK to coordinate
bind(StreamCoordinatorClient.class).to(InMemoryStreamCoordinatorClient.class).in(Scopes.SINGLETON);
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
}
}), new AbstractModule() {
@Override
protected void configure() {
// We don't need notification in this test, hence inject an no-op one
bind(NotificationFeedManager.class).to(NoOpNotificationFeedManager.class);
bind(NamespaceStore.class).to(InMemoryNamespaceStore.class);
}
}, new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule());
locationFactory = injector.getInstance(LocationFactory.class);
namespacedLocationFactory = injector.getInstance(NamespacedLocationFactory.class);
namespaceStore = injector.getInstance(NamespaceStore.class);
streamAdmin = injector.getInstance(StreamAdmin.class);
fileWriterFactory = injector.getInstance(StreamFileWriterFactory.class);
streamCoordinatorClient = injector.getInstance(StreamCoordinatorClient.class);
streamCoordinatorClient.startAndWait();
}
use of co.cask.cdap.common.namespace.DefaultNamespacedLocationFactory in project cdap by caskdata.
the class StorageProviderNamespaceAdminTest method setup.
@BeforeClass
public static void setup() throws IOException {
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
cConf.setBoolean(Constants.Explore.EXPLORE_ENABLED, true);
Injector injector = Guice.createInjector(Modules.override(new AppFabricTestModule(cConf)).with(new AbstractModule() {
@Override
protected void configure() {
// use the DefaultNamespacedLocationFactory here to test proper namespace creation in storage handler and
// not the NamespacedLocationFactoryTestClient
bind(NamespacedLocationFactory.class).to(DefaultNamespacedLocationFactory.class);
}
}));
namespacedLocationFactory = injector.getInstance(NamespacedLocationFactory.class);
storageProviderNamespaceAdmin = injector.getInstance(StorageProviderNamespaceAdmin.class);
// start the dataset service for namespace store to work
transactionManager = injector.getInstance(TransactionManager.class);
transactionManager.startAndWait();
datasetService = injector.getInstance(DatasetService.class);
datasetService.startAndWait();
// we don't use namespace admin here but the store because namespaceadmin will try to create the
// home directory for namespace which we don't want. We just want to store the namespace meta in store
// to look up during the delete.
namespaceStore = injector.getInstance(NamespaceStore.class);
}
Aggregations