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(); }
//-----------------------------------------------------------------------------// public async Task BasicTestAsync(bool fullTest = true) { logger.Info("\n** Starting Test {0} BasicTestAsync.\n", testNumber); var producerCount = await producer.ProducerCount; var consumerCount = await consumer.ConsumerCount; logger.Info("\n** Test {0} BasicTestAsync: producerCount={1}, consumerCount={2}.\n", testNumber, producerCount, consumerCount); await producer.ProduceSequentialSeries(ItemCount); await TestingUtils.WaitUntilAsync(lastTry => CheckCounters(producer, consumer, false), _timeout); await CheckCounters(producer, consumer); if (runFullTest) { await producer.ProduceParallelSeries(ItemCount); await TestingUtils.WaitUntilAsync(lastTry => CheckCounters(producer, consumer, false), _timeout); await CheckCounters(producer, consumer); await producer.ProducePeriodicSeries(ItemCount); await TestingUtils.WaitUntilAsync(lastTry => CheckCounters(producer, consumer, false), _timeout); await CheckCounters(producer, consumer); } await ValidatePubSub(producer.StreamId, producer.ProviderName); }
//public async Task StreamTest_17_Persistence_OneProducerGrainOneConsumerGrain() //{ // Heading("StreamTest_17_Persistence_OneProducerGrainOneConsumerGrain"); // StreamId streamId = StreamId.NewRandomStreamId(); // // consumer joins first, producer later // consumer = await ConsumerProxy.NewConsumerGrainsAsync(streamId, streamProviderName, logger); // producer = await ProducerProxy.NewProducerGrainsAsync(streamId, streamProviderName, logger); // await BasicTestAsync(false); // await consumer.DeactivateOnIdle(); // await producer.DeactivateOnIdle(); // await UnitTestBase.WaitUntilAsync(() => CheckGrainsDeactivated(null, consumer, assertAreEqual: false), _timeout); // await UnitTestBase.WaitUntilAsync(() => CheckGrainsDeactivated(producer, null, assertAreEqual: false), _timeout); // logger.Info("*******************************************************************"); // //await BasicTestAsync(false); // //await StopProxies(); //} public async Task StreamTest_19_ConsumerImplicitlySubscribedToProducerClient() { Heading("StreamTest_19_ConsumerImplicitlySubscribedToProducerClient"); string consumerTypeName = typeof(Streaming_ImplicitlySubscribedConsumerGrain).FullName; Guid streamGuid = Guid.NewGuid(); producer = await ProducerProxy.NewProducerClientObjectsAsync(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(); }