Search in sources :

Example 1 with TaskInformation

use of com.evolveum.midpoint.schema.util.task.TaskInformation in project midpoint by Evolveum.

the class TestMiscTasks method test110DeleteReportDataAgain.

/**
 * MID-7277
 */
@Test
public void test110DeleteReportDataAgain() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    when();
    suspendAndDeleteTasks(TASK_DELETE_REPORT_DATA.oid);
    addTask(TASK_DELETE_REPORT_DATA, result);
    waitForTaskCloseOrSuspend(TASK_DELETE_REPORT_DATA.oid, 10000);
    then();
    TaskType taskAfter = assertTask(TASK_DELETE_REPORT_DATA.oid, "after").display().assertSuccess().assertClosed().assertProgress(0).getObjectable();
    TaskInformation information = TaskInformation.createForTask(taskAfter, taskAfter);
    assertThat(information).isInstanceOf(ActivityBasedTaskInformation.class);
    assertThat(information.getProgressDescriptionShort()).as("progress description").isEqualTo("0");
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ActivityBasedTaskInformation(com.evolveum.midpoint.schema.util.task.ActivityBasedTaskInformation) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

Example 2 with TaskInformation

use of com.evolveum.midpoint.schema.util.task.TaskInformation in project midpoint by Evolveum.

the class TestMiscTasks method test100DeleteReportData.

/**
 * MID-7277
 */
@Test
public void test100DeleteReportData() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    ReportDataType reportData = new ReportDataType(PrismContext.get()).name("waste data");
    repoAddObject(reportData.asPrismObject(), result);
    when();
    addTask(TASK_DELETE_REPORT_DATA, result);
    waitForTaskCloseOrSuspend(TASK_DELETE_REPORT_DATA.oid, 10000);
    then();
    TaskType taskAfter = assertTask(TASK_DELETE_REPORT_DATA.oid, "after").display().assertSuccess().assertClosed().assertProgress(1).getObjectable();
    TaskInformation information = TaskInformation.createForTask(taskAfter, taskAfter);
    assertThat(information).isInstanceOf(ActivityBasedTaskInformation.class);
    assertThat(information.getProgressDescriptionShort()).as("progress description").isEqualTo("100.0%");
    assertNoRepoObject(ReportDataType.class, reportData.getOid());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ActivityBasedTaskInformation(com.evolveum.midpoint.schema.util.task.ActivityBasedTaskInformation) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ReportDataType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportDataType) Test(org.testng.annotations.Test) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

Example 3 with TaskInformation

use of com.evolveum.midpoint.schema.util.task.TaskInformation in project midpoint by Evolveum.

the class TaskTablePanel method createTaskStatusIconColumn.

private IconColumn<SelectableBean<TaskType>> createTaskStatusIconColumn() {
    return new IconColumn<>(createStringResource("pageTasks.task.status"), TaskType.F_RESULT_STATUS.getLocalPart()) {

        @Override
        protected DisplayType getIconDisplayType(final IModel<SelectableBean<TaskType>> rowModel) {
            TaskInformation taskInformation = getAttachedTaskInformation(rowModel.getObject());
            OperationResultStatusType status = taskInformation.getResultStatus();
            String icon = OperationResultStatusPresentationProperties.parseOperationalResultStatus(status).getIcon() + " fa-lg";
            String title = createStringResource(status).getString();
            return GuiDisplayTypeUtil.createDisplayType(icon, "", title);
        }
    };
}
Also used : IModel(org.apache.wicket.model.IModel) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn)

Example 4 with TaskInformation

use of com.evolveum.midpoint.schema.util.task.TaskInformation in project midpoint by Evolveum.

the class TaskTablePanel method createNodesColumn.

private AbstractColumn<SelectableBean<TaskType>, String> createNodesColumn() {
    return new AbstractColumn<>(createStringResource("pageTasks.task.executingAt")) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<TaskType>>> cellItem, String componentId, IModel<SelectableBean<TaskType>> rowModel) {
            TaskInformation taskInformation = getAttachedTaskInformation(rowModel.getObject());
            cellItem.add(new Label(componentId, taskInformation.getNodesDescription()));
        }
    };
}
Also used : ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IModel(org.apache.wicket.model.IModel) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) Label(org.apache.wicket.markup.html.basic.Label) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)

Example 5 with TaskInformation

use of com.evolveum.midpoint.schema.util.task.TaskInformation in project midpoint by Evolveum.

the class TaskTablePanel method createErrorsColumn.

private AbstractColumn<SelectableBean<TaskType>, String> createErrorsColumn() {
    return new AbstractColumn<>(createStringResource("pageTasks.task.errors")) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<TaskType>>> cellItem, String componentId, IModel<SelectableBean<TaskType>> rowModel) {
            TaskInformation taskInformation = getAttachedTaskInformation(rowModel.getObject());
            cellItem.add(new Label(componentId, taskInformation.getAllErrors()));
        }
    };
}
Also used : ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IModel(org.apache.wicket.model.IModel) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) Label(org.apache.wicket.markup.html.basic.Label) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)

Aggregations

TaskInformation (com.evolveum.midpoint.schema.util.task.TaskInformation)5 IModel (org.apache.wicket.model.IModel)3 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 ActivityBasedTaskInformation (com.evolveum.midpoint.schema.util.task.ActivityBasedTaskInformation)2 Task (com.evolveum.midpoint.task.api.Task)2 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)2 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)2 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)2 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)2 AbstractColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)2 Label (org.apache.wicket.markup.html.basic.Label)2 Item (org.apache.wicket.markup.repeater.Item)2 Test (org.testng.annotations.Test)2 IconColumn (com.evolveum.midpoint.web.component.data.column.IconColumn)1 ReportDataType (com.evolveum.midpoint.xml.ns._public.common.common_3.ReportDataType)1