예제 #1
0
        public void Setup()
        {
            InnerTransport = new TestTransport(Self.EndPoint);

            var configuration = new Mock<IBusConfiguration>();
            configuration.Setup(x => x.IsPersistent).Returns(IsPersistent);
            configuration.Setup(x => x.StartReplayTimeout).Returns(TimeSpan.FromMinutes(60));

            PeerDirectory = new Mock<IPeerDirectory>();
            PeerDirectory.Setup(dir => dir.GetPeersHandlingMessage(It.IsAny<StartMessageReplayCommand>())).Returns(new[] { PersistencePeer });
            PeerDirectory.Setup(dir => dir.GetPeersHandlingMessage(It.IsAny<PersistMessageCommand>())).Returns(new[] { PersistencePeer });
            PeerDirectory.Setup(dir => dir.GetPeersHandlingMessage(It.IsAny<MessageHandled>())).Returns(new[] { PersistencePeer });
            PeerDirectory.Setup(dir => dir.IsPersistent(AnotherPersistentPeer.Id)).Returns(true);
            PeerDirectory.Setup(dir => dir.IsPersistent(AnotherNonPersistentPeer.Id)).Returns(false);

            Transport = new PersistentTransport(configuration.Object, InnerTransport, PeerDirectory.Object);
            Transport.Configure(Self.Id, "test");

            MessagesForwardedToBus = new ConcurrentQueue<TransportMessage>();
            Transport.MessageReceived += MessagesForwardedToBus.Enqueue;

            Transport.OnRegistered();
            var startMessageReplayMessage = InnerTransport.Messages.FirstOrDefault(x => x.TransportMessage.MessageTypeId == MessageUtil.TypeId<StartMessageReplayCommand>());
            if (startMessageReplayMessage != null)
            {
                StartMessageReplayCommand = (StartMessageReplayCommand)startMessageReplayMessage.TransportMessage.ToMessage();
                StartMessageReplayCommandTargets = startMessageReplayMessage.Targets;
            }

            InnerTransport.Messages.Clear();
        }
예제 #2
0
 public ReplayPhase(PersistentTransport transport)
     : base(transport)
 {
 }
예제 #3
0
 public NormalPhase(PersistentTransport transport)
     : base(transport)
 {
 }
예제 #4
0
 public SafetyPhase(PersistentTransport transport)
     : base(transport)
 {
 }
예제 #5
0
 protected Phase(PersistentTransport transport)
 {
     Transport = transport;
 }
예제 #6
0
 public ReplayPhase(PersistentTransport transport)
     : base(transport)
 {
 }
예제 #7
0
 public NormalPhase(PersistentTransport transport)
     : base(transport)
 {
 }
예제 #8
0
 public SafetyPhase(PersistentTransport transport) : base(transport)
 {
 }
예제 #9
0
 protected Phase(PersistentTransport transport)
 {
     Transport = transport;
 }