use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCase in project streamline by hortonworks.
the class StreamCatalogService method getTopologyTestRunCase.
public TopologyTestRunCase getTopologyTestRunCase(Long topologyId, Long testcaseId) {
TopologyTestRunCase testCase = new TopologyTestRunCase();
testCase.setId(testcaseId);
TopologyTestRunCase found = dao.get(new StorableKey(TopologyTestRunCase.NAMESPACE, testCase.getPrimaryKey()));
if (found == null || !found.getTopologyId().equals(topologyId)) {
return null;
}
return found;
}
use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCase in project streamline by hortonworks.
the class TopologyTestRunResource method addTestRunCase.
@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);
}
use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCase in project streamline by hortonworks.
the class TopologyTestRunResource method getAssociatedTopologySink.
private TopologySink getAssociatedTopologySink(Long topologyId, Long testCaseId, Long topologySinkId) {
TopologyTestRunCase testCase = catalogService.getTopologyTestRunCase(topologyId, testCaseId);
if (testCase == null) {
throw EntityNotFoundException.byId("Topology test case with topology id " + topologyId + " and test case id " + testCaseId);
}
TopologySink topologySink = catalogService.getTopologySink(topologyId, topologySinkId, testCase.getVersionId());
if (topologySink == null) {
throw EntityNotFoundException.byId("Topology sink with topology id " + topologyId + " and version id " + testCase.getVersionId());
} else if (!testCase.getVersionId().equals(topologySink.getVersionId())) {
throw new IllegalStateException("Test case and topology sink point to the different version id: " + "version id of test case: " + testCase.getVersionId() + " / " + "version id of topology sink: " + topologySink.getVersionId());
}
return topologySink;
}
use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCase in project streamline by hortonworks.
the class TopologyTestRunResource method addOrUpdateTestRunCase.
@PUT
@Path("/topologies/{topologyId}/testcases/{testCaseId}")
public Response addOrUpdateTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCase testRunCase, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE);
testRunCase.setTopologyId(topologyId);
testRunCase.setId(testCaseId);
TopologyTestRunCase updatedCase = catalogService.addOrUpdateTopologyTestRunCase(topologyId, testRunCase);
return WSUtils.respondEntity(updatedCase, OK);
}
use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCase in project streamline by hortonworks.
the class TopologyTestRunResource method getTestRunCase.
@GET
@Path("/topologies/{topologyId}/testcases/{testCaseId}")
public Response getTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
TopologyTestRunCase testcase = catalogService.getTopologyTestRunCase(topologyId, testCaseId);
if (testcase == null) {
throw EntityNotFoundException.byId(Long.toString(testCaseId));
}
return WSUtils.respondEntity(testcase, OK);
}
Aggregations