@Override public void delete(NamespaceId namespaceId) throws Exception { namespaceAdmin.delete(namespaceId); }
@DELETE @Path("/unrecoverable/namespaces/{namespace-id}") public void delete(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespace) throws Exception { if (!cConf.getBoolean(Constants.Dangerous.UNRECOVERABLE_RESET, Constants.Dangerous.DEFAULT_UNRECOVERABLE_RESET)) { responder.sendString(HttpResponseStatus.FORBIDDEN, String.format("Namespace '%s' cannot be deleted because '%s' is not enabled. " + "Please enable it and restart CDAP Master.", namespace, Constants.Dangerous.UNRECOVERABLE_RESET)); return; } NamespaceId namespaceId = new NamespaceId(namespace); namespaceAdmin.delete(namespaceId); responder.sendStatus(HttpResponseStatus.OK); }
@DELETE @Path("/unrecoverable/namespaces/{namespace-id}") public void delete(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespace) throws Exception { if (!cConf.getBoolean(Constants.Dangerous.UNRECOVERABLE_RESET, Constants.Dangerous.DEFAULT_UNRECOVERABLE_RESET)) { responder.sendString(HttpResponseStatus.FORBIDDEN, String.format("Namespace '%s' cannot be deleted because '%s' is not enabled. " + "Please enable it and restart CDAP Master.", namespace, Constants.Dangerous.UNRECOVERABLE_RESET)); return; } NamespaceId namespaceId = new NamespaceId(namespace); namespaceAdmin.delete(namespaceId); responder.sendStatus(HttpResponseStatus.OK); }
private void deleteNamespace(NamespaceId namespaceId) throws Exception { // since the namespace admin here is an in memory one we need to delete the location explicitly namespacePathLocator.get(namespaceId).delete(true); namespaceAdmin.delete(namespaceId); }
@Test public void testPublishing() throws Exception { AppFabricTestHelper.deployApplication(Id.Namespace.DEFAULT, AllProgramsApp.class, null, cConf); Set<String> addedMetadata = new HashSet<>(); // TODO (CDAP-14670): this test is brittle, find a better condition to wait on Tasks.waitFor(26, () -> addAllSystemMetadata(addedMetadata), 10, TimeUnit.SECONDS); namespaceAdmin.delete(NamespaceId.DEFAULT); Set<String> removedMetadata = new HashSet<>(); // expect the same number of changes when namespace is deleted Tasks.waitFor(addedMetadata.size(), () -> addAllSystemMetadata(removedMetadata), 5, TimeUnit.SECONDS); // Assert that the exact same system properties and tags got added upon app deployment and removed upon deletion Assert.assertEquals(addedMetadata, removedMetadata); }
@AfterClass public static void tearDown() throws Exception { Services.chainStop(service, opExecutorService, txManager); namespaceAdmin.delete(NamespaceId.DEFAULT); Locations.deleteQuietly(locationFactory.create(NamespaceId.DEFAULT.getNamespace())); }
namespaceAdmin.delete(NamespaceId.DEFAULT); authorizerInstantiator.close();
@Test(timeout = 90000L) public void testSQLQuerySimpleNS() throws Exception { namespaceAdmin.create(new NamespaceMeta.Builder().setName(testSpace).build()); testSQLQuery(); namespaceAdmin.delete(testSpace); }
namespaceAdmin.delete(NamespaceId.DEFAULT); authorizerInstantiator.close();
@After @Override public void afterTest() throws Exception { Authorizer authorizer = getAuthorizer(); SecurityRequestContext.setUserId(ALICE.getName()); grantAndAssertSuccess(AUTH_NAMESPACE, SecurityRequestContext.toPrincipal(), EnumSet.of(Action.ADMIN)); // clean up. remove the namespace if it exists if (getNamespaceAdmin().exists(AUTH_NAMESPACE)) { getNamespaceAdmin().delete(AUTH_NAMESPACE); Assert.assertFalse(getNamespaceAdmin().exists(AUTH_NAMESPACE)); } revokeAndAssertSuccess(AUTH_NAMESPACE); for (EntityId entityId : cleanUpEntities) { revokeAndAssertSuccess(entityId); } Assert.assertEquals(Collections.emptySet(), authorizer.listPrivileges(ALICE)); }
Assert.assertEquals(toCreate, receivedMeta); namespaceClient.delete(fooNamespace); try { namespaceClient.get(fooNamespace);
namespaceAdmin.delete(testSpace);
getNamespaceAdmin().delete(outputDatasetNS.getNamespaceId());
getNamespaceAdmin().delete(otherNS.getNamespaceId());
getNamespaceAdmin().delete(otherNS.getNamespaceId());
Assert.assertEquals(namespaceConfig, resultMeta.getConfig()); namespaceAdmin.delete(namespaceId); Assert.assertTrue(!queryClient.exists(namespaceId));
@Test public void testUpdateExistingKeytab() throws Exception { String namespace = "updateNamespace"; NamespaceId namespaceId = new NamespaceId(namespace); NamespaceMeta nsMeta = new NamespaceMeta.Builder().setName(namespaceId) .setPrincipal("alice").setKeytabURI("/alice/keytab").build(); namespaceAdmin.create(nsMeta); Assert.assertTrue(namespaceAdmin.exists(namespaceId)); // update the keytab URI String newKeytab = "/alice/new_keytab"; NamespaceMeta newKeytabMeta = new NamespaceMeta.Builder(nsMeta).setKeytabURI(newKeytab).build(); namespaceAdmin.updateProperties(nsMeta.getNamespaceId(), newKeytabMeta); // assert the keytab URI is updated and the version remains 0 Assert.assertEquals(newKeytab, namespaceAdmin.get(namespaceId).getConfig().getKeytabURIWithoutVersion()); Assert.assertEquals(0, namespaceAdmin.get(namespaceId).getConfig().getKeytabURIVersion()); // update the namespace with the same keytab URI namespaceAdmin.updateProperties(nsMeta.getNamespaceId(), newKeytabMeta); // assert the keytab URI without version remains the same and the version is incremented to 1 Assert.assertEquals(newKeytab, namespaceAdmin.get(namespaceId).getConfig().getKeytabURIWithoutVersion()); Assert.assertEquals(1, namespaceAdmin.get(namespaceId).getConfig().getKeytabURIVersion()); //clean up namespaceAdmin.delete(namespaceId); }