NamespaceId customSpace = new NamespaceId("custom"); NamespaceMeta customSpaceMeta = new NamespaceMeta.Builder().setName(customSpace.getNamespace()) .setRootDirectory(TEMP_FOLDER.getRoot().toString() + "/" + customSpace.getNamespace()).build(); try { storageProviderNamespaceAdmin.create(new NamespaceMeta.Builder(customSpaceMeta) .setRootDirectory(randomFile.toString()).build()); Assert.fail("Expected exception to be thrown while creating namespace with custom location since the custom " + "location is not a directory");
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { String name = arguments.get(ArgumentName.NAMESPACE_NAME.toString()); String description = arguments.getOptional(ArgumentName.DESCRIPTION.toString(), null); String principal = arguments.getOptional(ArgumentName.PRINCIPAL.toString(), null); String groupName = arguments.getOptional(ArgumentName.NAMESPACE_GROUP_NAME.toString(), null); String keytabPath = arguments.getOptional(ArgumentName.NAMESPACE_KEYTAB_PATH.toString(), null); String hbaseNamespace = arguments.getOptional(ArgumentName.NAMESPACE_HBASE_NAMESPACE.toString(), null); String hiveDatabase = arguments.getOptional(ArgumentName.NAMESPACE_HIVE_DATABASE.toString(), null); String schedulerQueueName = arguments.getOptional(ArgumentName.NAMESPACE_SCHEDULER_QUEUENAME.toString(), null); String rootDir = arguments.getOptional(ArgumentName.NAMESPACE_ROOT_DIR.toString(), null); String exploreAsPrinc = arguments.getOptional(ArgumentName.NAMESPACE_EXPLORE_AS_PRINCIPAL.toString(), "true"); Boolean exploreAsPrincipal = Boolean.valueOf(exploreAsPrinc); NamespaceMeta.Builder builder = new NamespaceMeta.Builder(); builder.setName(name).setDescription(description).setPrincipal(principal).setGroupName(groupName) .setKeytabURI(keytabPath).setRootDirectory(rootDir).setHBaseNamespace(hbaseNamespace) .setHiveDatabase(hiveDatabase).setSchedulerQueueName(schedulerQueueName) .setExploreAsPrincipal(exploreAsPrincipal); namespaceClient.create(builder.build()); output.println(String.format(SUCCESS_MSG, name)); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { String name = arguments.get(ArgumentName.NAMESPACE_NAME.toString()); String description = arguments.getOptional(ArgumentName.DESCRIPTION.toString(), null); String principal = arguments.getOptional(ArgumentName.PRINCIPAL.toString(), null); String groupName = arguments.getOptional(ArgumentName.NAMESPACE_GROUP_NAME.toString(), null); String keytabPath = arguments.getOptional(ArgumentName.NAMESPACE_KEYTAB_PATH.toString(), null); String hbaseNamespace = arguments.getOptional(ArgumentName.NAMESPACE_HBASE_NAMESPACE.toString(), null); String hiveDatabase = arguments.getOptional(ArgumentName.NAMESPACE_HIVE_DATABASE.toString(), null); String schedulerQueueName = arguments.getOptional(ArgumentName.NAMESPACE_SCHEDULER_QUEUENAME.toString(), null); String rootDir = arguments.getOptional(ArgumentName.NAMESPACE_ROOT_DIR.toString(), null); String exploreAsPrinc = arguments.getOptional(ArgumentName.NAMESPACE_EXPLORE_AS_PRINCIPAL.toString(), "true"); Boolean exploreAsPrincipal = Boolean.valueOf(exploreAsPrinc); NamespaceMeta.Builder builder = new NamespaceMeta.Builder(); builder.setName(name).setDescription(description).setPrincipal(principal).setGroupName(groupName) .setKeytabURI(keytabPath).setRootDirectory(rootDir).setHBaseNamespace(hbaseNamespace) .setHiveDatabase(hiveDatabase).setSchedulerQueueName(schedulerQueueName) .setExploreAsPrincipal(exploreAsPrincipal); namespaceClient.create(builder.build()); output.println(String.format(SUCCESS_MSG, name)); }
Assert.assertTrue(customlocation.mkdirs()); NamespaceMeta nsMeta = new NamespaceMeta.Builder().setName(namespaceId) .setRootDirectory(customRoot).build(); namespaceAdmin.create(nsMeta); Assert.assertTrue(namespaceAdmin.exists(namespaceId)); new NamespaceMeta.Builder(nsMeta).setRootDirectory("/newloc").build()); Assert.fail(); } catch (BadRequestException e) { new NamespaceMeta.Builder(nsMeta).setRootDirectory("").build()); Assert.fail(); } catch (BadRequestException e) {
String homeGroup = homeDir.getGroup(); namespaceAdmin.create(new NamespaceMeta.Builder().setName("dd3").setRootDirectory(basePath).build()); .setGroupName(nsGroup).setRootDirectory(basePath).build());
Assert.assertTrue(customlocation.mkdirs()); NamespaceMeta nsMeta = new NamespaceMeta.Builder().setName(namespaceId) .setRootDirectory(customRootPath).setHBaseNamespace("hbasens").setHiveDatabase("hivedb").build(); namespaceAdmin.create(nsMeta); .setRootDirectory(customRootPath + "/subdir").build(), namespaceId); .setRootDirectory(parentPath).build(), namespaceId); Assert.assertTrue(otherNamespace.mkdirs()); namespaceAdmin.create(new NamespaceMeta.Builder().setName("otherNamespace") .setRootDirectory(otherRoot).build()); namespaceAdmin.delete(new NamespaceId("otherNamespace"));
NamespaceMeta ns1NSMeta = new NamespaceMeta.Builder().setName(ns1).setRootDirectory("/ns1").build();
.setDescription(description) .setSchedulerQueueName(schedulerQueue) .setRootDirectory(rootDirectory) .setHBaseNamespace(hbaseNamespace) .setHiveDatabase(hiveDb)