//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest(name = "V{0}") @ValueSource(longs = {org.neo4j.bolt.v1.BoltProtocolV1.VERSION, org.neo4j.bolt.v2.BoltProtocolV2.VERSION, org.neo4j.bolt.v3.BoltProtocolV3.VERSION}) void shouldCreateBoltProtocol(long protocolVersion) throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldCreateBoltProtocol(long protocolVersion)
        {
            EmbeddedChannel channel     = new EmbeddedChannel();
            BoltChannel     boltChannel = new BoltChannel("bolt-1", "bolt", channel);

            BoltStateMachineFactory stateMachineFactory = mock(typeof(BoltStateMachineFactory));
            BoltStateMachine        stateMachine        = mock(typeof(BoltStateMachine));

            when(stateMachineFactory.NewStateMachine(protocolVersion, boltChannel)).thenReturn(stateMachine);

            BoltConnectionFactory connectionFactory = mock(typeof(BoltConnectionFactory));
            BoltConnection        connection        = mock(typeof(BoltConnection));

            when(connectionFactory.NewConnection(boltChannel, stateMachine)).thenReturn(connection);

            BoltProtocolFactory factory = new DefaultBoltProtocolFactory(connectionFactory, stateMachineFactory, NullLogService.Instance);

            BoltProtocol protocol = factory(protocolVersion, boltChannel);

            protocol.Install();

            // handler with correct version is created
            assertEquals(protocolVersion, protocol.Version());
            // it uses the expected worker
            verify(connectionFactory).newConnection(eq(boltChannel), any(typeof(BoltStateMachine)));

            // and halts this same worker when closed
            verify(connection, never()).stop();
            channel.close();
            verify(connection).stop();

            channel.finishAndReleaseAll();
        }
Example #2
0
 public BoltProtocolV3(BoltChannel channel, BoltConnectionFactory connectionFactory, BoltStateMachineFactory stateMachineFactory, LogService logging) : base(channel, connectionFactory, stateMachineFactory, logging)
 {
 }
 public DefaultBoltProtocolFactory(BoltConnectionFactory connectionFactory, BoltStateMachineFactory stateMachineFactory, LogService logService)
 {
     this._connectionFactory   = connectionFactory;
     this._stateMachineFactory = stateMachineFactory;
     this._logService          = logService;
 }
Example #4
0
        public BoltProtocolV1(BoltChannel channel, BoltConnectionFactory connectionFactory, BoltStateMachineFactory stateMachineFactory, LogService logging)
        {
            this._channel = channel;
            this._logging = logging;

            BoltStateMachine stateMachine = stateMachineFactory.NewStateMachine(Version(), channel);

            this._connection = connectionFactory.NewConnection(channel, stateMachine);

            this._neo4jPack     = CreatePack();
            this._messageReader = CreateMessageReader(channel, _neo4jPack, _connection, logging);
        }