Package org.openengsb.core.workflow.api.model

Examples of org.openengsb.core.workflow.api.model.Task


        verify(persistenceService).query(any(Task.class));
    }

    @Test(expected = TaskboxException.class)
    public void testGetTaskForId_shouldThrowExceptionWhenNothingFound() throws Exception {
        Task task = Task.createTaskWithAllValuesSetToNull();
        task.setTaskId("1");
        when(persistenceService.query(any(Task.class))).thenReturn(new ArrayList<Task>());
        service.getTaskForId("1");
    }
View Full Code Here


        service.getTaskForId("1");
    }

    @Test(expected = TaskboxException.class)
    public void testGetTaskForId_shouldThrowExceptionWhenMoreThanOneFound() throws Exception {
        Task task = Task.createTaskWithAllValuesSetToNull();
        task.setTaskId("1");

        List<Task> list = new ArrayList<Task>();
        list.add(task);
        list.add(task);
        when(persistenceService.query(any(Task.class))).thenReturn(list);
View Full Code Here

        service.getTaskForId("1");
    }

    @Test
    public void testFinishTask_shouldProcessEvent() throws Exception {
        Task task = new Task();
        task.setProcessId("1");
        List<Task> result = new ArrayList<Task>();
        result.add(task);
        when(persistenceService.query(any(Task.class))).thenReturn(result);

        service.finishTask(task);
View Full Code Here

        verify(workflowService).processEvent(any(InternalWorkflowEvent.class));
    }

    @Test
    public void testFinishTaskTwice_shouldProcessEventOnlyOnce() throws Exception {
        Task task = new Task();
        task.setProcessId("1");
        List<Task> result = new ArrayList<Task>();
        result.add(task);
        when(persistenceService.query(any(Task.class))).thenReturn(result);
        service.finishTask(task);
View Full Code Here

        verify(workflowService, times(1)).processEvent(any(InternalWorkflowEvent.class));
    }

    @Test
    public void testFinishTask_shouldDeleteAndProcessEvent() throws Exception {
        Task task = new Task();
        task.setProcessId("1");
        List<Task> result = new ArrayList<Task>();
        result.add(task);
        when(persistenceService.query(any(Task.class))).thenReturn(result);

        ProcessBag bag = new ProcessBag(task);
View Full Code Here

        verify(workflowService).processEvent(any(InternalWorkflowEvent.class));
    }

    @Test
    public void testUpdateTask_shouldReturnUpdatedTask() throws Exception {
        Task task = new Task();
        task.setProcessId("1");
        List<Task> result = new ArrayList<Task>();
        result.add(task);
        when(persistenceService.query(any(Task.class))).thenReturn(result);

        Task newTask = Task.createTaskWithAllValuesSetToNull();
        newTask.setTaskId(task.getTaskId());
        newTask.setDescription("test");
        newTask.setProcessId("1");

        service.updateTask(newTask);
        verify(persistenceService).update(task, newTask);
    }
View Full Code Here

        workflowService.startFlowWithParameters("TaskDemoWorkflow", parameterMap);
        assertNotNull(processBag.getProcessId());
        assertThat(taskboxService.getOpenTasks().size(), is(1));

        Task task = taskboxService.getOpenTasks().get(0);
        assertEquals(task.getProcessId(), processBag.getProcessId());
        assertEquals(task.getProperty("test"), "test");
        assertEquals(task.getTaskType(), "demo");
        assertNotNull(task.getTaskId());
        taskboxService.finishTask(task);
        assertTrue(taskboxService.getOpenTasks().size() == 0);
    }
View Full Code Here

        assertThat(taskboxService.getOpenTasks().size(), is(0));
        authenticateAsAdmin();
        workflowService.startFlow("TaskDemoWorkflow");
        assertThat(taskboxService.getOpenTasks().size(), is(1));

        Task task = taskboxService.getOpenTasks().get(0);
        assertNotNull(task.getProcessId());
        assertNotNull(task.getTaskId());

        taskboxService.finishTask(task);
        assertThat(taskboxService.getOpenTasks().size(), is(0));
    }
View Full Code Here

        assertThat(taskboxService.getOpenTasks().size(), is(2));

        assertEquals(taskboxService.getTasksForProcessId(String.valueOf(id)).size(), 1);
        assertEquals(taskboxService.getTasksForProcessId(String.valueOf(id2)).size(), 1);

        Task task1 = taskboxService.getTasksForProcessId(String.valueOf(id)).get(0);
        Task task2 = taskboxService.getTasksForProcessId(String.valueOf(id2)).get(0);

        taskboxService.finishTask(task1);
        assertThat(taskboxService.getOpenTasks().size(), is(1));
        assertEquals(taskboxService.getTasksForProcessId(String.valueOf(id)).size(), 0);
        assertEquals(taskboxService.getTasksForProcessId(String.valueOf(id2)).size(), 1);
View Full Code Here

    @Test
    public void testCompleteWorkflow_humanInteractionShouldReplaceValues() throws Exception {
        addWorkflow("HIDemoWorkflow");
        authenticateAsAdmin();
        workflowService.startFlow("HIDemoWorkflow");
        Task task = taskboxService.getOpenTasks().get(0);
        Date date = new Date();
        task.addOrReplaceProperty("test", date);
        assertEquals("step1", task.getTaskType());

        task.setName("test");
        taskboxService.updateTask(task);
        task = taskboxService.getOpenTasks().get(0);
        assertEquals("test", task.getName());

        taskboxService.finishTask(task);

        task = taskboxService.getOpenTasks().get(0);
        assertEquals(date, task.getProperty("test"));
        assertEquals("step2", task.getTaskType());

        taskboxService.finishTask(task);
        assertThat(taskboxService.getOpenTasks().size(), is(0));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.workflow.api.model.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.