Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            string tag = DEFAULT_TAG;

            if (args.Length > 0)
            {
                tag = args[0];
            }
            currentFixtureTag = tag;

            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

            // register test scenarios
            ScenarioRunner runner = new ScenarioRunner(processEngine, tag);

            // compensation
            //rolling upgrade test scenarios
            runner.setupScenarios(typeof(ProcessWithUserTaskScenario));
            runner.setupScenarios(typeof(ProcessWithAsyncServiceTaskScenario));
            runner.setupScenarios(typeof(ProcessWithUserTaskAndTimerScenario));
            runner.setupScenarios(typeof(DeploymentWhichShouldBeDeletedScenario));
            runner.setupScenarios(typeof(ProcessWithParallelGatewayScenario));
            runner.setupScenarios(typeof(ProcessWithParallelGatewayAndServiceTaskScenario));
            runner.setupScenarios(typeof(ProcessWithCallActivityScenario));
            runner.setupScenarios(typeof(ProcessWithMultiInstanceCallActivityScenario));
            runner.setupScenarios(typeof(ProcessWithExternalTaskScenario));
            runner.setupScenarios(typeof(ProcessWithEventSubProcessScenario));
            runner.setupScenarios(typeof(JobTimestampsUpdateScenario));
            runner.setupScenarios(typeof(IncidentTimestampUpdateScenario));

            if (RollingUpdateConstants.NEW_ENGINE_TAG.Equals(currentFixtureTag))
            {     // create data with new engine
                runner.setupScenarios(typeof(HistoryCleanupScenario));
            }

            processEngine.close();

            processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.auth.cfg.xml");
            processEngine = processEngineConfiguration.buildProcessEngine();

            // register test auth scenarios
            runner = new ScenarioRunner(processEngine, tag);

            runner.setupScenarios(typeof(AuthorizationScenario));

            processEngine.close();
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFallbackSerializerDoesNotOverrideRegularSerializer()
        public virtual void testFallbackSerializerDoesNotOverrideRegularSerializer()
        {
            // given
            // that the process engine is configured with a serializer for a certain format
            // and a fallback serializer factory for the same format
            ProcessEngineConfigurationImpl engineConfiguration = (new StandaloneInMemProcessEngineConfiguration()).setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose");

            engineConfiguration.CustomPreVariableSerializers = Arrays.asList <TypedValueSerializer>(new ExampleConstantSerializer());
            engineConfiguration.FallbackSerializerFactory    = new ExampleSerializerFactory();

            processEngine = engineConfiguration.buildProcessEngine();
            deployOneTaskProcess(processEngine);

            // when setting a variable that no regular serializer can handle
            ObjectValue objectValue = Variables.objectValue("foo").serializationDataFormat(ExampleSerializer.FORMAT).create();

            ProcessInstance pi = processEngine.RuntimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValueTyped("var", objectValue));

            ObjectValue fetchedValue = processEngine.RuntimeService.getVariableTyped(pi.Id, "var", true);

            // then the fallback serializer is used
            Assert.assertNotNull(fetchedValue);
            Assert.assertEquals(ExampleSerializer.FORMAT, fetchedValue.SerializationDataFormat);
            Assert.assertEquals(ExampleConstantSerializer.DESERIALIZED_VALUE, fetchedValue.Value);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBuiltinFunctionMapperRegistration()
        public virtual void testBuiltinFunctionMapperRegistration()
        {
            // given a process engine configuration with a custom function mapper
            ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda" + this.GetType().Name);

            CustomExpressionManager customExpressionManager = new CustomExpressionManager();

            Assert.assertTrue(customExpressionManager.FunctionMappers.Count == 0);
            config.ExpressionManager = customExpressionManager;

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

            // then two default function mappers should be registered
            Assert.assertSame(customExpressionManager, config.ExpressionManager);
            Assert.assertEquals(2, customExpressionManager.FunctionMappers.Count);

            bool commandContextMapperFound = false;
            bool dateTimeMapperFound       = false;

            foreach (FunctionMapper functionMapper in customExpressionManager.FunctionMappers)
            {
                if (functionMapper is CommandContextFunctionMapper)
                {
                    commandContextMapperFound = true;
                }

                if (functionMapper is DateTimeFunctionMapper)
                {
                    dateTimeMapperFound = true;
                }
            }

            Assert.assertTrue(commandContextMapperFound && dateTimeMapperFound);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testPerformDatabaseSchemaOperationCreateTwice() throws Exception
        public virtual void testPerformDatabaseSchemaOperationCreateTwice()
        {
            // both process engines will be using this datasource.
            PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.ClassLoader, "org.h2.Driver", "jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000", "sa", "");

            Connection connection = pooledDataSource.Connection;

            connection.createStatement().execute("drop schema if exists " + SCHEMA_NAME);
            connection.createStatement().execute("create schema " + SCHEMA_NAME);
            connection.close();

            ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1").setDataSource(pooledDataSource).setDatabaseSchemaUpdate("NO_CHECK");

            config1.DatabaseTablePrefix       = SCHEMA_NAME + ".";
            config1.DatabaseSchema            = SCHEMA_NAME;
            config1.DbMetricsReporterActivate = false;
            ProcessEngine engine1 = config1.buildProcessEngine();

            // create the tables for the first time
            connection = pooledDataSource.Connection;
            connection.createStatement().execute("set schema " + SCHEMA_NAME);
            engine1.ManagementService.databaseSchemaUpgrade(connection, "", SCHEMA_NAME);
            connection.close();
            // create the tables for the second time; here we shouldn't crash since the
            // session should tell us that the tables are already present and
            // databaseSchemaUpdate is set to noop
            connection = pooledDataSource.Connection;
            connection.createStatement().execute("set schema " + SCHEMA_NAME);
            engine1.ManagementService.databaseSchemaUpgrade(connection, "", SCHEMA_NAME);
            engine1.close();
        }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

            // register test scenarios
            ScenarioRunner runner = new ScenarioRunner(processEngine, ENGINE_VERSION);

            // cmmn sentries
            runner.setupScenarios(typeof(SentryScenario));

            // compensation
            runner.setupScenarios(typeof(SingleActivityCompensationScenario));
            runner.setupScenarios(typeof(NestedCompensationScenario));
            runner.setupScenarios(typeof(SingleActivityConcurrentCompensationScenario));
            runner.setupScenarios(typeof(ParallelMultiInstanceCompensationScenario));
            runner.setupScenarios(typeof(SequentialMultiInstanceCompensationScenario));
            runner.setupScenarios(typeof(NestedMultiInstanceCompensationScenario));
            runner.setupScenarios(typeof(InterruptingEventSubProcessCompensationScenario));
            runner.setupScenarios(typeof(NonInterruptingEventSubProcessCompensationScenario));
            runner.setupScenarios(typeof(InterruptingEventSubProcessNestedCompensationScenario));

            // job
            runner.setupScenarios(typeof(JobMigrationScenario));

            // boundary events
            runner.setupScenarios(typeof(NonInterruptingBoundaryEventScenario));

            processEngine.close();
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPerformDatabaseSchemaOperationCreate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void shouldPerformDatabaseSchemaOperationCreate()
        {
            // both process engines will be using this datasource.
            PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.ClassLoader, "org.h2.Driver", "jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000", "sa", "");

            // create two schemas is the database
            Connection connection = pooledDataSource.Connection;

            connection.createStatement().execute("drop schema if exists SCHEMA1");
            connection.createStatement().execute("drop schema if exists SCHEMA2");
            connection.createStatement().execute("create schema SCHEMA1");
            connection.createStatement().execute("create schema SCHEMA2");
            connection.close();

            // configure & build two different process engines, each having a separate table prefix
            ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1").setDataSource(pooledDataSource).setDbMetricsReporterActivate(false).setDatabaseSchemaUpdate("NO_CHECK");     // disable auto create/drop schema

            config1.DatabaseTablePrefix        = "SCHEMA1.";
            config1.UseSharedSqlSessionFactory = true;
            ProcessEngine engine1 = config1.buildProcessEngine();

            ProcessEngineConfigurationImpl config2 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine2").setDataSource(pooledDataSource).setDbMetricsReporterActivate(false).setDatabaseSchemaUpdate("NO_CHECK");     // disable auto create/drop schema

            config2.DatabaseTablePrefix        = "SCHEMA2.";
            config2.UseSharedSqlSessionFactory = true;
            ProcessEngine engine2 = config2.buildProcessEngine();

            // create the tables in SCHEMA1
            connection = pooledDataSource.Connection;
            connection.createStatement().execute("set schema SCHEMA1");
            engine1.ManagementService.databaseSchemaUpgrade(connection, "", "SCHEMA1");
            connection.close();

            // create the tables in SCHEMA2
            connection = pooledDataSource.Connection;
            connection.createStatement().execute("set schema SCHEMA2");
            engine2.ManagementService.databaseSchemaUpgrade(connection, "", "SCHEMA2");
            connection.close();

            // if I deploy a process to one engine, it is not visible to the other
            // engine:
            try
            {
                engine1.RepositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/cfg/oneJobProcess.bpmn20.xml").deploy();

                assertEquals(1, engine1.RepositoryService.createDeploymentQuery().count());
                assertEquals(0, engine2.RepositoryService.createDeploymentQuery().count());
            }
            finally
            {
                engine1.close();
                engine2.close();
                ProcessEngineConfigurationImpl.cachedSqlSessionFactory = null;
            }
        }
