Search in sources :

Example 21 with Process

use of org.camunda.bpm.model.bpmn.instance.Process 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 22 with Process

use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpm-platform by camunda.

the class ServiceTaskBpmnModelExecutionContextTest method testJavaDelegateModelExecutionContext.

public void testJavaDelegateModelExecutionContext() {
    deploy();
    runtimeService.startProcessInstanceByKey(PROCESS_ID);
    BpmnModelInstance modelInstance = ModelExecutionContextServiceTask.modelInstance;
    assertNotNull(modelInstance);
    Model model = modelInstance.getModel();
    Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(Event.class));
    assertEquals(2, events.size());
    Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(Task.class));
    assertEquals(1, tasks.size());
    Process process = (Process) modelInstance.getDefinitions().getRootElements().iterator().next();
    assertEquals(PROCESS_ID, process.getId());
    assertTrue(process.isExecutable());
    ServiceTask serviceTask = ModelExecutionContextServiceTask.serviceTask;
    assertNotNull(serviceTask);
    assertEquals(ModelExecutionContextServiceTask.class.getName(), serviceTask.getCamundaClass());
}
Also used : ServiceTask(org.camunda.bpm.model.bpmn.instance.ServiceTask) Task(org.camunda.bpm.model.bpmn.instance.Task) ServiceTask(org.camunda.bpm.model.bpmn.instance.ServiceTask) ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance) Model(org.camunda.bpm.model.xml.Model) Event(org.camunda.bpm.model.bpmn.instance.Event) Process(org.camunda.bpm.model.bpmn.instance.Process) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Aggregations

Process (org.camunda.bpm.model.bpmn.instance.Process)22 Test (org.junit.Test)13 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)6 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)5 ModelValidationException (org.camunda.bpm.model.xml.ModelValidationException)4 Definitions (org.camunda.bpm.model.bpmn.instance.Definitions)3 ArrayList (java.util.ArrayList)2 StartEvent (org.camunda.bpm.model.bpmn.instance.StartEvent)2 UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)2 BpmnModelResource (org.camunda.bpm.model.bpmn.util.BpmnModelResource)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Properties (java.util.Properties)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1