Exemplo n.º 1
0
        public override RawIterator <object[], ProcedureException> Apply(Context ctx, object[] input, ResourceTracker resourceTracker)
        {
            IList <Endpoint> routeEndpoints = routeEndpoints();
            IList <Endpoint> writeEndpoints = writeEndpoints();
            IList <Endpoint> readEndpoints  = readEndpoints();

            return(RawIterator.of <object[], ProcedureException>(ResultFormatV1.Build(new LoadBalancingResult(routeEndpoints, writeEndpoints, readEndpoints, _config.get(CausalClusteringSettings.cluster_routing_ttl).toMillis()))));
        }
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 shouldSerializeToAndFromRecordFormatWithNoEntries()
        public virtual void ShouldSerializeToAndFromRecordFormatWithNoEntries()
        {
            // given
            IList <Endpoint> writers = emptyList();
            IList <Endpoint> readers = emptyList();
            IList <Endpoint> routers = emptyList();

            long ttlSeconds = 0;
            LoadBalancingResult original = new LoadBalancingResult(routers, writers, readers, ttlSeconds * 1000);

            // when
            object[] record = ResultFormatV1.Build(original);

            // then
            LoadBalancingResult parsed = ResultFormatV1.Parse(record);

            assertEquals(original, parsed);
        }
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 shouldSerializeToAndFromRecordFormat()
        public virtual void ShouldSerializeToAndFromRecordFormat()
        {
            // given
            IList <Endpoint> writers = new IList <Endpoint> {
                Endpoint.write(new AdvertisedSocketAddress("write", 1)), Endpoint.write(new AdvertisedSocketAddress("write", 2)), Endpoint.write(new AdvertisedSocketAddress("write", 3))
            };
            IList <Endpoint> readers = new IList <Endpoint> {
                Endpoint.read(new AdvertisedSocketAddress("read", 4)), Endpoint.read(new AdvertisedSocketAddress("read", 5)), Endpoint.read(new AdvertisedSocketAddress("read", 6)), Endpoint.read(new AdvertisedSocketAddress("read", 7))
            };
            IList <Endpoint> routers = singletonList(Endpoint.route(new AdvertisedSocketAddress("route", 8)));

            long ttlSeconds = 5;
            LoadBalancingResult original = new LoadBalancingResult(routers, writers, readers, ttlSeconds * 1000);

            // when
            object[] record = ResultFormatV1.Build(original);

            // then
            LoadBalancingResult parsed = ResultFormatV1.Parse(record);

            assertEquals(original, parsed);
        }