コード例 #1
0
 private void InitializeInstanceFields()
 {
     _supportedApplicationProtocol  = new ApplicationSupportedProtocols(_applicationProtocolIdentifier, emptyList());
     _applicationProtocolRepository = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), _supportedApplicationProtocol);
     _modifierProtocolRepository    = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), _supportedModifierProtocols);
     _expectedApplicationProtocol   = _applicationProtocolRepository.select(_applicationProtocolIdentifier.canonicalName(), _raftVersion).get();
 }
コード例 #2
0
 private void InitializeInstanceFields()
 {
     _raftApplicationProtocolRepository      = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), _supportedRaftApplicationProtocol);
     _catchupApplicationProtocolRepository   = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), _supportedCatchupApplicationProtocol);
     _compressionModifierProtocolRepository  = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), _supportedCompressionModifierProtocols);
     _unsupportingModifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), _noSupportedModifierProtocols);
 }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCompleteProtocolStackOnSuccessfulSwitchOverWithConfiguredModifierProtocols()
        public void shouldCompleteProtocolStackOnSuccessfulSwitchOverWithConfiguredModifierProtocols()
        {
            // given
            ISet <string>  requestedVersions         = asSet(TestProtocols_TestModifierProtocols.allVersionsOf(COMPRESSION));
            string         expectedNegotiatedVersion = SNAPPY.implementation();
            IList <string> configuredVersions        = singletonList(expectedNegotiatedVersion);

            IList <ModifierSupportedProtocols> supportedModifierProtocols = asList(new ModifierSupportedProtocols(COMPRESSION, configuredVersions));

            ModifierProtocolRepository modifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), supportedModifierProtocols);

            HandshakeServer server = new HandshakeServer(_applicationProtocolRepository, modifierProtocolRepository, _channel);

            server.Handle(InitialMagicMessage.Instance());
            server.Handle(new ApplicationProtocolRequest(RAFT.canonicalName(), asSet(RAFT_1.implementation())));
            server.Handle(new ModifierProtocolRequest(COMPRESSION.canonicalName(), requestedVersions));

            // when
            IList <Pair <string, string> > modifierRequest = new IList <Pair <string, string> > {
                Pair.of(SNAPPY.category(), SNAPPY.implementation())
            };

            server.Handle(new SwitchOverRequest(RAFT_1.category(), RAFT_1.implementation(), modifierRequest));

            // then
            verify(_channel).writeAndFlush(InitialMagicMessage.Instance());
            verify(_channel).writeAndFlush(new SwitchOverResponse(SUCCESS));
            ProtocolStack            protocolStack = server.ProtocolStackFuture().getNow(null);
            IList <ModifierProtocol> modifiers     = new IList <ModifierProtocol> {
                SNAPPY
            };

            assertThat(protocolStack, equalTo(new ProtocolStack(RAFT_1, modifiers)));
        }
コード例 #4
0
 internal HandshakeServer(ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository, Channel channel)
 {
     this._channel = channel;
     this._applicationProtocolRepository = applicationProtocolRepository;
     this._modifierProtocolRepository    = modifierProtocolRepository;
     this._supportedApplicationProtocol  = applicationProtocolRepository.SupportedProtocol();
 }
コード例 #5
0
 public HandshakeServerInitializer(ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository, ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server> protocolInstallerRepository, NettyPipelineBuilderFactory pipelineBuilderFactory, LogProvider logProvider)
 {
     this._log = logProvider.getLog(this.GetType());
     this._applicationProtocolRepository = applicationProtocolRepository;
     this._modifierProtocolRepository    = modifierProtocolRepository;
     this._protocolInstallerRepository   = protocolInstallerRepository;
     this._pipelineBuilderFactory        = pipelineBuilderFactory;
 }
コード例 #6
0
 public HandshakeClientInitializer(ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository, ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Client> protocolInstallerRepository, NettyPipelineBuilderFactory pipelineBuilderFactory, Duration handshakeTimeout, LogProvider debugLogProvider, LogProvider userLogProvider)
 {
     this._debugLog = debugLogProvider.getLog(this.GetType());
     this._userLog  = userLogProvider.getLog(this.GetType());
     this._applicationProtocolRepository = applicationProtocolRepository;
     this._modifierProtocolRepository    = modifierProtocolRepository;
     this._timeout                = handshakeTimeout;
     this._protocolInstaller      = protocolInstallerRepository;
     this._pipelineBuilderFactory = pipelineBuilderFactory;
     this._handshakeDelay         = new ExponentialBackoffStrategy(1, 2000, MILLISECONDS);
 }
コード例 #7
0
            internal Fixture(Parameters parameters)
            {
                ApplicationProtocolRepository serverApplicationProtocolRepository = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), parameters.ServerApplicationProtocol);
                ModifierProtocolRepository    serverModifierProtocolRepository    = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), parameters.ServerModifierProtocols);

                ClientApplicationProtocolRepository = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), parameters.ClientApplicationProtocol);
                ClientModifierProtocolRepository    = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), parameters.ClientModifierProtocols);

                HandshakeClient = new HandshakeClient();
                HandshakeServer = new HandshakeServer(serverApplicationProtocolRepository, serverModifierProtocolRepository, new FakeServerChannel(HandshakeClient));
                ClientChannel   = new FakeClientChannel(HandshakeServer);
                this.Parameters = parameters;
            }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnModifierProtocolOfSingleConfiguredVersionIfOthersRequested()
        public virtual void ShouldReturnModifierProtocolOfSingleConfiguredVersionIfOthersRequested()
        {
            // given
            IList <ModifierSupportedProtocols> supportedProtocols = asList(new ModifierSupportedProtocols(COMPRESSION, new IList <string> {
                LZO.implementation()
            }));
            ModifierProtocolRepository modifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), supportedProtocols);
            // when
            Optional <Org.Neo4j.causalclustering.protocol.Protocol_ModifierProtocol> modifierProtocol = modifierProtocolRepository.Select(COMPRESSION.canonicalName(), asSet(TestProtocols_TestModifierProtocols.allVersionsOf(COMPRESSION)));

            // then
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(modifierProtocol.map(Protocol::implementation), OptionalMatchers.contains(LZO.implementation()));
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSendSwitchOverRequestIfNoModifierProtocolsToRequestOnApplicationProtocolResponse()
        public virtual void ShouldSendSwitchOverRequestIfNoModifierProtocolsToRequestOnApplicationProtocolResponse()
        {
            ModifierProtocolRepository repo = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), emptyList());
            // given
            CompletableFuture <ProtocolStack> protocolStackCompletableFuture = _client.initiate(_channel, _applicationProtocolRepository, repo);

            _client.handle(InitialMagicMessage.Instance());

            // when
            _client.handle(new ApplicationProtocolResponse(StatusCode.Success, _applicationProtocolIdentifier.canonicalName(), _raftVersion));

            // then
            verify(_channel).writeAndFlush(new SwitchOverRequest(_applicationProtocolIdentifier.canonicalName(), _raftVersion, emptyList()));
            assertFalse(protocolStackCompletableFuture.Done);
        }
コード例 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnModifierProtocolOfFirstConfiguredVersionRequestedAndSupported()
        public virtual void ShouldReturnModifierProtocolOfFirstConfiguredVersionRequestedAndSupported()
        {
            // given
            IList <ModifierSupportedProtocols> supportedProtocols = asList(new ModifierSupportedProtocols(COMPRESSION, new IList <string> {
                LZO.implementation(), SNAPPY.implementation(), LZ4.implementation()
            }), new ModifierSupportedProtocols(GRATUITOUS_OBFUSCATION, new IList <string> {
                NAME_CLASH.implementation()
            }));
            ModifierProtocolRepository modifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), supportedProtocols);
            // when
            Optional <Org.Neo4j.causalclustering.protocol.Protocol_ModifierProtocol> modifierProtocol = modifierProtocolRepository.Select(COMPRESSION.canonicalName(), asSet("bzip2", SNAPPY.implementation(), LZ4.implementation(), LZO.implementation(), "fast_lz"));

            // then
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(modifierProtocol.map(Protocol::implementation), OptionalMatchers.contains(LZO.implementation()));
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _logProvider = new AssertableLogProvider(true);
            ApplicationProtocolRepository applicationProtocolRepository = new ApplicationProtocolRepository(Org.Neo4j.causalclustering.protocol.Protocol_ApplicationProtocols.values(), _parameters.applicationSupportedProtocol);
            ModifierProtocolRepository    modifierProtocolRepository    = new ModifierProtocolRepository(Protocol_ModifierProtocols.values(), _parameters.modifierSupportedProtocols);

            NettyPipelineBuilderFactory serverPipelineBuilderFactory = new NettyPipelineBuilderFactory(VoidPipelineWrapperFactory.VOID_WRAPPER);
            NettyPipelineBuilderFactory clientPipelineBuilderFactory = new NettyPipelineBuilderFactory(VoidPipelineWrapperFactory.VOID_WRAPPER);

            _server = new Server(serverPipelineBuilderFactory);
            _server.start(applicationProtocolRepository, modifierProtocolRepository, _logProvider);

            Config config = Config.builder().withSetting(CausalClusteringSettings.handshake_timeout, TIMEOUT_SECONDS + "s").build();

            _client = new Client(applicationProtocolRepository, modifierProtocolRepository, clientPipelineBuilderFactory, config, _logProvider);

            _client.connect(_server.port());
        }
