Examples of BytesStreamOutput


Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

        );
        request.creationTime = 0;
        request.includeTypesOnResponse(true);


        BytesStreamOutput out = new BytesStreamOutput();
        request.writeTo(out);

        byte[] expectedBytes = new byte[]
                {0,19,115,101,108,101,99,116,32,42,32,102,114,111,109,32,117,115,101,114,115,2,0,4,97,114,103,49,0,4,97,114,103, 50, 0, 1};
        assertThat(out.bytes().toBytes(), is(expectedBytes));
    }
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

                0,
                whereClause,
                ImmutableList.<ReferenceInfo>of()
        );

        BytesStreamOutput out = new BytesStreamOutput();
        request.writeTo(out);

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        QueryShardRequest inRequest = new QueryShardRequest();
        inRequest.readFrom(in);

        assertEquals(request, inRequest);
    }
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

        rows[2] = new Object[] {3, new BytesRef("Marvin")};

        DistributedResultRequest requestSender = new DistributedResultRequest(contextId, streamers);
        requestSender.rows(rows);

        BytesStreamOutput streamOutput = new BytesStreamOutput();
        requestSender.writeTo(streamOutput);
        // -- end sender


        // receiver
        DistributedRequestContextManager contextManager =
                new DistributedRequestContextManager(new DummyDownstreamOperationFactory(rows), functions,
                        new StatsTables(ImmutableSettings.EMPTY, mock(NodeSettingsService.class)));
        BytesStreamInput streamInput = new BytesStreamInput(streamOutput.bytes());
        DistributedResultRequest requestReceiver = new DistributedResultRequest(contextManager);
        requestReceiver.readFrom(streamInput);

        assertFalse(requestReceiver.rowsRead());
        assertNotNull(requestReceiver.memoryStream());
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

        streamers[1] = DataTypes.STRING.streamer();

        DistributedResultRequest requestSender = new DistributedResultRequest(contextId, streamers);
        requestSender.rows(rows);

        BytesStreamOutput streamOutput = new BytesStreamOutput();
        requestSender.writeTo(streamOutput);

        BytesStreamInput streamInput = new BytesStreamInput(streamOutput.bytes());

        DistributedResultRequest requestReceiver = new DistributedResultRequest(contextManager);
        requestReceiver.readFrom(streamInput);

View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

        cn.downStreamNodes(ImmutableList.of("n1", "n2"));
        cn.toCollect(ImmutableList.<Symbol>of(new Value(DataTypes.STRING)));


        BytesStreamOutput out = new BytesStreamOutput();
        cn.writeTo(out);

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        CollectNode cn2 = new CollectNode();
        cn2.readFrom(in);
        assertEquals(cn, cn2);

        assertEquals(cn.toCollect(), cn2.toCollect());
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

        cn.downStreamNodes(ImmutableList.of("n1", "n2"));
        cn.toCollect(ImmutableList.<Symbol>of(new Value(DataTypes.STRING)));
        cn.jobId(UUID.randomUUID());

        BytesStreamOutput out = new BytesStreamOutput();
        cn.writeTo(out);

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        CollectNode cn2 = new CollectNode();
        cn2.readFrom(in);
        assertEquals(cn, cn2);

        assertEquals(cn.toCollect(), cn2.toCollect());
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

        ));
        TopNProjection topNProjection = new TopNProjection(10, 0);

        node.projections(Arrays.asList(groupProjection, topNProjection));

        BytesStreamOutput output = new BytesStreamOutput();
        node.writeTo(output);


        BytesStreamInput input = new BytesStreamInput(output.bytes());
        MergeNode node2 = new MergeNode();
        node2.readFrom(input);

        assertThat(node.numUpstreams(), is(node2.numUpstreams()));
        assertThat(node.executionNodes(), is(node2.executionNodes()));
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

                new boolean[]{true},
                new Boolean[] { null });

        p.outputs(ImmutableList.<Symbol>of(new Value(DataTypes.BOOLEAN), new Value(DataTypes.INTEGER)));

        BytesStreamOutput out = new BytesStreamOutput();
        Projection.toStream(p, out);

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        TopNProjection p2 = (TopNProjection) Projection.fromStream(in);
        assertEquals(p, p2);
    }
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

                        createReference("bar", DataTypes.SHORT)
                ));

        p.values(ImmutableList.<Aggregation>of());

        BytesStreamOutput out = new BytesStreamOutput();
        Projection.toStream(p, out);

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        GroupProjection p2 = (GroupProjection) Projection.fromStream(in);

        assertEquals(p, p2);
    }
View Full Code Here

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput

                        Aggregation.Step.PARTIAL,
                        Aggregation.Step.FINAL
                )
        ));

        BytesStreamOutput out = new BytesStreamOutput();
        Projection.toStream(groupProjection, out);


        BytesStreamInput in = new BytesStreamInput(out.bytes());
        GroupProjection p2 = (GroupProjection) Projection.fromStream(in);

        assertThat(p2.keys.size(), is(1));
        assertThat(p2.values().size(), is(1));
    }
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.