public string ToCsv()
 {
     return(string.Join(",",
                        //AssemblyId.ToString().FormatForCsv(),
                        AssemblyName.FormatForCsv(),
                        //PluginTypeId.ToString().FormatForCsv(),
                        PluginTypeName, StepId.ToString().FormatForCsv(),
                        StepName.FormatForCsv(),
                        FormatForCsv(ImageId),
                        ImageName.FormatForCsv(),
                        Environment.FormatForCsv(),
                        GetStateText(Environment == "Source" ? "target": "source").FormatForCsv(),
                        StepMessageName.FormatForCsv(),
                        EntityName.FormatForCsv(),
                        StepFilteringAttributes.FormatForCsv(),
                        FormatForCsv(RunAsUserId),
                        RunAsUserName.FormatForCsv(),
                        StepRank.ToString().FormatForCsv(),
                        StepDescription.FormatForCsv(),
                        StepStageName.FormatForCsv(),
                        StepModeName.FormatForCsv(),
                        StepSupportedDeploymentName.FormatForCsv(),
                        StepAsyncAutoDelete.ToString(),
                        StepConfiguration.FormatForCsv(),
                        StepSecureConfiguration.FormatForCsv(),
                        ImageAttributes.FormatForCsv()
                        ));
 }
Esempio n. 2
0
        public PluginStepOptionsBuilder WhichExecutesOn(StepConfiguration configuration)
        {
            var pluginStepRegistration = new PluginStepRegistration(PluginTypeRegistration, configuration);

            PluginTypeRegistration.PluginStepRegistrations.Add(pluginStepRegistration);
            return(new PluginStepOptionsBuilder(this, pluginStepRegistration));
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Agent"/> class.
 /// </summary>
 /// <param name="config">The config to add metadata to the agent.</param>
 /// <param name="receiver">The receiver on which the agent should listen for messages.</param>
 /// <param name="transformerConfig">The config to create <see cref="ITransformer"/> instances.</param>
 /// <param name="exceptionHandler">The handler to handle failures during the agent execution.</param>
 /// <param name="stepConfiguration">The config to create <see cref="IStep"/> normal & error pipelines.</param>
 internal Agent(
     AgentConfig config,
     IReceiver receiver,
     Transformer transformerConfig,
     IAgentExceptionHandler exceptionHandler,
     StepConfiguration stepConfiguration)
     : this(config, receiver, transformerConfig, exceptionHandler, stepConfiguration, NoopJournalLogger.Instance)
 {
 }
 public CommandLineOperationBuilder(StepConfiguration step, string command)
 {
     _step = step;
     _task = new CommandLineTask(command);
     _step.AddOperation("command line task", opCfg =>
     {
         opCfg.AddTask(_task);
     });
 }
        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));
        }
Esempio n. 6
0
        public FlowManager(ObservableCollection <ConnectionConfigurationBase> connectionConfigurations, List <ModuleDescription> loadedModules, Package package)
        {
            this.connectionConfigurations = connectionConfigurations;
            this.loadedModules            = loadedModules;
            this.package = package;

            IntegrationTool.SDK.Diagram.DiagramDeserializer deserializer = new SDK.Diagram.DiagramDeserializer(this.loadedModules, this.package.Diagram.Diagram);

            this.connectionList = deserializer.Connections;
            foreach (DesignerItemBase item in deserializer.DesignerItems)
            {
                StepConfiguration configuration = package.Configurations.FirstOrDefault(t => t.ConfigurationId == item.ID) as StepConfiguration;
                ItemWorker        itemWorker    = InitializeItemWorker(item, configuration);
                itemWorkers.Add(itemWorker);
            }
        }
Esempio n. 7
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));
        }
