Ejemplo n.º 1
0
        private static BoltResponseMessageReader ResponseReader(Neo4jPack neo4jPack, sbyte[] bytes)
        {
            BufferedChannelInput input = new BufferedChannelInput(128);

            input.Reset(new ArrayByteChannel(bytes));
            return(new BoltResponseMessageReader(neo4jPack.NewUnpacker(input)));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void testMessageDecoding(org.neo4j.bolt.messaging.RequestMessage message) throws Exception
        private static void TestMessageDecoding(RequestMessage message)
        {
            Neo4jPack neo4jPack = newNeo4jPack();

            BoltStateMachine         stateMachine = mock(typeof(BoltStateMachine));
            BoltRequestMessageReader reader       = requestMessageReader(stateMachine);

            PackedInputArray input = new PackedInputArray(encode(neo4jPack, message));

            Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = neo4jPack.NewUnpacker(input);

            reader.Read(unpacker);

            verify(stateMachine).process(eq(message), any());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void assertOriginalMessageEqualsToDecoded(org.neo4j.bolt.messaging.RequestMessage originalMessage, org.neo4j.bolt.messaging.RequestMessageDecoder decoder) throws Exception
        internal static void AssertOriginalMessageEqualsToDecoded(RequestMessage originalMessage, RequestMessageDecoder decoder)
        {
            Neo4jPack neo4jPack = newNeo4jPack();

            PackedInputArray input = new PackedInputArray(encode(neo4jPack, originalMessage));

            Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = neo4jPack.NewUnpacker(input);

            // these two steps are executed before decoding in order to select a correct decoder
            unpacker.UnpackStructHeader();
            unpacker.UnpackStructSignature();

            RequestMessage deserializedMessage = decoder.Decode(unpacker);

            assertEquals(originalMessage, deserializedMessage);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void testShouldDecodeAuthToken(java.util.Map<String,Object> authToken, boolean checkDecodingResult) throws Exception
        protected internal override void TestShouldDecodeAuthToken(IDictionary <string, object> authToken, bool checkDecodingResult)
        {
            Neo4jPack neo4jPack = newNeo4jPack();

            authToken["user_agent"] = "My Driver";
            HelloMessage originalMessage = new HelloMessage(authToken);

            PackedInputArray input = new PackedInputArray(encode(neo4jPack, originalMessage));

            Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = neo4jPack.NewUnpacker(input);

            // these two steps are executed before decoding in order to select a correct decoder
            unpacker.UnpackStructHeader();
            unpacker.UnpackStructSignature();

            RequestMessage deserializedMessage = _decoder.decode(unpacker);

            if (checkDecodingResult)
            {
                AssertHelloMessageMatches(originalMessage, deserializedMessage);
            }
        }