/// <summary> /// Initializes a journal with set o predefined messages. /// </summary> protected IEnumerable<Persistent> Initialize() { _senderProbe = CreateTestProbe(); _receiverProbe = CreateTestProbe(); return WriteMessages(1, 5, Pid, _senderProbe.Ref); }
protected JournalSpec(Config config = null, string actorSystemName = null, string testActorName = null) : base(config ?? Config, actorSystemName ?? "JournalSpec", testActorName) { _senderProbe = CreateTestProbe(); _receiverProbe = CreateTestProbe(); WriteMessages(1, 5, Pid, _senderProbe.Ref); }
public TestBase() : base(AkkaConfig.Config) { //Create mocks TestProbeCreatorMock = new Mock <ITestProbeCreator>(); // Create objects passed into sut constructor TestProbeCreator = TestProbeCreatorMock.Object; Message1 = new ExampleMessage1(); Type1 = typeof(ExampleMessage1); Reply1 = TestUtils.Create <object>(); Message2 = new ExampleMessage2(); Type2 = typeof(ExampleMessage2); Reply2 = TestUtils.Create <object>(); Handlers = new Dictionary <Type, Func <object, object> > { { Type1, o => Reply1 }, { Type2, o => Reply2 } }; //Create objects returned by mocks TestProbe = CreateTestProbe(); // Set up mocks TestProbeCreatorMock .SetupSequence(creator => creator.Create(this)) .Returns(TestProbe) .Returns(CreateTestProbe()); }
/// <summary> /// Initializes a journal with set o predefined messages. /// </summary> protected IEnumerable<AtomicWrite> Initialize() { _senderProbe = CreateTestProbe(); _receiverProbe = CreateTestProbe(); PreparePersistenceId(Pid); return WriteMessages(1, 5, Pid, _senderProbe.Ref, WriterGuid); }
public ProbeRelay(TestProbe probe) { ReceiveAny(o => { probe.Forward(o); }); }
public EvenGatewayTests() { ReaderProbe = CreateTestProbe(); WriterProbe = CreateTestProbe(); AggregatesProbe = CreateTestProbe(); CommandProcessorsProbe = CreateTestProbe(); EventProcessorsProbe = CreateTestProbe(); ProjectionsProbe = CreateTestProbe(); InitializeTestGateway(); }
public void TestProbeActor_TestProbe_ReturnsSameResultOnEveryCall() { //arrange TestProbeActor sut = CreateTestProbeActor().UnderlyingActor; //act Akka.TestKit.TestProbe result = sut.TestProbe; //assert result.Should().BeSameAs(sut.TestProbe); }
public void TestProbeActor_TestProbe_ReturnsSameResultOnEveryCall() { //arrange TestActorRef <TestProbeActor> sut = CreateTestProbeActorWithoutSupervisorStrategy(); //act Akka.TestKit.TestProbe result = sut.UnderlyingActor.TestProbe; //assert result.Should().BeSameAs(sut.UnderlyingActor.TestProbe); }
public ClusterDomainEventPublisherSpec() { _memberSubscriber = CreateTestProbe(); Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.IMemberEvent)); Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.LeaderChanged)); _publisher = Sys.ActorOf(Props.Create<ClusterDomainEventPublisher>()); //TODO: If parent told of exception then test should fail (if not expected in some way)? _publisher.Tell(new InternalClusterAction.PublishChanges(g0)); _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(aUp)); _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(aUp.Address)); }
public ClusterDomainEventPublisherSpec() : base(Config) { _memberSubscriber = CreateTestProbe(); Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.IMemberEvent)); Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.LeaderChanged)); Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.ClusterShuttingDown)); _publisher = Sys.ActorOf(Props.Create<ClusterDomainEventPublisher>()); _publisher.Tell(new InternalClusterAction.PublishChanges(g0)); _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(aUp)); _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(aUp.Address)); }
public FixInterpreterTests() { var actorSystem = ActorSystem.Create("System"); var props = Props.Create(() => new FixInterpreterActor(new FakeFixParser())); _fixInterpreterActor = actorSystem.ActorOf(props); _serverActor = CreateTestProbe("Server"); _clientActor = CreateTestProbe("Client"); _fixInterpreterActor.Tell(new FixInterpreterActor.SetServer(_serverActor)); _fixInterpreterActor.Tell(new FixInterpreterActor.SetClient(_clientActor)); }
public PersistentViewSpec() : base(Configuration("inmem", "PersistentViewSpec")) { _prefProbe = CreateTestProbe(); _viewProbe = CreateTestProbe(); _pref = ActorOf(() => new TestPersistentActor(Name, _prefProbe.Ref)); _pref.Tell("a"); _pref.Tell("b"); _prefProbe.ExpectMsg("a-1"); _prefProbe.ExpectMsg("b-2"); }
public void TestProbeActor_TestProbe_TestProbeIsForwardedMessages() { //arrange TestActorRef <TestProbeActor> sut = CreateTestProbeActorWithoutSupervisorStrategy(); object message = TestUtils.Create <object>(); Akka.TestKit.TestProbe sender = CreateTestProbe(); //act Akka.TestKit.TestProbe result = sut.UnderlyingActor.TestProbe; //assert sut.Tell(message, sender); result.ExpectMsgFrom(sender, message); }
public FixServerActorTests() { var instrumentPrices = new Dictionary<string, double>() { { "USDGBP", 0.65575 }, { "USDJPY", 119.75 } }; _tcpServerActor = CreateTestProbe("TcpServer"); _tcpServerActor.IgnoreMessages(m => m is TcpServerActor.Subscribe); // Ignore wiring-up messages Func<IActorRefFactory, IActorRef> tcpServerCreator = (_) => _tcpServerActor; _fixInterpreterActor = CreateTestProbe("FixInterpreter"); _fixInterpreterActor.IgnoreMessages(m => m is FixInterpreterActor.SetServer || m is FixInterpreterActor.SetClient); // Ignore wiring-up messages Func<IActorRefFactory, IActorRef> fixInterpreterCreator = (_) => _fixInterpreterActor; var fixServerProps = Props.Create(() => new FixServerActor(tcpServerCreator, fixInterpreterCreator, instrumentPrices)); _fixServerActor = ActorOf(fixServerProps, "FixServer"); }
public CompletionOutputStream(TestProbe p) { _p = p; }
private void AwaitMemberUp(TestProbe memberProbe, params RoleName[] nodes) { if (nodes.Length > 1) { RunOn(() => { memberProbe.ExpectMsg<ClusterEvent.MemberUp>(TimeSpan.FromSeconds(15)).Member.Address .Should() .Be(GetAddress(nodes.First())); }, nodes.Skip(1).ToArray()); } RunOn(() => { var roleNodes = nodes.Select(node => GetAddress(node)); var addresses = memberProbe.ReceiveN(nodes.Length, TimeSpan.FromSeconds(15)) .Where(x => x is ClusterEvent.MemberUp) .Select(x => (x as ClusterEvent.MemberUp).Member.Address); addresses.Except(roleNodes).Count().Should().Be(0); }, nodes.First()); EnterBarrier(nodes.First().Name + "-up"); }
private TestActorRef<AccountActor> PrepareTest(Guid id,TestProbe probe,string name) { var relayProps = Props.Create<ProbeRelay>(probe); var testSink = Sys.ActorOf(relayProps, "testrelay" + name); _parms = new AggregateRootCreationParameters(id,testSink, 4); return ActorOfAsTestActorRef(() => new AccountActor(_parms), "test" + name); }
protected SnapshotStoreSpec(Config config = null, string actorSystemName = null, string testActorName = null) : base(FromConfig(config).WithFallback(Config), actorSystemName ?? "SnapshotStoreSpec", testActorName) { _senderProbe = CreateTestProbe(); }
public TestSetup(AkkaSpec spec, bool shouldBindServer = true) { BindOptions = Enumerable.Empty<Inet.SocketOption>(); ConnectOptions = Enumerable.Empty<Inet.SocketOption>(); _spec = spec; _shouldBindServer = shouldBindServer; _bindHandler = _spec.CreateTestProbe(); _endpoint = TestUtils.TemporaryServerAddress(); }
public ProbingActor(TestProbe probe) { _probe = probe; }
public VoidOutputStream(TestProbe p) { _p = p; }
public TestSetup(TestKitBase kit, bool pullMode) { _kit = kit; _pullMode = pullMode; _handler = kit.CreateTestProbe(); _handlerRef = _handler.Ref; _bindCommander = kit.CreateTestProbe(); _parent = kit.CreateTestProbe(); _selectorRouter = kit.CreateTestProbe(); _endpoint = TestUtils.TemporaryServerAddress(); _registerCallReceiver = kit.CreateTestProbe(); _interestCallReceiver = kit.CreateTestProbe(); _parentRef = new TestActorRef<ListenerParent>(kit.Sys, Props.Create(() => new ListenerParent(this, pullMode))); }
private TestSinkStage<ByteString, Stream> TestSink(TestProbe probe) => TestSinkStage<ByteString, Stream>.Create(new InputStreamSinkStage(Timeout), probe);
public CloseOutputStream(TestProbe p) { _p = p; }
protected ClusterSingletonManagerSpec(ClusterSingletonManagerSpecConfig config) : base(config) { _controller = config.Controller; _observer = config.Observer; _first = config.First; _second = config.Second; _third = config.Third; _fourth = config.Fourth; _fifth = config.Fifth; _sixth = config.Sixth; _identifyProbe = CreateTestProbe(); _controllerRootActorPath = Node(config.Controller); }
public DebugSniffer(TestProbe testProbe) { _testProbe = testProbe; }
private void AwaitMemberUp(TestProbe memberProbe, params RoleName[] nodes) { RunOn(() => { Assert.Equal(Node(nodes[0]).Address, memberProbe.ExpectMsg<ClusterEvent.MemberUp>(TimeSpan.FromSeconds(15)).Member.Address); }, nodes.Skip(1).ToArray()); RunOn(() => { var membersUp = memberProbe.ReceiveN(nodes.Length, TimeSpan.FromSeconds(15)) .Where(x => x is ClusterEvent.MemberUp) .Select(x => (x as ClusterEvent.MemberUp).Member.Address) .Distinct() .ToArray(); Assert.True(nodes.Select(x => Node(x).Address).ToArray().All(x => membersUp.Contains(x))); }, nodes[0]); EnterBarrier(nodes[0].Name + "-up"); }
public void ExpectReceivedData(TestProbe handler, int remaining) { if (remaining > 0) { var recv = handler.ExpectMsg<Tcp.Received>(); ExpectReceivedData(handler, remaining - recv.Data.Count); } }
public LocalServerTest(TestKitBase kit) { _system = kit.Sys; UserHandler = kit.CreateTestProbe(); Selector = kit.CreateTestProbe(); RegisterCallReceiver = kit.CreateTestProbe(); InterestCallReceiver = kit.CreateTestProbe(); ChannelProbe = kit.CreateTestProbe(); }
protected SnapshotStoreSpec(Config config = null, string actorSystemName = null, ITestOutputHelper output = null) : base(FromConfig(config).WithFallback(Config), actorSystemName ?? "SnapshotStoreSpec", output) { _senderProbe = CreateTestProbe(); }
private IEnumerable<ActorPath> CollectRouteePaths(TestProbe probe, IActorRef router, int n) { List<ActorPath> list = new List<ActorPath>(); for (var i = 1; i <= n; i++) { string msg = i.ToString(); router.Tell(msg, probe.Ref); probe.ExpectMsg(msg); list.Add(probe.LastSender.Path); } return list; }
private void SubscribeToReplay(TestProbe probe) { Sys.EventStream.Subscribe(probe.Ref, typeof(ReplayMessages)); }
public ServerConnection(TestKitBase testkit, IActorRef connectionActor) { _connectionActor = connectionActor; _connectionProbe = testkit.CreateTestProbe(); }