コード例 #12
0
        public virtual CompletableFuture <ProtocolStack> Initiate(Channel channel, ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository)
        {
            this._channel = channel;

            this._applicationProtocolRepository = applicationProtocolRepository;
            this._supportedApplicationProtocol  = applicationProtocolRepository.SupportedProtocol();

            this._modifierProtocolRepository = modifierProtocolRepository;
            this._supportedModifierProtocols = modifierProtocolRepository.SupportedProtocols();

            _negotiatedModifierProtocols = new List <Pair <string, Optional <Protocol_ModifierProtocol> > >(_supportedModifierProtocols.Count);

            channel.Write(InitialMagicMessage.Instance());

            SendProtocolRequests(channel, _supportedApplicationProtocol, _supportedModifierProtocols);

            return(_future);
        }
コード例 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCompleteProtocolStackOnSwitchoverResponse()
        public virtual void ShouldCompleteProtocolStackOnSwitchoverResponse()
        {
            // given
            ModifierProtocolRepository repo = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), asList(new ModifierSupportedProtocols(Org.Neo4j.causalclustering.protocol.Protocol_ModifierProtocolCategory.Compression, emptyList())));

            CompletableFuture <ProtocolStack> protocolStackCompletableFuture = _client.initiate(_channel, _applicationProtocolRepository, repo);

            _client.handle(InitialMagicMessage.Instance());
            _client.handle(new ApplicationProtocolResponse(StatusCode.Success, _applicationProtocolIdentifier.canonicalName(), _raftVersion));
            _client.handle(new ModifierProtocolResponse(StatusCode.Success, SNAPPY.category(), SNAPPY.implementation()));

            // when
            _client.handle(new SwitchOverResponse(StatusCode.Success));

            // then
            ProtocolStack protocolStack = protocolStackCompletableFuture.getNow(null);

            assertThat(protocolStack, equalTo(new ProtocolStack(_expectedApplicationProtocol, singletonList(SNAPPY))));
        }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Parameterized.Parameters public static java.util.Collection<Parameters> data()
        public static ICollection <Parameters> Data()
        {
            // Application protocols
            ApplicationSupportedProtocols allRaft          = new ApplicationSupportedProtocols(RAFT, TestProtocols_TestApplicationProtocols.listVersionsOf(RAFT));
            ApplicationSupportedProtocols raft1            = new ApplicationSupportedProtocols(RAFT, singletonList(RAFT_1.implementation()));
            ApplicationSupportedProtocols allRaftByDefault = new ApplicationSupportedProtocols(RAFT, emptyList());

            // Modifier protocols
            ICollection <ModifierSupportedProtocols> allModifiers = asList(new ModifierSupportedProtocols(COMPRESSION, TestProtocols_TestModifierProtocols.listVersionsOf(COMPRESSION)), new ModifierSupportedProtocols(GRATUITOUS_OBFUSCATION, TestProtocols_TestModifierProtocols.listVersionsOf(GRATUITOUS_OBFUSCATION))
                                                                           );
            ICollection <ModifierSupportedProtocols> allCompressionModifiers          = singletonList(new ModifierSupportedProtocols(COMPRESSION, TestProtocols_TestModifierProtocols.listVersionsOf(COMPRESSION)));
            ICollection <ModifierSupportedProtocols> allObfuscationModifiers          = singletonList(new ModifierSupportedProtocols(GRATUITOUS_OBFUSCATION, TestProtocols_TestModifierProtocols.listVersionsOf(GRATUITOUS_OBFUSCATION)));
            ICollection <ModifierSupportedProtocols> allCompressionModifiersByDefault = singletonList(new ModifierSupportedProtocols(COMPRESSION, emptyList()));

            IList <ModifierSupportedProtocols> onlyLzoCompressionModifiers    = singletonList(new ModifierSupportedProtocols(COMPRESSION, singletonList(LZO.implementation())));
            IList <ModifierSupportedProtocols> onlySnappyCompressionModifiers = singletonList(new ModifierSupportedProtocols(COMPRESSION, singletonList(SNAPPY.implementation())));

            ICollection <ModifierSupportedProtocols> noModifiers = emptyList();

            // Ordered modifier protocols
            ModifierProtocolRepository modifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), allModifiers);

            string[] lzoFirstVersions = new string[] { LZO.implementation(), LZ4.implementation(), SNAPPY.implementation() };
            IList <ModifierSupportedProtocols> lzoFirstCompressionModifiers = singletonList(new ModifierSupportedProtocols(COMPRESSION, new IList <string> {
                lzoFirstVersions
            }));
            Protocol_ModifierProtocol preferredLzoFirstCompressionModifier = modifierProtocolRepository.Select(COMPRESSION.canonicalName(), asSet(lzoFirstVersions)).get();

            string[] snappyFirstVersions = new string[] { SNAPPY.implementation(), LZ4.implementation(), LZO.implementation() };
            IList <ModifierSupportedProtocols> snappyFirstCompressionModifiers = singletonList(new ModifierSupportedProtocols(COMPRESSION, new IList <string> {
                snappyFirstVersions
            }));
            Protocol_ModifierProtocol preferredSnappyFirstCompressionModifier = modifierProtocolRepository.Select(COMPRESSION.canonicalName(), asSet(snappyFirstVersions)).get();

            return(asList(new Parameters(allRaft, allRaft, allModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION), TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(allRaft, allRaftByDefault, allModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION), TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(allRaftByDefault, allRaft, allModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION), TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(allRaft, raft1, allModifiers, allModifiers, RAFT_1, new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION), TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(raft1, allRaft, allModifiers, allModifiers, RAFT_1, new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION), TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(allRaft, allRaft, allModifiers, allCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION) }), new Parameters(allRaft, allRaft, allCompressionModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION) }), new Parameters(allRaft, allRaft, allModifiers, allCompressionModifiersByDefault, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION) }), new Parameters(allRaft, allRaft, allCompressionModifiersByDefault, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(COMPRESSION) }), new Parameters(allRaft, allRaft, allModifiers, allObfuscationModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(allRaft, allRaft, allObfuscationModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.latest(GRATUITOUS_OBFUSCATION) }), new Parameters(allRaft, allRaft, allModifiers, lzoFirstCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { LZO }), new Parameters(allRaft, allRaft, lzoFirstCompressionModifiers, allCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { preferredLzoFirstCompressionModifier }), new Parameters(allRaft, allRaft, allModifiers, snappyFirstCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { SNAPPY }), new Parameters(allRaft, allRaft, snappyFirstCompressionModifiers, allCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { preferredSnappyFirstCompressionModifier }), new Parameters(allRaft, allRaft, allModifiers, onlyLzoCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.LZO }), new Parameters(allRaft, allRaft, onlyLzoCompressionModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] { TestProtocols_TestModifierProtocols.LZO }), new Parameters(allRaft, allRaft, onlySnappyCompressionModifiers, onlyLzoCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] {}), new Parameters(allRaft, allRaft, onlyLzoCompressionModifiers, onlySnappyCompressionModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] {}), new Parameters(allRaft, allRaft, allModifiers, noModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] {}), new Parameters(allRaft, allRaft, noModifiers, allModifiers, TestProtocols_TestApplicationProtocols.latest(RAFT), new Protocol_ModifierProtocol[] {})
                          ));
        }
コード例 #15
0
            internal Client(ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository, NettyPipelineBuilderFactory pipelineBuilderFactory, Config config, LogProvider logProvider)
            {
                RaftProtocolClientInstallerV2.Factory raftFactoryV2 = new RaftProtocolClientInstallerV2.Factory(pipelineBuilderFactory, logProvider);
                RaftProtocolClientInstallerV1.Factory raftFactoryV1 = new RaftProtocolClientInstallerV1.Factory(pipelineBuilderFactory, logProvider);
                ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Client> protocolInstallerRepository = new ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Client>(Arrays.asList(raftFactoryV1, raftFactoryV2), Org.Neo4j.causalclustering.protocol.ModifierProtocolInstaller_Fields.AllClientInstallers);

                EventLoopGroup = new NioEventLoopGroup();
                Duration handshakeTimeout = config.Get(CausalClusteringSettings.handshake_timeout);

                HandshakeClientInitializer = new HandshakeClientInitializer(applicationProtocolRepository, modifierProtocolRepository, protocolInstallerRepository, pipelineBuilderFactory, handshakeTimeout, logProvider, logProvider);
                Bootstrap = (new Bootstrap()).group(EventLoopGroup).channel(typeof(NioSocketChannel)).handler(HandshakeClientInitializer);
            }
