//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(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldManageThrottlersInChannelInitializer() internal virtual void ShouldManageThrottlersInChannelInitializer() { TransportThrottleGroup throttleGroup = mock(typeof(TransportThrottleGroup)); SocketTransport socketTransport = NewSocketTransport(NetworkConnectionTracker.NO_OP, throttleGroup); EmbeddedChannel channel = new EmbeddedChannel(socketTransport.ChannelInitializer()); verify(throttleGroup).install(channel); verify(throttleGroup, never()).uninstall(channel); channel.close(); verify(throttleGroup).uninstall(channel); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldManageChannelsInChannelInitializer() internal virtual void ShouldManageChannelsInChannelInitializer() { NetworkConnectionTracker connectionTracker = mock(typeof(NetworkConnectionTracker)); SocketTransport socketTransport = NewSocketTransport(connectionTracker, NO_THROTTLE); EmbeddedChannel channel = new EmbeddedChannel(socketTransport.ChannelInitializer()); ArgumentCaptor <TrackedNetworkConnection> captor = ArgumentCaptor.forClass(typeof(TrackedNetworkConnection)); verify(connectionTracker).add(captor.capture()); verify(connectionTracker, never()).remove(any()); channel.close(); verify(connectionTracker).remove(captor.Value); }