Java Code Examples for org.activiti.engine.ProcessEngineConfiguration#buildProcessEngine()

The following examples show how to use org.activiti.engine.ProcessEngineConfiguration#buildProcessEngine() . 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: JobExecutorJMXClientTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testJobExecutorJMXClient() throws InterruptedException, IOException, MalformedObjectNameException, AttributeNotFoundException, InstanceNotFoundException, MBeanException,
    ReflectionException {
  String hostName = Utils.getHostName();
  JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://" + hostName + ":10111/jndi/rmi://" + hostName + ":1099/jmxrmi/activiti");

  ProcessEngineConfiguration processEngineConfig = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
  processEngineConfig.buildProcessEngine();

  // wait for jmx server to come up
  Thread.sleep(500);
  JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

  MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
  ObjectName jobExecutorBeanName = new ObjectName("org.activiti.jmx.Mbeans:type=JobExecutor");

  processEngineConfig.getAsyncExecutor().shutdown();

  // first check that job executor is not activated and correctly reported
  // as being inactive
  assertFalse(processEngineConfig.isAsyncExecutorActivate());
  assertFalse((Boolean) mbsc.getAttribute(jobExecutorBeanName, "JobExecutorActivated"));
  // now activate it remotely
  mbsc.invoke(jobExecutorBeanName, "setJobExecutorActivate", new Boolean[] { true }, new String[] { Boolean.class.getName() });

  // check if it has the effect and correctly reported
  // assertTrue(processEngineConfig.getJobExecutor().isActive());
  assertTrue((Boolean) mbsc.getAttribute(jobExecutorBeanName, "JobExecutorActivated"));

  // agani disable and check it
  mbsc.invoke(jobExecutorBeanName, "setJobExecutorActivate", new Boolean[] { false }, new String[] { Boolean.class.getName() });

  // check if it has the effect and correctly reported
  assertFalse(processEngineConfig.isAsyncExecutorActivate());
  assertFalse((Boolean) mbsc.getAttribute(jobExecutorBeanName, "JobExecutorActivated"));
}
 
Example 2
Source File: ResourceActivitiTestCase.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeProcessEngine() {
  ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(activitiConfigurationResource);
  if (processEngineName != null) {
    logger.info("Initializing process engine with name '" + processEngineName + "'");
    config.setProcessEngineName(processEngineName);
  }
  additionalConfiguration(config);
  processEngine = config.buildProcessEngine();
}
 
Example 3
Source File: ProcessEngineCreationIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void givenXMLConfig_whenCreateDefaultConfiguration_thenGotProcessEngine() {
    ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
    ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
    assertNotNull(processEngine);
    assertEquals("root", processEngine.getProcessEngineConfiguration().getJdbcUsername());
}
 
Example 4
Source File: ProcessEngineCreationIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void givenDifferentNameXMLConfig_whenGetProcessEngineConfig_thenGotResult() {
    ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("my.activiti.cfg.xml");
    ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
    assertNotNull(processEngine);
    assertEquals("baeldung", processEngine.getProcessEngineConfiguration().getJdbcUsername());
}
 
Example 5
Source File: ProcessEngineCreationIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void givenDifferentBeanNameInXMLConfig_whenGetProcessEngineConfig_thenGotResult() {
    ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration
      .createProcessEngineConfigurationFromResource("my.activiti.cfg.xml", "myProcessEngineConfiguration");
    ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
    assertNotNull(processEngine);
    assertEquals("baeldung", processEngine.getProcessEngineConfiguration().getJdbcUsername());
}