Ejemplo n.º 1
0
        public void DoWorkCallsAddsCorrectNumberOfFilenamesToCurrentTaskFromWfsServiceGetTargetFiles()
        {
            mockWfsService = new Mock <IWfsService>();
            mockWfsService.Setup(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid());
            mockWfsService.Setup(m => m.GetErrors(It.IsAny <Guid>())).Returns(new List <string>());

            WfsService.JMServices.Job job = new WfsService.JMServices.Job()
            {
                Status = JobStatus.Completed
            };
            mockWfsService.Setup(m => m.GetJob(It.IsAny <Guid>())).Returns(job);
            mockWfsService.Setup(m => m.GetTargetFiles(It.IsAny <Guid>())).Returns(new List <string>
            {
                "\\\\sdfsdfsdf\\sdfgsdf\\1",
                "\\\\sdfsdfsdf\\sdfgsdf\\2",
                "\\\\sdfsdfsdf\\sdfgsdf\\3"
            });

            sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            Task.To.Path = "\\\\sdfsdfsdf\\sdfgsdf";

            sut.Assign(Task);
            sut.Pulse(Task);

            Assert.That(sut.GetStatus().CurrentTask.To.Files.Count, Is.EqualTo(3));
        }
Ejemplo n.º 2
0
        public void DoWorkCallSetsCurrentTaskStateToFailedIfExceptionOrrurs()
        {
            mockWfsService = new Mock <IWfsService>();
            mockWfsService.Setup(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid());
            mockWfsService.Setup(m => m.GetErrors(It.IsAny <Guid>())).Returns(new List <string>());
            WfsService.JMServices.Job job = new WfsService.JMServices.Job()
            {
                Status = JobStatus.Completed
            };
            mockWfsService.Setup(m => m.GetJob(It.IsAny <Guid>())).Returns(job);
            mockWfsService.Setup(m => m.GetTargetFiles(It.IsAny <Guid>())).Returns(new List <string>
            {
                "\\\\sdfsdfsdf\\sdfgsdf\\1",
                "\\\\sdfsdfsdf\\sdfgsdf\\2",
                "\\\\sdfsdfsdf\\sdfgsdf\\3"
            });

            sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            Task.To.Path = "\\\\NOT ALIKE AT ALL"; // Forces exception

            sut.Assign(Task);
            sut.Pulse(Task);

            Assert.That(Task.State, Is.EqualTo(ExecutionState.Failed));
        }
Ejemplo n.º 3
0
        public void DoWorkCallsWfsServiceGetTargetFilesIfExecutionStateIsDone()
        {
            mockWfsService = new Mock <IWfsService>();
            mockWfsService.Setup(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid());

            WfsService.JMServices.Job job = new WfsService.JMServices.Job()
            {
                Status = JobStatus.Completed
            };
            mockWfsService.Setup(m => m.GetJob(It.IsAny <Guid>())).Returns(job);

            sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            sut.Assign(Task);
            sut.Pulse(Task);

            mockWfsService.Verify(m => m.GetTargetFiles(It.IsAny <Guid>()), Times.Once);
        }
Ejemplo n.º 4
0
        public void DoWorkDoesNotCallWfsServiceGetTargetFilesIfExecutionStateIsNotDone(JobStatus jobStatus)
        {
            mockWfsService = new Mock <IWfsService>();
            mockWfsService.Setup(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid());

            WfsService.JMServices.Job job = new WfsService.JMServices.Job()
            {
                Status = jobStatus
            };
            mockWfsService.Setup(m => m.GetJob(It.IsAny <Guid>())).Returns(job);
            mockWfsService.Setup(m => m.GetErrors(It.IsAny <Guid>())).Returns(new List <string>());

            sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            sut.Assign(Task);
            sut.Pulse(Task);

            mockWfsService.Verify(m => m.GetTargetFiles(It.IsAny <Guid>()), Times.Never);
        }
Ejemplo n.º 5
0
        public void DoWorkDoesSetsCurrentTaskStateToCorrectValue(JobStatus jobStatus, ExecutionState assertState)
        {
            mockWfsService = new Mock <IWfsService>();
            mockWfsService.Setup(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid());

            mockWfsService.Setup(m => m.GetErrors(It.IsAny <Guid>())).Returns(new List <string>());
            WfsService.JMServices.Job job = new WfsService.JMServices.Job()
            {
                Status = jobStatus
            };
            mockWfsService.Setup(m => m.GetJob(It.IsAny <Guid>())).Returns(job);

            sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            sut.Assign(Task);
            sut.Pulse(Task);

            Assert.That(Task.State, Is.EqualTo(assertState));
        }
Ejemplo n.º 6
0
        public void DoWorkDoesNotCallWfsServiceEnqueueJobIfForeignIsKeyNotEmpty(string foreignKey)
        {
            mockWfsService = new Mock <IWfsService>();
            mockWfsService.Setup(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid());

            WfsService.JMServices.Job job = new WfsService.JMServices.Job()
            {
                Status = JobStatus.Active
            };
            mockWfsService.Setup(m => m.GetJob(It.IsAny <Guid>())).Returns(job);
            Task.ForeignKey = foreignKey;

            sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            sut.Assign(Task);
            sut.Pulse(Task);

            mockWfsService.Verify(m => m.EnqueueJob(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never);
        }
Ejemplo n.º 7
0
        public void SetUp()
        {
            DynamicPlugin.ClearSiblings(Wfs.Wfs.Type);
            mockWfsService.Setup(m => m.GetWorkingNodes(It.IsAny <string>())).Returns(new string[1]);
            mockPresetProvider.Setup(m => m.AsList()).Returns(new List <WorkflowConfiguration>
            {
                new WorkflowConfiguration
                {
                    AspectRatio = AspectRatio.ratio_16x9,
                    BurnInLogo  = false,
                    Format      = StateFormat.h264_od_standard,
                    Workflow    = Guid.NewGuid()
                }
            });
            mockPresetProvider.SetupGet(m => m.MachineGroup).Returns("UnitTestGroup");
            Plugin = sut = new Wfs.Wfs(_pluginUrn, MockTimeProvider.Object, Logging, mockWfsService.Object, mockPresetProvider.Object);

            Task = new ExecutionTask
            {
                From = new Essence()
                {
                    Flags       = StateFlags.None,
                    Path        = @"\\sdfsd\sdfsdf\sdfsfsd",
                    Format      = StateFormat.dv5p,
                    AspectRatio = AspectRatio.ratio_16x9,
                    Files       = new List <EssenceFile> {
                        "sdfsdfsdf.mov"
                    },
                    Duration = 234234234
                },
                To = new Essence()
                {
                    Flags       = StateFlags.None,
                    Path        = @"\\sdfsdfsdf\sdgsdgsdg",
                    Format      = StateFormat.h264_od_standard,
                    AspectRatio = AspectRatio.ratio_16x9,
                    Files       = new List <EssenceFile>()
                },
                PluginUrn = _pluginUrn
            };
        }