Search in sources :

Example 11 with TopologyTestRunCase

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;
}
Also used : StorableKey(com.hortonworks.registries.storage.StorableKey) TopologyTestRunCase(com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)

Example 12 with TopologyTestRunCase

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

Example 13 with TopologyTestRunCase

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;
}
Also used : TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) TopologyTestRunCase(com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)

Example 14 with TopologyTestRunCase

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

Example 15 with TopologyTestRunCase

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

Aggregations

TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)15 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)7 TopologyTestRunHistory (com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory)7 Topology (com.hortonworks.streamline.streams.catalog.Topology)6 TopologyTestRunCaseSink (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink)6 Path (javax.ws.rs.Path)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 TopologyActions (com.hortonworks.streamline.streams.actions.TopologyActions)3 TopologySink (com.hortonworks.streamline.streams.catalog.TopologySink)3 TopologySource (com.hortonworks.streamline.streams.catalog.TopologySource)3 StreamCatalogService (com.hortonworks.streamline.streams.catalog.service.StreamCatalogService)3 StreamlineProcessor (com.hortonworks.streamline.streams.layout.component.StreamlineProcessor)3 StreamlineSink (com.hortonworks.streamline.streams.layout.component.StreamlineSink)3 StreamlineSource (com.hortonworks.streamline.streams.layout.component.StreamlineSource)3 TopologyLayout (com.hortonworks.streamline.streams.layout.component.TopologyLayout)3 TestRunProcessor (com.hortonworks.streamline.streams.layout.component.impl.testing.TestRunProcessor)3 TestRunRulesProcessor (com.hortonworks.streamline.streams.layout.component.impl.testing.TestRunRulesProcessor)3 VerificationsInOrder (mockit.VerificationsInOrder)3 Test (org.junit.Test)3