@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)); }
namespaceAdmin.create(new NamespaceMeta.Builder().setName(testSpace).setHiveDatabase(customHiveDatabase).build()); Assert.fail(); } catch (NamespaceCannotBeCreatedException e) { namespaceAdmin.create(new NamespaceMeta.Builder().setName(testSpace).setHiveDatabase(customHiveDatabase).build());
new NamespaceMeta.Builder(nsMeta).setHiveDatabase("newDB").build()); Assert.fail(); } catch (BadRequestException e) {
Assert.assertTrue(customlocation.mkdirs()); NamespaceMeta nsMeta = new NamespaceMeta.Builder().setName(namespaceId) .setRootDirectory(customRootPath).setHBaseNamespace("hbasens").setHiveDatabase("hivedb").build(); namespaceAdmin.create(nsMeta); verifyAlreadyExist(new NamespaceMeta.Builder().setName("otherNamespace").setHiveDatabase("hivedb").build(), namespaceId);
.setRootDirectory(rootDirectory) .setHBaseNamespace(hbaseNamespace) .setHiveDatabase(hiveDb) .build();