Ejemplo n.º 7
0
        public static void Main(string[] args)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

            // register test scenarios
            ScenarioRunner runner = new ScenarioRunner(processEngine, ENGINE_VERSION);

            // event subprocesses
            runner.setupScenarios(typeof(InterruptingEventSubprocessScenario));
            runner.setupScenarios(typeof(NonInterruptingEventSubprocessScenario));
            runner.setupScenarios(typeof(NestedNonInterruptingEventSubprocessScenario));
            runner.setupScenarios(typeof(ParallelNestedNonInterruptingEventSubprocessScenario));
            runner.setupScenarios(typeof(NestedParallelNonInterruptingEventSubprocessScenario));
            runner.setupScenarios(typeof(NestedNonInterruptingEventSubprocessNestedSubprocessScenario));
            runner.setupScenarios(typeof(NestedInterruptingErrorEventSubprocessScenario));
            runner.setupScenarios(typeof(TwoLevelNestedNonInterruptingEventSubprocessScenario));
            runner.setupScenarios(typeof(NestedInterruptingEventSubprocessParallelScenario));

            // multi instance
            runner.setupScenarios(typeof(SequentialMultiInstanceSubprocessScenario));
            runner.setupScenarios(typeof(NestedSequentialMultiInstanceSubprocessScenario));
            runner.setupScenarios(typeof(MultiInstanceReceiveTaskScenario));
            runner.setupScenarios(typeof(ParallelMultiInstanceSubprocessScenario));

            // async
            runner.setupScenarios(typeof(AsyncParallelMultiInstanceScenario));
            runner.setupScenarios(typeof(AsyncSequentialMultiInstanceScenario));

            // boundary event
            runner.setupScenarios(typeof(NonInterruptingBoundaryEventScenario));
            runner.setupScenarios(typeof(NestedNonInterruptingBoundaryEventOnInnerSubprocessScenario));
            runner.setupScenarios(typeof(NestedNonInterruptingBoundaryEventOnOuterSubprocessScenario));

            // compensation
            runner.setupScenarios(typeof(SingleActivityCompensationScenario));
            runner.setupScenarios(typeof(SubprocessCompensationScenario));
            runner.setupScenarios(typeof(TransactionCancelCompensationScenario));
            runner.setupScenarios(typeof(InterruptingEventSubprocessCompensationScenario));
            runner.setupScenarios(typeof(SubprocessParallelThrowCompensationScenario));
            runner.setupScenarios(typeof(SubprocessParallelCreateCompensationScenario));

            // plain tasks
            runner.setupScenarios(typeof(OneTaskScenario));
            runner.setupScenarios(typeof(OneScopeTaskScenario));
            runner.setupScenarios(typeof(ParallelTasksScenario));
            runner.setupScenarios(typeof(ParallelScopeTasksScenario));

            // event-based gateway
            runner.setupScenarios(typeof(EventBasedGatewayScenario));

            processEngine.close();
        }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readLevelFullfromDB() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void readLevelFullfromDB()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl config = config("true", org.camunda.bpm.engine.ProcessEngineConfiguration.HISTORY_FULL);
            ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_FULL);

            // init the db with level=full
            processEngineImpl = (ProcessEngineImpl)config.buildProcessEngine();

            HistoryLevel historyLevel = config.CommandExecutorSchemaOperations.execute(new DetermineHistoryLevelCmd(config.HistoryLevels));

            assertThat(historyLevel, CoreMatchers.equalTo(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL));
        }
