use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationBatchCmd method createBatch.
protected BatchEntity createBatch(CommandContext commandContext, List<AbstractProcessInstanceModificationCommand> instructions, Collection<String> processInstanceIds, ProcessDefinitionEntity processDefinition) {
ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
BatchJobHandler<ModificationBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);
ModificationBatchConfiguration configuration = new ModificationBatchConfiguration(new ArrayList<String>(processInstanceIds), builder.getProcessDefinitionId(), instructions, builder.isSkipCustomListeners(), builder.isSkipIoMappings());
BatchEntity batch = new BatchEntity();
batch.setType(batchJobHandler.getType());
batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
batch.setTenantId(processDefinition.getTenantId());
commandContext.getBatchManager().insert(batch);
return batch;
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class MailActivityBehavior method setMailServerProperties.
protected void setMailServerProperties(Email email) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
String host = processEngineConfiguration.getMailServerHost();
ensureNotNull("Could not send email: no SMTP host is configured", "host", host);
email.setHostName(host);
int port = processEngineConfiguration.getMailServerPort();
email.setSmtpPort(port);
email.setTLS(processEngineConfiguration.getMailServerUseTLS());
String user = processEngineConfiguration.getMailServerUsername();
String password = processEngineConfiguration.getMailServerPassword();
if (user != null && password != null) {
email.setAuthentication(user, password);
}
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class SpinProcessEnginePluginTest method testPluginDoesNotRegisterXmlSerializerIfNotPresentInClasspath.
public void testPluginDoesNotRegisterXmlSerializerIfNotPresentInClasspath() throws IOException {
ClassLoader mockClassloader = Mockito.mock(ClassLoader.class);
Mockito.when(mockClassloader.getResources(Mockito.anyString())).thenReturn(Collections.enumeration(Collections.<URL>emptyList()));
DataFormats.loadDataFormats(mockClassloader);
ProcessEngineConfigurationImpl mockConfig = Mockito.mock(ProcessEngineConfigurationImpl.class);
DefaultVariableSerializers serializers = new DefaultVariableSerializers();
Mockito.when(mockConfig.getVariableSerializers()).thenReturn(serializers);
new SpinProcessEnginePlugin().registerSerializers(mockConfig);
assertTrue(serializers.getSerializerByName(XmlValueType.TYPE_NAME) == null);
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class SpinProcessEnginePluginTest method testPluginRegistersJsonSerializerIfPresentInClasspath.
public void testPluginRegistersJsonSerializerIfPresentInClasspath() {
DataFormats.loadDataFormats(null);
ProcessEngineConfigurationImpl mockConfig = Mockito.mock(ProcessEngineConfigurationImpl.class);
Mockito.when(mockConfig.getVariableSerializers()).thenReturn(processEngineConfiguration.getVariableSerializers());
new SpinProcessEnginePlugin().registerSerializers(mockConfig);
assertTrue(processEngineConfiguration.getVariableSerializers().getSerializerByName(JsonValueType.TYPE_NAME) instanceof JsonValueSerializer);
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class HistoryCleanupRestServiceInteractionTest method testHistoryConfigurationOutsideBatchWindow.
@Test
public void testHistoryConfigurationOutsideBatchWindow() throws ParseException {
ProcessEngineConfigurationImpl processEngineConfigurationImplMock = mock(ProcessEngineConfigurationImpl.class);
Date startDate = HistoryCleanupHelper.parseTimeConfiguration("23:59+0200");
Date endDate = HistoryCleanupHelper.parseTimeConfiguration("00:00+0200");
when(processEngine.getProcessEngineConfiguration()).thenReturn(processEngineConfigurationImplMock);
when(processEngineConfigurationImplMock.getHistoryCleanupBatchWindowStartTimeAsDate()).thenReturn(startDate);
when(processEngineConfigurationImplMock.getHistoryCleanupBatchWindowEndTimeAsDate()).thenReturn(endDate);
SimpleDateFormat sdf = new SimpleDateFormat(JacksonConfigurator.dateFormatString);
Date now = sdf.parse("2017-09-01T22:00:00.000+0200");
ClockUtil.setCurrentTime(now);
Calendar today = Calendar.getInstance();
today.setTime(now);
Calendar tomorrow = Calendar.getInstance();
tomorrow.setTime(HistoryCleanupHelper.addDays(now, 1));
Date dateToday = HistoryCleanupHelper.updateTime(today.getTime(), startDate);
Date dateTomorrow = HistoryCleanupHelper.updateTime(tomorrow.getTime(), endDate);
given().contentType(ContentType.JSON).then().expect().statusCode(Status.OK.getStatusCode()).body("batchWindowStartTime", containsString(sdf.format(dateToday))).body("batchWindowEndTime", containsString(sdf.format(dateTomorrow))).when().get(CONFIGURATION_URL);
verify(processEngineConfigurationImplMock).getHistoryCleanupBatchWindowStartTimeAsDate();
verify(processEngineConfigurationImplMock).getHistoryCleanupBatchWindowEndTimeAsDate();
}
Aggregations