Example #1
0
 public StreamCompleted(StreamPath path)
 {
     if (path == StreamPath.Empty)
     {
         throw new InvalidOperationException("The stream path is empty");
     }
     Path = path;
 }
Example #2
0
            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));
            }
Example #3
0
            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));
            }
Example #4
0
        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));
        }
Example #5
0
        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;
        }
Example #6
0
        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)
                 ));
        }
Example #9
0
 StreamRef IActorSystem.StreamOf(StreamPath path)
 {
     return(GetOrCreateMock(path));
 }
Example #10
0
        public StreamRefMock MockStreamOf(string provider, string id)
        {
            var path = StreamPath.From(provider, id);

            return(GetOrCreateMock(path));
        }
Example #11
0
 public StreamRef StreamOf(StreamPath path) => Client.StreamOf(path);
Example #12
0
        public void Can_be_constructed_and_serialized_without_stream_provider_registration()
        {
            var path = StreamPath.From("sms", "42");

            Assert.AreEqual("sms:42", path.Serialize());
        }
Example #13
0
 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()
 };
Example #15
0
 public StreamRef <TItem> Original <TItem>(HyperionSerializer ctx) =>
 ctx.system.StreamOf <TItem>(StreamPath.Parse(S));
 public static StreamPathSurrogate From(StreamPath path) =>
 new StreamPathSurrogate
 {
     S = path
 };
Example #17
0
 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);
Example #20
0
 internal StreamRefMock(StreamPath path, SerializationOptions serialization)
     : base(path)
 {
     this.serialization = serialization;
 }
 public StreamRef Original(HyperionSerializer ctx) =>
 ctx.system.StreamOf(StreamPath.Parse(S));
Example #22
0
 StreamRef IActorSystem.StreamOf(StreamPath path)
 {
     throw new NotImplementedException();
 }
Example #23
0
 public StreamRefMock(StreamPath path, IMessageSerializer serializer = null)
     : base(path)
 {
     this.serializer = serializer;
 }
 public StreamPath Original() => StreamPath.Parse(S);
Example #25
0
 public StreamRef <TItem> StreamOf <TItem>(StreamPath path) => throw new NotImplementedException();
Example #26
0
 internal StreamRefMock(StreamPath path, MessageSerialization serialization = null)
     : base(path)
 {
     this.serialization = serialization ?? MessageSerialization.Default;
 }
Example #27
0
 StreamRef <TItem> IActorSystem.StreamOf <TItem>(StreamPath path)
 {
     return(GetOrCreateMock <TItem>(path));
 }
Example #28
0
 public StreamRef StreamOf(StreamPath path)
 {
     throw new NotImplementedException();
 }
 public StreamRef StreamOf(StreamPath path)
 {
     throw new NotImplementedException();
 }