Search in sources :

Example 1 with ExecutionIdLiteral

use of org.camunda.bpm.engine.cdi.annotation.ExecutionIdLiteral in project camunda-bpm-platform by camunda.

the class ExecutionIdTest method testExecutionIdInjectableByQualifier.

@Test
@Deployment
public void testExecutionIdInjectableByQualifier() {
    getBeanInstance(BusinessProcess.class).startProcessByKey("keyOfTheProcess");
    Set<Bean<?>> beans = beanManager.getBeans(String.class, new ExecutionIdLiteral());
    Bean<String> bean = (Bean<java.lang.String>) beanManager.resolve(beans);
    CreationalContext<String> ctx = beanManager.createCreationalContext(bean);
    String executionId = (String) beanManager.getReference(bean, String.class, ctx);
    Assert.assertNotNull(executionId);
    String processInstanceId = (String) getBeanInstance("processInstanceId");
    Assert.assertNotNull(processInstanceId);
    assertEquals(processInstanceId, executionId);
}
Also used : ExecutionIdLiteral(org.camunda.bpm.engine.cdi.annotation.ExecutionIdLiteral) BusinessProcess(org.camunda.bpm.engine.cdi.BusinessProcess) Bean(javax.enterprise.inject.spi.Bean) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

Bean (javax.enterprise.inject.spi.Bean)1 BusinessProcess (org.camunda.bpm.engine.cdi.BusinessProcess)1 ExecutionIdLiteral (org.camunda.bpm.engine.cdi.annotation.ExecutionIdLiteral)1 Deployment (org.camunda.bpm.engine.test.Deployment)1 Test (org.junit.Test)1