Search in sources :

Example 66 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class BatchMigrationTest method testMigrationJobsExecutionByJobExecutorWithAuthorizationEnabledAndTenant.

@Test
public void testMigrationJobsExecutionByJobExecutorWithAuthorizationEnabledAndTenant() {
    ProcessEngineConfigurationImpl processEngineConfiguration = engineRule.getProcessEngineConfiguration();
    processEngineConfiguration.setAuthorizationEnabled(true);
    try {
        Batch batch = helper.migrateProcessInstancesAsyncForTenant(10, "someTenantId");
        helper.executeSeedJob(batch);
        testRule.waitForJobExecutorToProcessAllJobs();
        // then all process instances where migrated
        assertEquals(0, helper.countSourceProcessInstances());
        assertEquals(10, helper.countTargetProcessInstances());
    } finally {
        processEngineConfiguration.setAuthorizationEnabled(false);
    }
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Test(org.junit.Test)

Example 67 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class BatchMigrationTest method testDefaultBatchConfiguration.

@Test
public void testDefaultBatchConfiguration() {
    ProcessEngineConfigurationImpl configuration = engineRule.getProcessEngineConfiguration();
    assertEquals(100, configuration.getBatchJobsPerSeed());
    assertEquals(1, configuration.getInvocationsPerBatchJob());
    assertEquals(30, configuration.getBatchPollTime());
}
Also used : ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Test(org.junit.Test)

Example 68 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class BatchMigrationTest method restoreEngineSettings.

@After
public void restoreEngineSettings() {
    ProcessEngineConfigurationImpl configuration = engineRule.getProcessEngineConfiguration();
    configuration.setBatchJobsPerSeed(defaultBatchJobsPerSeed);
    configuration.setInvocationsPerBatchJob(defaultInvocationsPerBatchJob);
}
Also used : ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) After(org.junit.After)

Example 69 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class SentryScenarioTest method createCaseSentryPartQuery.

// queries /////////////////////////////////
protected CaseSentryPartQueryImpl createCaseSentryPartQuery() {
    ProcessEngine processEngine = rule.getProcessEngine();
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
    return new CaseSentryPartQueryImpl(commandExecutor);
}
Also used : CommandExecutor(org.camunda.bpm.engine.impl.interceptor.CommandExecutor) CaseSentryPartQueryImpl(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 70 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class JobMigrationScenario method triggerEntryCriterion.

@DescribesScenario("createJob")
public static ScenarioSetup triggerEntryCriterion() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, final String scenarioName) {
            final ProcessEngineConfigurationImpl engineConfiguration = (ProcessEngineConfigurationImpl) engine.getProcessEngineConfiguration();
            CommandExecutor commandExecutor = engineConfiguration.getCommandExecutorTxRequired();
            // create a job with the scenario name as id and a null suspension state
            commandExecutor.execute(new Command<Void>() {

                public Void execute(CommandContext commandContext) {
                    Connection connection = null;
                    Statement statement = null;
                    ResultSet rs = null;
                    try {
                        SqlSession sqlSession = commandContext.getDbSqlSession().getSqlSession();
                        connection = sqlSession.getConnection();
                        statement = connection.createStatement();
                        statement.executeUpdate("INSERT INTO ACT_RU_JOB(ID_, REV_, RETRIES_, TYPE_, EXCLUSIVE_, HANDLER_TYPE_) " + "VALUES (" + "'" + scenarioName + "'," + "1," + "3," + "'timer'," + DbSqlSessionFactory.databaseSpecificTrueConstant.get(engineConfiguration.getDatabaseType()) + "," + "'" + TimerStartEventJobHandler.TYPE + "'" + ")");
                        connection.commit();
                        statement.close();
                    } catch (SQLException e) {
                        throw new RuntimeException(e);
                    } finally {
                        try {
                            if (statement != null) {
                                statement.close();
                            }
                            if (rs != null) {
                                rs.close();
                            }
                            if (connection != null) {
                                connection.close();
                            }
                        } catch (SQLException e) {
                            throw new RuntimeException(e);
                        }
                    }
                    return null;
                }
            });
        }
    };
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) SqlSession(org.apache.ibatis.session.SqlSession) SQLException(java.sql.SQLException) Statement(java.sql.Statement) CommandExecutor(org.camunda.bpm.engine.impl.interceptor.CommandExecutor) Connection(java.sql.Connection) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ResultSet(java.sql.ResultSet) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario)

Aggregations

ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)161 Test (org.junit.Test)35 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)22 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)18 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)17 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)17 HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)13 HistoryEventProcessor (org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor)12 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)12 Before (org.junit.Before)11 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)8 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)8 After (org.junit.After)8 Date (java.util.Date)7 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)7 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)7 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)7 IdentityService (org.camunda.bpm.engine.IdentityService)7 ProcessEngineImpl (org.camunda.bpm.engine.impl.ProcessEngineImpl)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)6