public void RWReferencesInvalidCastException() { Assert.Throws <InvalidCastException>(() => { reader = GrainClient.GrainFactory.GetGrain <IMultifacetReader>(GetRandomGrainId()); writer = (IMultifacetWriter)reader; }); }
public void RWReferencesInvalidCastException() { Assert.Throws<InvalidCastException>(() => { reader = GrainClient.GrainFactory.GetGrain<IMultifacetReader>(GetRandomGrainId()); writer = (IMultifacetWriter)reader; }); }
public void RWReferences() { writer = GrainClient.GrainFactory.GetGrain<IMultifacetWriter>(GetRandomGrainId()); reader = writer.AsReference<IMultifacetReader>(); int x = 1234; bool ok = writer.SetValue(x).Wait(timeout); if (!ok) throw new TimeoutException(); int y = reader.GetValue().Result; Assert.Equal(x, y); }
public async Task MultifacetFactory() { IMultifacetFactoryTestGrain factory = GrainClient.GrainFactory.GetGrain <IMultifacetFactoryTestGrain>(GetRandomGrainId()); IMultifacetTestGrain grain = GrainClient.GrainFactory.GetGrain <IMultifacetTestGrain>(GetRandomGrainId()); IMultifacetWriter writer = await factory.GetWriter(grain /*"MultifacetFactory"*/); IMultifacetReader reader = await factory.GetReader(grain /*"MultifacetFactory"*/); writer.SetValue(5).Wait(); int v = reader.GetValue().Result; Assert.Equal(5, v); }
public async Task Multifacet_InterfacesAsArguments() { IMultifacetFactoryTestGrain factory = GrainClient.GrainFactory.GetGrain <IMultifacetFactoryTestGrain>(GetRandomGrainId()); IMultifacetTestGrain grain = GrainClient.GrainFactory.GetGrain <IMultifacetTestGrain>(GetRandomGrainId()); factory.SetReader(grain).Wait(); factory.SetWriter(grain).Wait(); IMultifacetWriter writer = await factory.GetWriter(); IMultifacetReader reader = await factory.GetReader(); writer.SetValue(10).Wait(); int v = reader.GetValue().Result; Assert.Equal(10, v); }
public void RWReferences() { writer = GrainClient.GrainFactory.GetGrain <IMultifacetWriter>(GetRandomGrainId()); reader = writer.AsReference <IMultifacetReader>(); int x = 1234; bool ok = writer.SetValue(x).Wait(timeout); if (!ok) { throw new TimeoutException(); } int y = reader.GetValue().Result; Assert.Equal(x, y); }
public void CastMultifacetRWReference() { // MultifacetTestGrain implements IMultifacetReader // MultifacetTestGrain implements IMultifacetWriter int newValue = 3; IMultifacetWriter writer = GrainClient.GrainFactory.GetGrain <IMultifacetWriter>(1); // No Wait in this test case IMultifacetReader reader = writer.AsReference <IMultifacetReader>(); // --> Test case intermittently fails here // Error: System.InvalidCastException: Grain reference MultifacetGrain.MultifacetWriterFactory+MultifacetWriterReference service interface mismatch: expected interface id=[1947430462] received interface name=[MultifacetGrain.IMultifacetWriter] id=[62435819] in grainRef=[GrainReference:*std/b198f19f] writer.SetValue(newValue).Wait(); Task <int> readAsync = reader.GetValue(); readAsync.Wait(); int result = readAsync.Result; Assert.Equal(newValue, result); }
public void CastMultifacetRWReferenceWaitForResolve() { // MultifacetTestGrain implements IMultifacetReader // MultifacetTestGrain implements IMultifacetWriter //Interface Id values for debug: // IMultifacetWriter = 62435819 // IMultifacetReader = 1947430462 // IMultifacetTestGrain = 222717230 (also compatable with 1947430462 or 62435819) int newValue = 4; IMultifacetWriter writer = GrainClient.GrainFactory.GetGrain <IMultifacetWriter>(2); IMultifacetReader reader = writer.AsReference <IMultifacetReader>(); // --> Test case fails here // Error: System.InvalidCastException: Grain reference MultifacetGrain.MultifacetWriterFactory+MultifacetWriterReference service interface mismatch: expected interface id=[1947430462] received interface name=[MultifacetGrain.IMultifacetWriter] id=[62435819] in grainRef=[GrainReference:*std/8408c2bc] writer.SetValue(newValue).Wait(); int result = reader.GetValue().Result; Assert.Equal(newValue, result); }
public Task SetWriter(IMultifacetWriter writer) { State.Writer = writer; return(TaskDone.Done); }
public void RWReferencesInvalidCastException() { reader = GrainClient.GrainFactory.GetGrain<IMultifacetReader>(5); writer = (IMultifacetWriter)reader; }
public void RWReferencesInvalidCastException() { reader = GrainClient.GrainFactory.GetGrain <IMultifacetReader>(5); writer = (IMultifacetWriter)reader; }
public Task SetWriter(IMultifacetWriter writer) { State.Writer = writer; return(Task.CompletedTask); }