@POST @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks") public Response addTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCaseSink testRunCaseSink, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId()); testRunCaseSink.setVersionId(topologySink.getVersionId()); TopologyTestRunCaseSink addedCaseSink = catalogService.addTopologyTestRunCaseSink(testRunCaseSink); return WSUtils.respondEntity(addedCaseSink, CREATED); }
private void addTopologyTestRunCaseSink(Long newTestCaseId, Long newVersionId, TopologyTestRunCaseSink testRunCaseSink) { // unlike topology related entities, just issues a new id testRunCaseSink.setId(null); testRunCaseSink.setTestCaseId(newTestCaseId); testRunCaseSink.setVersionId(newVersionId); addTopologyTestRunCaseSink(testRunCaseSink); }
@PUT @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks/{id}") public Response addOrUpdateTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("id") Long id, TopologyTestRunCaseSink testRunCaseSink, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); testRunCaseSink.setId(id); testRunCaseSink.setTestCaseId(testCaseId); TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId()); testRunCaseSink.setVersionId(topologySink.getVersionId()); TopologyTestRunCaseSink updatedCase = catalogService.addOrUpdateTopologyTestRunCaseSink(testRunCaseSink.getId(), testRunCaseSink); return WSUtils.respondEntity(updatedCase, OK); }
public TopologyTestRunCaseSink(TopologyTestRunCaseSink other) { if (other != null) { setId(other.getId()); setTestCaseId(other.getTestCaseId()); setSinkId(other.getSinkId()); setVersionId(other.getVersionId()); setRecords(other.getRecords()); setTimestamp(other.getTimestamp()); } }