本文整理汇总了Java中org.camunda.bpm.engine.runtime.Execution类的典型用法代码示例。如果您正苦于以下问题:Java Execution类的具体用法?Java Execution怎么用?Java Execution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Execution类属于org.camunda.bpm.engine.runtime包,在下文中一共展示了Execution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTriggerCondition
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/ConditionalIntermediateEventTest.bpmn"})
public void testTriggerCondition() {
when(scenario.waitsAtConditionalIntermediateEvent("ConditionalIntermediateEvent")).thenReturn(new ConditionalIntermediateEventAction() {
@Override
public void execute(ProcessInstanceDelegate processInstance) {
Execution execution = rule.getRuntimeService().createExecutionQuery().processInstanceId(processInstance.getId()).activityId("ConditionalIntermediateEvent").singleResult();
rule.getRuntimeService().signal(execution.getId()); // not encouraged for conditional events, but possible and tested here...
}
});
Scenario.run(scenario).startByKey("ConditionalIntermediateEventTest", variables).execute();
verify(scenario, times(1)).hasFinished("ConditionalIntermediateEvent");
verify(scenario, times(1)).hasFinished("EndEvent");
}
示例2: testCatchErrorThrownBySignalOfDelegateExpression
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Deployment( resources = {
"org/camunda/bpm/engine/test/bpmn/event/error/BoundaryErrorEventTest.testCatchErrorThrownByDelegateExpression.bpmn20.xml"
})
public void testCatchErrorThrownBySignalOfDelegateExpression() {
VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertNull(runtimeService.getVariable(pi, "signaled"));
Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();
assertNotNull(serviceTask);
runtimeService.setVariables(pi, throwError());
runtimeService.signal(serviceTask.getId());
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
assertNotNull(userTask);
assertEquals("userTaskError", userTask.getTaskDefinitionKey());
taskService.complete(userTask.getId());
}
示例3: testMessageCorrelateAllResultListWithResultTypeExecution
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/MessageCorrelationTest.testCatchingMessageEventCorrelation.bpmn20.xml")
@Test
public void testMessageCorrelateAllResultListWithResultTypeExecution() {
//given
ProcessInstance procInstance1 = runtimeService.startProcessInstanceByKey("process");
ProcessInstance procInstance2 = runtimeService.startProcessInstanceByKey("process");
//when correlated all with result
List<MessageCorrelationResult> resultList = runtimeService.createMessageCorrelation("newInvoiceMessage")
.correlateAllWithResult();
assertEquals(2, resultList.size());
//then result should contains executions on which messages was correlated
for (MessageCorrelationResult result : resultList) {
assertNotNull(result);
assertEquals(MessageCorrelationResultType.Execution, result.getResultType());
assertTrue(procInstance1.getId().equalsIgnoreCase(result.getExecution().getProcessInstanceId())
|| procInstance2.getId().equalsIgnoreCase(result.getExecution().getProcessInstanceId())
);
ExecutionEntity entity = (ExecutionEntity) result.getExecution();
assertEquals("messageCatch", entity.getActivityId());
}
}
示例4: shouldSkipIoMappings
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
public void shouldSkipIoMappings() {
// given
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(
modify(ProcessModels.TWO_TASKS_PROCESS).activityBuilder("userTask1").camundaInputParameter("foo", "bar").done());
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
// when
runtimeService.restartProcessInstances(processDefinition.getId())
.startBeforeActivity("userTask1")
.skipIoMappings()
.processInstanceIds(processInstance.getId())
.execute();
// then
Execution task1Execution = runtimeService.createExecutionQuery().activityId("userTask1").singleResult();
assertNotNull(task1Execution);
assertNull(runtimeService.getVariable(task1Execution.getId(), "foo"));
}
示例5: testResolveProcessInstanceBean
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/BusinessProcessBeanTest.test.bpmn20.xml")
public void testResolveProcessInstanceBean() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
assertNull(getBeanInstance(ProcessInstance.class));
assertNull(getBeanInstance("processInstanceId"));
assertNull(getBeanInstance(Execution.class));
assertNull(getBeanInstance("executionId"));
String pid = businessProcess.startProcessByKey("businessProcessBeanTest").getId();
// assert that now we can resolve the ProcessInstance-bean
assertEquals(pid, getBeanInstance(ProcessInstance.class).getId());
assertEquals(pid, getBeanInstance("processInstanceId"));
assertEquals(pid, getBeanInstance(Execution.class).getId());
assertEquals(pid, getBeanInstance("executionId"));
taskService.complete(taskService.createTaskQuery().singleResult().getId());
}
示例6: testCatchExceptionThrownBySignalOfParallelAbstractBpmnActivityBehavior
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Deployment( resources = {
"org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownByParallelAbstractBpmnActivityBehavior.bpmn20.xml"
})
public void testCatchExceptionThrownBySignalOfParallelAbstractBpmnActivityBehavior() {
String pi = runtimeService.startProcessInstanceByKey("testProcess").getId();
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertNull(runtimeService.getVariable(pi, "signaled"));
Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3);
assertNotNull(serviceTask);
runtimeService.setVariables(pi, throwException());
runtimeService.signal(serviceTask.getId());
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
assertNotNull(userTask);
assertEquals("userTaskException", userTask.getTaskDefinitionKey());
taskService.complete(userTask.getId());
}
示例7: assertExecution
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Override
public void assertExecution(ExecutionTree tree) {
List<Execution> nonMatchingExecutions = matches(tree);
if (!nonMatchingExecutions.isEmpty()) {
StringBuilder sb = new StringBuilder();
sb.append("Expected all executions to have process definition id " + expectedProcessDefinitionId + "\n");
sb.append("Actual Tree: \n");
sb.append(tree);
sb.append("\nExecutions with unexpected process definition id:\n");
sb.append("[\n");
for (Execution execution : nonMatchingExecutions) {
sb.append(execution);
sb.append("\n");
}
sb.append("]\n");
Assert.fail(sb.toString());
}
}
示例8: sendSignalToIntermediateCatchEventWithExecutionIdAndAuthenticatedTenant
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
public void sendSignalToIntermediateCatchEventWithExecutionIdAndAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);
engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery()
.processDefinitionKey("signalCatch")
.signalEventSubscriptionName("signal")
.singleResult();
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRuntimeService().createSignalEvent("signal").executionId(execution.getId()).send();
engineRule.getIdentityService().clearAuthentication();
TaskQuery query = engineRule.getTaskService().createTaskQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MultiTenancySignalReceiveCmdTenantCheckTest.java
示例9: queryExecutions
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Override
public List<ExecutionDto> queryExecutions(
ExecutionQueryDto queryDto, Integer firstResult, Integer maxResults) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
ExecutionQuery query = queryDto.toQuery(engine);
List<Execution> matchingExecutions;
if (firstResult != null || maxResults != null) {
matchingExecutions = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingExecutions = query.list();
}
List<ExecutionDto> executionResults = new ArrayList<ExecutionDto>();
for (Execution execution : matchingExecutions) {
ExecutionDto resultExecution = ExecutionDto.fromExecution(execution);
executionResults.add(resultExecution);
}
return executionResults;
}
示例10: testCatchExceptionThrownBySignalOfDelegateExpression
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/error/ErrorEventSubProcessTest.testCatchErrorThrownByDelegateExpression.bpmn20.xml"
})
public void testCatchExceptionThrownBySignalOfDelegateExpression() {
VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertNull(runtimeService.getVariable(pi, "signaled"));
Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();
assertNotNull(serviceTask);
runtimeService.setVariables(pi, throwException());
runtimeService.signal(serviceTask.getId());
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
assertNotNull(userTask);
assertEquals("userTaskException", userTask.getTaskDefinitionKey());
taskService.complete(userTask.getId());
}
示例11: signalIntermediateCatchEventWithAuthenticatedTenant
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
public void signalIntermediateCatchEventWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);
engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery()
.processDefinitionKey("signalCatch")
.signalEventSubscriptionName("signal")
.singleResult();
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRuntimeService().signal(execution.getId(), "signal", null, null);
engineRule.getIdentityService().clearAuthentication();
TaskQuery query = engineRule.getTaskService().createTaskQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MultiTenancySignalReceiveCmdTenantCheckTest.java
示例12: correlateReceivedMessageToIntermediateCatchEventWithAuthenticatedTenant
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
public void correlateReceivedMessageToIntermediateCatchEventWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);
engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery()
.processDefinitionKey("messageCatch")
.messageEventSubscriptionName("message")
.singleResult();
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRuntimeService().messageEventReceived("message", execution.getId());
engineRule.getIdentityService().clearAuthentication();
TaskQuery query = engineRule.getTaskService().createTaskQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MultiTenancyMessageEventReceivedCmdTenantCheckTest.java
示例13: correlateReceivedMessageToIntermediateCatchEventDisabledTenantCheck
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Test
public void correlateReceivedMessageToIntermediateCatchEventDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);
testRule.deployForTenant(TENANT_TWO, MESSAGE_CATCH_PROCESS);
engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_ONE).execute();
engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_TWO).execute();
Execution execution = engineRule.getRuntimeService().createExecutionQuery()
.processDefinitionKey("messageCatch")
.messageEventSubscriptionName("message")
.tenantIdIn(TENANT_ONE)
.singleResult();
engineRule.getRuntimeService().messageEventReceived("message", execution.getId());
TaskQuery query = engineRule.getTaskService().createTaskQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:MultiTenancyMessageEventReceivedCmdTenantCheckTest.java
示例14: testCatchExceptionThrownBySignalOfParallelDelegateExpression
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Deployment( resources = {
"org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownByParallelDelegateExpression.bpmn20.xml"
})
public void testCatchExceptionThrownBySignalOfParallelDelegateExpression() {
VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertNull(runtimeService.getVariable(pi, "signaled"));
Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3);
assertNotNull(serviceTask);
runtimeService.setVariables(pi, throwException());
runtimeService.signal(serviceTask.getId());
assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
assertNotNull(userTask);
assertEquals("userTaskException", userTask.getTaskDefinitionKey());
taskService.complete(userTask.getId());
}
示例15: testNonInterruptingBoundaryMessageEvent
import org.camunda.bpm.engine.runtime.Execution; //导入依赖的package包/类
@Deployment
public void testNonInterruptingBoundaryMessageEvent() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
Execution execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("newMessage").singleResult();
runtimeService.messageEventReceived("newMessage", execution.getId());
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
query.activityId("message");
assertEquals(1, query.count());
assertNotNull(query.singleResult().getEndTime());
assertEquals("boundaryMessage", query.singleResult().getActivityType());
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.complete(task.getId());
}
assertProcessEnded(pi.getId());
}