Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldProcessRunMessage() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldProcessRunMessage()
        {
            StatementMetadata statementMetadata = mock(typeof(StatementMetadata));

            when(statementMetadata.FieldNames()).thenReturn(new string[] { "foo", "bar", "baz" });
            when(_statementProcessor.run(any(), any())).thenReturn(statementMetadata);

            BoltResponseHandler responseHandler = mock(typeof(BoltResponseHandler));

            _connectionState.ResponseHandler = responseHandler;

            BoltStateMachineState nextState = _state.process(new RunMessage("RETURN 1", EMPTY_MAP), _context);

            assertEquals(_streamingState, nextState);
            verify(_statementProcessor).run("RETURN 1", EMPTY_MAP);
            verify(responseHandler).onMetadata("fields", stringArray("foo", "bar", "baz"));
            verify(responseHandler).onMetadata(eq("result_available_after"), any());
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.bolt.runtime.BoltStateMachineState processRunMessage(org.neo4j.bolt.v1.messaging.request.RunMessage message, org.neo4j.bolt.runtime.StateMachineContext context) throws org.neo4j.bolt.runtime.BoltConnectionFatality
        private BoltStateMachineState ProcessRunMessage(RunMessage message, StateMachineContext context)
        {
            try
            {
                long start = context.Clock().millis();
                StatementMetadata statementMetadata = ProcessRunMessage(message, context.ConnectionState().StatementProcessor);
                long end = context.Clock().millis();

                context.ConnectionState().onMetadata("fields", stringArray(statementMetadata.FieldNames()));
                context.ConnectionState().onMetadata("result_available_after", Values.longValue(end - start));

                return(_streamingState);
            }
            catch (AuthorizationExpiredException e)
            {
                context.HandleFailure(e, true);
                return(_failedState);
            }
            catch (Exception t)
            {
                context.HandleFailure(t, false);
                return(_failedState);
            }
        }