use of io.cdap.cdap.client.app.AllProgramsApp in project cdap by caskdata.
the class MetadataHttpHandlerTestRun method testScopeQueryParam.
@Test
public void testScopeQueryParam() throws Exception {
appClient.deploy(NamespaceId.DEFAULT, createAppJarFile(AllProgramsApp.class));
ApplicationId app = NamespaceId.DEFAULT.app(AllProgramsApp.NAME);
RESTClient restClient = new RESTClient(clientConfig);
URL url = clientConfig.resolveNamespacedURLV3(NamespaceId.DEFAULT, "apps/" + AllProgramsApp.NAME + "/metadata?scope=system");
Assert.assertEquals(HttpResponseStatus.OK.code(), restClient.execute(HttpRequest.get(url).build()).getResponseCode());
url = clientConfig.resolveNamespacedURLV3(NamespaceId.DEFAULT, "datasets/" + AllProgramsApp.DATASET_NAME + "/metadata/properties?scope=SySTeM");
Assert.assertEquals(HttpResponseStatus.OK.code(), restClient.execute(HttpRequest.get(url).build()).getResponseCode());
url = clientConfig.resolveNamespacedURLV3(NamespaceId.DEFAULT, "apps/" + AllProgramsApp.NAME + "/services/" + AllProgramsApp.NoOpService.NAME + "/metadata/tags?scope=USER");
Assert.assertEquals(HttpResponseStatus.OK.code(), restClient.execute(HttpRequest.get(url).build()).getResponseCode());
appClient.delete(app);
// deleting the app does not delete the dataset, delete them explicitly to clear their system metadata
ApplicationSpecification spec = Specifications.from(new AllProgramsApp());
for (String dataset : spec.getDatasets().keySet()) {
datasetClient.delete(NamespaceId.DEFAULT.dataset(dataset));
}
}
Aggregations