use of org.camunda.bpm.qa.performance.engine.loadgenerator.LoadGeneratorConfiguration in project camunda-bpm-platform by camunda.
the class DefaultLoadGenerator method main.
public static void main(String[] args) throws InterruptedException {
final Properties properties = PerfTestProcessEngine.loadProperties();
final ProcessEngine processEngine = PerfTestProcessEngine.getInstance();
final LoadGeneratorConfiguration config = new LoadGeneratorConfiguration();
config.setColor(Boolean.parseBoolean(properties.getProperty("loadGenerator.colorOutput", "false")));
config.setNumberOfIterations(Integer.parseInt(properties.getProperty("loadGenerator.numberOfIterations", "10000")));
final List<BpmnModelInstance> modelInstances = createProcesses(config.getNumberOfIterations());
Runnable[] setupTasks = new Runnable[] { new DeployModelInstancesTask(processEngine, modelInstances) };
config.setSetupTasks(setupTasks);
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
processEngineConfiguration.setMetricsEnabled(true);
processEngineConfiguration.getDbMetricsReporter().setReporterId(REPORTER_ID);
final Runnable[] workerRunnables = new Runnable[2];
Process process = modelInstances.get(0).getModelElementsByType(Process.class).iterator().next();
String processDefKey = process.getId();
workerRunnables[0] = new StartProcessInstanceTask(processEngine, processDefKey);
workerRunnables[1] = new GenerateMetricsTask(processEngine);
config.setWorkerTasks(workerRunnables);
new LoadGenerator(config).execute();
System.out.println(processEngine.getHistoryService().createHistoricProcessInstanceQuery().count() + " Process Instances in DB");
processEngineConfiguration.setMetricsEnabled(false);
}
Aggregations