Example #1
0
        /// <summary>
        /// Assures that property names are matched on the setter name according to java beans conventions
        /// and not on the field name.
        /// </summary>
        public virtual void testConfigurationPropertiesWithMismatchingFieldAndSetter()
        {
            ProcessEngineConfigurationImpl engineConfiguration = new StandaloneProcessEngineConfiguration();

            IDictionary <string, string> propertiesToSet = new Dictionary <string, string>();

            propertiesToSet[DB_IDENTITY_USED_PROP] = "false";
            PropertyHelper.applyProperties(engineConfiguration, propertiesToSet);

            Assert.assertFalse(engineConfiguration.DbIdentityUsed);

            propertiesToSet[DB_IDENTITY_USED_PROP] = "true";
            PropertyHelper.applyProperties(engineConfiguration, propertiesToSet);

            Assert.assertTrue(engineConfiguration.DbIdentityUsed);
        }
Example #2
0
        public virtual void testNonExistingPropertyForProcessEngineConfiguration()
        {
            ProcessEngineConfiguration   engineConfiguration = new StandaloneProcessEngineConfiguration();
            IDictionary <string, string> propertiesToSet     = new Dictionary <string, string>();

            propertiesToSet["aNonExistingProperty"] = "someValue";

            try
            {
                PropertyHelper.applyProperties(engineConfiguration, propertiesToSet);
                Assert.fail();
            }
            catch (Exception)
            {
                // happy path
            }
        }
Example #3
0
        /// <summary>
        /// Assert that String, int and boolean properties can be set.
        /// </summary>
        public virtual void testProcessEngineConfigurationProperties()
        {
            ProcessEngineConfiguration engineConfiguration = new StandaloneProcessEngineConfiguration();

            IDictionary <string, string> propertiesToSet = new Dictionary <string, string>();

            propertiesToSet[JOB_EXECUTOR_DEPLOYMENT_AWARE_PROP] = "true";
            propertiesToSet[JOB_EXECUTOR_PREFER_TIMER_JOBS]     = "true";
            propertiesToSet[JOB_EXECUTOR_ACQUIRE_BY_DUE_DATE]   = "true";
            propertiesToSet[MAIL_SERVER_PORT_PROP] = "42";
            propertiesToSet[JDBC_URL_PROP]         = "someUrl";

            PropertyHelper.applyProperties(engineConfiguration, propertiesToSet);

            Assert.assertTrue(engineConfiguration.JobExecutorDeploymentAware);
            Assert.assertTrue(engineConfiguration.JobExecutorPreferTimerJobs);
            Assert.assertTrue(engineConfiguration.JobExecutorAcquireByDueDate);
            Assert.assertEquals(42, engineConfiguration.MailServerPort);
            Assert.assertEquals("someUrl", engineConfiguration.JdbcUrl);
        }
Example #4
0
        protected internal static ProcessEngine createProcessEngine(javax.sql.DataSource datasource, Properties properties)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration();

            processEngineConfiguration.DataSource           = datasource;
            processEngineConfiguration.DatabaseSchemaUpdate = ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE;

            processEngineConfiguration.History = properties.getProperty("historyLevel");

            processEngineConfiguration.JdbcBatchProcessing = Convert.ToBoolean(properties.getProperty("jdbcBatchProcessing"));

            // load plugins
            string processEnginePlugins = properties.getProperty("processEnginePlugins", "");

            foreach (string pluginName in processEnginePlugins.Split(",", true))
            {
                if (pluginName.Length > 1)
                {
                    object pluginInstance = ReflectUtil.instantiate(pluginName);
                    if (!(pluginInstance is ProcessEnginePlugin))
                    {
                        throw new PerfTestException("Plugin " + pluginName + " is not an instance of ProcessEnginePlugin");
                    }
                    else
                    {
                        IList <ProcessEnginePlugin> plugins = processEngineConfiguration.ProcessEnginePlugins;
                        if (plugins == null)
                        {
                            plugins = new List <ProcessEnginePlugin>();
                            processEngineConfiguration.ProcessEnginePlugins = plugins;
                        }
                        plugins.Add((ProcessEnginePlugin)pluginInstance);
                    }
                }
            }

            return(processEngineConfiguration.buildProcessEngine());
        }