Пример #1
0
        public virtual void testQueryJobOperations()
        {
            // given
            process = runtimeService.startProcessInstanceByKey("process");

            // when
            managementService.suspendJobDefinitionByProcessDefinitionId(process.ProcessDefinitionId);
            managementService.activateJobDefinitionByProcessDefinitionId(process.ProcessDefinitionId);
            managementService.suspendJobByProcessInstanceId(process.Id);
            managementService.activateJobByProcessInstanceId(process.Id);

            // then
            assertEquals(2, query().entityType(JOB_DEFINITION).count());
            assertEquals(2, query().entityType(JOB).count());

            // active job definition
            UserOperationLogEntry activeJobDefinitionEntry = query().entityType(JOB_DEFINITION).processDefinitionId(process.ProcessDefinitionId).operationType(OPERATION_TYPE_ACTIVATE_JOB_DEFINITION).singleResult();

            assertNotNull(activeJobDefinitionEntry);
            assertEquals(process.ProcessDefinitionId, activeJobDefinitionEntry.ProcessDefinitionId);

            assertEquals("suspensionState", activeJobDefinitionEntry.Property);
            assertEquals("active", activeJobDefinitionEntry.NewValue);
            assertNull(activeJobDefinitionEntry.OrgValue);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, activeJobDefinitionEntry.Category);

            // active job
            UserOperationLogEntry activateJobIdEntry = query().entityType(JOB).processInstanceId(process.ProcessInstanceId).operationType(OPERATION_TYPE_ACTIVATE_JOB).singleResult();

            assertNotNull(activateJobIdEntry);
            assertEquals(process.ProcessInstanceId, activateJobIdEntry.ProcessInstanceId);

            assertEquals("suspensionState", activateJobIdEntry.Property);
            assertEquals("active", activateJobIdEntry.NewValue);
            assertNull(activateJobIdEntry.OrgValue);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, activateJobIdEntry.Category);

            // suspended job definition
            UserOperationLogEntry suspendJobDefinitionEntry = query().entityType(JOB_DEFINITION).processDefinitionId(process.ProcessDefinitionId).operationType(OPERATION_TYPE_SUSPEND_JOB_DEFINITION).singleResult();

            assertNotNull(suspendJobDefinitionEntry);
            assertEquals(process.ProcessDefinitionId, suspendJobDefinitionEntry.ProcessDefinitionId);

            assertEquals("suspensionState", suspendJobDefinitionEntry.Property);
            assertEquals("suspended", suspendJobDefinitionEntry.NewValue);
            assertNull(suspendJobDefinitionEntry.OrgValue);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, suspendJobDefinitionEntry.Category);

            // suspended job
            UserOperationLogEntry suspendedJobEntry = query().entityType(JOB).processInstanceId(process.ProcessInstanceId).operationType(OPERATION_TYPE_SUSPEND_JOB).singleResult();

            assertNotNull(suspendedJobEntry);
            assertEquals(process.ProcessInstanceId, suspendedJobEntry.ProcessInstanceId);

            assertEquals("suspensionState", suspendedJobEntry.Property);
            assertEquals("suspended", suspendedJobEntry.NewValue);
            assertNull(suspendedJobEntry.OrgValue);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, suspendedJobEntry.Category);
        }
Пример #2
0
        public virtual void testQueryJobOperations()
        {
            // given
            process = runtimeService.startProcessInstanceByKey("process");

            // when
            managementService.suspendJobDefinitionByProcessDefinitionId(process.ProcessDefinitionId);
            managementService.activateJobDefinitionByProcessDefinitionId(process.ProcessDefinitionId);
            managementService.suspendJobByProcessInstanceId(process.Id);
            managementService.activateJobByProcessInstanceId(process.Id);

            // then
            assertEquals(0, query().entityType(JOB_DEFINITION).count());
            assertEquals(0, query().entityType(JOB).count());
        }