Пример #1
0
        public async Task ObserverTest_Unsubscribe()
        {
            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(null, null);
            ISimpleGrainObserver reference = await SimpleGrainObserverFactory.CreateObjectReference(this.observer1);

            try
            {
                bool ok = grain.Unsubscribe(reference).Wait(timeout);
                if (!ok)
                {
                    throw new TimeoutException();
                }

                await SimpleGrainObserverFactory.DeleteObjectReference(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                if (!(baseException is OrleansException))
                {
                    Assert.Fail("Unexpected exception type {0}", baseException);
                }
            }
        }
Пример #2
0
        public async Task ObserverTest_Unsubscribe()
        {
            TestInitialize();
            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(null, null, this.Logger);
            ISimpleGrainObserver reference = await this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            try
            {
                await grain.Unsubscribe(reference);

                await this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                if (!(baseException is OrleansException))
                {
                    Assert.True(false);
                }
            }
        }
Пример #3
0
        public async Task ObserverTest_SubscribeUnsubscribe()
        {
            ResultHandle result = new ResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(ObserverTest_SubscribeUnsubscribe_Callback, result);
            ISimpleGrainObserver reference = await SimpleGrainObserverFactory.CreateObjectReference(this.observer1);

            grain.Subscribe(reference).Wait();
            grain.SetA(5).Wait();
            Assert.IsTrue(result.WaitForContinue(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetA");
            grain.Unsubscribe(reference).Wait();
            grain.SetB(3).Wait();

            Assert.IsFalse(result.WaitForFinished(timeout), "Should timeout waiting {0} for {1}", timeout, "SetB");

            await SimpleGrainObserverFactory.DeleteObjectReference(reference);
        }
Пример #4
0
        public async Task ObserverTest_SubscribeUnsubscribe()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            observer1 = new SimpleGrainObserver(ObserverTest_SubscribeUnsubscribe_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            await grain.Subscribe(reference);

            await grain.SetA(5);

            Assert.IsTrue(await result.WaitForContinue(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetA");
            await grain.Unsubscribe(reference);

            await grain.SetB(3);

            Assert.IsFalse(await result.WaitForFinished(timeout), "Should timeout waiting {0} for {1}", timeout, "SetB");

            await GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }
Пример #5
0
        public async Task ObserverTest_SubscribeUnsubscribe()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(this.ObserverTest_SubscribeUnsubscribe_Callback, result, this.Logger);
            ISimpleGrainObserver reference = this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);

            await grain.SetA(5);

            Assert.True(await result.WaitForContinue(timeout), string.Format("Should not timeout waiting {0} for SetA", timeout));

            await grain.Unsubscribe(reference);

            await grain.SetB(3);

            Assert.False(await result.WaitForFinished(timeout), string.Format("Should timeout waiting {0} for SetB", timeout));

            this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }