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 shouldSerializeToString()
        public virtual void ShouldSerializeToString()
        {
            // given
            ClientConnectorAddresses connectorAddresses = new ClientConnectorAddresses(new IList <ConnectorUri>
            {
                new ConnectorUri(bolt, new AdvertisedSocketAddress("host", 1)),
                new ConnectorUri(http, new AdvertisedSocketAddress("host", 2)),
                new ConnectorUri(https, new AdvertisedSocketAddress("host", 3)),
                new ConnectorUri(bolt, new AdvertisedSocketAddress("::1", 4)),
                new ConnectorUri(http, new AdvertisedSocketAddress("::", 5)),
                new ConnectorUri(https, new AdvertisedSocketAddress("fe80:1:2::3", 6))
            });

            string expectedString = "bolt://host:1,http://host:2,https://host:3,bolt://[::1]:4,http://[::]:5,https://[fe80:1:2::3]:6";

            // when
            string connectorAddressesString = connectorAddresses.ToString();

            // then
            assertEquals(expectedString, connectorAddressesString);

            // when
            ClientConnectorAddresses @out = ClientConnectorAddresses.FromString(connectorAddressesString);

            // then
            assertEquals(connectorAddresses, @out);
        }
Ejemplo n.º 2
0
        internal static MemberAttributeConfig BuildMemberAttributesForCore(MemberId myself, Config config)
        {
            MemberAttributeConfig memberAttributeConfig = new MemberAttributeConfig();

            memberAttributeConfig.setStringAttribute(MEMBER_UUID, myself.Uuid.ToString());

            AdvertisedSocketAddress discoveryAddress = config.Get(CausalClusteringSettings.discovery_advertised_address);

            memberAttributeConfig.setStringAttribute(DISCOVERY_SERVER, discoveryAddress.ToString());

            AdvertisedSocketAddress transactionSource = config.Get(CausalClusteringSettings.transaction_advertised_address);

            memberAttributeConfig.setStringAttribute(TRANSACTION_SERVER, transactionSource.ToString());

            AdvertisedSocketAddress raftAddress = config.Get(CausalClusteringSettings.raft_advertised_address);

            memberAttributeConfig.setStringAttribute(RAFT_SERVER, raftAddress.ToString());

            ClientConnectorAddresses clientConnectorAddresses = ClientConnectorAddresses.ExtractFromConfig(config);

            memberAttributeConfig.setStringAttribute(CLIENT_CONNECTOR_ADDRESSES, clientConnectorAddresses.ToString());

            memberAttributeConfig.setBooleanAttribute(REFUSE_TO_BE_LEADER_KEY, config.Get(refuse_to_be_leader));

            memberAttributeConfig.setStringAttribute(MEMBER_DB_NAME, config.Get(CausalClusteringSettings.database));

            return(memberAttributeConfig);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeWithNoHttpsAddress()
        public virtual void ShouldSerializeWithNoHttpsAddress()
        {
            // given
            ClientConnectorAddresses connectorAddresses = new ClientConnectorAddresses(asList(new ConnectorUri(bolt, new AdvertisedSocketAddress("host", 1)), new ConnectorUri(http, new AdvertisedSocketAddress("host", 2))
                                                                                              ));

            // when
            ClientConnectorAddresses @out = ClientConnectorAddresses.FromString(connectorAddresses.ToString());

            // then
            assertEquals(connectorAddresses, @out);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void keepReadReplicaAlive() throws HazelcastInstanceNotActiveException
        private void KeepReadReplicaAlive()
        {
            _hzInstance.perform(hazelcastInstance =>
            {
                string hzId      = hazelcastInstance.LocalEndpoint.Uuid;
                string addresses = _connectorAddresses.ToString();
                _log.debug("Adding read replica into cluster (%s -> %s)", hzId, addresses);

                hazelcastInstance.getMap(READ_REPLICAS_DB_NAME_MAP).put(hzId, _dbName, _timeToLive, MILLISECONDS);

                hazelcastInstance.getMap(READ_REPLICA_TRANSACTION_SERVER_ADDRESS_MAP).put(hzId, _transactionSource.ToString(), _timeToLive, MILLISECONDS);

                hazelcastInstance.getMap(READ_REPLICA_MEMBER_ID_MAP).put(hzId, _myself.Uuid.ToString(), _timeToLive, MILLISECONDS);

                refreshGroups(hazelcastInstance, hzId, _groups);

                // this needs to be last as when we read from it in HazelcastClusterTopology.readReplicas
                // we assume that all the other maps have been populated if an entry exists in this one
                hazelcastInstance.getMap(READ_REPLICA_BOLT_ADDRESS_MAP).put(hzId, addresses, _timeToLive, MILLISECONDS);
            });
        }