Esempio n. 9
0
        public CreateStep(int order, JobConfiguration jonConfiguration, StepConfiguration stepConfiguration)
        {
            Order = order;
            Name  = "Create Step";

            Contents = @"
IF '@@RunAs@@' = 'EMPTY'
BEGIN
	EXEC msdb.dbo.sp_add_jobstep @job_name='@@JobName@@', @step_name='@@StepName@@', 
			@step_id=@@StepId@@, 
			@cmdexec_success_code=0, 
			@on_success_action='@@SuccessActionId@@', 
			@on_fail_action='@@FailureActionId@@', 
			@retry_attempts=0, 
			@retry_interval=0, 
			@os_run_priority=0, @subsystem='@@SubSystem@@', 
			@command='@@Command@@', 
			@database_name=N'master', 
			@flags=0	
END 
ELSE 
BEGIN
	EXEC msdb.dbo.sp_add_jobstep @job_name='@@JobName@@', @step_name='@@StepName@@', 
			@step_id=@@StepId@@, 
			@cmdexec_success_code=0, 
			@on_success_action='@@SuccessActionId@@', 
			@on_fail_action='@@FailureActionId@@', 
			@retry_attempts=0, 
			@retry_interval=0, 
			@os_run_priority=0, @subsystem='@@SubSystem@@', 
			@command='@@Command@@', 
			@database_name=N'master', 
			@flags=0,
			@proxy_name=N'@@RunAs@@'
END
GO"
                       .Replace("@@JobName@@", jonConfiguration.JobName)
                       .Replace("@@StepName@@", stepConfiguration.StepName)
                       .Replace("@@StepId@@", stepConfiguration.StepId.ToString())
                       .Replace("@@SuccessActionId@@", ((int)stepConfiguration.SuccessAction).ToString())
                       .Replace("@@FailureActionId@@", ((int)stepConfiguration.FailureAction).ToString())
                       .Replace("@@SubSystem@@", stepConfiguration.SubSystem)
                       .Replace("@@Command@@", stepConfiguration.Command)
                       .Replace("@@RunAs@@", stepConfiguration.RunAs);
        }
Esempio n. 10
0
        public void Parse(StepConfiguration stepConfiguration)
        {
            if (string.IsNullOrEmpty(stepConfiguration.StepName))
            {
                throw new JobConfigurationParserException("Step Name is missing from Step Configuration, please check your configuration setup");
            }

            if (string.IsNullOrEmpty(stepConfiguration.Command))
            {
                throw new JobConfigurationParserException("Command is missing from Step Configuration, please check your configuration setup");
            }

            if (stepConfiguration.StepId == 0)
            {
                throw new JobConfigurationParserException("Step Id is missing from Step Configuration, please check your configuration setup");
            }

            if (string.IsNullOrEmpty(stepConfiguration.SubSystem))
            {
                throw new JobConfigurationParserException("Sub System is missing from Step Configuration, please check your configuration setup");
            }

            if (stepConfiguration.SuccessAction == 0)
            {
                throw new JobConfigurationParserException("Success Action is missing from Step Configuration, please check your configuration setup");
            }

            if (stepConfiguration.FailureAction == 0)
            {
                throw new JobConfigurationParserException("Failure Action is missing from Step Configuration, please check your configuration setup");
            }

            if (stepConfiguration.SubSystem == SsisSubSystem.IntegrationServices)
            {
                if (string.IsNullOrEmpty(stepConfiguration.DtsxFile))
                {
                    throw new JobConfigurationParserException("Dtsx File is missing from Step Configuration, please check your configuration setup");
                }

                if (string.IsNullOrEmpty(stepConfiguration.DtsxFileDestination))
                {
                    throw new JobConfigurationParserException("Dtsx File Destination is missing from Step Configuration, please check your configuration setup");
                }
            }
        }
        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));
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Agent"/> class.
        /// </summary>
        /// <param name="config">The config to add metadata to the agent.</param>
        /// <param name="receiver">The receiver on which the agent should listen for messages.</param>
        /// <param name="transformerConfig">The config to create <see cref="ITransformer"/> instances.</param>
        /// <param name="exceptionHandler">The handler to handle failures during the agent execution.</param>
        /// <param name="stepConfiguration">The config to create <see cref="IStep"/> normal & error pipelines.</param>
        /// <param name="journalLogger">The logging implementation to write journal log entries for handled messages.</param>
        internal Agent(
            AgentConfig config,
            IReceiver receiver,
            Transformer transformerConfig,
            IAgentExceptionHandler exceptionHandler,
            StepConfiguration stepConfiguration,
            IJournalLogger journalLogger)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (receiver == null)
            {
                throw new ArgumentNullException(nameof(receiver));
            }

            if (transformerConfig == null)
            {
                throw new ArgumentNullException(nameof(transformerConfig));
            }

            if (exceptionHandler == null)
            {
                throw new ArgumentNullException(nameof(exceptionHandler));
            }

            if (stepConfiguration == null)
            {
                throw new ArgumentNullException(nameof(stepConfiguration));
            }

            _receiver          = receiver;
            _transformerConfig = transformerConfig;
            _exceptionHandler  = exceptionHandler;
            _steps             = new StepExecutioner(stepConfiguration, exceptionHandler);
            _journalLogger     = journalLogger ?? NoopJournalLogger.Instance;

            AgentConfig = config;
        }
