public StreamCompleted(StreamPath path) { if (path == StreamPath.Empty) { throw new InvalidOperationException("The stream path is empty"); } Path = path; }
public override Task Publish <TMessage>(StreamPath path, TMessage message, Receive <TMessage> receiver) { if (message is NextItem <ItemData> nextItem && nextItem.Item.Text == "StreamRefMiddlewarePublishTest") { nextItem.Item.Text += " - it works!"; } return(base.Publish(path, message, receiver)); }
public override Task Receive <TMessage>(StreamPath path, TMessage message, Receive <TMessage> receiver) { if (message is StreamItem <ItemData> streamItem && streamItem.Item.Text == "StreamRefMiddlewareSubscribeTest") { streamItem.Item.Text += " - it works!"; } return(base.Receive(path, message, receiver)); }
public void Equatable_by_path() { var path = StreamPath.From("sms", "42"); var ref1 = new StreamRef(path, null); var ref2 = new StreamRef(path, null); Assert.True(ref1 == ref2); Assert.True(ref1.Equals(ref2)); }
public StreamError(StreamPath path, Exception exception) { Requires.NotNull(exception, nameof(exception)); if (path == StreamPath.Empty) { throw new InvalidOperationException("The stream path is empty"); } Path = path; Exception = exception; }
StreamRefMock GetOrCreateMock(StreamPath path) { if (streams.ContainsKey(path)) { return(streams[path]); } var mock = new StreamRefMock(path, serialization); streams.Add(path, mock); return(mock); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (StreamPath != null) { hashCode = hashCode * 59 + StreamPath.GetHashCode(); } if (StreamName != null) { hashCode = hashCode * 59 + StreamName.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if ComAdobeCqSocialActivitystreamsListenerImplResourceActivityStreProperties instances are equal /// </summary> /// <param name="other">Instance of ComAdobeCqSocialActivitystreamsListenerImplResourceActivityStreProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ComAdobeCqSocialActivitystreamsListenerImplResourceActivityStreProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( StreamPath == other.StreamPath || StreamPath != null && StreamPath.Equals(other.StreamPath) ) && ( StreamName == other.StreamName || StreamName != null && StreamName.Equals(other.StreamName) )); }
StreamRef IActorSystem.StreamOf(StreamPath path) { return(GetOrCreateMock(path)); }
public StreamRefMock MockStreamOf(string provider, string id) { var path = StreamPath.From(provider, id); return(GetOrCreateMock(path)); }
public StreamRef StreamOf(StreamPath path) => Client.StreamOf(path);
public void Can_be_constructed_and_serialized_without_stream_provider_registration() { var path = StreamPath.From("sms", "42"); Assert.AreEqual("sms:42", path.Serialize()); }
public Task Publish <TMessage>(StreamPath path, TMessage message, Receive <TMessage> receiver) where TMessage : PublishMessage => receiver(message);
public static StreamPathSurrogate From(StreamPath path) => new StreamPathSurrogate { S = path.Serialize() };
public StreamRef <TItem> Original <TItem>(HyperionSerializer ctx) => ctx.system.StreamOf <TItem>(StreamPath.Parse(S));
public static StreamPathSurrogate From(StreamPath path) => new StreamPathSurrogate { S = path };
public Task Receive <TMessage>(StreamPath path, TMessage message, Receive <TMessage> receiver) where TMessage : StreamMessage => receiver(message);
public StreamRef Original() => StreamRef.Deserialize(StreamPath.Deserialize(S));
public StreamPath Original() => StreamPath.Deserialize(S);
internal StreamRefMock(StreamPath path, SerializationOptions serialization) : base(path) { this.serialization = serialization; }
public StreamRef Original(HyperionSerializer ctx) => ctx.system.StreamOf(StreamPath.Parse(S));
StreamRef IActorSystem.StreamOf(StreamPath path) { throw new NotImplementedException(); }
public StreamRefMock(StreamPath path, IMessageSerializer serializer = null) : base(path) { this.serializer = serializer; }
public StreamPath Original() => StreamPath.Parse(S);
public StreamRef <TItem> StreamOf <TItem>(StreamPath path) => throw new NotImplementedException();
internal StreamRefMock(StreamPath path, MessageSerialization serialization = null) : base(path) { this.serialization = serialization ?? MessageSerialization.Default; }
StreamRef <TItem> IActorSystem.StreamOf <TItem>(StreamPath path) { return(GetOrCreateMock <TItem>(path)); }
public StreamRef StreamOf(StreamPath path) { throw new NotImplementedException(); }