Search in sources :

Example 1 with Topology

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

the class TopologyStates method invokeKill.

private static void invokeKill(TopologyContext context) throws Exception {
    Topology topology = context.getTopology();
    TopologyActions topologyActions = context.getTopologyActions();
    topologyActions.kill(CatalogToLayoutConverter.getTopologyLayout(topology), context.getAsUser());
    LOG.debug("Killed topology '{}'", topology.getName());
}
Also used : TopologyActions(com.hortonworks.streamline.streams.actions.TopologyActions) Topology(com.hortonworks.streamline.streams.catalog.Topology)

Example 2 with Topology

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

the class RestIntegrationTest method storeTestTopology.

private Topology storeTestTopology(Client client, Long topologyId, String topologyName, Long namespaceId) {
    Topology topology = createTopology(topologyId, topologyName, namespaceId);
    String topologyBaseUrl = rootUrl + String.format("topologies");
    client.target(topologyBaseUrl).request().post(Entity.json(topology));
    return topology;
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology)

Example 3 with Topology

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

the class RestIntegrationTest method createTopology.

private Topology createTopology(Long id, String name, Long namespaceId) {
    Topology topology = new Topology();
    topology.setId(id);
    topology.setVersionId(1L);
    topology.setName(name);
    topology.setNamespaceId(namespaceId);
    topology.setConfig("{}");
    topology.setVersionTimestamp(System.currentTimeMillis());
    return topology;
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology)

Example 4 with Topology

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

the class TopologyActionResource method topologyStatus.

@GET
@Path("/topologies/{topologyId}/actions/status")
@Timed
public Response topologyStatus(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology result = catalogService.getTopology(topologyId);
    if (result != null) {
        String asUser = WSUtils.getUserFromSecurityContext(securityContext);
        TopologyActions.Status status = actionsService.topologyStatus(result, asUser);
        return WSUtils.respondEntity(status, OK);
    }
    throw EntityNotFoundException.byId(topologyId.toString());
}
Also used : TopologyActions(com.hortonworks.streamline.streams.actions.TopologyActions) Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Example 5 with Topology

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

the class TopologyActionResource method topologyStatusVersion.

@GET
@Path("/topologies/{topologyId}/versions/{versionId}/actions/status")
@Timed
public Response topologyStatusVersion(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology result = catalogService.getTopology(topologyId, versionId);
    if (result != null) {
        String asUser = WSUtils.getUserFromSecurityContext(securityContext);
        TopologyActions.Status status = actionsService.topologyStatus(result, asUser);
        return WSUtils.respondEntity(status, OK);
    }
    throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
Also used : TopologyActions(com.hortonworks.streamline.streams.actions.TopologyActions) Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Topology (com.hortonworks.streamline.streams.catalog.Topology)67 Timed (com.codahale.metrics.annotation.Timed)39 Path (javax.ws.rs.Path)27 GET (javax.ws.rs.GET)17 IOException (java.io.IOException)12 TopologyActions (com.hortonworks.streamline.streams.actions.TopologyActions)9 TopologyTestRunHistory (com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory)9 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)8 TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)8 List (java.util.List)8 Map (java.util.Map)8 POST (javax.ws.rs.POST)8 Expectations (mockit.Expectations)8 Test (org.junit.Test)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 TopologyComponent (com.hortonworks.streamline.streams.catalog.TopologyComponent)6 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)6 ArrayList (java.util.ArrayList)6 StreamCatalogService (com.hortonworks.streamline.streams.catalog.service.StreamCatalogService)5 Collections (java.util.Collections)5