Пример #1
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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        public TestOutcome CreateRequest()
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Request";
            outcome.methodName = "RequestCreateJob";
            try
            {
                RequestsApi requestsApi = new RequestsApi(_url);
                Request     request     = RequestGenerator.GetSimpleRequest();
                JobReport   job         = requestsApi.RequestCreateJob(_session.SessionId, "all", request);

                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);
            }
        }
Пример #4
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);
            }
        }