public void CompleteTrackingOfInboundMessageWithoutProcessAffiliationAfterStreamLastReadEvent()
        {
            using (var stream = new TrackingStream(new StringStream("some-content")))
            {
                MessageMock.Object.BodyPart.Data = stream;

                var sut = ActivityTracker.Create(new MicroComponent.ActivityTracker.Context(PipelineContextMock.Object, MessageMock.Object, ActivityTrackingModes.Step));
                sut.TrackActivity();
                MessageMock.Object.BodyPart.Data.Drain();

                ProcessMock.Verify(
                    p => p.TrackActivity(),
                    Times.Never());
                InitiatingMessagingStepMock.Verify(
                    ms => ms.TrackActivity(It.IsAny <ActivityTrackingModes>(), It.IsAny <TrackingStream>()),
                    Times.Never());
                ProcessMock.Verify(
                    p => p.AddStep(InitiatingMessagingStepMock.Object),
                    Times.Never());
                MessagingStepMock.Verify(
                    ms => ms.TrackActivity(It.IsAny <ActivityTrackingModes>(), It.IsAny <TrackingStream>()),
                    Times.Once());
                ProcessMock.Verify(
                    p => p.AddStep(MessagingStepMock.Object),
                    Times.Never());
            }
        }
Exemple #2
0
        public void TrackActivityWithAmbientProcessActivity()
        {
            var batchTrackingContext = new BatchTrackingContext {
                MessagingStepActivityIdList = new[] { ActivityId.NewActivityId(), ActivityId.NewActivityId(), ActivityId.NewActivityId() },
                ProcessActivityId           = ActivityId.NewActivityId()
            };

            var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object);

            sut.TrackActivity(batchTrackingContext);

            ActivityFactory.Verify(af => af.CreateProcess(It.IsAny <IBaseMessage>(), It.IsAny <string>()), Times.Never());
            // ReSharper disable once ImplicitlyCapturedClosure
            ActivityFactory.Verify(af => af.FindProcess(batchTrackingContext.ProcessActivityId), Times.Once());

            ProcessMock.Verify(p => p.TrackActivity(), Times.Once());
            ProcessMock.Verify(
                p =>
                p.AddSteps(
                    It.Is <IEnumerable <string> >(
                        list =>
                        list.SequenceEqual(
                            batchTrackingContext.MessagingStepActivityIdList
                            .Concat(new[] { MessageMock.Object.GetProperty(TrackingProperties.MessagingStepActivityId) })))),
                Times.Once());
        }
        public void CompleteTrackingOfOutboundMessageWithProcessAffiliationAfterStreamLastReadEvent()
        {
            using (var stream = new TrackingStream(new StringStream("some-content")))
            {
                MessageMock.Object.BodyPart.Data = stream;
                MessageMock.Setup(m => m.GetProperty(BtsProperties.OutboundTransportLocation)).Returns("outbound-transport-location");
                MessageMock.Setup(m => m.GetProperty(TrackingProperties.ProcessActivityId)).Returns(ActivityId.NewActivityId());

                var sut = ActivityTracker.Create(new MicroComponent.ActivityTracker.Context(PipelineContextMock.Object, MessageMock.Object, ActivityTrackingModes.Step));
                sut.TrackActivity();
                MessageMock.Object.BodyPart.Data.Drain();

                ProcessMock.Verify(
                    p => p.TrackActivity(),
                    Times.Never());
                InitiatingMessagingStepMock.Verify(
                    ms => ms.TrackActivity(It.IsAny <ActivityTrackingModes>(), It.IsAny <TrackingStream>()),
                    Times.Never());
                ProcessMock.Verify(
                    p => p.AddStep(InitiatingMessagingStepMock.Object),
                    Times.Never());
                MessagingStepMock.Verify(
                    ms => ms.TrackActivity(It.IsAny <ActivityTrackingModes>(), It.IsAny <TrackingStream>()),
                    Times.Once());
                ProcessMock.Verify(
                    p => p.AddStep(MessagingStepMock.Object),
                    Times.Once());
            }
        }
            public VersionReaderFixture()
            {
                var appPath = AppDomain.CurrentDomain.BaseDirectory;

                CakeEnviromentMock
                .Setup(t => t.WorkingDirectory)
                .Returns(new DirectoryPath(appPath));
                CakeContextMock
                .Setup(t => t.ProcessRunner)
                .Returns(ProcessRunner);
                CakeContextMock
                .Setup(t => t.FileSystem)
                .Returns(FileSystem);
                CakeContextMock
                .Setup(t => t.Log)
                .Returns(CakeLog);
                CakeContextMock
                .Setup(t => t.Environment)
                .Returns(CakeEnvironment);
                ProcessRunnerMock
                .Setup(t => t.Start(It.IsAny <FilePath>(), It.IsAny <ProcessSettings>()))
                .Returns(ProcessMock.Object);
                ProcessMock
                .Setup(t => t.GetExitCode())
                .Returns(0);
            }
        IProcess CreateProcess(int process, int workflowId, String client)
        {
            switch (process)
            {
            case ParamAppli.ProcessControlePacks:
                return(ProcessControlePacks.CreateProcess(workflowId, client));

            case ParamAppli.ProcessAnalyseImpact:
                return(ProcessAnalyseImpact.CreateProcess(workflowId, client));

            case ParamAppli.ProcessInit:
                return(ProcessInit.CreateProcess(workflowId, client));

            case ParamAppli.ProcessGestionDependance:
                return(ProcessGestionDependance.CreateProcess(workflowId, client));

            case ParamAppli.ProcessIntegration:
                return(ProcessIntegration.CreateProcess(workflowId, client));

            case ParamAppli.ProcessProcessusCritique:
                return(ProcessProcessusCritique.CreateProcess(workflowId, client));

            case ParamAppli.ProcessTNR:
                return(ProcessTNR.CreateProcess(workflowId, client));

            case ParamAppli.ProcessLivraison:
                return(ProcessLivraison.CreateProcess(workflowId, client));

            default:
                return(ProcessMock.CreateProcess(workflowId, client));
            }
        }
Exemple #6
0
        public void TrackActivityWhenBatchTrackingContextIsNull()
        {
            var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object);

            sut.TrackActivity(null);

            ActivityFactory.Verify(af => af.CreateProcess(It.IsAny <IBaseMessage>(), It.IsAny <string>()), Times.Never());
            ActivityFactory.Verify(af => af.FindProcess(It.IsAny <string>()), Times.Never());

            ProcessMock.Verify(p => p.TrackActivity(), Times.Never());
            ProcessMock.Verify(p => p.AddSteps(It.IsAny <IEnumerable <string> >()), Times.Never());
        }
Exemple #7
0
            public CakeOctoDeployAliasFixture(int exitCode)
            {
                GetDirectoryPath = Guid.NewGuid().ToString();

                CakeContextMock.Setup(t => t.ProcessRunner).Returns(ProcessRunnerMock.Object);
                CakeContextMock.Setup(t => t.FileSystem).Returns(FileSysteMock.Object);
                CakeContextMock.Setup(t => t.Log).Returns(GetCakeLog);

                ProcessRunnerMock.Setup(t => t.Start(It.IsAny <FilePath>(), It.IsAny <ProcessSettings>()))
                .Returns(ProcessMock.Object);
                ProcessMock.Setup(t => t.GetExitCode()).Returns(exitCode);
            }
Exemple #8
0
        public void TrackActivityWhenBatchTrackingContextOnlyHasProcessActivityId()
        {
            var batchTrackingContext = new BatchTrackingContext {
                ProcessActivityId = ActivityId.NewActivityId()
            };

            var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object);

            sut.TrackActivity(batchTrackingContext);

            ActivityFactory.Verify(af => af.CreateProcess(It.IsAny <IBaseMessage>(), It.IsAny <string>()), Times.Never);
            ActivityFactory.Verify(af => af.FindProcess(It.IsAny <string>()), Times.Never);

            ProcessMock.Verify(p => p.TrackActivity(), Times.Never);
            ProcessMock.Verify(p => p.AddSteps(It.IsAny <IEnumerable <string> >()), Times.Never);
        }
Exemple #9
0
        public void TrackActivityWithoutAmbientProcessActivity()
        {
            var batchTrackingContext = new BatchTrackingContext {
                MessagingStepActivityIdList = new[] { ActivityId.NewActivityId(), ActivityId.NewActivityId(), ActivityId.NewActivityId() }
            };

            var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object);

            sut.TrackActivity(batchTrackingContext);

            ActivityFactory.Verify(af => af.CreateProcess(MessageMock.Object, It.IsAny <string>()), Times.Once);
            ActivityFactory.Verify(af => af.FindProcess(It.IsAny <string>()), Times.Never);

            ProcessMock.Verify(p => p.TrackActivity(), Times.Once);
            ProcessMock.Verify(
                p => p.AddSteps(
                    It.Is <IEnumerable <string> >(
                        list => list.SequenceEqual(
                            batchTrackingContext.MessagingStepActivityIdList.Append(MessageMock.Object.GetProperty(TrackingProperties.MessagingStepActivityId))))),
                Times.Once);
        }
Exemple #10
0
 IProcess createProcess(String process, String client)
 {
     return(ProcessMock.createProcess());
 }