Exemplo n.º 1
0
        public TestOutcome UpdateTask(string path)
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskEdit";
            try
            {
                TasksApi tasksApi          = new TasksApi(_url);
                IO.Swagger.Model.Task task = tasksApi.TaskFind(_session.SessionId, path);
                task.Rows[0].Values["conc"] = "55";
                JobReport job       = tasksApi.TaskEdit(_session.SessionId, path, task);
                JobReport polledJob = JobHandler.pollJob(job, _session.SessionId, _url);

                if (polledJob.ErrorMessage != null)
                {
                    outcome.outcome = polledJob.ErrorMessage;
                }
                else
                {
                    outcome.outcome = "Success";
                }
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Exemplo n.º 2
0
        public TestOutcome CreateHierarchicalTask()
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskCreate(Hierarchical)";
            try
            {
                TasksApi tasksApi               = new TasksApi(_url);
                IO.Swagger.Model.Task task      = TaskGenerator.GetHierarchicalTask();
                JobReport             job       = tasksApi.TaskCreate(_session.SessionId, "all", task);
                JobReport             polledJob = JobHandler.pollJob(job, _session.SessionId, _url);

                if (polledJob.ErrorMessage != null)
                {
                    outcome.outcome = polledJob.ErrorMessage;
                }
                else
                {
                    outcome.outcome = "Success";
                }
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Exemplo n.º 3
0
        public TestOutcome GetTaskNoRows(string path)
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskFind(norows)";
            try
            {
                TasksApi tasksApi          = new TasksApi(_url);
                IO.Swagger.Model.Task task = tasksApi.TaskFind(_session.SessionId, path, true);
                Console.WriteLine(task.ProcessPath);
                outcome.outcome = "Success";
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Exemplo n.º 4
0
        public TestOutcome GetTaskById(int taskid)
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskGet";
            try
            {
                TasksApi tasksApi          = new TasksApi(_url);
                IO.Swagger.Model.Task task = tasksApi.TaskGet(_session.SessionId, taskid.ToString());
                Console.WriteLine(task.ProcessPath);
                outcome.outcome = "Success";
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Exemplo n.º 5
0
        public static IO.Swagger.Model.Task GetFlatTask()
        {
            Guid   g      = Guid.NewGuid();
            string suffix = g.ToString().Replace('-', '_');

            //get a context
            //TasksApi tasksApi = new TasksApi(url);
            IO.Swagger.Model.Task task = new IO.Swagger.Model.Task(Name: "BRFlatTask" + suffix,
                                                                   Description: "A task with one row",
                                                                   StateName: "pending",
                                                                   ElementTypeName: "ResultTask",
                                                                   ProcessPath: "main/flat:1",
                                                                   MembershipPath: "all/support",
                                                                   StartedAt: new DateTime(2025, 4, 4),
                                                                   ExpectedAt: new DateTime(2026, 6, 4),
                                                                   CustomProperties: null,
                                                                   Rows: null
                                                                   );
            task.Rows = GetFlatRows();
            return(task);
        }
Exemplo n.º 6
0
        public TestOutcome DestroyTask(string filterstring)
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskDestroy";
            try
            {
                TasksApi tasksApi               = new TasksApi(_url);
                IO.Swagger.Model.Task task      = TaskGenerator.GetFlatTask();
                JobReport             job       = tasksApi.TaskCreate(_session.SessionId, "all", task);
                JobReport             polledJob = JobHandler.pollJob(job, _session.SessionId, _url);
                FolderArray           tasks     = tasksApi.TaskSearch(_session.SessionId, "", true, 100, FilterGenerator.SimpleFilter("tasks.name", "like", filterstring + "%"));
                tasksApi.TaskDestroy(_session.SessionId, tasks[0].ReferenceId);
                outcome.outcome = "Success";
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }