Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnEmptyIfInvalidFilterSpecification()
        public virtual void ShouldReturnEmptyIfInvalidFilterSpecification()
        {
            // given
            TopologyService topologyService = FakeTopologyService(fakeCoreTopology(new MemberId(System.Guid.randomUUID())), FakeReadReplicaTopology(MemberIDs(100), this.noEastGroupGenerator));

            UserDefinedConfigurationStrategy strategy = new UserDefinedConfigurationStrategy();
            Config config = ConfigWithFilter("invalid filter specification");

            strategy.Inject(topologyService, config, NullLogProvider.Instance, null);

            //when

            Optional <MemberId> memberId = strategy.UpstreamDatabase();

            // then
            assertThat(memberId, empty());
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPickTheFirstMatchingServerIfCore()
        public virtual void ShouldPickTheFirstMatchingServerIfCore()
        {
            // given
            MemberId        theCoreMemberId = new MemberId(System.Guid.randomUUID());
            TopologyService topologyService = FakeTopologyService(fakeCoreTopology(theCoreMemberId), FakeReadReplicaTopology(MemberIDs(100), this.noEastGroupGenerator));

            UserDefinedConfigurationStrategy strategy = new UserDefinedConfigurationStrategy();
            Config config = Config.defaults(CausalClusteringSettings.user_defined_upstream_selection_strategy, "groups(east); groups(core); halt()");

            strategy.Inject(topologyService, config, NullLogProvider.Instance, null);

            //when

            Optional <MemberId> memberId = strategy.UpstreamDatabase();

            // then
            assertThat(memberId, contains(theCoreMemberId));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnEmptyIfNoMatchingServers()
        public virtual void ShouldReturnEmptyIfNoMatchingServers()
        {
            // given
            MemberId[]      readReplicaIds  = MemberIDs(100);
            TopologyService topologyService = FakeTopologyService(fakeCoreTopology(new MemberId(System.Guid.randomUUID())), FakeReadReplicaTopology(readReplicaIds, this.noEastGroupGenerator));

            UserDefinedConfigurationStrategy strategy = new UserDefinedConfigurationStrategy();
            string wantedGroup = _eastGroup;
            Config config      = ConfigWithFilter("groups(" + wantedGroup + "); halt()");

            strategy.Inject(topologyService, config, NullLogProvider.Instance, null);

            //when

            Optional <MemberId> memberId = strategy.UpstreamDatabase();

            // then
            assertThat(memberId, empty());
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotReturnSelf()
        public virtual void ShouldNotReturnSelf()
        {
            // given
            string wantedGroup = _eastGroup;

            MemberId[]      readReplicaIds  = MemberIDs(1);
            TopologyService topologyService = FakeTopologyService(fakeCoreTopology(new MemberId(System.Guid.randomUUID())), FakeReadReplicaTopology(readReplicaIds, memberId => asSet(wantedGroup)));

            UserDefinedConfigurationStrategy strategy = new UserDefinedConfigurationStrategy();
            Config config = ConfigWithFilter("groups(" + wantedGroup + "); halt()");

            strategy.Inject(topologyService, config, NullLogProvider.Instance, readReplicaIds[0]);

            //when

            Optional <MemberId> memberId = strategy.UpstreamDatabase();

            // then
            assertThat(memberId, empty());
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPickTheFirstMatchingServerIfReadReplica()
        public virtual void ShouldPickTheFirstMatchingServerIfReadReplica()
        {
            // given
            MemberId[]      readReplicaIds  = MemberIDs(100);
            TopologyService topologyService = FakeTopologyService(fakeCoreTopology(new MemberId(System.Guid.randomUUID())), FakeReadReplicaTopology(readReplicaIds, this.noEastGroupGenerator));

            UserDefinedConfigurationStrategy strategy = new UserDefinedConfigurationStrategy();
            string wantedGroup = _noEastGroup[1];
            Config config      = ConfigWithFilter("groups(" + wantedGroup + "); halt()");

            strategy.Inject(topologyService, config, NullLogProvider.Instance, null);

            //when

            Optional <MemberId> memberId = strategy.UpstreamDatabase();

            // then
            assertThat(memberId, contains(isIn(readReplicaIds)));
            assertThat(memberId.map(this.noEastGroupGenerator), contains(equalTo(asSet(wantedGroup))));
        }