Ejemplo n.º 9
0
        public static void Main(string[] args)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

            // register test scenarios
            ScenarioRunner runner = new ScenarioRunner(processEngine, ENGINE_VERSION);

            // compensation
            runner.setupScenarios(typeof(DeployProcessWithoutIsExecutableAttributeScenario));

            processEngine.close();
        }
Ejemplo n.º 10
0
        public static void Main(string[] args)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

            // register test scenarios
            ScenarioRunner runner = new ScenarioRunner(processEngine, ENGINE_VERSION);

            // compensation
            runner.setupScenarios(typeof(CreateProcessInstanceWithJsonVariablesScenario));
            runner.setupScenarios(typeof(CreateRootProcessInstanceWithoutRootIdScenario));

            processEngine.close();
        }
Ejemplo n.º 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failWhenExistingHistoryLevelIsNotRegistered()
        public virtual void failWhenExistingHistoryLevelIsNotRegistered()
        {
            // init the db with custom level
            HistoryLevel customLevel = new HistoryLevelAnonymousInnerClass(this);
            ProcessEngineConfigurationImpl config = config("true", "custom");

            config.CustomHistoryLevels = Arrays.asList(customLevel);
            processEngineImpl          = (ProcessEngineImpl)config.buildProcessEngine();

            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("The configured history level with id='99' is not registered in this config.");

            config.CommandExecutorSchemaOperations.execute(new DetermineHistoryLevelCmd(System.Linq.Enumerable.Empty <HistoryLevel>()));
        }
