Search in sources :

Example 46 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class UpdateTaskAttachmentsAccTest method modifyExistingAttachment.

@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void modifyExistingAttachment() throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, AttachmentPersistenceException, SQLException {
    setUpMethod();
    // setup test
    assertThat(task.getAttachments().size(), equalTo(0));
    task.addAttachment(attachment);
    Attachment attachment2 = createAttachment(// prio 101, SL PT7H
    "L10303", createObjectReference("COMPANY_B", "SYSTEM_C", "INSTANCE_C", "ArchiveId", "ABC45678901234567890123456789012345678901234567890"), "ROHRPOST", "2018-01-15", createSimpleCustomProperties(4));
    task.addAttachment(attachment2);
    task = taskService.updateTask(task);
    task = taskService.getTask(task.getId());
    assertTrue(task.getPriority() == 101);
    assertTrue(task.getDue().equals(task.getPlanned()));
    assertThat(task.getAttachments().size(), equalTo(2));
    List<Attachment> attachments = task.getAttachments();
    boolean rohrpostFound = false;
    boolean emailFound = false;
    for (Attachment att : attachments) {
        String channel = att.getChannel();
        int custAttSize = att.getCustomAttributes().size();
        if ("ROHRPOST".equals(channel)) {
            rohrpostFound = true;
        } else if ("E-MAIL".equals(channel)) {
            emailFound = true;
        } else {
            fail("unexpected attachment detected " + att);
        }
        assertTrue(("ROHRPOST".equals(channel) && custAttSize == 4) || ("E-MAIL".equals(channel) && custAttSize == 3));
    }
    assertTrue(rohrpostFound && emailFound);
    ClassificationSummary newClassificationSummary = taskanaEngine.getClassificationService().getClassification(// Prio 5, SL P16D
    "CLI:100000000000000000000000000000000006").asSummary();
    // modify existing attachment
    for (Attachment att : task.getAttachments()) {
        att.setClassificationSummary(newClassificationSummary);
        if (att.getCustomAttributes().size() == 3) {
            att.setChannel("FAX");
        }
    }
    // modify existing attachment and task classification
    // Prio 99, SL P2000D
    task.setClassificationKey("DOCTYPE_DEFAULT");
    task = taskService.updateTask(task);
    task = taskService.getTask(task.getId());
    assertTrue(task.getPriority() == 99);
    DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
    long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 16);
    assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays))));
    rohrpostFound = false;
    boolean faxFound = false;
    for (Attachment att : task.getAttachments()) {
        String channel = att.getChannel();
        int custAttSize = att.getCustomAttributes().size();
        if ("FAX".equals(channel)) {
            faxFound = true;
        } else if ("ROHRPOST".equals(channel)) {
            rohrpostFound = true;
        } else {
            fail("unexpected attachment detected " + att);
        }
        assertTrue(("ROHRPOST".equals(channel) && custAttSize == 4) || ("FAX".equals(channel) && custAttSize == 3));
    }
    assertTrue(faxFound && rohrpostFound);
}
Also used : DaysToWorkingDaysConverter(pro.taskana.impl.DaysToWorkingDaysConverter) ClassificationSummary(pro.taskana.ClassificationSummary) Attachment(pro.taskana.Attachment) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 47 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportNotInWorkingDays.

@Test
public void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null, columnHeaders, false);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("EXTERN").getCells();
    assertArrayEquals(new int[] { 23, 0, 2, 0, 8 }, row1);
    int[] row2 = report.getRow("AUTOMATIC").getCells();
    assertArrayEquals(new int[] { 3, 0, 0, 0, 4 }, row2);
    int[] row3 = report.getRow("MANUAL").getCells();
    assertArrayEquals(new int[] { 4, 0, 2, 0, 4 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 48 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportWithCategoryFilter.

@Test
public void testEachItemOfCategoryReportWithCategoryFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CategoryReport report = taskMonitorService.getCategoryReport(null, null, categories, null, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(2, report.rowSize());
    int[] row1 = report.getRow("AUTOMATIC").getCells();
    assertArrayEquals(new int[] { 2, 1, 0, 1, 3 }, row1);
    int[] row2 = report.getRow("MANUAL").getCells();
    assertArrayEquals(new int[] { 2, 2, 2, 0, 4 }, row2);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 49 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method testEachItemOfCategoryReport.

@Test
public void testEachItemOfCategoryReport() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("EXTERN").getCells();
    assertArrayEquals(new int[] { 15, 8, 2, 6, 2 }, row1);
    int[] row2 = report.getRow("AUTOMATIC").getCells();
    assertArrayEquals(new int[] { 2, 1, 0, 1, 3 }, row2);
    int[] row3 = report.getRow("MANUAL").getCells();
    assertArrayEquals(new int[] { 2, 2, 2, 0, 4 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 50 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method getListOfColumnHeaders.

private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
    List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
    columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
    columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
    columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
    columnHeaders.add(new TimeIntervalColumnHeader(-1));
    columnHeaders.add(new TimeIntervalColumnHeader(0));
    columnHeaders.add(new TimeIntervalColumnHeader(1));
    columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
    columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
    columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
    return columnHeaders;
}
Also used : ArrayList(java.util.ArrayList) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader)

Aggregations

TimeIntervalColumnHeader (pro.taskana.impl.report.impl.TimeIntervalColumnHeader)75 Test (org.junit.Test)57 TaskMonitorService (pro.taskana.TaskMonitorService)46 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)46 ArrayList (java.util.ArrayList)25 CustomField (pro.taskana.CustomField)19 DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)13 TaskState (pro.taskana.TaskState)12 DetailedClassificationReport (pro.taskana.impl.report.impl.DetailedClassificationReport)10 CategoryReport (pro.taskana.impl.report.impl.CategoryReport)9 ClassificationReport (pro.taskana.impl.report.impl.ClassificationReport)9 CustomFieldValueReport (pro.taskana.impl.report.impl.CustomFieldValueReport)9 WorkbasketLevelReport (pro.taskana.impl.report.impl.WorkbasketLevelReport)9 DetailedReportRow (pro.taskana.impl.report.impl.DetailedReportRow)8 SelectedItem (pro.taskana.impl.SelectedItem)6 AbstractAccTest (acceptance.AbstractAccTest)4 DaysToWorkingDaysConverter (pro.taskana.impl.DaysToWorkingDaysConverter)4 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)4 WithAccessId (pro.taskana.security.WithAccessId)4 Task (pro.taskana.Task)3