Example #1
0
        public static void CreateTask(ProjectWrapper projectWrapper, PackageWrapper packageWrapper, ContainerWrapper containerWrapper,
                                      IonStructure.Task task, List <ScriptProject> globalScriptProjects, ScriptProject referencedGlobalScriptProject = null)
        {
            try
            {
                ExecutableWrapper executableWrapper = null;

                switch (task)
                {
                case DataFlow dataFlow:
                    DataFlowTask dataFlowTask = new DataFlowTask(dataFlow, projectWrapper, packageWrapper, containerWrapper);
                    executableWrapper = dataFlowTask.DataFlowTaskWrapper;
                    break;

                case ExecuteSql executeSql:
                    ExecuteSqlTask executeSqlTask = new ExecuteSqlTask(executeSql, containerWrapper);
                    executableWrapper = executeSqlTask.ExecuteSqlTaskWrapper;
                    break;

                case ExecuteProcess executeProcess:
                    executableWrapper = ExecuteProcessTask.CreateTask(executeProcess, containerWrapper);
                    break;

                case Expression expression:
                    executableWrapper = ExpressionTask.CreateTask(expression, containerWrapper);
                    break;

                case Script script:
                    ScriptTask scriptTask = new ScriptTask(script, projectWrapper, packageWrapper, containerWrapper, referencedGlobalScriptProject);
                    executableWrapper = scriptTask.ScriptTaskWrapper;
                    break;

                case ForLoopContainer forLoopContainer:
                    executableWrapper = ContainerExecutable.CreateForLoopContainer(forLoopContainer, projectWrapper, packageWrapper, containerWrapper, globalScriptProjects);
                    break;

                case ForEachFromVariableLoopContainer forEachFromVarLoopContainer:
                    executableWrapper = ContainerExecutable.CreateForEachFromVariableLoopContainer(forEachFromVarLoopContainer, projectWrapper, packageWrapper, containerWrapper, globalScriptProjects);
                    break;

                case SequenceContainer sequenceContainer:
                    executableWrapper = ContainerExecutable.CreateSequenceContainer(sequenceContainer, projectWrapper, packageWrapper, containerWrapper, globalScriptProjects);
                    break;
                }

                AddPrecedenceConstraints(containerWrapper, executableWrapper, task.PrecedenceConstraints);
            }
            catch (Exception e)
            {
                if (e.Data[Constants.ExceptionTaskKey] == null)
                {
                    e.Data[Constants.ExceptionTaskKey] = task.Name;
                }
                else
                {
                    e.Data[Constants.ExceptionTaskKey] = task.Name + "/" + e.Data[Constants.ExceptionTaskKey];                     // If task is not null then the task being created is a container, and an exception has been thrown in one of its underlying tasks.
                }
                throw;
            }
        }
Example #2
0
        public void VerifyingInvalidProcessShouldThrow()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(InvalidProcess);

            var task = new ExecuteProcessTask(startInfo);

            task.Invoking(t => t.Verify(this.Context)).ShouldThrow <FileNotFoundException>();
        }
Example #3
0
        public void ExecuteInvalidProcessShouldThrow()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(InvalidProcess);

            var task = new ExecuteProcessTask(startInfo);

            task.Invoking(t => t.Execute(this.Context)).ShouldThrow <Win32Exception>();
        }
Example #4
0
        public void ExecuteValidProcessShouldNotThrow()
        {
            var task = new ExecuteProcessTask(this.validStartInfo);

            task.Invoking(t => t.Execute(this.Context)).ShouldNotThrow();
        }
Example #5
0
        public void ExecuteValidProcessShouldNotThrow()
        {
            var task = new ExecuteProcessTask(this.validStartInfo);

            task.Invoking(t => t.Execute(this.Context)).ShouldNotThrow();
        }
Example #6
0
        public void ExecuteInvalidProcessShouldThrow()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(InvalidProcess);

            var task = new ExecuteProcessTask(startInfo);

            task.Invoking(t => t.Execute(this.Context)).ShouldThrow<Win32Exception>();
        }
Example #7
0
        public void VerifyingInvalidProcessShouldThrow()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(InvalidProcess);

            var task = new ExecuteProcessTask(startInfo);

            task.Invoking(t => t.Verify(this.Context)).ShouldThrow<FileNotFoundException>();
        }