Ejemplo n.º 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void useDefaultLevelAudit() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void useDefaultLevelAudit()
        {
            ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_AUTO);

            // init the db with level=auto -> audit
            processEngineImpl = (ProcessEngineImpl)config.buildProcessEngine();
            // the history Level has been overwritten with audit
            assertThat(config.HistoryLevel, CoreMatchers.equalTo(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_AUDIT));

            // and this is written to the database
            HistoryLevel databaseLevel = config.CommandExecutorSchemaOperations.execute(new DetermineHistoryLevelCmd(config.HistoryLevels));

            assertThat(databaseLevel, CoreMatchers.equalTo(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_AUDIT));
        }
Ejemplo n.º 13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testForceCloseMybatisConnectionPoolTrue()
        public virtual void testForceCloseMybatisConnectionPoolTrue()
        {
            // given
            // that the process engine is configured with forceCloseMybatisConnectionPool = true
            ProcessEngineConfigurationImpl configurationImpl = (new StandaloneInMemProcessEngineConfiguration()).setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose").setForceCloseMybatisConnectionPool(true);

            ProcessEngine processEngine = configurationImpl.buildProcessEngine();

            PooledDataSource pooledDataSource = (PooledDataSource)configurationImpl.DataSource;
            PoolState        state            = pooledDataSource.PoolState;


            // then
            // if the process engine is closed
            processEngine.close();

            // the idle connections are closed
            Assert.assertTrue(state.IdleConnectionCount == 0);
        }
