Ejemplo n.º 1
0
        private IDictionary <string, object> ToNeo4jValue <T1>(IDictionary <T1> attributeValue)
        {
            // Build a new map with the same keys, but each value passed
            // through `toNeo4jValue`
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            return(attributeValue.SetOfKeyValuePairs().Select(e => pair(e.Key.ToString(), toNeo4jValue(e.Value))).collect(CollectorsUtil.pairsToMap()));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") com.hazelcast.core.MultiMap<String,String> serverGroupsMMap = mock(com.hazelcast.core.MultiMap.class);
            MultiMap <string, string> serverGroupsMMap = mock(typeof(MultiMap));

            when(serverGroupsMMap.get(any())).thenReturn(_groups);
            when(_hzInstance.getMultiMap(anyString())).thenReturn((MultiMap)serverGroupsMMap);
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            _rrAttributeMaps = RR_ATTR_KEYS.Select(k => Pair.of(k, (IMap <string, string>)mock(typeof(IMap)))).collect(CollectorsUtil.pairsToMap());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Given a hazelcast member id and a set of non-null attribute maps, this method builds a discovery representation of a read replica
        /// (i.e. `Pair<MemberId,ReadReplicaInfo>`). Any missing attributes which are missing for a given hazelcast member id are logged and this
        /// method will return null.
        /// </summary>
        private static Pair <MemberId, ReadReplicaInfo> BuildReadReplicaFromAttrMap(string hzId, IDictionary <string, IMap <string, string> > simpleAttrMaps, MultiMap <string, string> serverGroupsMap, Log log)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            IDictionary <string, string> memberAttrs = simpleAttrMaps.SetOfKeyValuePairs().Select(e => Pair.of(e.Key, e.Value.get(hzId))).Where(p => HasAttribute(p, hzId, log)).collect(CollectorsUtil.pairsToMap());

//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the java.util.Collection 'containsAll' method:
            if (!memberAttrs.Keys.containsAll(RrAttrKeys))
            {
                return(null);
            }

            ICollection <string> memberServerGroups = serverGroupsMap.get(hzId);

            if (memberServerGroups == null)
            {
                log.Warn("Missing attribute %s for read replica with hz id %s", SERVER_GROUPS_MULTIMAP, hzId);
                return(null);
            }

            ClientConnectorAddresses boltAddresses = ClientConnectorAddresses.FromString(memberAttrs[READ_REPLICA_BOLT_ADDRESS_MAP]);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            AdvertisedSocketAddress catchupAddress = socketAddress(memberAttrs[READ_REPLICA_TRANSACTION_SERVER_ADDRESS_MAP], AdvertisedSocketAddress::new);
            MemberId      memberId       = new MemberId(System.Guid.Parse(memberAttrs[READ_REPLICA_MEMBER_ID_MAP]));
            string        memberDbName   = memberAttrs[READ_REPLICAS_DB_NAME_MAP];
            ISet <string> serverGroupSet = asSet(memberServerGroups);

            ReadReplicaInfo rrInfo = new ReadReplicaInfo(boltAddresses, catchupAddress, serverGroupSet, memberDbName);

            return(Pair.of(memberId, rrInfo));
        }