public ManyToOneConcurrentArrayQueueMailboxActorTest()
        {
            var properties = new Properties();

            properties.SetProperty("plugin.name.testArrayQueueMailbox", "true");
            properties.SetProperty("plugin.testArrayQueueMailbox.classname", "Vlingo.Actors.Plugin.Mailbox.AgronaMPSCArrayQueue.ManyToOneConcurrentArrayQueuePlugin");
            properties.SetProperty("plugin.testArrayQueueMailbox.defaultMailbox", "false");
            properties.SetProperty("plugin.testArrayQueueMailbox.size", "" + MailboxSize);
            properties.SetProperty("plugin.testArrayQueueMailbox.fixedBackoff", "2");
            properties.SetProperty("plugin.testArrayQueueMailbox.dispatcherThrottlingCount", "1");
            properties.SetProperty("plugin.testArrayQueueMailbox.sendRetires", "10");

            var provider         = new ManyToOneConcurrentArrayQueuePlugin();
            var pluginProperties = new PluginProperties("testRingMailbox", properties);
            var plugin           = new PooledCompletesPlugin();

            plugin.Configuration.BuildWith(World.Configuration, pluginProperties);

            provider.Start(World);
        }
        private void Init(int mailboxSize)
        {
            var properties = new Properties();

            properties.SetProperty("plugin.name.testRingMailbox", "true");
            properties.SetProperty("plugin.testRingMailbox.classname", "Vlingo.Actors.Plugin.Mailbox.SharedRingBuffer.SharedRingBufferMailboxPlugin");
            properties.SetProperty("plugin.testRingMailbox.defaultMailbox", "false");
            properties.SetProperty("plugin.testRingMailbox.size", $"{mailboxSize}");
            properties.SetProperty("plugin.testRingMailbox.fixedBackoff", "2");
            properties.SetProperty("plugin.testRingMailbox.numberOfDispatchersFactor", "1.0");
            properties.SetProperty("plugin.testRingMailbox.dispatcherThrottlingCount", "20");

            var provider         = new SharedRingBufferMailboxPlugin();
            var pluginProperties = new PluginProperties("testRingMailbox", properties);
            var plugin           = new PooledCompletesPlugin();

            plugin.Configuration.BuildWith(World.Configuration, pluginProperties);

            provider.Start(World);
        }
Esempio n. 3
0
        public void TestActuallyCompletes()
        {
            var properties = new Properties();

            properties.SetProperty("plugin.name.pooledCompletes", "true");
            properties.SetProperty("plugin.pooledCompletes.classname", "Vlingo.Actors.Plugin.Completes.PooledCompletesPlugin");
            properties.SetProperty("plugin.pooledCompletes.pool", "10");

            var pluginProperties = new PluginProperties("pooledCompletes", properties);

            var plugin = new PooledCompletesPlugin();

            plugin.Configuration.BuildWith(World.Configuration, pluginProperties);

            plugin.Start(World);

            var clientCompletes = new MockCompletes <object>(1);
            var asyncCompletes  = World.CompletesFor(clientCompletes);

            asyncCompletes.With(5);

            Assert.Equal(1, clientCompletes.WithCount);
            Assert.Equal(5, clientCompletes.Outcome);
        }
        public void TestCompletesAddressMatches()
        {
            var properties = new Properties();

            properties.SetProperty("plugin.name.pooledCompletes", "true");
            properties.SetProperty("plugin.pooledCompletes.classname", "Vlingo.Actors.Plugin.Completes.PooledCompletesPlugin");
            properties.SetProperty("plugin.pooledCompletes.pool", "10");

            var pluginProperties = new PluginProperties("pooledCompletes", properties);
            var plugin           = new PooledCompletesPlugin();

            plugin.Configuration.BuildWith(World.Configuration, pluginProperties);

            plugin.Start(World);

            var clientCompletes1 = new MockCompletes <int>();
            var clientCompletes2 = new MockCompletes <int>();

            clientCompletes1.UntilWith = TestUntil.Happenings(1);
            var completes1 = World.CompletesFor(clientCompletes1);

            completes1.With(5);
            clientCompletes1.UntilWith.Completes();

            clientCompletes2.UntilWith = TestUntil.Happenings(1);
            var completes2 = World.CompletesFor(completes1.Address, clientCompletes2);

            completes2.With(10);
            clientCompletes2.UntilWith.Completes();

            Assert.Equal(1, clientCompletes1.WithCount);
            Assert.Equal(5, clientCompletes1.Outcome);
            Assert.Equal(1, clientCompletes2.WithCount);
            Assert.Equal(10, clientCompletes2.Outcome);
            Assert.Equal(completes1, completes2);
        }