예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldConnectToGroupDefinedInStrategySpecificConfig()
        public virtual void ShouldConnectToGroupDefinedInStrategySpecificConfig()
        {
            // given
            const string targetServerGroup           = "target_server_group";
            Config       configWithTargetServerGroup = Config.defaults(CausalClusteringSettings.connect_randomly_to_server_group_strategy, targetServerGroup);

            MemberId[]      targetGroupMemberIds = memberIDs(10);
            TopologyService topologyService      = ConnectRandomlyToServerGroupStrategyImplTest.GetTopologyService(Collections.singletonList(targetServerGroup), targetGroupMemberIds, Collections.singletonList("your_server_group"));

            ConnectRandomlyToServerGroupStrategy strategy = new ConnectRandomlyToServerGroupStrategy();

            strategy.Inject(topologyService, configWithTargetServerGroup, NullLogProvider.Instance, targetGroupMemberIds[0]);

            // when
            Optional <MemberId> result = strategy.UpstreamDatabase();

            // then
            assertThat(result, contains(isIn(targetGroupMemberIds)));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseServerGroupsFromConfig()
        public virtual void ShouldUseServerGroupsFromConfig()
        {
            // given
            const string myServerGroup           = "my_server_group";
            Config       configWithMyServerGroup = Config.defaults(CausalClusteringSettings.server_groups, myServerGroup);

            MemberId[]      myGroupMemberIds = memberIDs(10);
            TopologyService topologyService  = ConnectRandomlyToServerGroupStrategyImplTest.GetTopologyService(Collections.singletonList(myServerGroup), myGroupMemberIds, Collections.singletonList("your_server_group"));

            ConnectRandomlyWithinServerGroupStrategy strategy = new ConnectRandomlyWithinServerGroupStrategy();

            strategy.Inject(topologyService, configWithMyServerGroup, NullLogProvider.Instance, myGroupMemberIds[0]);

            // when
            Optional <MemberId> result = strategy.UpstreamDatabase();

            // then
            assertThat(result, contains(isIn(myGroupMemberIds)));
        }
예제 #3
0
 public CatchupAddressProvider_PrioritisingUpstreamStrategyBasedAddressProvider(LeaderLocator leaderLocator, TopologyService topologyService, UpstreamDatabaseStrategySelector strategySelector)
 {
     this.LeaderLocator   = leaderLocator;
     this.TopologyService = topologyService;
     this.SecondaryUpstreamStrategyAddressSupplier = new UpstreamStrategyAddressSupplier(strategySelector, topologyService);
 }