@POST @Path("/topologies/{topologyId}/versions/{versionId}/testcases") public Response addTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, TopologyTestRunCase testRunCase, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); testRunCase.setTopologyId(topologyId); testRunCase.setVersionId(versionId); TopologyTestRunCase addedCase = catalogService.addTopologyTestRunCase(testRunCase); return WSUtils.respondEntity(addedCase, CREATED); }
Collection<TopologyTestRunCaseSink> runCaseSinks = listTopologyTestRunCaseSink(runCase.getId()); TopologyTestRunCase newCase = addTopologyTestRunCase(topologyId, newVersionId, new TopologyTestRunCase(runCase));
@POST @Path("/topologies/{topologyId}/testcases") public Response addTestRunCase(@PathParam("topologyId") Long topologyId, TopologyTestRunCase testRunCase, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); testRunCase.setTopologyId(topologyId); Long currentVersionId = catalogService.getCurrentVersionId(topologyId); testRunCase.setVersionId(currentVersionId); TopologyTestRunCase addedCase = catalogService.addTopologyTestRunCase(testRunCase); return WSUtils.respondEntity(addedCase, CREATED); }
private TopologyTestRunCase addTopologyTestRunCase(Long topologyId, Long newVersionId, TopologyTestRunCase testRunCase) { // unlike topology related entities, just issues a new id testRunCase.setId(null); testRunCase.setTopologyId(topologyId); testRunCase.setVersionId(newVersionId); return addTopologyTestRunCase(testRunCase); }