Ejemplo n.º 14
0
        public static void Main(string[] args)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

            // register test scenarios
            ScenarioRunner runner = new ScenarioRunner(processEngine, ENGINE_VERSION);

            runner.setupScenarios(typeof(DeleteHistoricDecisionsBatchScenario));
            runner.setupScenarios(typeof(DeleteHistoricProcessInstancesBatchScenario));
            runner.setupScenarios(typeof(DeleteProcessInstancesBatchScenario));
            runner.setupScenarios(typeof(SetExternalTaskRetriesBatchScenario));
            runner.setupScenarios(typeof(SetJobRetriesBatchScenario));
            runner.setupScenarios(typeof(UpdateProcessInstanceSuspendStateBatchScenario));
            runner.setupScenarios(typeof(RestartProcessInstanceBatchScenario));
            runner.setupScenarios(typeof(TimerChangeProcessDefinitionScenario));
            runner.setupScenarios(typeof(TimerChangeJobDefinitionScenario));
            runner.setupScenarios(typeof(ModificationBatchScenario));
            runner.setupScenarios(typeof(ProcessInstanceModificationScenario));
            runner.setupScenarios(typeof(MigrationBatchScenario));
            runner.setupScenarios(typeof(TaskFilterScenario));
            runner.setupScenarios(typeof(TaskFilterVariablesScenario));
            runner.setupScenarios(typeof(TaskFilterPropertiesScenario));
            runner.setupScenarios(typeof(DeploymentDeployTimeScenario));
            runner.setupScenarios(typeof(JobTimestampsScenario));
            runner.setupScenarios(typeof(IncidentTimestampScenario));
            runner.setupScenarios(typeof(TaskCreateTimeScenario));
            runner.setupScenarios(typeof(ExternalTaskLockExpTimeScenario));
            runner.setupScenarios(typeof(EventSubscriptionCreateTimeScenario));
            runner.setupScenarios(typeof(MeterLogTimestampScenario));
            runner.setupScenarios(typeof(UserLockExpTimeScenario));
            runner.setupScenarios(typeof(CreateStandaloneTaskScenario));
            runner.setupScenarios(typeof(SetAssigneeProcessInstanceTaskScenario));
            runner.setupScenarios(typeof(CreateStandaloneTaskDeleteScenario));
            runner.setupScenarios(typeof(SuspendProcessDefinitionDeleteScenario));

            processEngine.close();
        }
Ejemplo n.º 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testTablePresentWithSchemaAndPrefix() throws java.sql.SQLException
        public virtual void testTablePresentWithSchemaAndPrefix()
        {
            PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.ClassLoader, "org.h2.Driver", "jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000", "sa", "");

            Connection connection = pooledDataSource.Connection;

            connection.createStatement().execute("drop schema if exists " + SCHEMA_NAME);
            connection.createStatement().execute("create schema " + SCHEMA_NAME);
            connection.createStatement().execute("create table " + SCHEMA_NAME + "." + PREFIX_NAME + "SOME_TABLE(id varchar(64));");
            connection.close();

            ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1").setDataSource(pooledDataSource).setDatabaseSchemaUpdate("NO_CHECK");

            config1.DatabaseTablePrefix       = SCHEMA_NAME + "." + PREFIX_NAME;
            config1.DatabaseSchema            = SCHEMA_NAME;
            config1.DbMetricsReporterActivate = false;
            ProcessEngine   engine          = config1.buildProcessEngine();
            CommandExecutor commandExecutor = config1.CommandExecutorTxRequired;

            commandExecutor.execute(new CommandAnonymousInnerClass(this));

            engine.close();
        }
