-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from freever/master
Added test for creating and mocking multiple grain probes
- Loading branch information
Showing
6 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Orleans; | ||
|
||
namespace TestGrains | ||
{ | ||
public interface IUnknownGrainResolver : IGrainWithStringKey | ||
{ | ||
Task<List<string>> GetResolvedUnknownGrainIdsAsync(); | ||
|
||
Task CreateAndPingMultiple(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Orleans; | ||
using TestInterfaces; | ||
|
||
namespace TestGrains | ||
{ | ||
public class UnknownGrainResolver : Grain, IUnknownGrainResolver | ||
{ | ||
private List<string> _resolvedIds = new List<string>(); | ||
|
||
public Task<List<string>> GetResolvedUnknownGrainIdsAsync() => Task.FromResult(_resolvedIds); | ||
|
||
public async Task CreateAndPingMultiple() | ||
{ | ||
var unknownGrainOne = GrainFactory.GetGrain<IUnknownGrain>("unknownGrainOne"); | ||
var unknownGrainTwo = GrainFactory.GetGrain<IUnknownGrain>("unknownGrainTwo"); | ||
|
||
_resolvedIds.Add(await unknownGrainOne.WhatsMyId()); | ||
_resolvedIds.Add(await unknownGrainTwo.WhatsMyId()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ public interface IPong : IGrainWithIntegerKey | |
{ | ||
Task Pong(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Threading.Tasks; | ||
using Orleans; | ||
|
||
namespace TestInterfaces | ||
{ | ||
public interface IUnknownGrain : IGrainWithStringKey | ||
{ | ||
//this grain's identity is not known when it is resolved | ||
//for instance, if GrainA needs to create another NEW IUnknownGrain it would generate a new id and ask the GrainFactory for a reference | ||
//in this case a test of GrainA would not know the id in advance and would not be able to set up a probe using the id. | ||
|
||
Task<string> WhatsMyId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters