public async Task TestClientAddressableSadPath() { const string message = "o hai!"; try { var myOb = new MyPseudoGrain(); this.anchor = myOb; var myRef = await((GrainFactory)GrainClient.GrainFactory).CreateObjectReference <IClientAddressableTestClientObject>(myOb); var proxy = GrainClient.GrainFactory.GetGrain <IClientAddressableTestGrain>(GetRandomGrainId()); await proxy.SetTarget(myRef); await proxy.SadPath(message); await GrainReference.DeleteObjectReference(myRef); } catch (AggregateException e) { var ef = e.Flatten(); if (ef.InnerExceptions.Count == 1 && ef.InnerExceptions[0] is ApplicationException && ef.InnerExceptions[0].Message == message) { throw (ApplicationException)ef.InnerExceptions[0]; } else { throw; } } }
public async Task MicroClientAddressableSerialStressTest() { const int iterationCount = 1000; var myOb = new MyPseudoGrain(); this.anchor = myOb; var myRef = await((GrainFactory)GrainClient.GrainFactory).CreateObjectReference <IClientAddressableTestClientObject>(myOb); var proxy = GrainClient.GrainFactory.GetGrain <IClientAddressableTestGrain>(GetRandomGrainId()); await proxy.SetTarget(myRef); await proxy.MicroSerialStressTest(iterationCount); await GrainReference.DeleteObjectReference(myRef); }
public async Task TestClientAddressableHappyPath() { var myOb = new MyPseudoGrain(); this.anchor = myOb; var myRef = await((GrainFactory)GrainClient.GrainFactory).CreateObjectReference <IClientAddressableTestClientObject>(myOb); var proxy = GrainClient.GrainFactory.GetGrain <IClientAddressableTestGrain>(GetRandomGrainId()); const string expected = "o hai!"; await proxy.SetTarget(myRef); var actual = await proxy.HappyPath(expected); Assert.AreEqual(expected, actual); await GrainReference.DeleteObjectReference(myRef); }
public async Task TestClientAddressableSadPath() { const string message = "o hai!"; var myOb = new MyPseudoGrain(); this.anchor = myOb; var myRef = await((GrainFactory)GrainClient.GrainFactory).CreateObjectReference <IClientAddressableTestClientObject>(myOb); var proxy = GrainClient.GrainFactory.GetGrain <IClientAddressableTestGrain>(GetRandomGrainId()); await proxy.SetTarget(myRef); await Xunit.Assert.ThrowsAsync <ApplicationException>(() => proxy.SadPath(message) ); await GrainReference.DeleteObjectReference(myRef); }
public async Task GrainShouldSuccessfullyPullFromClientObject() { var myOb = new MyProducer(); this.anchor = myOb; var myRef = await((GrainFactory)GrainClient.GrainFactory).CreateObjectReference <IClientAddressableTestProducer>(myOb); var rendez = GrainClient.GrainFactory.GetGrain <IClientAddressableTestRendezvousGrain>(0); var consumer = GrainClient.GrainFactory.GetGrain <IClientAddressableTestConsumer>(0); await rendez.SetProducer(myRef); await consumer.Setup(); var n = await consumer.PollProducer(); Assert.AreEqual(1, n); await GrainReference.DeleteObjectReference(myRef); }
public static void DeleteObjectReference(IObserve reference) { GrainReference.DeleteObjectReference(reference); }
/// <summary> /// Deletes the provided object reference. /// </summary> /// <typeparam name="TGrainObserverInterface"> /// The specific <see cref="IGrainObserver"/> type of <paramref name="obj"/>. /// </typeparam> /// <param name="obj">The reference being deleted.</param> /// <returns>A <see cref="Task"/> representing the work performed.</returns> public Task DeleteObjectReference <TGrainObserverInterface>( IGrainObserver obj) where TGrainObserverInterface : IGrainObserver { return(GrainReference.DeleteObjectReference(obj)); }