Search in sources :

Example 1 with AllProgramsApp

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));
    }
}
Also used : ApplicationSpecification(io.cdap.cdap.api.app.ApplicationSpecification) RESTClient(io.cdap.cdap.client.util.RESTClient) AllProgramsApp(io.cdap.cdap.client.app.AllProgramsApp) ApplicationId(io.cdap.cdap.proto.id.ApplicationId) URL(java.net.URL) Test(org.junit.Test)

Aggregations

ApplicationSpecification (io.cdap.cdap.api.app.ApplicationSpecification)1 AllProgramsApp (io.cdap.cdap.client.app.AllProgramsApp)1 RESTClient (io.cdap.cdap.client.util.RESTClient)1 ApplicationId (io.cdap.cdap.proto.id.ApplicationId)1 URL (java.net.URL)1 Test (org.junit.Test)1