use of io.cdap.cdap.client.util.RESTClient in project cdap by caskdata.
the class ArtifactClientTestRun method setUp.
@Override
@Before
public void setUp() throws Throwable {
super.setUp();
artifactClient = new ArtifactClient(clientConfig, new RESTClient(clientConfig));
for (ArtifactSummary artifactSummary : artifactClient.list(NamespaceId.DEFAULT)) {
artifactClient.delete(NamespaceId.DEFAULT.artifact(artifactSummary.getName(), artifactSummary.getVersion()));
}
}
use of io.cdap.cdap.client.util.RESTClient 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