private IActorRef Setup(string persistenceId, int n)
        {
            var sw   = Stopwatch.StartNew();
            var pref = Sys.ActorOf(JournalTestActor.Props(persistenceId));

            for (int i = 1; i <= n; i++)
            {
                pref.Tell($"{persistenceId}-{i}");
                ExpectMsg($"{persistenceId}-{i}-done", TimeSpan.FromSeconds(10), $"{persistenceId}-{i}-done");
            }
            _output.WriteLine(sw.ElapsedMilliseconds.ToString());
            return(pref);
        }
        public AzureTableEventsByTagSpec(ITestOutputHelper output)
            : base(Config(), nameof(AzureTableEventsByTagSpec), output)
        {
            AzurePersistence.Get(Sys);

            ReadJournal =
                Sys.ReadJournalFor<AzureTableStorageReadJournal>(
                    AzureTableStorageReadJournal.Identifier);

            var x = Sys.ActorOf(JournalTestActor.Props("x"));
            x.Tell("warm-up");
            ExpectMsg("warm-up-done", TimeSpan.FromSeconds(60));
        }
Ejemplo n.º 3
0
        public void ReadJournal_should_delete_EventTags_index_items()
        {
            var queries = ReadJournal as IEventsByTagQuery;

            var b = Sys.ActorOf(JournalTestActor.Props("b"));
            var d = Sys.ActorOf(JournalTestActor.Props("d"));

            b.Tell("a black car");
            ExpectMsg("a black car-done");

            var blackSrc = queries.EventsByTag("black", offset: Offset.NoOffset());
            var probe    = blackSrc.RunWith(this.SinkProbe <EventEnvelope>(), Materializer);

            probe.Request(2);
            probe.ExpectNext <EventEnvelope>(p => p.PersistenceId == "b" && p.SequenceNr == 1L && p.Event.Equals("a black car"));
            probe.ExpectNoMsg(TimeSpan.FromMilliseconds(100));

            d.Tell("a black dog");
            ExpectMsg("a black dog-done");
            d.Tell("a black night");
            ExpectMsg("a black night-done");

            probe.ExpectNext <EventEnvelope>(p => p.PersistenceId == "d" && p.SequenceNr == 1L && p.Event.Equals("a black dog"));
            probe.ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            probe.Request(10);
            probe.ExpectNext <EventEnvelope>(p => p.PersistenceId == "d" && p.SequenceNr == 2L && p.Event.Equals("a black night"));

            b.Tell(new JournalTestActor.DeleteCommand(1));
            AwaitAssert(() => ExpectMsg("1-deleted"));

            d.Tell(new JournalTestActor.DeleteCommand(2));
            AwaitAssert(() => ExpectMsg("2-deleted"));

            probe.Request(10);
            probe.ExpectNoMsg(TimeSpan.FromMilliseconds(100));

            probe.Cancel();
        }