//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnEmptyIfNoGroupsInConfig() public virtual void ShouldReturnEmptyIfNoGroupsInConfig() { // given MemberId[] myGroupMemberIds = memberIDs(10); TopologyService topologyService = GetTopologyService(Collections.singletonList("my_server_group"), myGroupMemberIds, Arrays.asList("x", "y", "z")); ConnectRandomlyToServerGroupImpl strategy = new ConnectRandomlyToServerGroupImpl(Collections.emptyList(), topologyService, null); // when Optional <MemberId> memberId = strategy.UpstreamDatabase(); // then assertThat(memberId, empty()); }
public override void Init() { IList <string> groups = Config.get(CausalClusteringSettings.connect_randomly_to_server_group_strategy); _strategyImpl = new ConnectRandomlyToServerGroupImpl(groups, TopologyService, Myself); if (groups.Count == 0) { Log.warn("No server groups configured for upstream strategy " + ReadableName + ". Strategy will not find upstream servers."); } else { string readableGroups = string.join(", ", groups); Log.info("Upstream selection strategy " + ReadableName + " configured with server groups " + readableGroups); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSelectAnyFromMultipleServerGroups() public virtual void ShouldSelectAnyFromMultipleServerGroups() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<String> myServerGroups = java.util.Arrays.asList("a", "b", "c"); IList <string> myServerGroups = Arrays.asList("a", "b", "c"); MemberId[] myGroupMemberIds = memberIDs(10); TopologyService topologyService = GetTopologyService(myServerGroups, myGroupMemberIds, Arrays.asList("x", "y", "z")); ConnectRandomlyToServerGroupImpl strategy = new ConnectRandomlyToServerGroupImpl(myServerGroups, topologyService, myGroupMemberIds[0]); // when Optional <MemberId> memberId = strategy.UpstreamDatabase(); // then assertThat(memberId, contains(isIn(myGroupMemberIds))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldStayWithinGivenSingleServerGroup() public virtual void ShouldStayWithinGivenSingleServerGroup() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<String> myServerGroup = java.util.Collections.singletonList("my_server_group"); IList <string> myServerGroup = Collections.singletonList("my_server_group"); MemberId[] myGroupMemberIds = memberIDs(10); TopologyService topologyService = GetTopologyService(myServerGroup, myGroupMemberIds, Collections.singletonList("your_server_group")); ConnectRandomlyToServerGroupImpl strategy = new ConnectRandomlyToServerGroupImpl(myServerGroup, topologyService, myGroupMemberIds[0]); // when Optional <MemberId> memberId = strategy.UpstreamDatabase(); // then assertThat(memberId, contains(isIn(myGroupMemberIds))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnEmptyIfGroupOnlyContainsSelf() public virtual void ShouldReturnEmptyIfGroupOnlyContainsSelf() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<String> myServerGroup = java.util.Collections.singletonList("group"); IList <string> myServerGroup = Collections.singletonList("group"); MemberId[] myGroupMemberIds = memberIDs(1); TopologyService topologyService = GetTopologyService(myServerGroup, myGroupMemberIds, Arrays.asList("x", "y", "z")); ConnectRandomlyToServerGroupImpl strategy = new ConnectRandomlyToServerGroupImpl(myServerGroup, topologyService, myGroupMemberIds[0]); // when Optional <MemberId> memberId = strategy.UpstreamDatabase(); // then assertThat(memberId, empty()); }