Java Code Examples for org.activiti.engine.ProcessEngines#destroy()
The following examples show how to use
org.activiti.engine.ProcessEngines#destroy() .
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: MuleHttpBasicAuthTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void httpWithBasicAuth() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService() .createDeployment() .addClasspathResource("org/activiti5/mule/testHttpBasicAuth.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(10, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example 2
Source File: MuleVMTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void send() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); Deployment deployment = repositoryService.createDeployment() .addClasspathResource("org/activiti5/mule/testVM.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(30, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); repositoryService.deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example 3
Source File: MuleHttpTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void http() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttp.bpmn20.xml").deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(20, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example 4
Source File: MuleHttpBasicAuthTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void httpWithBasicAuth() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttpBasicAuth.bpmn20.xml").deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(10, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example 5
Source File: MuleVMTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void send() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/mule/testVM.bpmn20.xml").deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(30, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); repositoryService.deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example 6
Source File: PluggableActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected void initializeProcessEngine() { if (cachedProcessEngine == null) { pluggableActivitiTestCaseLogger.info("No cached process engine found for test. Retrieving the default engine."); ProcessEngines.destroy(); // Just to be sure we're not getting any previously cached version cachedProcessEngine = ProcessEngines.getDefaultProcessEngine(); if (cachedProcessEngine == null) { throw new ActivitiException("no default process engine available"); } } processEngine = cachedProcessEngine; processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); // Enable verbose execution tree debugging if needed if (this.getClass().isAnnotationPresent(EnableVerboseExecutionTreeLogging.class)) { swapCommandInvoker(true); } }
Example 7
Source File: MuleHttpTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void http() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService().createDeployment() .addClasspathResource("org/activiti5/mule/testHttp.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(20, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example 8
Source File: ReplayRunTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Test public void testProcessInstanceStartEvents() throws Exception { ProcessEngineImpl processEngine = initProcessEngine(); TaskService taskService = processEngine.getTaskService(); RuntimeService runtimeService = processEngine.getRuntimeService(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put(TEST_VARIABLE, TEST_VALUE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(USERTASK_PROCESS, BUSINESS_KEY, variables); Task task = taskService.createTaskQuery().taskDefinitionKey("userTask").singleResult(); TimeUnit.MILLISECONDS.sleep(50); taskService.complete(task.getId()); final SimulationDebugger simRun = new ReplaySimulationRun(processEngine, getReplayHandlers(processInstance.getId())); simRun.init(new NoExecutionVariableScope()); // original process is finished - there should not be any running process instance/task assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey(USERTASK_PROCESS).count()); assertEquals(0, taskService.createTaskQuery().taskDefinitionKey("userTask").count()); simRun.step(); // replay process was started assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey(USERTASK_PROCESS).count()); // there should be one task assertEquals(1, taskService.createTaskQuery().taskDefinitionKey("userTask").count()); simRun.step(); // userTask was completed - replay process was finished assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey(USERTASK_PROCESS).count()); assertEquals(0, taskService.createTaskQuery().taskDefinitionKey("userTask").count()); simRun.close(); processEngine.close(); ProcessEngines.destroy(); }
Example 9
Source File: PluggableActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void initializeProcessEngine() { if (cachedProcessEngine == null) { pluggableActivitiTestCaseLogger.info("No cached process engine found for test. Retrieving the default engine."); ProcessEngines.destroy(); // Just to be sure we're not getting any previously cached version cachedProcessEngine = ProcessEngines.getDefaultProcessEngine(); if (cachedProcessEngine==null) { throw new ActivitiException("no default process engine available"); } } processEngine = cachedProcessEngine; }
Example 10
Source File: ProcessEngineCreationIntegrationTest.java From tutorials with MIT License | 4 votes |
@After public void cleanup() { ProcessEngines.destroy(); }
Example 11
Source File: ActivitiPlugin.java From my_curd with Apache License 2.0 | 4 votes |
@Override public boolean stop() { ProcessEngines.destroy(); ActivitiPlugin.processEngine = null; return true; }
Example 12
Source File: ProcessEnginesTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void tearDown() throws Exception { ProcessEngines.destroy(); super.tearDown(); }
Example 13
Source File: ProcessEnginesTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void setUp() throws Exception { super.setUp(); ProcessEngines.destroy(); ProcessEngines.init(); }
Example 14
Source File: ActivitiServletContextListener.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void contextDestroyed(ServletContextEvent event) { LOGGER.info("Destroying Activiti Process Engine"); ProcessEngines.destroy(); }
Example 15
Source File: AbstractPlaybackTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override protected void closeDownProcessEngine() { ProcessEngines.destroy(); }
Example 16
Source File: SimulationRunTaskTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override protected void closeDownProcessEngine() { super.closeDownProcessEngine(); ProcessEngines.destroy(); }
Example 17
Source File: FirstSimulationRunTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override protected void closeDownProcessEngine() { super.closeDownProcessEngine(); ProcessEngines.destroy(); }
Example 18
Source File: ProcessDefinitionCacheTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void testStartProcessInstanceByIdAfterReboot() { // In case this test is run in a test suite, previous engines might // have been initialized and cached. First we close the // existing process engines to make sure that the db is clean // and that there are no existing process engines involved. ProcessEngines.destroy(); // Creating the DB schema (without building a process engine) ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration(); processEngineConfiguration.setProcessEngineName("reboot-test-schema"); processEngineConfiguration.setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000"); ProcessEngine schemaProcessEngine = processEngineConfiguration.buildProcessEngine(); // Create process engine and deploy test process ProcessEngine processEngine = new StandaloneProcessEngineConfiguration().setProcessEngineName("reboot-test").setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000").setAsyncExecutorActivate(false).buildProcessEngine(); processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/engine/test/cache/originalProcess.bpmn20.xml").deploy(); // verify existence of process definition List<ProcessDefinition> processDefinitions = processEngine.getRepositoryService().createProcessDefinitionQuery().list(); assertEquals(1, processDefinitions.size()); // Start a new Process instance ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitions.get(0).getId()); String processInstanceId = processInstance.getId(); assertNotNull(processInstance); // Close the process engine processEngine.close(); assertNotNull(processEngine.getRuntimeService()); // Reboot the process engine processEngine = new StandaloneProcessEngineConfiguration().setProcessEngineName("reboot-test").setDatabaseSchemaUpdate(org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000").setAsyncExecutorActivate(false).buildProcessEngine(); // Check if the existing process instance is still alive processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); assertNotNull(processInstance); // Complete the task. That will end the process instance TaskService taskService = processEngine.getTaskService(); Task task = taskService.createTaskQuery().list().get(0); taskService.complete(task.getId()); // Check if the process instance has really ended. This means that the // process definition has // re-loaded into the process definition cache processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); assertNull(processInstance); // Extra check to see if a new process instance can be started as well processInstance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitions.get(0).getId()); assertNotNull(processInstance); // close the process engine processEngine.close(); // Cleanup schema schemaProcessEngine.close(); }