Search in sources :

Example 11 with TopologyTestRunCaseSink

use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink in project streamline by hortonworks.

the class StreamCatalogService method getTopologyTestRunCaseSinkBySinkId.

public TopologyTestRunCaseSink getTopologyTestRunCaseSinkBySinkId(Long testCaseId, Long sinkId) {
    TopologyTestRunCaseSink testCaseSink = new TopologyTestRunCaseSink();
    testCaseSink.setId(testCaseId);
    Collection<TopologyTestRunCaseSink> sinks = dao.find(TopologyTestRunCaseSink.NAMESPACE, Lists.newArrayList(new QueryParam("testCaseId", testCaseId.toString()), new QueryParam("sinkId", sinkId.toString())));
    if (sinks == null || sinks.isEmpty()) {
        return null;
    } else if (sinks.size() > 1) {
        LOG.warn("More than one test run case sink entity for same test case and sink. test case id: " + testCaseId + " , sink id: " + sinkId);
        LOG.warn("Returning first one...");
    }
    return sinks.iterator().next();
}
Also used : TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)

Example 12 with TopologyTestRunCaseSink

use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink in project streamline by hortonworks.

the class TopologyTestRunResource method addTestRunCaseSink.

@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);
}
Also used : TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 13 with TopologyTestRunCaseSink

use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink in project streamline by hortonworks.

the class TopologyTestRunResource method getTestRunCaseSinkByTopologySink.

@GET
@Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks/topologysink/{sinkId}")
public Response getTestRunCaseSinkByTopologySink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("sinkId") Long sinkId, @Context SecurityContext securityContext) {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
    TopologyTestRunCaseSink testCaseSink = catalogService.getTopologyTestRunCaseSinkBySinkId(testCaseId, sinkId);
    if (testCaseSink == null) {
        throw EntityNotFoundException.byId("test case id: " + testCaseId + " , topology source id: " + sinkId);
    }
    return WSUtils.respondEntity(testCaseSink, OK);
}
Also used : TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 14 with TopologyTestRunCaseSink

use of com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink in project streamline by hortonworks.

the class TopologyTestRunResource method addOrUpdateTestRunCaseSink.

@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);
}
Also used : TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) PUT(javax.ws.rs.PUT)

Aggregations

TopologyTestRunCaseSink (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink)14 Path (javax.ws.rs.Path)5 QueryParam (com.hortonworks.registries.common.QueryParam)4 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)4 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)4 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)4 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)4 TopologySink (com.hortonworks.streamline.streams.catalog.TopologySink)4 TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)4 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Collectors.toMap (java.util.stream.Collectors.toMap)3 BaseTopologyRule (com.hortonworks.streamline.streams.catalog.BaseTopologyRule)2 TopologyBranchRule (com.hortonworks.streamline.streams.catalog.TopologyBranchRule)2 TopologyEdge (com.hortonworks.streamline.streams.catalog.TopologyEdge)2 TopologyProcessor (com.hortonworks.streamline.streams.catalog.TopologyProcessor)2 TopologyRule (com.hortonworks.streamline.streams.catalog.TopologyRule)2 TopologySource (com.hortonworks.streamline.streams.catalog.TopologySource)2