Search in sources :

Example 6 with StreamDetail

use of co.cask.cdap.proto.StreamDetail in project cdap by caskdata.

the class StreamHandlerTest method listStreams.

private List<StreamDetail> listStreams(NamespaceId namespaceId) throws Exception {
    URL url = createURL(namespaceId.getNamespace(), "streams");
    HttpRequest request = HttpRequest.get(url).build();
    HttpResponse response = HttpRequests.execute(request);
    if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
        throw new NamespaceNotFoundException(namespaceId);
    }
    Assert.assertEquals(200, response.getResponseCode());
    return GSON.fromJson(response.getResponseBodyAsString(), new TypeToken<List<StreamDetail>>() {
    }.getType());
}
Also used : HttpRequest(co.cask.common.http.HttpRequest) TypeToken(com.google.common.reflect.TypeToken) StreamDetail(co.cask.cdap.proto.StreamDetail) HttpResponse(co.cask.common.http.HttpResponse) URL(java.net.URL) NamespaceNotFoundException(co.cask.cdap.common.NamespaceNotFoundException)

Example 7 with StreamDetail

use of co.cask.cdap.proto.StreamDetail in project cdap by caskdata.

the class IntegrationTestBase method assertNoStreams.

private void assertNoStreams(NamespaceId namespace) throws Exception {
    List<StreamDetail> streams = getStreamClient().list(namespace);
    List<String> streamNames = Lists.newArrayList();
    for (StreamDetail stream : streams) {
        streamNames.add(stream.getName());
    }
    Assert.assertTrue("Must have no streams, but found the following streams: " + Joiner.on(", ").join(streamNames), streamNames.isEmpty());
}
Also used : StreamDetail(co.cask.cdap.proto.StreamDetail)

Aggregations

StreamDetail (co.cask.cdap.proto.StreamDetail)7 NamespaceNotFoundException (co.cask.cdap.common.NamespaceNotFoundException)2 NamespaceId (co.cask.cdap.proto.id.NamespaceId)2 ArtifactSummary (co.cask.cdap.api.artifact.ArtifactSummary)1 StreamSpecification (co.cask.cdap.api.data.stream.StreamSpecification)1 RowMaker (co.cask.cdap.cli.util.RowMaker)1 Table (co.cask.cdap.cli.util.table.Table)1 ArtifactClient (co.cask.cdap.client.ArtifactClient)1 ApplicationDetail (co.cask.cdap.proto.ApplicationDetail)1 ApplicationRecord (co.cask.cdap.proto.ApplicationRecord)1 DatasetDetail (co.cask.cdap.proto.DatasetDetail)1 DatasetSpecificationSummary (co.cask.cdap.proto.DatasetSpecificationSummary)1 ProgramRecord (co.cask.cdap.proto.ProgramRecord)1 EntityId (co.cask.cdap.proto.id.EntityId)1 StreamId (co.cask.cdap.proto.id.StreamId)1 Principal (co.cask.cdap.proto.security.Principal)1 HttpRequest (co.cask.common.http.HttpRequest)1 HttpResponse (co.cask.common.http.HttpResponse)1 TypeToken (com.google.common.reflect.TypeToken)1 URL (java.net.URL)1