org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl Java Examples

The following examples show how to use org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HostnameProviderTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
  configuration =
      (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
          .createStandaloneInMemProcessEngineConfiguration();

  configuration
      .setJdbcUrl("jdbc:h2:mem:camunda" + getClass().getSimpleName() + "testHostnameProvider")
      .setProcessEngineName(ENGINE_NAME)
      .setHostname(hostname)
      .setHostnameProvider(hostnameProvider)
      .setMetricsReporterIdProvider(reporterProvider);

  engine = configuration.buildProcessEngine();
  configuration.getMetricsRegistry().markOccurrence("TEST", 1L);
  configuration.getDbMetricsReporter().reportNow();

  managementService = configuration.getManagementService();
}
 
Example #2
Source File: JobAcquisitionBackoffTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  jobExecutor1 = (ControllableJobExecutor)
      ((ProcessEngineConfigurationImpl) engineRule.getProcessEngine().getProcessEngineConfiguration())
        .getJobExecutor();
  jobExecutor1.setMaxJobsPerAcquisition(DEFAULT_NUM_JOBS_TO_ACQUIRE);
  jobExecutor1.setBackoffTimeInMillis(BASE_BACKOFF_TIME);
  jobExecutor1.setMaxBackoff(MAX_BACKOFF_TIME);
  jobExecutor1.setBackoffDecreaseThreshold(BACKOFF_DECREASE_THRESHOLD);
  acquisitionThread1 = jobExecutor1.getAcquisitionThreadControl();

  jobExecutor2 = new ControllableJobExecutor((ProcessEngineImpl) engineRule.getProcessEngine());
  jobExecutor2.setMaxJobsPerAcquisition(DEFAULT_NUM_JOBS_TO_ACQUIRE);
  jobExecutor2.setBackoffTimeInMillis(BASE_BACKOFF_TIME);
  jobExecutor2.setMaxBackoff(MAX_BACKOFF_TIME);
  jobExecutor2.setBackoffDecreaseThreshold(BACKOFF_DECREASE_THRESHOLD);
  acquisitionThread2 = jobExecutor2.getAcquisitionThreadControl();
}
 
Example #3
Source File: CompetingHistoryCleanupAcquisitionTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void initializeProcessEngine() {
  processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
    .createProcessEngineConfigurationFromResource("camunda.cfg.xml");

  jobExecutor.setMaxJobsPerAcquisition(1);
  processEngineConfiguration.setJobExecutor(jobExecutor);
  processEngineConfiguration.setHistoryCleanupBatchWindowStartTime("12:00");

  processEngineConfiguration.setCustomPostCommandInterceptorsTxRequiresNew(Collections.<CommandInterceptor>singletonList(new CommandInterceptor() {
    @Override
    public <T> T execute(Command<T> command) {

      T executed = next.execute(command);
      if(syncBeforeFlush.get() != null && syncBeforeFlush.get()) {
        cleanupThread.sync();
      }

      return executed;
    }
  }));

  processEngine = processEngineConfiguration.buildProcessEngine();
}
 
Example #4
Source File: SpringBootProcessApplication.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Bean
public static CamundaDeploymentConfiguration deploymentConfiguration() {
  return new CamundaDeploymentConfiguration() {
    @Override
    public Set<Resource> getDeploymentResources() {
      return Collections.emptySet();
    }

    @Override
    public void preInit(ProcessEngineConfigurationImpl configuration) {
      LOG.skipAutoDeployment();
    }

    @Override
    public String toString() {
      return "disableDeploymentResourcePattern";
    }
  };
}
 
