public void SnapshotStore_should_not_delete_snapshots_with_non_matching_upper_timestamp_bounds() { var snapshotMetadata = _metadata[3]; var criteria = new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp.Subtract(TimeSpan.FromTicks(1L)), 0L, new DateTime?()); var message = new DeleteSnapshots(Pid, criteria); var testProbe = CreateTestProbe(); Subscribe <DeleteSnapshots>(testProbe.Ref); SnapshotStore.Tell(message, _senderProbe.Ref); testProbe.ExpectMsg(message, new TimeSpan?()); _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>(m => m.Criteria.Equals(criteria), new TimeSpan?()); SnapshotStore.Tell( new LoadSnapshot(Pid, new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp, 0L, new DateTime?()), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg((Predicate <LoadSnapshotResult>)(result => { if (result.ToSequenceNr == long.MaxValue && result.Snapshot != null && result.Snapshot.Metadata.Equals(_metadata[3])) { return(result.Snapshot.Snapshot.ToString() == "s-4"); } return(false); }), new TimeSpan?()); }
public void SnapshotStore_should_not_delete_snapshots_with_non_matching_upper_timestamp_bounds() { var md = Metadata[3]; var criteria = new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp.Subtract(TimeSpan.FromTicks(1))); var command = new DeleteSnapshots(Pid, criteria); var sub = CreateTestProbe(); Subscribe <DeleteSnapshots>(sub.Ref); SnapshotStore.Tell(command, _senderProbe.Ref); sub.ExpectMsg(command); _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>(m => m.Criteria.Equals(criteria)); SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg <LoadSnapshotResult>(result => result.ToSequenceNr == long.MaxValue && result.Snapshot != null && result.Snapshot.Metadata.Equals(Metadata[3]) && result.Snapshot.Snapshot.ToString() == "s-4"); }
public void SnapshotStore_should_delete_all_snapshots_matching_upper_sequence_number_and_timestamp_bounds() { var md = Metadata[2]; var command = new DeleteSnapshots(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp)); var sub = CreateTestProbe(); Subscribe <DeleteSnapshots>(sub.Ref); SnapshotStore.Tell(command); sub.ExpectMsg(command); SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg <LoadSnapshotResult>(result => result.Snapshot == null && result.ToSequenceNr == long.MaxValue); SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(Metadata[3].SequenceNr, Metadata[3].Timestamp), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg <LoadSnapshotResult>(result => result.ToSequenceNr == long.MaxValue && result.Snapshot != null && result.Snapshot.Metadata.Equals(Metadata[3]) && result.Snapshot.Snapshot.ToString() == "s-4"); }
public void SnapshotStore_should_delete_all_snapshots_matching_upper_sequence_number_and_timestamp_bounds() { var snapshotMetadata = _metadata[2]; var message = new DeleteSnapshots(Pid, new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp, 0L, new DateTime?())); var testProbe = CreateTestProbe(); Subscribe <DeleteSnapshots>(testProbe.Ref); SnapshotStore.Tell(message, _senderProbe.Ref); testProbe.ExpectMsg(message, new TimeSpan?()); _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>(new TimeSpan?()); SnapshotStore.Tell( new LoadSnapshot(Pid, new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp, 0L, new DateTime?()), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg <LoadSnapshotResult>(result => { if (result.Snapshot == null) { return(result.ToSequenceNr == long.MaxValue); } return(false); }, new TimeSpan?()); SnapshotStore.Tell( new LoadSnapshot(Pid, new SnapshotSelectionCriteria(_metadata[3].SequenceNr, _metadata[3].Timestamp, 0L, new DateTime?()), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg <LoadSnapshotResult>(result => { if (result.ToSequenceNr == long.MaxValue && result.Snapshot != null && result.Snapshot.Metadata.Equals(_metadata[3])) { return(result.Snapshot.Snapshot.ToString() == "s-4"); } return(false); }, new TimeSpan?()); }
public void SnapshotStore_should_not_delete_snapshots_with_non_matching_upper_timestamp_bounds() { var md = Metadata[3]; var criteria = new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp.Subtract(TimeSpan.FromTicks(1))); var command = new DeleteSnapshots(Pid, criteria); var sub = CreateTestProbe(); Subscribe<DeleteSnapshots>(sub.Ref); SnapshotStore.Tell(command, _senderProbe.Ref); sub.ExpectMsg(command); _senderProbe.ExpectMsg<DeleteSnapshotsSuccess>(m => m.Criteria.Equals(criteria)); SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg<LoadSnapshotResult>(result => result.ToSequenceNr == long.MaxValue && result.Snapshot != null && result.Snapshot.Metadata.Equals(Metadata[3]) && result.Snapshot.Snapshot.ToString() == "s-4"); }
public void SnapshotStore_should_delete_all_snapshots_matching_upper_sequence_number_and_timestamp_bounds() { var md = Metadata[2]; var command = new DeleteSnapshots(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp)); var sub = CreateTestProbe(); Subscribe<DeleteSnapshots>(sub.Ref); SnapshotStore.Tell(command, _senderProbe.Ref); sub.ExpectMsg(command); _senderProbe.ExpectMsg<DeleteSnapshotsSuccess>(); SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg<LoadSnapshotResult>(result => result.Snapshot == null && result.ToSequenceNr == long.MaxValue); SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(Metadata[3].SequenceNr, Metadata[3].Timestamp), long.MaxValue), _senderProbe.Ref); _senderProbe.ExpectMsg<LoadSnapshotResult>(result => result.ToSequenceNr == long.MaxValue && result.Snapshot != null && result.Snapshot.Metadata.Equals(Metadata[3]) && result.Snapshot.Snapshot.ToString() == "s-4"); }