Esempio n. 13
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;
 }
        public static Step GetNextStepBySelectionKey(StepConfiguration config, string key)
        {
            KeyValuePair <string, string> nextStep;

            if (config.PotentialNextSteps == null || config.PotentialNextSteps.Count == 0)
            {
                throw new NextStepNotFoundException();
            }

            //Step key is mandatory, multiple next steps.
            if (config.HasMultipleNextStep)
            {
                nextStep = config.PotentialNextSteps.Where(p => p.Key == key).SingleOrDefault();
            }

            else
            {
                nextStep = config.PotentialNextSteps.First();
            }

            var nextStepName = nextStep.Value;

            return(GetStepByName(nextStepName));
        }
 public Step(StepConfiguration configuration)
 {
     this.Id             = StepId.Generate();
     this._configuration = configuration;
 }
Esempio n. 16
0
 public void SetConfiguration(ConfigurationBase configurationBase)
 {
     this.stepConfiguration = configurationBase as StepConfiguration;
 }
Esempio n. 17
0
        internal static async Task <MessagingContext> ExecuteStepsAsync(MessagingContext context, StepConfiguration stepConfig)
        {
            try
            {
                IEnumerable <IStep> steps  = CreateSteps(stepConfig.NormalPipeline);
                StepResult          result = await ExecuteSteps(steps, context);

                bool weHaveAnyUnhappyPath = stepConfig.ErrorPipeline != null;
                if (result.Succeeded == false && weHaveAnyUnhappyPath && result.MessagingContext.Exception == null)
                {
                    IEnumerable <IStep> unhappySteps = CreateSteps(stepConfig.ErrorPipeline);
                    result = await ExecuteSteps(unhappySteps, result.MessagingContext);
                }

                return(result.MessagingContext);
            }
            catch (Exception ex)
            {
                return(new MessagingContext(ex));
            }
        }
Esempio n. 18
0
            public void NonConfigurableStepWithSettingsThrowsConfigurationException()
            {
                StepConfiguration config = CreateInvalidConfigurableStepConfig();

                Assert.Throws <InvalidOperationException>(() => StepBuilder.FromSettings(config.NormalPipeline).BuildAsSingleStep());
            }
Esempio n. 19
0
 public PluginStepRegistration(PluginTypeRegistration pluginTypeRegistration, StepConfiguration configuration)
     : this(pluginTypeRegistration, configuration.SdkMessageNames.ToString(), configuration.PrimaryEntityName, configuration.SecondaryEntityName)
 {
     SdkMessageProcessingStep.FilteringAttributes = configuration.FilteringAttributes;
 }
Esempio n. 20
0
        static StepRegistry()
        {
            OutBoundProcessingConfig =
                new StepConfiguration
            {
                NormalPipeline = new[]
                {
                    new Step {
                        Type = typeof(ValidateSendingPModeStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(CompressAttachmentsStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(SignAS4MessageStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(EncryptAS4MessageStep).AssemblyQualifiedName
                    }
                }
            };

            InBoundProcessingConfig = new StepConfiguration()
            {
                NormalPipeline = new[]
                {
                    new Step {
                        Type = typeof(ValidateAS4MessageStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(DecryptAS4MessageStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(VerifySignatureAS4MessageStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(DecompressAttachmentsStep).AssemblyQualifiedName
                    },
                },
                ErrorPipeline = new[]
                {
                    new Step {
                        Type = typeof(CreateAS4ErrorStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(SignAS4MessageStep).AssemblyQualifiedName
                    }
                }
            };

            ReceiptCreationConfig = new StepConfiguration()
            {
                NormalPipeline = new[]
                {
                    new Step {
                        Type = typeof(CreateAS4ReceiptStep).AssemblyQualifiedName
                    },
                    new Step {
                        Type = typeof(SignAS4MessageStep).AssemblyQualifiedName
                    }
                }
            };
        }
Esempio n. 21
0
 public PluginStepOptionsBuilder AndExecutesOn(StepConfiguration configuration)
 {
     return(PluginTypeOptions.WhichExecutesOn(configuration));
 }