use of org.camunda.bpm.engine.delegate.DelegateExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyJobExecutorTest method hasAuthenticatedTenantId.
protected static DelegateExecutionAsserter hasAuthenticatedTenantId(final String expectedTenantId) {
return new DelegateExecutionAsserter() {
@Override
public void doAssert(DelegateExecution execution) {
IdentityService identityService = execution.getProcessEngineServices().getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
assertThat(currentAuthentication, is(notNullValue()));
assertThat(currentAuthentication.getTenantIds(), hasItem(expectedTenantId));
}
};
}
use of org.camunda.bpm.engine.delegate.DelegateExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyJobExecutorTest method hasNoAuthenticatedTenantId.
protected static DelegateExecutionAsserter hasNoAuthenticatedTenantId() {
return new DelegateExecutionAsserter() {
@Override
public void doAssert(DelegateExecution execution) {
IdentityService identityService = execution.getProcessEngineServices().getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
assertThat(currentAuthentication, is(nullValue()));
}
};
}
use of org.camunda.bpm.engine.delegate.DelegateExecution in project camunda-bpm-platform by camunda.
the class MocksTest method testMockAvailability.
// helper ////////////////////////////////////////////////////////////
private void testMockAvailability() {
// given
final String testStr = "testValue";
Mocks.register("myMock", new Object() {
public String getTest() {
return testStr;
}
public void testMethod(DelegateExecution execution, String str) {
execution.setVariable("testVar", str);
}
});
// when
ProcessInstance pi = runtimeService.startProcessInstanceByKey("mocksTest");
Mocks.reset();
// then
assertEquals(testStr, runtimeService.getVariable(pi.getId(), "testVar"));
}
use of org.camunda.bpm.engine.delegate.DelegateExecution in project camunda-bpm-platform by camunda.
the class RecorderTaskListener method notify.
public void notify(DelegateTask task) {
DelegateExecution execution = task.getExecution();
recordedEvents.add(new RecordedTaskEvent(task.getId(), task.getExecutionId(), task.getEventName(), execution.getActivityInstanceId()));
}
use of org.camunda.bpm.engine.delegate.DelegateExecution in project camunda-bpm-platform by camunda.
the class TenantIdProviderTest method providerCalledWithSuperProcessInstance.
@Test
public void providerCalledWithSuperProcessInstance() {
ContextLoggingTenantIdProvider tenantIdProvider = new ContextLoggingTenantIdProvider();
TestTenantIdProvider.delegate = tenantIdProvider;
testRule.deploy(Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().done(), Bpmn.createExecutableProcess("superProcess").startEvent().callActivity().calledElement(PROCESS_DEFINITION_KEY).done());
ProcessDefinition superProcessDefinition = engineRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("superProcess").singleResult();
// if a process instance is started
engineRule.getRuntimeService().startProcessInstanceByKey("superProcess");
// then the tenant id provider is passed in the process definition
DelegateExecution superExecution = tenantIdProvider.parameters.get(1).getSuperExecution();
assertThat(superExecution, is(notNullValue()));
assertThat(superExecution.getProcessDefinitionId(), is(superProcessDefinition.getId()));
}
Aggregations