use of com.datastax.oss.protocol.internal.response.result.ColumnSpec in project java-driver by datastax.
the class DseTestFixtures method tenDseRows.
// Returns 10 rows, each with a single "message" column with the value "hello, world"
public static Rows tenDseRows(int page, boolean last) {
DseRowsMetadata metadata = new DseRowsMetadata(ImmutableList.of(new ColumnSpec("ks", "table", "message", 0, RawType.PRIMITIVES.get(ProtocolConstants.DataType.VARCHAR))), last ? null : ByteBuffer.wrap(new byte[] { (byte) page }), new int[] {}, null, page, last);
Queue<List<ByteBuffer>> data = new ArrayDeque<>();
for (int i = 0; i < 10; i++) {
data.add(ImmutableList.of(Bytes.fromHexString("0x68656C6C6F2C20776F726C64")));
}
return new DefaultRows(metadata, data);
}
use of com.datastax.oss.protocol.internal.response.result.ColumnSpec in project java-driver by datastax.
the class CqlPrepareHandlerTest method simplePrepared.
private static Message simplePrepared() {
RowsMetadata variablesMetadata = new RowsMetadata(ImmutableList.of(new ColumnSpec("ks", "table", "key", 0, RawType.PRIMITIVES.get(ProtocolConstants.DataType.VARCHAR))), null, new int[] { 0 }, null);
RowsMetadata resultMetadata = new RowsMetadata(ImmutableList.of(new ColumnSpec("ks", "table", "message", 0, RawType.PRIMITIVES.get(ProtocolConstants.DataType.VARCHAR))), null, new int[] {}, null);
return new Prepared(Bytes.fromHexString("0xffff").array(), null, variablesMetadata, resultMetadata);
}
use of com.datastax.oss.protocol.internal.response.result.ColumnSpec in project java-driver by datastax.
the class GraphTestUtils method singleGraphRow.
public static Message singleGraphRow(GraphProtocol graphProtocol, GraphBinaryModule module) throws IOException {
Vertex value = DetachedVertex.build().setId(1).setLabel("person").addProperty(DetachedVertexProperty.build().setId(11).setLabel("name").setValue("marko").create()).create();
DseRowsMetadata metadata = new DseRowsMetadata(ImmutableList.of(new ColumnSpec("ks", "table", "gremlin", 0, graphProtocol.isGraphBinary() ? RawType.PRIMITIVES.get(ProtocolConstants.DataType.BLOB) : RawType.PRIMITIVES.get(ProtocolConstants.DataType.VARCHAR))), null, new int[] {}, null, 1, true);
Queue<List<ByteBuffer>> data = new ArrayDeque<>();
data.add(ImmutableList.of(serialize(graphProtocol.isGraphBinary() ? // GraphBinary returns results directly inside a Traverser
new DefaultRemoteTraverser<>(value, 1) : ImmutableMap.of("result", value), graphProtocol, module)));
return new DefaultRows(metadata, data);
}
use of com.datastax.oss.protocol.internal.response.result.ColumnSpec in project java-driver by datastax.
the class CqlRequestHandlerTestBase method singleRow.
// Returns a single row, with a single "message" column with the value "hello, world"
protected static Message singleRow() {
RowsMetadata metadata = new RowsMetadata(ImmutableList.of(new ColumnSpec("ks", "table", "message", 0, RawType.PRIMITIVES.get(ProtocolConstants.DataType.VARCHAR))), null, new int[] {}, null);
Queue<List<ByteBuffer>> data = new ArrayDeque<>();
data.add(ImmutableList.of(Bytes.fromHexString("0x68656C6C6F2C20776F726C64")));
return new DefaultRows(metadata, data);
}
use of com.datastax.oss.protocol.internal.response.result.ColumnSpec in project java-driver by datastax.
the class GraphTestUtils method tenGraphRows.
// Returns 10 rows, each with a vertex
public static Rows tenGraphRows(GraphProtocol graphProtocol, GraphBinaryModule module, int page, boolean last) throws IOException {
DseRowsMetadata metadata = new DseRowsMetadata(ImmutableList.of(new ColumnSpec("ks", "table", "gremlin", 0, graphProtocol.isGraphBinary() ? RawType.PRIMITIVES.get(ProtocolConstants.DataType.BLOB) : RawType.PRIMITIVES.get(ProtocolConstants.DataType.VARCHAR))), null, new int[] {}, null, page, last);
Queue<List<ByteBuffer>> data = new ArrayDeque<>();
int start = (page - 1) * 10;
for (int i = start; i < start + 10; i++) {
Vertex v = DetachedVertex.build().setId("vertex" + i).setLabel("person").addProperty(DetachedVertexProperty.build().setId("property" + i).setLabel("name").setValue("user" + i).create()).create();
data.add(ImmutableList.of(serialize(graphProtocol.isGraphBinary() ? // GraphBinary returns results directly inside a Traverser
new DefaultRemoteTraverser<>(v, 1) : ImmutableMap.of("result", v), graphProtocol, module)));
}
return new DefaultRows(metadata, data);
}
Aggregations