use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class EventSubscriptionQueryTest method testQueryByEventName.
public void testQueryByEventName() {
processEngineConfiguration.getCommandExecutor().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity3 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity3.setEventName("messageName2");
messageEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery().eventName("messageName").list();
assertEquals(2, list.size());
list = newEventSubscriptionQuery().eventName("messageName2").list();
assertEquals(1, list.size());
cleanDb();
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class JobQueryTest method deleteJobInDatabase.
private void deleteJobInDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
timerEntity.delete();
return null;
}
});
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class JobQueryTest method createJobWithoutExceptionStacktrace.
private void createJobWithoutExceptionStacktrace() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
JobEntityManager jobManager = commandContext.getJobEntityManager();
timerEntity = new TimerEntity();
timerEntity.setLockOwner(UUID.randomUUID().toString());
timerEntity.setDuedate(new Date());
timerEntity.setRetries(0);
timerEntity.setExceptionMessage("I'm supposed to fail");
jobManager.insert(timerEntity);
assertNotNull(timerEntity.getId());
return null;
}
});
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class JobQueryTest method setRetries.
//helper ////////////////////////////////////////////////////////////
private void setRetries(final String processInstanceId, final int retries) {
final Job job = managementService.createJobQuery().processInstanceId(processInstanceId).singleResult();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
JobEntity timer = commandContext.getDbSqlSession().selectById(JobEntity.class, job.getId());
timer.setRetries(retries);
return null;
}
});
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class BpmnParseTest method testParseNamespaceInConditionExpressionType.
@Deployment
public void testParseNamespaceInConditionExpressionType() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKey("resolvableNamespacesProcess");
}
});
// Test that the process definition has been deployed
assertNotNull(processDefinitionEntity);
ActivityImpl activity = processDefinitionEntity.findActivity("ExclusiveGateway_1");
assertNotNull(activity);
// Test that the conditions has been resolved
for (PvmTransition transition : activity.getOutgoingTransitions()) {
if (transition.getDestination().getId().equals("Task_2")) {
assertTrue(transition.getProperty("conditionText").equals("#{approved}"));
} else if (transition.getDestination().getId().equals("Task_3")) {
assertTrue(transition.getProperty("conditionText").equals("#{!approved}"));
} else {
fail("Something went wrong");
}
}
}
Aggregations