public async Task StreamTest_21_GenericConsumerImplicitlySubscribedToProducerGrain()
        {
            Heading("StreamTest_21_GenericConsumerImplicitlySubscribedToProducerGrain");
            //ToDo in migrate: the following consumer grain is not implemented in VSO and all tests depend on it fail.
            string consumerTypeName = "UnitTests.Grains.Streaming_ImplicitlySubscribedGenericConsumerGrain";//typeof(Streaming_ImplicitlySubscribedGenericConsumerGrain).FullName;
            Guid   streamGuid       = Guid.NewGuid();

            producer = await ProducerProxy.NewProducerGrainsAsync(streamGuid, streamProviderName, "TestNamespace1", logger);

            consumer = ConsumerProxy.NewConsumerGrainAsync_WithoutBecomeConsumer(streamGuid, logger, consumerTypeName);

            logger.Info("\n** Starting Test {0}.\n", testNumber);
            var producerCount = await producer.ProducerCount;

            logger.Info("\n** Test {0} BasicTestAsync: producerCount={1}.\n", testNumber, producerCount);

            Func <bool, Task <bool> > waitUntilFunc =
                async lastTry =>
                0 < await TestUtils.GetActivationCount(consumerTypeName) && await CheckCounters(producer, consumer, false);

            await producer.ProduceSequentialSeries(ItemCount);

            await TestingUtils.WaitUntilAsync(waitUntilFunc, _timeout);

            await CheckCounters(producer, consumer);
            await StopProxies();
        }
Ejemplo n.º 2
0
        public async Task StreamTest_20_ConsumerImplicitlySubscribedToProducerGrain()
        {
            Heading("StreamTest_20_ConsumerImplicitlySubscribedToProducerGrain");
            string consumerTypeName = typeof(Streaming_ImplicitlySubscribedConsumerGrain).FullName;
            Guid   streamGuid       = Guid.NewGuid();

            this.producer = await ProducerProxy.NewProducerGrainsAsync(streamGuid, this.streamProviderName, "TestNamespace1", this.logger, this.client);

            this.consumer = ConsumerProxy.NewConsumerGrainAsync_WithoutBecomeConsumer(streamGuid, this.logger, this.client, consumerTypeName);

            logger.Info("\n** Starting Test {0}.\n", testNumber);
            var producerCount = await producer.ProducerCount;

            logger.Info("\n** Test {0} BasicTestAsync: producerCount={1}.\n", testNumber, producerCount);

            Func <bool, Task <bool> > waitUntilFunc =
                async lastTry =>
                0 < await TestUtils.GetActivationCount(this.client, consumerTypeName) && await this.CheckCounters(this.producer, this.consumer, false);

            await producer.ProduceSequentialSeries(ItemCount);

            await TestingUtils.WaitUntilAsync(waitUntilFunc, _timeout);

            await CheckCounters(producer, consumer);
            await StopProxies();
        }
        public async Task StreamTest_16_Deactivation_OneProducerGrainOneConsumerGrain()
        {
            Heading("StreamTest_16_Deactivation_OneProducerGrainOneConsumerGrain");
            Guid streamId = Guid.NewGuid();

            Guid[] consumerGrainIds = { Guid.NewGuid() };
            Guid[] producerGrainIds = { Guid.NewGuid() };

            // consumer joins first, producer later
            consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger, consumerGrainIds);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger, producerGrainIds);
            await BasicTestAsync(false);

            //await consumer.StopBeingConsumer();
            await StopProxies();

            await consumer.DeactivateOnIdle();

            await producer.DeactivateOnIdle();

            await TestingUtils.WaitUntilAsync(lastTry => CheckGrainsDeactivated(null, consumer, false), _timeout);

            await TestingUtils.WaitUntilAsync(lastTry => CheckGrainsDeactivated(producer, null, false), _timeout);

            logger.Info("\n\n\n*******************************************************************\n\n\n");

            consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger, consumerGrainIds);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger, producerGrainIds);

            await BasicTestAsync(false);
            await StopProxies();
        }
        internal async Task StreamTest_Create_OneProducerGrainOneConsumerGrain()
        {
            Guid streamId = Guid.NewGuid();

            consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger);
        }
Ejemplo n.º 5
0
        internal async Task StreamTest_Create_OneProducerGrainOneConsumerGrain()
        {
            Guid streamId = Guid.NewGuid();

            this.consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, this.streamProviderName, this.logger, this.client);

            this.producer = await ProducerProxy.NewProducerGrainsAsync(streamId, this.streamProviderName, null, this.logger, this.client);
        }
        public async Task StreamTest_06_ManyDifferent_ManyProducerGrainManyConsumerClients()
        {
            Heading("StreamTest_06_ManyDifferent_ManyProducerGrainManyConsumerClients");
            Guid streamId = Guid.NewGuid();

            consumer = await ConsumerProxy.NewConsumerClientObjectsAsync(streamId, streamProviderName, logger, Many);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger, null, Many);
            await BasicTestAsync();
            await StopProxies();
        }
Ejemplo n.º 7
0
        //------------------------ MANY to Many different grains ----------------------//

        public async Task StreamTest_05_ManyDifferent_ManyProducerGrainsManyConsumerGrains()
        {
            Heading("StreamTest_05_ManyDifferent_ManyProducerGrainsManyConsumerGrains");
            Guid streamId = Guid.NewGuid();

            this.consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, this.streamProviderName, this.logger, this.client, null, Many);

            this.producer = await ProducerProxy.NewProducerGrainsAsync(streamId, this.streamProviderName, null, this.logger, this.client, null, Many);
            await BasicTestAsync();
            await StopProxies();
        }
        public async Task StreamTest_11_ManySame_ManyProducerGrainsManyConsumerClients()
        {
            Heading("StreamTest_11_ManySame_ManyProducerGrainsManyConsumerClients");
            Guid streamId = Guid.NewGuid();
            Guid grain1   = Guid.NewGuid();

            Guid[] producerGrainIds = new Guid[] { grain1, grain1, grain1, grain1 };
            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger, producerGrainIds);

            consumer = await ConsumerProxy.NewConsumerClientObjectsAsync(streamId, streamProviderName, logger, Many);
            await BasicTestAsync();
            await StopProxies();
        }
        //----------------------------------------------//

        public async Task StreamTest_15_ConsumeAtProducersRequest()
        {
            Heading("StreamTest_15_ConsumeAtProducersRequest");
            Guid streamId = Guid.NewGuid();

            // this reproduces a scenario was discovered to not work (deadlock) by the Halo team. the scenario is that
            // where a producer calls a consumer, which subscribes to the calling producer.

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger);

            Guid consumerGrainId = await producer.AddNewConsumerGrain();

            consumer = ConsumerProxy.NewConsumerGrainAsync_WithoutBecomeConsumer(consumerGrainId, logger);
            await BasicTestAsync();
            await StopProxies();
        }
        public async Task StreamTest_10_ManySame_ManyConsumerGrainsManyProducerGrains()
        {
            Heading("StreamTest_10_ManySame_ManyConsumerGrainsManyProducerGrains");
            Guid streamId = Guid.NewGuid();
            Guid grain1   = Guid.NewGuid();
            Guid grain2   = Guid.NewGuid();

            Guid[] consumerGrainIds = new Guid[] { grain1, grain1, grain1 };
            Guid[] producerGrainIds = new Guid[] { grain2, grain2, grain2 };
            // consumer joins first, producer later
            consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger, consumerGrainIds);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger, producerGrainIds);
            await BasicTestAsync();
            await StopProxies();
        }
        public async Task StreamTest_02_OneProducerGrainOneConsumerClient()
        {
            Heading("StreamTest_02_OneProducerGrainOneConsumerClient");
            Guid streamId = Guid.NewGuid();

            consumer = await ConsumerProxy.NewConsumerClientObjectsAsync(streamId, streamProviderName, logger);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger);
            await BasicTestAsync();
            await StopProxies();

            streamId = Guid.NewGuid();
            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger);

            consumer = await ConsumerProxy.NewConsumerClientObjectsAsync(streamId, streamProviderName, logger);
            await BasicTestAsync();
            await StopProxies();
        }
        //------------------------ One to One ----------------------//
        public async Task StreamTest_01_OneProducerGrainOneConsumerGrain()
        {
            Heading("StreamTest_01_ConsumerJoinsFirstProducerLater");
            Guid streamId = Guid.NewGuid();

            // consumer joins first, producer later
            consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger);

            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger);
            await BasicTestAsync();
            await StopProxies();

            streamId = Guid.NewGuid();
            // produce joins first, consumer later
            producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, null, logger);

            consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger);
            await BasicTestAsync();
            await StopProxies();
        }