Search in sources :

Example 31 with Deployment

use of org.activiti.engine.test.Deployment in project Activiti by Activiti.

the class ManagementServiceTest method testDeleteJobDeletion.

@Deployment(resources = { "org/activiti/engine/test/api/mgmt/timerOnTask.bpmn20.xml" })
public void testDeleteJobDeletion() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("timerOnTask");
    Job timerJob = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull("Task timer should be there", timerJob);
    managementService.deleteJob(timerJob.getId());
    timerJob = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNull("There should be no job now. It was deleted", timerJob);
}
Also used : ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Job(org.activiti.engine.runtime.Job) Deployment(org.activiti.engine.test.Deployment)

Example 32 with Deployment

use of org.activiti.engine.test.Deployment in project Activiti by Activiti.

the class ManagementServiceTest method testSetJobRetries.

@Deployment(resources = { "org/activiti/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml" })
public void testSetJobRetries() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exceptionInJobExecution");
    // The execution is waiting in the first usertask. This contains a boundary
    // timer event.
    Job timerJob = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
    Date duedate = timerJob.getDuedate();
    assertNotNull("No job found for process instance", timerJob);
    assertEquals(JobEntity.DEFAULT_RETRIES, timerJob.getRetries());
    managementService.setJobRetries(timerJob.getId(), 5);
    timerJob = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals(5, timerJob.getRetries());
    assertEquals(duedate, timerJob.getDuedate());
}
Also used : ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Job(org.activiti.engine.runtime.Job) Date(java.util.Date) Deployment(org.activiti.engine.test.Deployment)

Example 33 with Deployment

use of org.activiti.engine.test.Deployment in project Activiti by Activiti.

the class EventSubscriptionQueryTest method testQueryByExecutionId.

@Deployment
public void testQueryByExecutionId() {
    // starting two instances:
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("catchSignal");
    runtimeService.startProcessInstanceByKey("catchSignal");
    // test query by process instance id
    EventSubscriptionEntity subscription = newEventSubscriptionQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(subscription);
    Execution executionWaitingForSignal = runtimeService.createExecutionQuery().activityId("signalEvent").processInstanceId(processInstance.getId()).singleResult();
    // test query by execution id
    EventSubscriptionEntity signalSubscription = newEventSubscriptionQuery().executionId(executionWaitingForSignal.getId()).singleResult();
    assertNotNull(signalSubscription);
    assertEquals(signalSubscription, subscription);
    cleanDb();
}
Also used : Execution(org.activiti.engine.runtime.Execution) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) MessageEventSubscriptionEntity(org.activiti.engine.impl.persistence.entity.MessageEventSubscriptionEntity) SignalEventSubscriptionEntity(org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity) EventSubscriptionEntity(org.activiti.engine.impl.persistence.entity.EventSubscriptionEntity) Deployment(org.activiti.engine.test.Deployment)

Example 34 with Deployment

use of org.activiti.engine.test.Deployment in project Activiti by Activiti.

the class ProcessInstanceIdentityLinkTest method testSetAuthenticatedUserAndCompleteLastTask.

// Test specific for fix introduced by https://activiti.atlassian.net/browse/ACT-1591
// (Referential integrity constraint violation on PROC_INST and IDENTITY_LINK)
@Deployment
public void testSetAuthenticatedUserAndCompleteLastTask() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("identityLinktest");
    // There are two tasks
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    identityService.setAuthenticatedUserId("kermit");
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    identityService.setAuthenticatedUserId(null);
    assertProcessEnded(processInstance.getId());
}
Also used : Task(org.activiti.engine.task.Task) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 35 with Deployment

use of org.activiti.engine.test.Deployment in project Activiti by Activiti.

the class ProcessInstanceIdentityLinkTest method testSetAuthenticatedUserWithNoWaitStates.

// Test specific for fix introduced by https://activiti.atlassian.net/browse/ACT-1591
// (Referential integrity constraint violation on PROC_INST and IDENTITY_LINK)
@Deployment
public void testSetAuthenticatedUserWithNoWaitStates() {
    identityService.setAuthenticatedUserId("kermit");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("identityLinktest");
    assertProcessEnded(processInstance.getId());
    identityService.setAuthenticatedUserId(null);
}
Also used : ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Aggregations

Deployment (org.activiti.engine.test.Deployment)1020 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)709 Task (org.activiti.engine.task.Task)469 HashMap (java.util.HashMap)267 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)180 Execution (org.activiti.engine.runtime.Execution)106 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)87 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)84 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)83 Date (java.util.Date)82 Job (org.activiti.engine.runtime.Job)76 JsonNode (com.fasterxml.jackson.databind.JsonNode)66 Calendar (java.util.Calendar)54 StringEntity (org.apache.http.entity.StringEntity)50 HttpGet (org.apache.http.client.methods.HttpGet)49 ActivitiException (org.activiti.engine.ActivitiException)46 DelegateTask (org.activiti.engine.delegate.DelegateTask)40 ArrayList (java.util.ArrayList)39 HistoricActivityInstance (org.activiti.engine.history.HistoricActivityInstance)30 TaskQuery (org.activiti.engine.task.TaskQuery)29