use of co.cask.cdap.proto.id.ProgramId in project cdap by caskdata.
the class MetadataHttpHandler method removeProgramProperty.
@DELETE
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/metadata/properties/{property}")
public void removeProgramProperty(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @PathParam("property") String property) throws NotFoundException {
ProgramId program = new ProgramId(namespaceId, appId, ProgramType.valueOfCategoryName(programType), programId);
metadataAdmin.removeProperties(program, property);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata property %s for program %s deleted successfully.", property, program));
}
use of co.cask.cdap.proto.id.ProgramId in project cdap by caskdata.
the class MetadataHttpHandler method addProgramTags.
@POST
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/metadata/tags")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addProgramTags(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId) throws BadRequestException, NotFoundException {
ProgramId program = new ProgramId(namespaceId, appId, ProgramType.valueOfCategoryName(programType), programId);
metadataAdmin.addTags(program, readArray(request));
responder.sendString(HttpResponseStatus.OK, String.format("Added tags to program %s successfully.", program));
}
use of co.cask.cdap.proto.id.ProgramId in project cdap by caskdata.
the class MetadataHttpHandler method addProgramProperties.
@POST
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/metadata/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addProgramProperties(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId) throws BadRequestException, NotFoundException {
ProgramId program = new ProgramId(namespaceId, appId, ProgramType.valueOfCategoryName(programType), programId);
metadataAdmin.addProperties(program, readMetadata(request));
responder.sendString(HttpResponseStatus.OK, "Metadata added successfully to " + program);
}
use of co.cask.cdap.proto.id.ProgramId in project cdap by caskdata.
the class MetadataHttpHandler method removeProgramTags.
@DELETE
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/metadata/tags")
public void removeProgramTags(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId) throws NotFoundException {
ProgramId program = new ProgramId(namespaceId, appId, ProgramType.valueOfCategoryName(programType), programId);
metadataAdmin.removeTags(program);
responder.sendString(HttpResponseStatus.OK, String.format("Tags for program %s deleted successfully.", program));
}
use of co.cask.cdap.proto.id.ProgramId in project cdap by caskdata.
the class AbstractProgramRuntimeServiceTest method testUpdateDeadLock.
@Test(timeout = 5000L)
public void testUpdateDeadLock() {
// This test is for testing (CDAP-3716)
// Create a service to simulate an existing running app.
Service service = new TestService();
ProgramId programId = NamespaceId.DEFAULT.app("dummyApp").program(ProgramType.WORKER, "dummy");
RunId runId = RunIds.generate();
ProgramRuntimeService.RuntimeInfo extraInfo = createRuntimeInfo(service, programId, runId);
service.startAndWait();
ProgramRunnerFactory runnerFactory = createProgramRunnerFactory();
TestProgramRuntimeService runtimeService = new TestProgramRuntimeService(CConfiguration.create(), runnerFactory, null, extraInfo);
runtimeService.startAndWait();
// The lookup will get deadlock for CDAP-3716
Assert.assertNotNull(runtimeService.lookup(programId, runId));
service.stopAndWait();
runtimeService.stopAndWait();
}
Aggregations