Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCollectMembersAsAMap() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCollectMembersAsAMap()
        {
            // given
            int              numMembers       = 5;
            ISet <Member>    hazelcastMembers = new HashSet <Member>();
            IList <MemberId> coreMembers      = new List <MemberId>();

            IList <Config> configs = GenerateConfigs(numMembers);

            for (int i = 0; i < configs.Count; i++)
            {
                MemberId mId = new MemberId(System.Guid.randomUUID());
                coreMembers.Add(mId);

                Config c = configs[i];
                IDictionary <string, object> attributes = buildMemberAttributesForCore(mId, c).Attributes;
                hazelcastMembers.Add(new MemberImpl(new Address("localhost", i), null, attributes, false));
            }

            // when
            IDictionary <MemberId, CoreServerInfo> coreMemberMap = toCoreMemberMap(hazelcastMembers, NullLog.Instance, _hzInstance);

            // then
            for (int i = 0; i < numMembers; i++)
            {
                CoreServerInfo coreServerInfo = coreMemberMap[coreMembers[i]];
                assertEquals(new AdvertisedSocketAddress("tx", i + 1), coreServerInfo.CatchupServer);
                assertEquals(new AdvertisedSocketAddress("raft", i + 1), coreServerInfo.RaftServer);
                assertEquals(new AdvertisedSocketAddress("bolt", i + 1), coreServerInfo.Connectors().boltAddress());
                assertEquals(coreServerInfo.DatabaseName, DEFAULT_DB_NAME);
                assertEquals(coreServerInfo.Groups(), _groups);
            }
        }
Ejemplo n.º 2
0
 public static Config ConfigFor(CoreServerInfo coreServerInfo)
 {
     return(Config.builder().withSetting(CausalClusteringSettings.raft_advertised_address, coreServerInfo.RaftServer.ToString()).withSetting(CausalClusteringSettings.transaction_advertised_address, coreServerInfo.CatchupServer.ToString()).withSetting("dbms.connector.bolt.listen_address", coreServerInfo.Connectors().boltAddress().ToString()).withSetting("dbms.connector.bolt.enabled", true.ToString()).withSetting(CausalClusteringSettings.database, coreServerInfo.DatabaseName).withSetting(CausalClusteringSettings.server_groups, string.join(",", coreServerInfo.Groups())).withSetting(CausalClusteringSettings.refuse_to_be_leader, coreServerInfo.RefusesToBeLeader().ToString()).build());
 }