Example #5
Source File: OptimizeRestService.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/activity-instance/running")
public List<OptimizeHistoricActivityInstanceDto> getRunningHistoricActivityInstances(@QueryParam("startedAfter") String startedAfterAsString,
                                                                                     @QueryParam("startedAt") String startedAtAsString,
                                                                                     @QueryParam("maxResults") int maxResults) {

  Date startedAfter = dateConverter.convertQueryParameterToType(startedAfterAsString);
  Date startedAt = dateConverter.convertQueryParameterToType(startedAtAsString);
  maxResults = ensureValidMaxResults(maxResults);

  ProcessEngineConfigurationImpl config =
    (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();

  List<HistoricActivityInstance> historicActivityInstances =
    config.getOptimizeService().getRunningHistoricActivityInstances(startedAfter, startedAt, maxResults);

  List<OptimizeHistoricActivityInstanceDto> result = new ArrayList<>();
  for (HistoricActivityInstance instance : historicActivityInstances) {
    OptimizeHistoricActivityInstanceDto dto = OptimizeHistoricActivityInstanceDto.fromHistoricActivityInstance(instance);
    result.add(dto);
  }
  return result;
}
 
Example #6
Source File: FormServiceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Deployment(resources = { "org/camunda/bpm/engine/test/api/twoTasksProcess.bpmn20.xml" })
@Test
public void testSubmitTaskFormWithObjectVariables() {
  // given
  ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();

  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoTasksProcess");

  // when a task form is submitted with an object variable
  Task task = taskService.createTaskQuery().singleResult();
  assertNotNull(task);

  Map<String, Object> variables = new HashMap<>();
  variables.put("var", new ArrayList<String>());
  formService.submitTaskForm(task.getId(), variables);

  // then the variable is available as a process variable
  ArrayList<String> var = (ArrayList<String>) runtimeService.getVariable(processInstance.getId(), "var");
  assertNotNull(var);
  assertTrue(var.isEmpty());

  // then no historic form property event has been written since this is not supported for custom objects
  if(processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_FULL) {
    assertEquals(0, historyService.createHistoricDetailQuery().formFields().count());
  }
}
 
Example #7
Source File: DmnEngineConfigurationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void setElProvider() {
  // given a DMN engine configuration with el provider
  DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration) DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
  ElProvider elProvider = mock(ElProvider.class);
  dmnEngineConfiguration.setElProvider(elProvider);

  ProcessEngineConfigurationImpl processEngineConfiguration = createProcessEngineConfiguration();
  processEngineConfiguration.setDmnEngineConfiguration(dmnEngineConfiguration);

  // when the engine is initialized
  engine = processEngineConfiguration.buildProcessEngine();

  // then the el provider should be set on the DMN engine
  assertThat(getConfigurationOfDmnEngine().getElProvider(), is(elProvider));
}
 
Example #8
Source File: TaskServiceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void testCompleteTaskWithParametersEmptyParameters() {
  Task task = taskService.newTask();
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.complete(taskId, Collections.EMPTY_MAP);

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertNull(task);
}
 
Example #9
Source File: DbIdentityServiceProvider.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void lockUser(UserEntity user) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  int max = processEngineConfiguration.getLoginDelayMaxTime();
  int baseTime = processEngineConfiguration.getLoginDelayBase();
  int factor = processEngineConfiguration.getLoginDelayFactor();
  int attempts = user.getAttempts() + 1;

  long delay = (long) (baseTime * Math.pow(factor, attempts - 1));
  delay = Math.min(delay, max) * 1000;

  long currentTime = ClockUtil.getCurrentTime().getTime();
  Date lockExpirationTime = new Date(currentTime + delay);

  if(attempts >= processEngineConfiguration.getLoginMaxAttempts()) {
    LOG.infoUserPermanentlyLocked(user.getId());
  } else {
    LOG.infoUserTemporarilyLocked(user.getId(), lockExpirationTime);
  }

  getIdentityInfoManager().updateUserLock(user, attempts, lockExpirationTime);
}
 
Example #10
Source File: OptimizeServiceAuthorizationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {

  identityService = engineRule.getIdentityService();
  repositoryService = engineRule.getRepositoryService();
  authorizationService = engineRule.getAuthorizationService();
  runtimeService = engineRule.getRuntimeService();
  decisionService = engineRule.getDecisionService();
  taskService = engineRule.getTaskService();
  ProcessEngineConfigurationImpl config = engineRule.getProcessEngineConfiguration();
  optimizeService = config.getOptimizeService();

  DefaultDmnEngineConfiguration dmnEngineConfiguration =
    engineRule.getProcessEngineConfiguration().getDmnEngineConfiguration();
  ResetDmnConfigUtil.reset(dmnEngineConfiguration)
    .enableFeelLegacyBehavior(true)
    .init();

  authRule.createUserAndGroup(userId, "testGroup");
  authRule.createGrantAuthorization(AUTHORIZATION, ANY, userId, ALL);
  authRule.createGrantAuthorization(USER, ANY, userId, ALL);

  deployTestData();
  authRule.enableAuthorization(userId);
}
 
Example #11
Source File: TestHelper.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static void waitForJobExecutorToProcessAllJobs(ProcessEngineConfigurationImpl processEngineConfiguration, long maxMillisToWait, long intervalMillis) {
  JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
  jobExecutor.start();

  try {
    Timer timer = new Timer();
    InteruptTask task = new InteruptTask(Thread.currentThread());
    timer.schedule(task, maxMillisToWait);
    boolean areJobsAvailable = true;
    try {
      while (areJobsAvailable && !task.isTimeLimitExceeded()) {
        Thread.sleep(intervalMillis);
        areJobsAvailable = areJobsAvailable(processEngineConfiguration);
      }
    } catch (InterruptedException e) {
    } finally {
      timer.cancel();
    }
    if (areJobsAvailable) {
      throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded");
    }

  } finally {
    jobExecutor.shutdown();
  }
}
 
