use of org.activiti.engine.ProcessEngine in project Activiti by Activiti.
the class SpringProcessEngineConfiguration method buildProcessEngine.
@Override
public ProcessEngine buildProcessEngine() {
ProcessEngine processEngine = super.buildProcessEngine();
ProcessEngines.setInitialized(true);
autoDeployResources(processEngine);
return processEngine;
}
use of org.activiti.engine.ProcessEngine in project Activiti by Activiti.
the class EndpointAutoConfigurationTest method mvcEndpoint.
@Test
public void mvcEndpoint() throws Throwable {
AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(CallbackEmbeddedContainerCustomizer.class, EmbeddedContainerConfiguration.class, EndpointConfiguration.class);
ProcessEngine processEngine = applicationContext.getBean(ProcessEngine.class);
org.junit.Assert.assertNotNull("the processEngine should not be null", processEngine);
ProcessEngineEndpoint processEngineEndpoint = applicationContext.getBean(ProcessEngineEndpoint.class);
org.junit.Assert.assertNotNull("the processEngineEndpoint should not be null", processEngineEndpoint);
RestTemplate restTemplate = applicationContext.getBean(RestTemplate.class);
ResponseEntity<Map> mapResponseEntity = restTemplate.getForEntity("http://localhost:9091/activiti/", Map.class);
Map map = mapResponseEntity.getBody();
String[] criticalKeys = { "completedTaskCount", "openTaskCount", "cachedProcessDefinitionCount" };
Map<?, ?> invokedResults = processEngineEndpoint.invoke();
for (String k : criticalKeys) {
org.junit.Assert.assertTrue(map.containsKey(k));
org.junit.Assert.assertEquals(((Number) map.get(k)).longValue(), ((Number) invokedResults.get(k)).longValue());
}
}
use of org.activiti.engine.ProcessEngine in project Activiti by Activiti.
the class ReportDetailPanel method initForm.
protected void initForm() {
// Check if a start form is defined
final ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
StartFormData startFormData = processEngine.getFormService().getStartFormData(processDefinition.getId());
if (startFormData != null && ((startFormData.getFormProperties() != null && !startFormData.getFormProperties().isEmpty()) || startFormData.getFormKey() != null)) {
processDefinitionStartForm = new FormPropertiesForm();
detailContainer.addComponent(processDefinitionStartForm);
processDefinitionStartForm.setFormProperties(startFormData.getFormProperties());
processDefinitionStartForm.setSubmitButtonCaption(i18nManager.getMessage(Messages.REPORTING_GENERATE_REPORT));
processDefinitionStartForm.hideCancelButton();
processDefinitionStartForm.addListener(new FormPropertiesEventListener() {
private static final long serialVersionUID = 1L;
protected void handleFormSubmit(FormPropertiesEvent event) {
// Report is generated by running a process and storing the dataset in the history tablkes
savedFormProperties = event.getFormProperties();
ProcessInstance processInstance = startProcessInstanceWithFormProperties(processDefinition.getId(), event.getFormProperties());
generateReport(processInstance);
}
protected void handleFormCancel(FormPropertiesEvent event) {
// Not needed, cancel button not shown in report panels
}
});
} else {
// Just start the process-instance since it has no form.
ProcessInstance processInstance = startProcessInstance(processDefinition.getId());
generateReport(processInstance);
}
}
use of org.activiti.engine.ProcessEngine in project Activiti by Activiti.
the class TestHelper method getProcessEngine.
// Engine startup and shutdown helpers ///////////////////////////////////////////////////
public static ProcessEngine getProcessEngine(String configurationResource) {
ProcessEngine processEngine = processEngines.get(configurationResource);
if (processEngine == null) {
log.debug("==== BUILDING PROCESS ENGINE ========================================================================");
processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(configurationResource).buildProcessEngine();
log.debug("==== PROCESS ENGINE CREATED =========================================================================");
processEngines.put(configurationResource, processEngine);
}
return processEngine;
}
use of org.activiti.engine.ProcessEngine in project Activiti by Activiti.
the class SpringActivitiTestCase method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
String[] value = contextConfiguration.value();
boolean hasOneArg = value != null && value.length == 1;
String key = hasOneArg ? value[0] : ProcessEngine.class.getName();
ProcessEngine engine = this.cachedProcessEngines.containsKey(key) ? this.cachedProcessEngines.get(key) : this.applicationContext.getBean(ProcessEngine.class);
this.cachedProcessEngines.put(key, engine);
this.processEngine = engine;
}
Aggregations