Esempio n. 1
0
        public TcpManagementTests()
        {
            var courierContainer = CourierBuilder.Create()
                                   .UseTcpServerTransport(21337)
                                   .BuildAsync().Result;

            Setup(courierContainer);
        }
Esempio n. 2
0
        public UdpManagementTests()
        {
            var courierContainer = CourierBuilder.Create()
                                   .UseUdpTransport()
                                   .BuildAsync().Result;

            Setup(courierContainer);
        }
Esempio n. 3
0
        public LocalManagementTests()
        {
            var testTransportFactory = new TestTransportFactory();
            var courierContainer     = CourierBuilder.Create()
                                       .UseTransport(testTransportFactory)
                                       .BuildAsync().Result;

            Setup(courierContainer);
        }
        public LocalMessagingLoadTests()
        {
            var testTransportFactory = new TestTransportFactory();
            var courierFacades       = Util.Generate(
                3,
                i => CourierBuilder.Create()
                .UseTransport(testTransportFactory)
                .UseTcpServerTransport(21337 + i)
                .BuildAsync().Result);

            Setup(courierFacades);
        }
Esempio n. 5
0
        public TcpServiceTests()
        {
            var clientFacade = CourierBuilder.Create()
                               .UseTcpClientTransport(IPAddress.Loopback, 21337)
                               .BuildAsync().Result;

            var serverFacade = CourierBuilder.Create()
                               .UseTcpServerTransport(21337)
                               .BuildAsync().Result;

            Setup(clientFacade, serverFacade);
        }
        public TcpMessagingTests()
        {
            var senderFacade = CourierBuilder.Create()
                               .UseTcpClientTransport(IPAddress.Loopback, 21337)
                               .BuildAsync().Result;

            var receiverFacade = CourierBuilder.Create()
                                 .UseTcpServerTransport(21337)
                                 .BuildAsync().Result;

            Setup(senderFacade, receiverFacade);
        }
Esempio n. 7
0
        public static void Main()
        {
            InitializeLogging();
            var courierFacade = CourierBuilder.Create()
                                .UseUdpTransport()
                                .UseTcpServerTransport(21337)
                                .BuildAsync().Result;
            var testMob = new TestMob();

            courierFacade.MobOperations.RegisterMob(testMob);

            new CountdownEvent(1).Wait();
        }
Esempio n. 8
0
        public LocalServiceTests()
        {
            var testTransportFactory = new TestTransportFactory();

            var clientFacade = CourierBuilder.Create()
                               .UseTransport(testTransportFactory)
                               .BuildAsync().Result;

            var serverFacade = CourierBuilder.Create()
                               .UseTransport(testTransportFactory)
                               .BuildAsync().Result;

            Setup(clientFacade, serverFacade);
        }
Esempio n. 9
0
        private static async Task RunAsync()
        {
            var courier = await CourierBuilder.Create()
                          .UseUdpTransport()
                          .UseTcpServerTransport(21337)
                          .BuildAsync().ConfigureAwait(false);

            var cacheInitializer = new CacheInitializer(courier);
            var myCacheFacade    = cacheInitializer.CreateLocal <int, string>(
                new CacheConfiguration <int, string>("my-cache"));
//         var myCache = myCacheFacade.UserCache;
//         var entry0 = await myCache.GetAsync(0).ConfigureAwait(false);
//         var previous = await myCache.PutAsync(0, "asdf").ConfigureAwait(false);
        }
Esempio n. 10
0
        public LocalMessagingTests()
        {
            var testTransportFactory = new TestTransportFactory();

            var senderfacade = CourierBuilder.Create()
                               .UseTransport(testTransportFactory)
                               .BuildAsync().Result;

            var receiverFacade = CourierBuilder.Create()
                                 .UseTransport(testTransportFactory)
                                 .BuildAsync().Result;

            Setup(senderfacade, receiverFacade);
        }
Esempio n. 11
0
        public UdpServiceTests()
        {
            var clientFacade = CourierBuilder.Create()
                               .UseUdpTransport(
                UdpTransportConfigurationBuilder.Create()
                .WithUnicastReceivePort(21338)
                .Build())
                               .BuildAsync().Result;

            var serverFacade = CourierBuilder.Create()
                               .UseUdpTransport(
                UdpTransportConfigurationBuilder.Create()
                .WithUnicastReceivePort(21339)
                .Build())
                               .BuildAsync().Result;

            Setup(clientFacade, serverFacade);
        }
