use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionCachedEntityStateTest method testProcessInstanceIncident.
@Deployment
public void testProcessInstanceIncident() {
runtimeService.startProcessInstanceByKey("testProcess");
ExecutionEntity processInstance = (ExecutionEntity) runtimeService.createProcessInstanceQuery().singleResult();
assertEquals(0, processInstance.getCachedEntityStateRaw());
final ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().activityId("task").singleResult();
assertEquals(0, execution.getCachedEntityStateRaw());
processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
IncidentContext incidentContext = new IncidentContext();
incidentContext.setExecutionId(execution.getId());
IncidentEntity.createAndInsertIncident("foo", incidentContext, null);
return null;
}
});
ExecutionEntity execution2 = (ExecutionEntity) runtimeService.createExecutionQuery().activityId("task").singleResult();
assertEquals(BitMaskUtil.getMaskForBit(ExecutionEntity.INCIDENT_STATE_BIT), execution2.getCachedEntityStateRaw());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionCachedEntityStateTest method testExecutionTasksMi.
@Deployment
public void testExecutionTasksMi() {
runtimeService.startProcessInstanceByKey("testProcess");
ExecutionEntity processInstance = (ExecutionEntity) runtimeService.createProcessInstanceQuery().singleResult();
assertEquals(0, processInstance.getCachedEntityStateRaw());
List<Execution> executions = runtimeService.createExecutionQuery().activityId("userTask").list();
for (Execution execution : executions) {
int cachedEntityStateRaw = ((ExecutionEntity) execution).getCachedEntityStateRaw();
if (!((ExecutionEntity) execution).isScope()) {
assertEquals(BitMaskUtil.getMaskForBit(ExecutionEntity.TASKS_STATE_BIT) | BitMaskUtil.getMaskForBit(ExecutionEntity.VARIABLES_STATE_BIT), cachedEntityStateRaw);
} else {
assertEquals(BitMaskUtil.getMaskForBit(ExecutionEntity.VARIABLES_STATE_BIT), cachedEntityStateRaw);
}
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionCachedEntityStateTest method testExecutionJobsParallel.
@Deployment
public void testExecutionJobsParallel() {
runtimeService.startProcessInstanceByKey("testProcess");
ExecutionEntity processInstance = (ExecutionEntity) runtimeService.createProcessInstanceQuery().singleResult();
assertEquals(0, processInstance.getCachedEntityStateRaw());
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().activityId("userTask").singleResult();
assertEquals(BitMaskUtil.getMaskForBit(ExecutionEntity.JOBS_STATE_BIT), execution.getCachedEntityStateRaw());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionCachedEntityStateTest method testProcessInstanceEventSubscriptions.
@Deployment
public void testProcessInstanceEventSubscriptions() {
runtimeService.startProcessInstanceByKey("testProcess");
ExecutionEntity processInstance = (ExecutionEntity) runtimeService.createProcessInstanceQuery().singleResult();
assertEquals(BitMaskUtil.getMaskForBit(ExecutionEntity.EVENT_SUBSCRIPTIONS_STATE_BIT), processInstance.getCachedEntityStateRaw());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ProcessScope method get.
public Object get(String name, ObjectFactory<?> objectFactory) {
ExecutionEntity executionEntity = null;
try {
logger.fine("returning scoped object having beanName '" + name + "' for conversation ID '" + this.getConversationId() + "'. ");
ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
executionEntity = (ExecutionEntity) processInstance;
Object scopedObject = executionEntity.getVariable(name);
if (scopedObject == null) {
scopedObject = objectFactory.getObject();
if (scopedObject instanceof ScopedObject) {
ScopedObject sc = (ScopedObject) scopedObject;
scopedObject = sc.getTargetObject();
logger.fine("de-referencing " + ScopedObject.class.getName() + "#targetObject before persisting variable");
}
persistVariable(name, scopedObject);
}
return createDirtyCheckingProxy(name, scopedObject);
} catch (Throwable th) {
logger.warning("couldn't return value from process scope! " + ExceptionUtils.getFullStackTrace(th));
} finally {
if (executionEntity != null) {
logger.fine("set variable '" + name + "' on executionEntity# " + executionEntity.getId());
}
}
return null;
}
Aggregations