Search in sources :

Example 1 with StartProcessInstanceTask

use of org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.StartProcessInstanceTask 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);
}
Also used : DeployModelInstancesTask(org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.DeployModelInstancesTask) GenerateMetricsTask(org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.GenerateMetricsTask) Process(org.camunda.bpm.model.bpmn.instance.Process) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Properties(java.util.Properties) LoadGeneratorConfiguration(org.camunda.bpm.qa.performance.engine.loadgenerator.LoadGeneratorConfiguration) StartProcessInstanceTask(org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.StartProcessInstanceTask) LoadGenerator(org.camunda.bpm.qa.performance.engine.loadgenerator.LoadGenerator) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) PerfTestProcessEngine(org.camunda.bpm.qa.performance.engine.junit.PerfTestProcessEngine)

Example 2 with StartProcessInstanceTask

use of org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.StartProcessInstanceTask in project camunda-bpm-platform by camunda.

the class StartProcessInstancesInDirectory method main.

public static void main(String[] args) throws InterruptedException {
    ProcessEngine processEngine = PerfTestProcessEngine.getInstance();
    final LoadGeneratorConfiguration config = new LoadGeneratorConfiguration();
    final List<String> deployableFiles = findDeployableFiles(new File("."));
    final Runnable[] setupTasks = new Runnable[deployableFiles.size()];
    for (int i = 0; i < deployableFiles.size(); i++) {
        setupTasks[i] = new DeployFileTask(processEngine, deployableFiles.get(i));
    }
    config.setSetupTasks(setupTasks);
    final List<String> processKeys = extractProcessDefinitionKeys(deployableFiles);
    final Runnable[] workerRunnables = new Runnable[processKeys.size()];
    for (int i = 0; i < processKeys.size(); i++) {
        workerRunnables[i] = new StartProcessInstanceTask(processEngine, processKeys.get(i));
    }
    config.setWorkerTasks(workerRunnables);
    final LoadGenerator loadGenerator = new LoadGenerator(config);
    loadGenerator.execute();
}
Also used : StartProcessInstanceTask(org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.StartProcessInstanceTask) DeployFileTask(org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.DeployFileTask) File(java.io.File) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) PerfTestProcessEngine(org.camunda.bpm.qa.performance.engine.junit.PerfTestProcessEngine)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 PerfTestProcessEngine (org.camunda.bpm.qa.performance.engine.junit.PerfTestProcessEngine)2 StartProcessInstanceTask (org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.StartProcessInstanceTask)2 File (java.io.File)1 Properties (java.util.Properties)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)1 Process (org.camunda.bpm.model.bpmn.instance.Process)1 LoadGenerator (org.camunda.bpm.qa.performance.engine.loadgenerator.LoadGenerator)1 LoadGeneratorConfiguration (org.camunda.bpm.qa.performance.engine.loadgenerator.LoadGeneratorConfiguration)1 DeployFileTask (org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.DeployFileTask)1 DeployModelInstancesTask (org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.DeployModelInstancesTask)1 GenerateMetricsTask (org.camunda.bpm.qa.performance.engine.loadgenerator.tasks.GenerateMetricsTask)1