Esempio n. 12
0
        public UdpMessagingTests()
        {
            var senderFacade = CourierBuilder.Create()
                               .UseUdpTransport(
                UdpTransportConfigurationBuilder.Create()
                .WithUnicastReceivePort(21338)
                .Build())
                               .UseTcpServerTransport(21337)
                               .BuildAsync().Result;

            var receiverFacade = CourierBuilder.Create()
                                 .UseUdpTransport(
                UdpTransportConfigurationBuilder.Create()
                .WithUnicastReceivePort(21339)
                .Build())
                                 .UseTcpServerTransport(21338)
                                 .BuildAsync().Result;

            Setup(senderFacade, receiverFacade);
        }
Esempio n. 13
0
            public int Eval(string args)
            {
                string ipAndPortString;

                args = Tokenizer.Next(args, out ipAndPortString);

                ipAndPortString = string.IsNullOrWhiteSpace(ipAndPortString) ? "127.0.0.1:21337" : ipAndPortString;

                IPEndPoint endpoint;

                if (!TryParseIpEndpoint(ipAndPortString, out endpoint))
                {
                    Console.Error.WriteLine($"Failed to parse '{ipAndPortString}' as tcp endpoint.");
                    return(1);
                }


                Identity         remoteIdentity  = null;
                ManualResetEvent completionLatch = new ManualResetEvent(false);
                var courierFacade = CourierBuilder.Create()
                                    .UseTcpClientTransport(
                    endpoint.Address,
                    endpoint.Port,
                    e => {
                    remoteIdentity = e.RemoteIdentity;
                    completionLatch.Set();
                })
                                    .BuildAsync().Result;

                Console.WriteLine($"Connecting to remote tcp endpoint {endpoint}.");
                completionLatch.WaitOne();
                Console.WriteLine($"Connected to {endpoint} with remote identity {remoteIdentity}.");

                var remotePeer = courierFacade.PeerTable.GetOrAdd(remoteIdentity.Id);
                var managementObjectService = courierFacade.RemoteServiceProxyContainer.Get <IManagementObjectService>(remotePeer);

                ReplGlobals.CourierFacade           = courierFacade;
                ReplGlobals.ManagementObjectService = managementObjectService;

                return(0);
            }
Esempio n. 14
0
        private static async Task <ICacheFacade <K, V> > CreateCohortAsync <K, V>(int cohortNumber, CacheConfiguration <K, V> cacheConfiguration)
        {
            // Force loads assemblies in directory and registers to global serializer.
            new RyuFactory().Create();

            AssertTrue(cohortNumber >= 0 && cohortNumber < 15);
            var cohortId = Guid.Parse("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".Replace('x', (cohortNumber + 1).ToString("x")[0]));
            var courier  = await CourierBuilder.Create()
                           .ForceIdentity(cohortId)
                           .UseUdpTransport(
                UdpTransportConfigurationBuilder.Create()
                .WithUnicastReceivePort(21338 + cohortNumber)
                .Build())
                           .UseTcpServerTransport(21337 + cohortNumber)
                           .BuildAsync().ConfigureAwait(false);

            var cacheInitializer = new CacheInitializer(courier);
            var myCacheFacade    = cacheInitializer.CreateLocal <K, V>(cacheConfiguration);

            return(myCacheFacade);
        }
        public UdpMessagingLoadTests()
        {
            Go(async() => {
                var ch = new BlockingChannel <string>();
                var l  = new AsyncLatch();
                Go(async() => {
                    await l.WaitAsync().ConfigureAwait(false);
                    for (var i = 0; i < 10; i++)
                    {
                        await ch.WriteAsync("asdf").ConfigureAwait(false);
                        await Task.Delay(400).ConfigureAwait(false);
                    }
                }).Forget();
                l.Set();
                for (var i = 0; i < 10; i++)
                {
                    await new Select {
                        Case(Time.After(500), () => {
                            Console.WriteLine("Nay!");
                        }),
                        Case(ch, () => {
                            Console.WriteLine("Yay!");
                        })
                    }.WaitAsync().ConfigureAwait(false);
                }
                while (true)
                {
                    ;
                }
            }).Wait();
            var courierFacades = Util.Generate(
                2,
                i => CourierBuilder.Create()
                .UseUdpTransport()
                .UseTcpServerTransport(21337 + i)
                .BuildAsync().Result);

            Setup(courierFacades);
        }