public virtual void testQueryProcessInstanceOperationsById() { // given process = runtimeService.startProcessInstanceByKey("oneTaskProcess"); // when runtimeService.suspendProcessInstanceById(process.Id); runtimeService.activateProcessInstanceById(process.Id); runtimeService.deleteProcessInstance(process.Id, "a delete reason"); // then assertEquals(4, query().entityType(PROCESS_INSTANCE).count()); UserOperationLogEntry deleteEntry = query().entityType(PROCESS_INSTANCE).processInstanceId(process.Id).operationType(OPERATION_TYPE_DELETE).singleResult(); assertNotNull(deleteEntry); assertEquals(process.Id, deleteEntry.ProcessInstanceId); assertNotNull(deleteEntry.ProcessDefinitionId); assertEquals("oneTaskProcess", deleteEntry.ProcessDefinitionKey); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, deleteEntry.Category); UserOperationLogEntry suspendEntry = query().entityType(PROCESS_INSTANCE).processInstanceId(process.Id).operationType(OPERATION_TYPE_SUSPEND).singleResult(); assertNotNull(suspendEntry); assertEquals(process.Id, suspendEntry.ProcessInstanceId); assertNotNull(suspendEntry.ProcessDefinitionId); assertEquals("oneTaskProcess", suspendEntry.ProcessDefinitionKey); assertEquals("suspensionState", suspendEntry.Property); assertEquals("suspended", suspendEntry.NewValue); assertNull(suspendEntry.OrgValue); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, suspendEntry.Category); UserOperationLogEntry activateEntry = query().entityType(PROCESS_INSTANCE).processInstanceId(process.Id).operationType(OPERATION_TYPE_ACTIVATE).singleResult(); assertNotNull(activateEntry); assertEquals(process.Id, activateEntry.ProcessInstanceId); assertNotNull(activateEntry.ProcessDefinitionId); assertEquals("oneTaskProcess", activateEntry.ProcessDefinitionKey); assertEquals("suspensionState", activateEntry.Property); assertEquals("active", activateEntry.NewValue); assertNull(activateEntry.OrgValue); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, activateEntry.Category); }