コード例 #1
0
        public virtual void testRestartProcessInstanceSyncWithTenantIdByHistoricProcessInstanceQuery()
        {
            // given
            ProcessInstance processInstance    = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
            HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processDefinitionId(processInstance.ProcessDefinitionId);

            identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE));

            // when
            runtimeService.restartProcessInstances(processInstance.ProcessDefinitionId).startBeforeActivity("userTask").historicProcessInstanceQuery(query).execute();

            // then
            ProcessInstance restartedInstance = runtimeService.createProcessInstanceQuery().active().processDefinitionId(processInstance.ProcessDefinitionId).singleResult();

            assertNotNull(restartedInstance);
            assertEquals(restartedInstance.TenantId, TENANT_ONE);
        }
コード例 #2
0
        public virtual void testFailToRestartProcessInstanceAsyncWithOtherTenantIdByHistoricProcessInstanceQuery()
        {
            // given
            ProcessInstance processInstance    = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
            HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processDefinitionId(processInstance.ProcessDefinitionId);

            identityService.setAuthentication("user", null, Collections.singletonList(TENANT_TWO));

            try
            {
                // when
                runtimeService.restartProcessInstances(processInstance.ProcessDefinitionId).startBeforeActivity("userTask").historicProcessInstanceQuery(query).executeAsync();
            }
            catch (ProcessEngineException e)
            {
                assertThat(e.Message, containsString("processInstanceIds is empty"));
            }
        }
コード例 #3
0
        public virtual void testMigrateHistoryProcessInstance()
        {
            //given
            HistoricProcessInstanceQuery sourceHistoryProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery().processDefinitionId(sourceProcessDefinition.Id);
            HistoricProcessInstanceQuery targetHistoryProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery().processDefinitionId(targetProcessDefinition.Id);


            //when
            assertEquals(1, sourceHistoryProcessInstanceQuery.count());
            assertEquals(0, targetHistoryProcessInstanceQuery.count());
            ProcessInstanceQuery sourceProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(sourceProcessDefinition.Id);

            runtimeService.newMigration(migrationPlan).processInstanceQuery(sourceProcessInstanceQuery).execute();

            //then
            assertEquals(0, sourceHistoryProcessInstanceQuery.count());
            assertEquals(1, targetHistoryProcessInstanceQuery.count());

            HistoricProcessInstance instance = targetHistoryProcessInstanceQuery.singleResult();

            assertEquals(instance.ProcessDefinitionKey, targetProcessDefinition.Key);
        }