use of org.neo4j.bolt.packstream.PackedOutputArray in project neo4j by neo4j.
the class UnsupportedStructTypesV1V2IT method createRunWithUnknownValue.
private byte[] createRunWithUnknownValue(AnyValue value) throws IOException {
PackedOutputArray out = new PackedOutputArray();
Neo4jPack.Packer packer = neo4jPack.newPacker(out);
packer.packStructHeader(2, RunMessage.SIGNATURE);
packer.pack("RETURN $x");
packer.packMapHeader(1);
packer.pack("x");
packer.pack(value);
return out.bytes();
}
use of org.neo4j.bolt.packstream.PackedOutputArray in project neo4j by neo4j.
the class BoltV3TransportIT method runMessage.
private byte[] runMessage(Map<String, Object> metadata) throws IOException {
PackedOutputArray out = new PackedOutputArray();
Neo4jPack.Packer packer = util.getNeo4jPack().newPacker(out);
packer.packStructHeader(3, RunMessage.SIGNATURE);
packer.pack("RETURN 1");
packer.pack(EMPTY_MAP);
packer.pack(asMapValue(metadata));
return out.bytes();
}
use of org.neo4j.bolt.packstream.PackedOutputArray in project neo4j by neo4j.
the class MessageDecoderTest method shouldThrowOnUnknownStructType.
@ParameterizedTest
@MethodSource("argumentsProvider")
public void shouldThrowOnUnknownStructType(Neo4jPack packerUnderTest) throws Exception {
this.packerUnderTest = packerUnderTest;
PackedOutputArray out = new PackedOutputArray();
Neo4jPack.Packer packer = packerUnderTest.newPacker(out);
packer.packStructHeader(2, RunMessage.SIGNATURE);
packer.pack("RETURN $x");
packer.packMapHeader(1);
packer.pack("x");
packer.packStructHeader(0, (byte) 'A');
var ex = assertThrows(BoltIOException.class, () -> unpack(out.bytes()));
assertEquals("Struct types of 0x41 are not recognized.", ex.getMessage());
}
use of org.neo4j.bolt.packstream.PackedOutputArray in project neo4j by neo4j.
the class MessageDecoderTest method packMessageWithSignature.
private byte[] packMessageWithSignature(byte signature) throws IOException {
PackedOutputArray out = new PackedOutputArray();
Neo4jPack.Packer packer = packerUnderTest.newPacker(out);
packer.packStructHeader(2, signature);
packer.pack("RETURN 'Hello World!'");
packer.pack(EMPTY_MAP);
return out.bytes();
}
use of org.neo4j.bolt.packstream.PackedOutputArray in project neo4j by neo4j.
the class TransportUnauthenticatedConnectionErrorIT method createHelloWithOversizeDeclaredMap.
private byte[] createHelloWithOversizeDeclaredMap(Neo4jPack neo4jPack) throws IOException {
PackedOutputArray out = new PackedOutputArray();
Neo4jPack.Packer packer = neo4jPack.newPacker(out);
packer.packStructHeader(2, HelloMessage.SIGNATURE);
// Map claims to be huge when it isn't
packer.packMapHeader(Integer.MAX_VALUE);
packer.pack("x");
packer.pack("Boom!");
return out.bytes();
}
Aggregations