예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCustomIncidentMigrationWithoutConfiguration()
        public virtual void testCustomIncidentMigrationWithoutConfiguration()
        {
            // given
            RuntimeService    runtimeService = engineRule.RuntimeService;
            BpmnModelInstance instance1      = Bpmn.createExecutableProcess("process1").startEvent().userTask("u1").endEvent().done();
            BpmnModelInstance instance2      = Bpmn.createExecutableProcess("process2").startEvent().userTask("u2").endEvent().done();

            testHelper.deploy(instance1, instance2);

            ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("process1");
            ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("process2");

            MigrationPlan migrationPlan = runtimeService.createMigrationPlan(processInstance1.ProcessDefinitionId, processInstance2.ProcessDefinitionId).mapActivities("u1", "u2").build();

            runtimeService.createIncident("custom", processInstance1.Id, null);

            // when
            runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance1.Id).execute();

            // then
            Incident incident = runtimeService.createIncidentQuery().singleResult();

            assertEquals(processInstance2.ProcessDefinitionId, incident.ProcessDefinitionId);
            assertEquals("custom", incident.IncidentType);
            assertEquals(processInstance1.Id, incident.ExecutionId);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogIncidentCreation()
        public virtual void shouldLogIncidentCreation()
        {
            // given
            testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");

            assertEquals(0, historyService.createUserOperationLogQuery().count());

            // when
            identityService.AuthenticatedUserId = "userId";
            Incident incident = runtimeService.createIncident("foo", processInstance.Id, "aa", "bar");

            identityService.clearAuthentication();

            // then
            assertEquals(2, historyService.createUserOperationLogQuery().count());

            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().property("incidentType").singleResult();

            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE_INCIDENT, entry.OperationType);
            assertEquals(EntityTypes.PROCESS_INSTANCE, entry.EntityType);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, entry.Category);
            assertNull(entry.OrgValue);
            assertEquals("foo", entry.NewValue);
            assertNull(entry.ExecutionId);
            assertEquals(processInstance.Id, entry.ProcessInstanceId);
            assertEquals(processInstance.ProcessDefinitionId, entry.ProcessDefinitionId);
            assertEquals("Process", entry.ProcessDefinitionKey);

            entry = historyService.createUserOperationLogQuery().property("configuration").singleResult();
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE_INCIDENT, entry.OperationType);
            assertEquals(EntityTypes.PROCESS_INSTANCE, entry.EntityType);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, entry.Category);
            assertNull(entry.OrgValue);
            assertEquals(incident.Configuration, entry.NewValue);
            assertNull(entry.ExecutionId);
            assertEquals(processInstance.Id, entry.ProcessInstanceId);
            assertEquals(processInstance.ProcessDefinitionId, entry.ProcessDefinitionId);
            assertEquals("Process", entry.ProcessDefinitionKey);
        }