Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeleteProcessDefinitionCascade()
        public virtual void testDeleteProcessDefinitionCascade()
        {
            // given process definition and a process instance
            BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().userTask().endEvent().done();

            testHelper.deploy(bpmnModel);

            ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult();

            runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).executeWithVariablesInReturn();

            authRule.init(scenario).withUser("userId").start();

            //when the corresponding process definition is cascading deleted from the deployment
            repositoryService.deleteProcessDefinition(processDefinition.Id, true);

            //then exist no process instance and no definition
            if (authRule.assertScenario(scenario))
            {
                assertEquals(0, runtimeService.createProcessInstanceQuery().count());
                assertEquals(0, repositoryService.createProcessDefinitionQuery().count());
                if (processEngineConfiguration.HistoryLevel.Id >= org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_ACTIVITY.Id)
                {
                    assertEquals(0, engineRule.HistoryService.createHistoricActivityInstanceQuery().count());
                }
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("deprecation") protected org.camunda.bpm.engine.externaltask.ExternalTask startProcessInstanceAndFailExternalTask(String tenant)
        protected internal virtual ExternalTask startProcessInstanceAndFailExternalTask(string tenant)
        {
            ProcessInstance pi           = runtimeService.createProcessInstanceByKey(DEFAULT_PROCESS_KEY).processDefinitionTenantId(tenant).execute();
            ExternalTask    externalTask = externalTaskService.createExternalTaskQuery().processInstanceId(pi.Id).singleResult();

            reportExternalTaskFailure(externalTask.Id);
            return(externalTask);
        }
Пример #3
0
        // helper //////////////////////////////////////////////////////////

        protected internal virtual string startProcessInstance(string tenantId)
        {
            if (string.ReferenceEquals(tenantId, null))
            {
                return(runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY).Id);
            }
            else
            {
                return(runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(tenantId).execute().Id);
            }
        }
Пример #4
0
 protected internal virtual void startProcessInstance(CommandContext commandContext, string tenantId, ProcessDefinition processDefinition)
 {
     if (!processDefinition.Suspended)
     {
         RuntimeService runtimeService = commandContext.ProcessEngineConfiguration.RuntimeService;
         runtimeService.createProcessInstanceByKey(processDefinition.Key).processDefinitionTenantId(tenantId).execute();
     }
     else
     {
         LOG.ignoringSuspendedJob(processDefinition);
     }
 }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void decisionRefVersionTagBinding()
        public virtual void decisionRefVersionTagBinding()
        {
            // given
            testRule.deploy(DECISION_VERSION_TAG_OKAY_DMN);
            testRule.deploy(BPMN_VERSION_TAG_BINDING);

            // when
            ProcessInstance processInstance = runtimeService.createProcessInstanceByKey("process").setVariable("status", "gold").execute();

            // then
            assertEquals("A", getDecisionResult(processInstance));
        }
Пример #6
0
        protected internal virtual void prepareProcessInstances(string key, int daysInThePast, int?historyTimeToLive, int instanceCount, string tenantId)
        {
            IList <ProcessDefinition> processDefinitions = null;

            if (string.ReferenceEquals(tenantId, null))
            {
                processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).withoutTenantId().list();
            }
            else
            {
                processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).tenantIdIn(tenantId).list();
            }
            assertEquals(1, processDefinitions.Count);
            repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinitions[0].Id, historyTimeToLive);

            DateTime oldCurrentTime = ClockUtil.CurrentTime;

            ClockUtil.CurrentTime = DateUtils.addDays(oldCurrentTime, daysInThePast);

            IList <string> processInstanceIds = new List <string>();

            {
                for (int i = 0; i < instanceCount; i++)
                {
                    string processInstanceId = null;
                    if (string.ReferenceEquals(tenantId, null))
                    {
                        processInstanceId = runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().execute().Id;
                    }
                    else
                    {
                        processInstanceId = runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(tenantId).execute().Id;
                    }
                    processInstanceIds.Add(processInstanceId);
                }
            }
            runtimeService.deleteProcessInstances(processInstanceIds, null, true, true);

            ClockUtil.CurrentTime = oldCurrentTime;
        }
Пример #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPointToItselfByStartingAtActivity()
        public virtual void shouldPointToItselfByStartingAtActivity()
        {
            // given
            testRule.deploy(CALLED_PROCESS);

            // when
            ProcessInstance processInstance = runtimeService.createProcessInstanceByKey(CALLED_PROCESS_KEY).startAfterActivity("userTask").execute();

            // assume
            assertThat(processInstance.RootProcessInstanceId, notNullValue());

            // then
            assertThat(processInstance.RootProcessInstanceId, @is(processInstance.ProcessInstanceId));
        }
Пример #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeleteProcessDefinitionWithProcessInstance()
        public virtual void testDeleteProcessDefinitionWithProcessInstance()
        {
            // given process definition and a process instance
            BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done();

            deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", bpmnModel).deploy();
            ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult();

            runtimeService.createProcessInstanceByKey("process").executeWithVariablesInReturn();

            //when the corresponding process definition is deleted from the deployment
            try
            {
                repositoryService.deleteProcessDefinition(processDefinition.Id);
                fail("Should fail, since there exists a process instance");
            }
            catch (ProcessEngineException pee)
            {
                // then Exception is expected, the deletion should fail since there exist a process instance
                // and the cascade flag is per default false
                assertTrue(pee.Message.contains("Deletion of process definition without cascading failed."));
            }
            assertEquals(1, repositoryService.createProcessDefinitionQuery().count());
        }
Пример #9
0
        public virtual void testStartProcessAtActivityOperationId()
        {
            // given
            identityService.AuthenticatedUserId = "demo";

            // when
            ProcessInstance pi = runtimeService.createProcessInstanceByKey(PROCESS_KEY).startBeforeActivity("theTask").setVariables(Variables).execute();

            //then
            IList <UserOperationLogEntry> userOperationLogEntries = historyService.createUserOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE).processInstanceId(pi.Id).list();
            IList <HistoricDetail>        historicDetails         = historyService.createHistoricDetailQuery().list();

            assertFalse(userOperationLogEntries.Count == 0);
            assertFalse(historicDetails.Count == 0);
            verifySameOperationId(userOperationLogEntries, historicDetails);
        }
Пример #10
0
        // helper //////////////////////////////////////////////////////////

        protected internal virtual string startAndCompleteProcessInstance(string tenantId)
        {
            string processInstanceId = null;

            if (string.ReferenceEquals(tenantId, null))
            {
                processInstanceId = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY).Id;
            }
            else
            {
                processInstanceId = runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(tenantId).execute().Id;
            }

            addToCalendar(DateTime.MONTH, 5);

            Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();

            taskService.complete(task.Id);

            return(processInstanceId);
        }
Пример #11
0
 protected internal virtual string startProcess(string processDefinitionKey, string activity)
 {
     return(runtimeService.createProcessInstanceByKey(processDefinitionKey).startBeforeActivity(activity).execute().Id);
 }
Пример #12
0
 protected internal virtual ProcessInstance startProcessInstanceForTenant(string tenant)
 {
     return(runtimeService.createProcessInstanceByKey("testProcess").processDefinitionTenantId(tenant).execute());
 }