Examples of Stream


Examples of org.eclipse.jetty.http2.api.Stream

        Session session = newClient(new Session.Listener.Adapter());
        MetaData.Request metaData = newRequest("GET", new HttpFields());
        HeadersFrame requestFrame = new HeadersFrame(0, metaData, null, false);
        FuturePromise<Stream> promise = new FuturePromise<>();
        session.newStream(requestFrame, promise, new Stream.Listener.Adapter());
        final Stream stream = promise.get(5, TimeUnit.SECONDS);

        sleep(idleTimeout / 2);
        final CountDownLatch dataLatch = new CountDownLatch(1);
        stream.data(new DataFrame(stream.getId(), ByteBuffer.allocate(1), false), new Callback.Adapter()
        {
            private int sends;

            @Override
            public void succeeded()
            {
                sleep(idleTimeout / 2);
                final boolean last = ++sends == 2;
                stream.data(new DataFrame(stream.getId(), ByteBuffer.allocate(1), last), !last ? this : new Adapter()
                {
                    @Override
                    public void succeeded()
                    {
                        dataLatch.countDown();
View Full Code Here

Examples of org.eclipse.jetty.spdy.api.Stream

        }, 30000), null);

        Fields headers = SPDYTestUtils.createHeaders("localhost", connector.getPort(), version, "POST", path);
        headers.put("content-type", "application/x-www-form-urlencoded");
        final CountDownLatch replyLatch = new CountDownLatch(1);
        Stream stream = session.syn(new SynInfo(5, TimeUnit.SECONDS, headers, false, (byte)0),
                new StreamFrameListener.Adapter()
                {
                    @Override
                    public void onReply(Stream stream, ReplyInfo replyInfo)
                    {
                        assertTrue(replyInfo.isClose());
                        Fields replyHeaders = replyInfo.getHeaders();
                        assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).getValue().contains("200"));
                        replyLatch.countDown();
                    }
                });
        stream.data(new StringDataInfo("a", false));
        assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
        assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
        stream.data(new StringDataInfo("b", true));
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.stream.Stream

     */
    @Test
    public void testAdd()
    {
        // Stream to add
        final Stream stream = new Stream();
        stream.setId(0L);

        // Empty list
        final List<Stream> streams = new ArrayList<Stream>();

        CONTEXT.checking(new Expectations()
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

                new DateTime((long) fields.remove("timestamp"), DateTimeZone.UTC)
        );
        final List<Stream> streamList = Lists.newArrayList();

        for (String id : bean.getStreams()) {
            Stream stream = getStream(id);

            if (stream != null) {
                streamList.add(stream);
            }
        }
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

    @GET
    @Timed
    @ApiOperation(value = "Get a list of all alarm callbacks for this stream")
    @Produces(MediaType.APPLICATION_JSON)
    public Response get(@ApiParam(name = "streamid", value = "The id of the stream whose alarm callbacks we want.", required = true) @PathParam("streamid") String streamid) {
        Stream stream = null;
        try {
            stream = streamService.load(streamid);
        } catch (NotFoundException e) {
            throw new WebApplicationException(404);
        }
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

    @Timed
    @ApiOperation(value = "Get a single specified alarm callback for this stream")
    @Produces(MediaType.APPLICATION_JSON)
    public Response get(@ApiParam(name = "streamid", value = "The id of the stream whose alarm callbacks we want.", required = true) @PathParam("streamid") String streamid,
                        @ApiParam(name = "alarmCallbackId", value = "The alarm callback id we are getting", required = true) @PathParam("alarmCallbackId") String alarmCallbackId) {
        Stream stream = null;
        try {
            stream = streamService.load(streamid);
        } catch (NotFoundException e) {
            throw new WebApplicationException(404);
        }

        AlarmCallbackConfiguration result = alarmCallbackConfigurationService.load(alarmCallbackId);
        if (result == null || !result.getStreamId().equals(stream.getId()))
            throw new WebApplicationException(404);
        return Response.status(Response.Status.OK).entity(json(result.getFields())).build();
    }
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

        } catch(IOException e) {
            LOG.error("Error while parsing JSON", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }

        Stream stream;
        try {
            stream = streamService.load(streamid);
        } catch (org.graylog2.database.NotFoundException e) {
            throw new WebApplicationException(404);
        }
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

            @ApiResponse(code = 400, message = "Invalid ObjectId.")
    })
    public Response delete(@ApiParam(name = "streamid", value = "The stream id this new rule belongs to.", required = true) @PathParam("streamid") String streamid,
                           @ApiParam(name = "alarmCallbackId", required = true) @PathParam("alarmCallbackId") String alarmCallbackId) {

        Stream stream = null;
        try {
            stream = streamService.load(streamid);
        } catch (NotFoundException e) {
            throw new WebApplicationException(404);
        }

        AlarmCallbackConfiguration result = alarmCallbackConfigurationService.load(alarmCallbackId);
        if (result == null || !result.getStreamId().equals(stream.getId()))
            throw new WebApplicationException(404);

        if (alarmCallbackConfigurationService.destroy(result) > 0)
            return Response.status(Response.Status.NO_CONTENT).build();
        else
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

    })
    public Response get(@ApiParam(name = "streamid", value = "The id of the stream whose outputs we want.", required = true) @PathParam("streamid") String streamid) throws org.graylog2.database.NotFoundException {
        checkPermission(RestPermissions.STREAMS_READ, streamid);
        checkPermission(RestPermissions.STREAM_OUTPUTS_READ);

        final Stream stream = streamService.load(streamid);

        final Set<Output> outputs = stream.getOutputs();
        Map<String, Object> result = new HashMap<String, Object>() {{
            put("outputs", outputs);
            put("total", outputs.size());
        }};
View Full Code Here

Examples of org.graylog2.plugin.streams.Stream

    })
    public Response add(@ApiParam(name = "streamid", value = "The id of the stream whose outputs we want.", required = true) @PathParam("streamid") String streamid,
                           @ApiParam(name = "JSON body", required = true) AddOutputRequest request) throws ValidationException, org.graylog2.database.NotFoundException {
        checkPermission(RestPermissions.STREAM_OUTPUTS_CREATE);

        final Stream stream = streamService.load(streamid);

        for (String outputId : request.outputs) {
            final Output output = outputService.load(outputId);
            streamService.addOutput(stream, output);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.