Example #12
Source File: KeycloakConfigureAdminUserIdAsMailTest.java    From camunda-bpm-identity-keycloak with Apache License 2.0 6 votes vote down vote up
public static Test suite() {
    return new TestSetup(new TestSuite(KeycloakConfigureAdminUserIdAsMailTest.class)) {

    	// @BeforeClass
        protected void setUp() throws Exception {
    		ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
    				.createProcessEngineConfigurationFromResource("camunda.configureAdminUserIdAsMail.cfg.xml");
    		configureKeycloakIdentityProviderPlugin(config);
    		PluggableProcessEngineTestCase.cachedProcessEngine = config.buildProcessEngine();
        }
        
        // @AfterClass
        protected void tearDown() throws Exception {
    		PluggableProcessEngineTestCase.cachedProcessEngine.close();
    		PluggableProcessEngineTestCase.cachedProcessEngine = null;
        }
    };
}
 
Example #13
Source File: DmnEngineConfigurationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void setFeelEngineFactory() {
  // given a DMN engine configuration with feel engine factory
  DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration) DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
  FeelEngineFactory feelEngineFactory = mock(FeelEngineFactory.class);
  dmnEngineConfiguration.setFeelEngineFactory(feelEngineFactory);

  ProcessEngineConfigurationImpl processEngineConfiguration = createProcessEngineConfiguration();
  processEngineConfiguration.setDmnEngineConfiguration(dmnEngineConfiguration);

  // when the engine is initialized
  engine = processEngineConfiguration.buildProcessEngine();

  // then the feel engine factory should be set on the DMN engine
  assertThat(getConfigurationOfDmnEngine().getFeelEngineFactory(), is(feelEngineFactory));
}
 
Example #14
Source File: KeycloakConfigureAdminUserIdAndUseUsernameAsIdTest.java    From camunda-bpm-identity-keycloak with Apache License 2.0 6 votes vote down vote up
public static Test suite() {
    return new TestSetup(new TestSuite(KeycloakConfigureAdminUserIdAndUseUsernameAsIdTest.class)) {

    	// @BeforeClass
        protected void setUp() throws Exception {
    		ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
    				.createProcessEngineConfigurationFromResource("camunda.configureAdminUserIdAndUseUsernameAsId.cfg.xml");
    		configureKeycloakIdentityProviderPlugin(config).setAdministratorUserId(USER_ID_CAMUNDA_ADMIN);
    		PluggableProcessEngineTestCase.cachedProcessEngine = config.buildProcessEngine();
        }
        
        // @AfterClass
        protected void tearDown() throws Exception {
    		PluggableProcessEngineTestCase.cachedProcessEngine.close();
    		PluggableProcessEngineTestCase.cachedProcessEngine = null;
        }
    };
}
 
Example #15
Source File: AsyncEndEventTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Deployment
public void testAsyncEndEventListeners() {
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("asyncEndEvent");
  long count = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).active().count();

  Assert.assertNull(runtimeService.getVariable(pi.getId(), "listener"));
  Assert.assertEquals(1, runtimeService.createExecutionQuery().activityId("endEvent").count());
  Assert.assertEquals(1, count);

  // as we are standing at the end event, we execute it.
  executeAvailableJobs();

  count = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).active().count();
  Assert.assertEquals(0, count);

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {

    // after the end event we have a event listener
    HistoricVariableInstanceQuery name = historyService.createHistoricVariableInstanceQuery()
                                                        .processInstanceId(pi.getId())
                                                        .variableName("listener");
    Assert.assertNotNull(name);
    Assert.assertEquals("listener invoked", name.singleResult().getValue());
  }
}
 
