public void FileService_Execute_should_return_unsuccessful_result_if_the_step_is_an_integration_services_job_step_and_an_exception_is_thrown()
        {
            var jobConfiguration =
                JobConfiguration.Create()
                .WithName("Test Job")
                .WithStep(StepConfiguration.Create()
                          .WithName("Test Step")
                          .WithSubSystem(SsisSubSystem.IntegrationServices));

            var fileService = new IntegrationServicesFileService(new IoWrapper());

            var result = fileService.Execute(jobConfiguration);

            Assert.That(result.Successful, Is.EqualTo(false));
        }
Exemplo n.º 2
0
        private static int Main(string[] args)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["MasterDb"];
            var fileDestination  = ConfigurationManager.AppSettings["FileDestination"];

            var jobConfiguration = JobConfiguration.Create()
                                   .WithName("Ssis Up - Sample Data Load")
                                   .WithDescription("This is a sample data load")
                                   .WithSsisOwner("sa")
                                   .WithSsisServer(Environment.MachineName)
                                   .WithSchedule(
                ScheduleConfiguration.Create()
                .WithName("Saturday Load")
                .RunOn(FrequencyDay.Saturday)
                .StartingAt(new TimeSpan(10, 0, 0))
                .ActivatedFrom(DateTime.Parse("1 Jan 2010"))
                .ActivatedUntil(DateTime.Parse("31 Dec 2020")))
                                   .WithStep(
                StepConfiguration.Create()
                .WithId(1)
                .WithName("Load Movie Data")
                .WithSubSystem(SsisSubSystem.IntegrationServices)
                .WithDtsxFile(@".\Packages\SampleJob.dtsx")
                .WithDtsConfigurationFile(@".\Packages\SampleJob.dtsConfig")
                .WithDtsxFileDestination(fileDestination)
                .ExecuteCommand(
                    string.Format(
                        @"/FILE ""{0}\SampleJob.dtsx"" /CONFIGFILE ""{0}\SampleJob.dtsConfig"" /CHECKPOINTING OFF /REPORTING E /X86",
                        fileDestination))
                .OnSuccess(JobAction.QuitWithSuccess)
                .OnFailure(JobAction.QuitWithFailure));


            var result = DeploymentConfiguration
                         .Create()
                         .ToDatabase(connectionString.ConnectionString)
                         .WithJobConfiguration(jobConfiguration)
                         .Deploy();


            if (!result.Successful)
            {
                return(-1);
            }

            return(0);
        }
        public void FileService_Execute_should_return_successful_result_if_the_job_step_is_not_an_integration_services_job()
        {
            var jobConfiguration =
                JobConfiguration.Create()
                .WithName("Test Job")
                .WithStep(StepConfiguration.Create()
                          .WithName("Test Step")
                          .WithSubSystem(SsisSubSystem.CommandExecutable));

            var mockIoWrapper = new Mock <IIoWrapper>();

            var fileService = new IntegrationServicesFileService(mockIoWrapper.Object);

            var result = fileService.Execute(jobConfiguration);

            Assert.That(result.Successful, Is.EqualTo(true));
        }
        public void FileService_Execute_should_return_sucessful_result_if_the_step_is_an_integration_services_job_step_and_NO_exceptions_are_thrown()
        {
            var jobConfiguration =
                JobConfiguration.Create()
                .WithName("Test Job")
                .WithStep(StepConfiguration.Create()
                          .WithName("Test Step")
                          .WithSubSystem(SsisSubSystem.IntegrationServices));

            var mockIoWrapper = new Mock <IIoWrapper>();

            var fileService = new IntegrationServicesFileService(mockIoWrapper.Object);

            var result = fileService.Execute(jobConfiguration);

            Assert.That(result.Successful, Is.EqualTo(true));
            mockIoWrapper.Verify(x => x.CreateDirectoryIfNotExists(It.IsAny <string>()), Times.Once());
            mockIoWrapper.Verify(x => x.CopyFile(It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(2));
        }
Exemplo n.º 5
0
 private static JobConfiguration CreateJobConfiguration()
 {
     var jobConfiguration =
         JobConfiguration.Create()
             .WithName("Test Name")
             .WithDescription("Test Description")
             .WithSsisOwner("Test SSIS Owner")
             .WithSsisServer("Test SSIS Server")
             .WithStep(StepConfiguration.Create()
                 .WithName("Test Step Name")
                 .WithId(1)
                 .WithSubSystem(SsisSubSystem.TransactStructuredQueryLanguage)
                 .ExecuteCommand("Test Command")
                 .OnFailure(JobAction.QuitWithFailure)
                 .OnSuccess(JobAction.QuitWithSuccess))
             .WithSchedule(ScheduleConfiguration.Create()
                 .WithName("Test Schedule Configuration")
                 .RunOn(FrequencyDay.Monday)
                 .ActivatedFrom(DateTime.Now)
                 .ActivatedUntil(DateTime.Now.AddDays(1))
                 .StartingAt(TimeSpan.FromSeconds(6)));
     return jobConfiguration;
 }