use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class ProcessWithParallelGatewayAndServiceTaskScenario method startProcessAsyncServiceTaskCompleteUserTask.
@DescribesScenario("init.async.complete")
@Times(1)
public static ScenarioSetup startProcessAsyncServiceTaskCompleteUserTask() {
return new ScenarioSetup() {
@Override
public void execute(ProcessEngine engine, String scenarioName) {
ProcessInstance procInst = engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY_2, scenarioName);
Task task = engine.getTaskService().createTaskQuery().processInstanceId(procInst.getId()).singleResult();
engine.getTaskService().complete(task.getId());
}
};
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class CreateProcessInstanceWithJsonVariablesScenario method initProcessInstance.
@DescribesScenario("initProcessInstanceWithDifferentVariables")
public static ScenarioSetup initProcessInstance() {
return new ScenarioSetup() {
public void execute(ProcessEngine engine, String scenarioName) {
// given
ProcessInstance processInstance = engine.getRuntimeService().startProcessInstanceByKey("Process", "processWithJsonVariables");
// when
Execution execution = engine.getRuntimeService().createExecutionQuery().processInstanceId(processInstance.getId()).singleResult();
engine.getRuntimeService().setVariable(execution.getId(), "objectVariable", createObjectVariable());
engine.getRuntimeService().setVariable(execution.getId(), "plainTypeArrayVariable", createPlainTypeArray());
engine.getRuntimeService().setVariable(execution.getId(), "notGenericObjectListVariable", createNotGenericObjectList());
engine.getRuntimeService().setVariable(execution.getId(), "serializedMapVariable", createSerializedMap());
}
};
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class DbSchemaPrefixTestHelper method afterPropertiesSet.
public void afterPropertiesSet() throws Exception {
dataSource = new PooledDataSource(ReflectUtil.getClassLoader(), "org.h2.Driver", "jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000;MVCC=TRUE;", "sa", "");
// create schema in the
Connection connection = dataSource.getConnection();
connection.createStatement().execute("drop schema if exists SCHEMA1");
connection.createStatement().execute("create schema SCHEMA1");
connection.close();
ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1").setDataSource(dataSource).setDbMetricsReporterActivate(false).setDatabaseSchemaUpdate(// disable auto create/drop schema
"NO_CHECK");
config1.setDatabaseTablePrefix("SCHEMA1.");
ProcessEngine engine1 = config1.buildProcessEngine();
// create the tables in SCHEMA1
connection = dataSource.getConnection();
connection.createStatement().execute("set schema SCHEMA1");
engine1.getManagementService().databaseSchemaUpgrade(connection, "", "SCHEMA1");
connection.close();
engine1.close();
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class EnsureCleanDbPlugin method postProcessApplicationUndeploy.
@SuppressWarnings("resource")
@Override
public void postProcessApplicationUndeploy(ProcessApplicationInterface processApplication) {
// best example is TestWarDeploymentWithBrokenBpmnXml in integration-test-engine test suite
if (counter.get() == 0 || counter.decrementAndGet() == 0) {
final ProcessEngine defaultProcessEngine = BpmPlatform.getDefaultProcessEngine();
try {
logger.log(Level.INFO, "=== Ensure Clean Database ===");
ManagementServiceImpl managementService = (ManagementServiceImpl) defaultProcessEngine.getManagementService();
PurgeReport report = managementService.purge();
if (report.isEmpty()) {
logger.log(Level.INFO, "Clean DB and cache.");
} else {
StringBuilder builder = new StringBuilder();
DatabasePurgeReport databasePurgeReport = report.getDatabasePurgeReport();
if (!databasePurgeReport.isEmpty()) {
builder.append(DATABASE_NOT_CLEAN).append(databasePurgeReport.getPurgeReportAsString());
}
CachePurgeReport cachePurgeReport = report.getCachePurgeReport();
if (!cachePurgeReport.isEmpty()) {
builder.append(CACHE_IS_NOT_CLEAN).append(cachePurgeReport.getPurgeReportAsString());
}
logger.log(Level.INFO, builder.toString());
}
} catch (Throwable e) {
logger.log(Level.SEVERE, "Could not clean DB:", e);
}
}
}
use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenario method defaultHandlerThrowCompensate.
@DescribesScenario("defaultHandler.beforeCompensate.throwCompensate")
@ExtendsScenario("defaultHandler.beforeCompensate")
@Times(3)
public static ScenarioSetup defaultHandlerThrowCompensate() {
return new ScenarioSetup() {
public void execute(ProcessEngine engine, String scenarioName) {
Task beforeCompensateTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
engine.getTaskService().complete(beforeCompensateTask.getId());
}
};
}
Aggregations