Example #16
Source File: OptimizeRestService.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/process-instance/running")
public List<HistoricProcessInstanceDto> getRunningHistoricProcessInstances(@QueryParam("startedAfter") String startedAfterAsString,
                                                                           @QueryParam("startedAt") String startedAtAsString,
                                                                           @QueryParam("maxResults") int maxResults) {
  Date startedAfter = dateConverter.convertQueryParameterToType(startedAfterAsString);
  Date startedAt = dateConverter.convertQueryParameterToType(startedAtAsString);
  maxResults = ensureValidMaxResults(maxResults);

  ProcessEngineConfigurationImpl config =
    (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();
  List<HistoricProcessInstance> historicProcessInstances =
    config.getOptimizeService().getRunningHistoricProcessInstances(startedAfter, startedAt, maxResults);

  List<HistoricProcessInstanceDto> result = new ArrayList<>();
  for (HistoricProcessInstance instance : historicProcessInstances) {
    HistoricProcessInstanceDto dto = HistoricProcessInstanceDto.fromHistoricProcessInstance(instance);
    result.add(dto);
  }
  return result;
}
 
Example #17
Source File: MultiInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelCallActivity.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.externalSubProcess.bpmn20.xml" })
public void testParallelCallActivityHistory() {
  runtimeService.startProcessInstanceByKey("miParallelCallActivity");
  List<Task> tasks = taskService.createTaskQuery().list();
  assertEquals(12, tasks.size());
  for (int i = 0; i < tasks.size(); i++) {
    taskService.complete(tasks.get(i).getId());
  }

  if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
    // Validate historic processes
    List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list();
    assertEquals(7, historicProcessInstances.size()); // 6 subprocesses + main process
    for (HistoricProcessInstance hpi : historicProcessInstances) {
      assertNotNull(hpi.getStartTime());
      assertNotNull(hpi.getEndTime());
    }

    // Validate historic activities
    List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("callActivity").list();
    assertEquals(6, historicActivityInstances.size());
    for (HistoricActivityInstance hai : historicActivityInstances) {
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getEndTime());
    }
  }

  if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
    // Validate historic tasks
    List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().list();
    assertEquals(12, historicTaskInstances.size());
    for (HistoricTaskInstance hti : historicTaskInstances) {
      assertNotNull(hti.getStartTime());
      assertNotNull(hti.getEndTime());
      assertNotNull(hti.getAssignee());
      assertEquals("completed", hti.getDeleteReason());
    }
  }
}
 
Example #18
Source File: CamundaBpmConfiguration.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(ProcessEngineConfigurationImpl.class)
public ProcessEngineConfigurationImpl processEngineConfigurationImpl(List<ProcessEnginePlugin> processEnginePlugins) {
  final SpringProcessEngineConfiguration configuration = CamundaSpringBootUtil.springProcessEngineConfiguration();
  configuration.getProcessEnginePlugins().add(new CompositeProcessEnginePlugin(processEnginePlugins));
  return configuration;
}
 
Example #19
Source File: Context.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
  Deque<ProcessEngineConfigurationImpl> stack = getStack(processEngineConfigurationStackThreadLocal);
  if (stack.isEmpty()) {
    return null;
  }
  return stack.peek();
}
 
Example #20
Source File: ManagementServiceTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected PropertyEntity getTelemetryProperty(ProcessEngineConfigurationImpl configuration) {
    return configuration.getCommandExecutorTxRequired()
      .execute(new Command<PropertyEntity>() {
        public PropertyEntity execute(CommandContext commandContext) {
          return commandContext.getPropertyManager().findPropertyById("camunda.telemetry.enabled");
        }
      });
}
 
Example #21
Source File: GetHistoricDecisionInstancesForOptimizeTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void init() {
  ProcessEngineConfigurationImpl config =
    engineRule.getProcessEngineConfiguration();
  optimizeService = config.getOptimizeService();
  identityService = engineRule.getIdentityService();
  runtimeService = engineRule.getRuntimeService();
  authorizationService = engineRule.getAuthorizationService();

  createUser(userId);
}
 
Example #22
Source File: CamundaBpmConfigurationTest.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Test
public void processEngineConfigurationImplTest() {
  CamundaBpmConfiguration camundaBpmConfiguration = new CamundaBpmConfiguration();
  List<ProcessEnginePlugin> processEnginePlugins = createUnordedList();
  ProcessEngineConfigurationImpl processEngineConfigurationImpl = camundaBpmConfiguration.processEngineConfigurationImpl(processEnginePlugins);

  CompositeProcessEnginePlugin compositeProcessEnginePlugin = (CompositeProcessEnginePlugin) processEngineConfigurationImpl.getProcessEnginePlugins().get(0);
  assertThat(compositeProcessEnginePlugin.getPlugins()).isEqualTo(processEnginePlugins);
}
 
Example #23
Source File: LoginAttemptsTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessEngineConfiguration configureEngine(ProcessEngineConfigurationImpl configuration) {
  configuration.setJdbcUrl("jdbc:h2:mem:LoginAttemptsTest;DB_CLOSE_DELAY=1000");
  configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP);
  configuration.setLoginMaxAttempts(5);
  configuration.setLoginDelayFactor(2);
  configuration.setLoginDelayMaxTime(30);
  configuration.setLoginDelayBase(1);
  return configuration;
}
 