コード例 #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCompareModifierProtocolsByListOrder()
        public virtual void ShouldCompareModifierProtocolsByListOrder()
        {
            IList <ModifierSupportedProtocols> supportedProtocols = asList(new ModifierSupportedProtocols(COMPRESSION, new IList <string> {
                LZO.implementation(), SNAPPY.implementation(), LZ4.implementation()
            }));

            IComparer <Org.Neo4j.causalclustering.protocol.Protocol_ModifierProtocol> comparator = ModifierProtocolRepository.GetModifierProtocolComparator(supportedProtocols).apply(COMPRESSION.canonicalName());

            assertThat(comparator.Compare(LZO, TestProtocols_TestModifierProtocols.Snappy), Matchers.greaterThan(0));
            assertThat(comparator.Compare(TestProtocols_TestModifierProtocols.Snappy, TestProtocols_TestModifierProtocols.Lz4), Matchers.greaterThan(0));
        }
コード例 #17
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: void start(final ApplicationProtocolRepository applicationProtocolRepository, final ModifierProtocolRepository modifierProtocolRepository)
            internal virtual void Start(ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository)
            {
                EventLoopGroup = new NioEventLoopGroup();
                ServerBootstrap bootstrap = (new ServerBootstrap()).group(EventLoopGroup).channel(typeof(NioServerSocketChannel)).option(ChannelOption.SO_REUSEADDR, true).localAddress(0).childHandler(new ChannelInitializerAnonymousInnerClass(this, applicationProtocolRepository, modifierProtocolRepository));

                Channel = bootstrap.bind().syncUninterruptibly().channel();
            }
コード例 #18
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: void start(final ApplicationProtocolRepository applicationProtocolRepository, final ModifierProtocolRepository modifierProtocolRepository, org.neo4j.logging.LogProvider logProvider)
            internal virtual void Start(ApplicationProtocolRepository applicationProtocolRepository, ModifierProtocolRepository modifierProtocolRepository, LogProvider logProvider)
            {
                RaftProtocolServerInstallerV2.Factory raftFactoryV2 = new RaftProtocolServerInstallerV2.Factory(nettyHandler, PipelineBuilderFactory, logProvider);
                RaftProtocolServerInstallerV1.Factory raftFactoryV1 = new RaftProtocolServerInstallerV1.Factory(nettyHandler, PipelineBuilderFactory, logProvider);
                ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server> protocolInstallerRepository = new ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server>(Arrays.asList(raftFactoryV1, raftFactoryV2), Org.Neo4j.causalclustering.protocol.ModifierProtocolInstaller_Fields.AllServerInstallers);

                EventLoopGroup = new NioEventLoopGroup();
                ServerBootstrap bootstrap = (new ServerBootstrap()).group(EventLoopGroup).channel(typeof(NioServerSocketChannel)).option(ChannelOption.SO_REUSEADDR, true).localAddress(PortAuthority.allocatePort()).childHandler((new HandshakeServerInitializer(applicationProtocolRepository, modifierProtocolRepository, protocolInstallerRepository, PipelineBuilderFactory, logProvider)).asChannelInitializer());

                Channel = bootstrap.bind().syncUninterruptibly().channel();
            }