Search in sources :

Example 1 with DelegateExecutionAsserter

use of org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter in project camunda-bpm-platform by camunda.

the class DelegateExecutionHierarchyTest method testTaskInsideEmbeddedSubprocess.

public void testTaskInsideEmbeddedSubprocess() {
    deployment(Bpmn.createExecutableProcess("testProcess").startEvent().subProcess().embeddedSubProcess().startEvent().serviceTask().camundaClass(AssertingJavaDelegate.class.getName()).endEvent().subProcessDone().endEvent().done());
    AssertingJavaDelegate.addAsserts(new DelegateExecutionAsserter() {

        public void doAssert(DelegateExecution execution) {
            assertFalse(execution.equals(execution.getProcessInstance()));
            assertNull(execution.getSuperExecution());
        }
    });
    runtimeService.startProcessInstanceByKey("testProcess");
}
Also used : DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionAsserter(org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter)

Example 2 with DelegateExecutionAsserter

use of org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter 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));
        }
    };
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) Authentication(org.camunda.bpm.engine.impl.identity.Authentication) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionAsserter(org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter)

Example 3 with DelegateExecutionAsserter

use of org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter 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()));
        }
    };
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) Authentication(org.camunda.bpm.engine.impl.identity.Authentication) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionAsserter(org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter)

Example 4 with DelegateExecutionAsserter

use of org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter in project camunda-bpm-platform by camunda.

the class DelegateExecutionHierarchyTest method testSingleNonScopeActivity.

public void testSingleNonScopeActivity() {
    deployment(Bpmn.createExecutableProcess("testProcess").startEvent().serviceTask().camundaClass(AssertingJavaDelegate.class.getName()).endEvent().done());
    AssertingJavaDelegate.addAsserts(new DelegateExecutionAsserter() {

        public void doAssert(DelegateExecution execution) {
            assertEquals(execution, execution.getProcessInstance());
            assertNull(execution.getSuperExecution());
        }
    });
    runtimeService.startProcessInstanceByKey("testProcess");
}
Also used : DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionAsserter(org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter)

Example 5 with DelegateExecutionAsserter

use of org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter in project camunda-bpm-platform by camunda.

the class DelegateExecutionHierarchyTest method testSubProcessInstance.

public void testSubProcessInstance() {
    deployment(Bpmn.createExecutableProcess("testProcess").startEvent().callActivity().calledElement("testProcess2").endEvent().done(), Bpmn.createExecutableProcess("testProcess2").startEvent().serviceTask().camundaClass(AssertingJavaDelegate.class.getName()).endEvent().done());
    AssertingJavaDelegate.addAsserts(new DelegateExecutionAsserter() {

        public void doAssert(DelegateExecution execution) {
            assertTrue(execution.equals(execution.getProcessInstance()));
            assertNotNull(execution.getSuperExecution());
        }
    });
    runtimeService.startProcessInstanceByKey("testProcess");
}
Also used : DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionAsserter(org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter)

Aggregations

DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)6 DelegateExecutionAsserter (org.camunda.bpm.engine.test.api.delegate.AssertingJavaDelegate.DelegateExecutionAsserter)6 IdentityService (org.camunda.bpm.engine.IdentityService)2 Authentication (org.camunda.bpm.engine.impl.identity.Authentication)2