Example #24
Source File: HistoricVariableInstanceScopeTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = {"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
public void testCmmnActivityInstanceIdOnTask() {

  // given
  CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase");

  String taskExecutionId = caseService
      .createCaseExecutionQuery()
      .activityId("PI_HumanTask_1")
      .singleResult()
      .getId();

  Task task = taskService
      .createTaskQuery()
      .singleResult();

  // when
  taskService.setVariable(task.getId(), "foo", "bar");

  // then
  HistoricVariableInstance variable = historyService
      .createHistoricVariableInstanceQuery()
      .variableName("foo")
      .singleResult();

  assertNotNull(variable);
  assertEquals(caseInstance.getId(), variable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail variableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(variable.getId())
      .singleResult();
    assertEquals(taskExecutionId, variableDetail.getActivityInstanceId());
  }

}
 
Example #25
Source File: AbstractPersistenceSession.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void dbSchemaUpdate() {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  if (!isEngineTablePresent()) {
    dbSchemaCreateEngine();
  }

  if (!isHistoryTablePresent() && processEngineConfiguration.isDbHistoryUsed()) {
    dbSchemaCreateHistory();
  }

  if (!isIdentityTablePresent() && processEngineConfiguration.isDbIdentityUsed()) {
    dbSchemaCreateIdentity();
  }

  if (!isCmmnTablePresent() && processEngineConfiguration.isCmmnEnabled()) {
    dbSchemaCreateCmmn();
  }

  if (!isCmmnHistoryTablePresent() && processEngineConfiguration.isCmmnEnabled() && processEngineConfiguration.isDbHistoryUsed()) {
    dbSchemaCreateCmmnHistory();
  }

  if (!isDmnTablePresent() && processEngineConfiguration.isDmnEnabled()) {
    dbSchemaCreateDmn();
  }

  if(!isDmnHistoryTablePresent() && processEngineConfiguration.isDmnEnabled() && processEngineConfiguration.isDbHistoryUsed()) {
    dbSchemaCreateDmnHistory();
  }

}
 
Example #26
Source File: MultiTenancySharedDefinitionPropagationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public ProcessEngineConfiguration configureEngine(ProcessEngineConfigurationImpl configuration) {

  TenantIdProvider tenantIdProvider = new StaticTenantIdTestProvider(TENANT_ID);
  configuration.setTenantIdProvider(tenantIdProvider);

  return configuration;
}
 
Example #27
Source File: MetricsDecisionEvaluationListener.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void notify(DmnDecisionEvaluationEvent evaluationEvent) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  if (processEngineConfiguration != null && processEngineConfiguration.isMetricsEnabled()) {
    MetricsRegistry metricsRegistry = processEngineConfiguration.getMetricsRegistry();
    metricsRegistry.markOccurrence(Metrics.EXECUTED_DECISION_INSTANCES,
                                   evaluationEvent.getExecutedDecisionInstances());
    metricsRegistry.markOccurrence(Metrics.EXECUTED_DECISION_ELEMENTS,
                                   evaluationEvent.getExecutedDecisionElements());
  }
}
 
Example #28
Source File: AbstractCamundaAutoConfigurationIT.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@After
public void cleanup() {
  //remove history level from database
  ((ProcessEngineConfigurationImpl)processEngine.getProcessEngineConfiguration()).getCommandExecutorTxRequired().execute(new Command<Void>() {
    @Override
    public Void execute(CommandContext commandContext) {
      final PropertyEntity historyLevel = commandContext.getPropertyManager().findPropertyById("historyLevel");
      if (historyLevel != null) {
        commandContext.getDbEntityManager().delete(historyLevel);
      }
      return null;
    }
  });
}
 
Example #29
Source File: HistoryCleanupDisabledOnBootstrapTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessEngineConfiguration configureEngine(ProcessEngineConfigurationImpl configuration) {
  configuration.setJdbcUrl("jdbc:h2:mem:" + HistoryCleanupDisabledOnBootstrapTest.class.getSimpleName());
  configuration.setHistoryCleanupEnabled(false);
  configuration.setHistoryCleanupBatchWindowStartTime("12:00");
  configuration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_CREATE_DROP);
  return configuration;
}
 
Example #30
Source File: SpringBootProcessEnginePluginTest.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Test
public void no_delegate_for_standaloneConfig() throws Exception {
  ProcessEngineConfigurationImpl c = new StandaloneInMemProcessEngineConfiguration();

  DummySpringPlugin plugin = new DummySpringPlugin();

  plugin.preInit(c);
  plugin.postInit(c);

  assertThat(plugin.preInit).isFalse();
  assertThat(plugin.postInit).isFalse();
}