As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
@Bean public SpringProcessEngineConfiguration processEngineConfiguration() { final SpringProcessEngineConfiguration engineConfiguration = new SpringProcessEngineConfiguration(); final DataSource dataSource = activitiDataSource(); engineConfiguration.setDataSource(dataSource); engineConfiguration.setTransactionManager(transactionManager); engineConfiguration.setDatabaseSchemaUpdate("drop-create"); engineConfiguration.setJobExecutorActivate(true); return engineConfiguration; }
de.wps.activiti.process.TransactionExceptionThrowingProcessTest2Async#transactionManagementTest
<br> @Test<br> @Deployment(resources = { PROCESS_BPMN })<br> public void transactionManagementTest() throws Exception {<br> try {<br> runtimeService.startProcessInstanceByKey(PROCESS_KEY, key);<br> } catch (Exception ex) {<br> LOGGER.error("#### Catched exception ####", ex);<br> }<br> TimeUnit.SECONDS.sleep(15);<br> assertThat(countHistoricProcessesByBusinessKey(key), is(1L));<br> List<Foo> findAll = fooRepository.findAll();<br> assertThat(findAll, containsInAnyOrder(hasProperty("bar", is("FooBar1")), hasProperty("bar", is("FooBar2"))));<br><br> assertThat(findAll.size(), is(2));<br> }<br>
TimeUnit.SECONDS.sleep(15)
changeDBValueTo3
<br> public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait, long intervalMillis) {<br> JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();<br> jobExecutor.start();<br><br> try {<br> Timer timer = new Timer();<br> InteruptTask task = new InteruptTask(Thread.currentThread());<br> timer.schedule(task, maxMillisToWait);<br> boolean areJobsAvailable = true;<br> try {<br> while (areJobsAvailable && !task.isTimeLimitExceeded()) {<br> Thread.sleep(intervalMillis);<br> try {<br> areJobsAvailable = areJobsAvailable();<br> } catch(Throwable t) {<br> // Ignore, possible that exception occurs due to locking/updating of table on MSSQL when<br> // isolation level doesn't allow READ of the table<br> }<br> }<br> } catch (InterruptedException e) {<br> // ignore<br> } finally {<br> timer.cancel();<br> }<br> if (areJobsAvailable) {<br> throw new ActivitiException("time limit of " + maxMillisToWait + " was exceeded");<br> }<br><br> } finally {<br> jobExecutor.shutdown();<br> }<br> }<br>