Ejemplo n.º 16
0
        /// <param name="args"> </param>
        public static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                throw LOG.invokeSchemaResourceToolException(args.Length);
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String configurationFileResourceName = args[0];
            string configurationFileResourceName = args[0];
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String schemaFileResourceName = args[1];
            string schemaFileResourceName = args[1];

            ensureNotNull("Process engine configuration file name cannot be null", "configurationFileResourceName", configurationFileResourceName);
            ensureNotNull("Schema resource file name cannot be null", "schemaFileResourceName", schemaFileResourceName);

            ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(configurationFileResourceName);
            ProcessEngine processEngine = configuration.buildProcessEngine();

            configuration.CommandExecutorTxRequired.execute(new CommandAnonymousInnerClass(schemaFileResourceName));

            processEngine.close();
        }
Ejemplo n.º 17
0
        public virtual void testMyBatisConnectionPoolProperlyConfigured()
        {
            ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/api/cfg/connection-pool.camunda.cfg.xml");

            ProcessEngine engine = config.buildProcessEngine();

            // Expected values
            int maxActive            = 25;
            int maxIdle              = 10;
            int maxCheckoutTime      = 30000;
            int maxWaitTime          = 25000;
            int?jdbcStatementTimeout = 300;

            assertEquals(maxActive, config.JdbcMaxActiveConnections);
            assertEquals(maxIdle, config.JdbcMaxIdleConnections);
            assertEquals(maxCheckoutTime, config.JdbcMaxCheckoutTime);
            assertEquals(maxWaitTime, config.JdbcMaxWaitTime);
            assertEquals(jdbcStatementTimeout, config.JdbcStatementTimeout);

            // Verify that these properties are correctly set in the MyBatis datasource
            Configuration sessionFactoryConfiguration = config.DbSqlSessionFactory.SqlSessionFactory.Configuration;
            DataSource    datasource = sessionFactoryConfiguration.Environment.DataSource;

            assertTrue(datasource is PooledDataSource);

            PooledDataSource pooledDataSource = (PooledDataSource)datasource;

            assertEquals(maxActive, pooledDataSource.PoolMaximumActiveConnections);
            assertEquals(maxIdle, pooledDataSource.PoolMaximumIdleConnections);
            assertEquals(maxCheckoutTime, pooledDataSource.PoolMaximumCheckoutTime);
            assertEquals(maxWaitTime, pooledDataSource.PoolTimeToWait);

            assertEquals(jdbcStatementTimeout, sessionFactoryConfiguration.DefaultStatementTimeout);

            engine.close();
        }
Ejemplo n.º 18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void afterPropertiesSet() throws Exception
        public virtual void afterPropertiesSet()
        {
            dataSource = new PooledDataSource(ReflectUtil.ClassLoader, "org.h2.Driver", "jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000;MVCC=TRUE;", "sa", "");

            // create schema in the
            Connection connection = dataSource.Connection;

            connection.createStatement().execute("drop schema if exists SCHEMA1");
            connection.createStatement().execute("create schema SCHEMA1");
            connection.close();

            ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1").setDataSource(dataSource).setDbMetricsReporterActivate(false).setDatabaseSchemaUpdate("NO_CHECK");     // disable auto create/drop schema

            config1.DatabaseTablePrefix = "SCHEMA1.";
            ProcessEngine engine1 = config1.buildProcessEngine();

            // create the tables in SCHEMA1
            connection = dataSource.Connection;
            connection.createStatement().execute("set schema SCHEMA1");
            engine1.ManagementService.databaseSchemaUpgrade(connection, "", "SCHEMA1");
            connection.close();

            engine1.close();
        }
Ejemplo n.º 19
0
        protected internal override void initializeProcessEngine()
        {
            ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(engineConfigurationResource);

            processEngine = processEngineConfig.buildProcessEngine();
        }
Ejemplo n.º 20
0
        protected internal virtual ProcessEngineConfigurationImpl buildProcessEngine(ProcessEngineConfigurationImpl config)
        {
            processEngine = config.buildProcessEngine();

            return((ProcessEngineConfigurationImpl)processEngine.ProcessEngineConfiguration);
        }