Search in sources :

Example 11 with ExecutorServiceImpl

use of org.jbpm.executor.impl.ExecutorServiceImpl in project jbpm by kiegroup.

the class JmsAvaiableJobExecutorTest method configureListener.

protected CountDownAsyncJobListener configureListener(int threads) {
    CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(threads);
    ((ExecutorServiceImpl) executorService).addAsyncJobListener(countDownListener);
    return countDownListener;
}
Also used : CountDownAsyncJobListener(org.jbpm.executor.test.CountDownAsyncJobListener) ExecutorServiceImpl(org.jbpm.executor.impl.ExecutorServiceImpl)

Example 12 with ExecutorServiceImpl

use of org.jbpm.executor.impl.ExecutorServiceImpl in project jbpm by kiegroup.

the class LogCleanupCommandTest method skipProcessLog.

@Test(timeout = 10000)
public void skipProcessLog() throws Exception {
    CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(1);
    ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener);
    // Generate data
    KieSession kieSession = createKSession(HELLO_WORLD);
    startProcess(kieSession, HELLO_WORLD_ID, 1);
    // Verify presence of data
    Assertions.assertThat(getProcessLogSize(HELLO_WORLD_ID)).isEqualTo(1);
    Assertions.assertThat(getNodeInstanceLogSize(HELLO_WORLD_ID)).isPositive();
    // Schedule cleanup job
    scheduleLogCleanup(true, false, false, getTomorrow(), null, HELLO_WORLD_ID);
    countDownListener.waitTillCompleted();
    // Verify that the process log has not been touched
    Assertions.assertThat(getProcessLogSize(HELLO_WORLD_ID)).isEqualTo(1);
    Assertions.assertThat(getNodeInstanceLogSize(HELLO_WORLD_ID)).isPositive();
}
Also used : CountDownAsyncJobListener(org.jbpm.test.listener.CountDownAsyncJobListener) ExecutorServiceImpl(org.jbpm.executor.impl.ExecutorServiceImpl) KieSession(org.kie.api.runtime.KieSession) Test(org.junit.Test)

Example 13 with ExecutorServiceImpl

use of org.jbpm.executor.impl.ExecutorServiceImpl in project jbpm by kiegroup.

the class LogCleanupCommandTest method deleteAllLogsOlderThanNow.

@Ignore
@Test(timeout = 10000)
@BZ("1190881")
public void deleteAllLogsOlderThanNow() throws Exception {
    CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(1);
    ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener);
    deleteAllLogsOlderThan(null, countDownListener);
    Assertions.assertThat(getProcessLogSize(HELLO_WORLD_ID)).isZero();
    Assertions.assertThat(getNodeInstanceLogSize(HELLO_WORLD_ID)).isZero();
}
Also used : CountDownAsyncJobListener(org.jbpm.test.listener.CountDownAsyncJobListener) ExecutorServiceImpl(org.jbpm.executor.impl.ExecutorServiceImpl) Ignore(org.junit.Ignore) Test(org.junit.Test) BZ(qa.tools.ikeeper.annotation.BZ)

Example 14 with ExecutorServiceImpl

use of org.jbpm.executor.impl.ExecutorServiceImpl in project jbpm by kiegroup.

the class LogCleanupCommandTest method deleteAllLogsOlderThanTomorrow.

@Ignore
@Test(timeout = 10000)
public void deleteAllLogsOlderThanTomorrow() throws Exception {
    CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(1);
    ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener);
    deleteAllLogsOlderThan(getTomorrow(), countDownListener);
    Assertions.assertThat(getProcessLogSize(HELLO_WORLD_ID)).isZero();
    Assertions.assertThat(getNodeInstanceLogSize(HELLO_WORLD_ID)).isZero();
}
Also used : CountDownAsyncJobListener(org.jbpm.test.listener.CountDownAsyncJobListener) ExecutorServiceImpl(org.jbpm.executor.impl.ExecutorServiceImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 15 with ExecutorServiceImpl

use of org.jbpm.executor.impl.ExecutorServiceImpl in project jbpm by kiegroup.

the class LogCleanupCommandTest method deleteAllLogsOlderThanPeriod.

@Ignore
@Test(timeout = 10000)
@BZ("1190881")
public void deleteAllLogsOlderThanPeriod() throws Exception {
    CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(1);
    ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener);
    // Generate data
    KieSession kieSession = createKSession(HELLO_WORLD);
    startProcess(kieSession, HELLO_WORLD_ID, 3);
    countDownListener.waitTillCompleted();
    startProcess(kieSession, HELLO_WORLD_ID, 2);
    // Verify presence of data
    Assertions.assertThat(getProcessLogSize(HELLO_WORLD_ID)).isEqualTo(5);
    Assertions.assertThat(getNodeInstanceLogSize(HELLO_WORLD_ID)).isPositive();
    // Schedule cleanup job
    scheduleLogCleanup(false, false, false, null, "8s", HELLO_WORLD_ID);
    countDownListener.waitTillCompleted();
    // Verify absence of data
    Assertions.assertThat(getProcessLogSize(HELLO_WORLD_ID)).isEqualTo(2);
}
Also used : CountDownAsyncJobListener(org.jbpm.test.listener.CountDownAsyncJobListener) ExecutorServiceImpl(org.jbpm.executor.impl.ExecutorServiceImpl) KieSession(org.kie.api.runtime.KieSession) Ignore(org.junit.Ignore) Test(org.junit.Test) BZ(qa.tools.ikeeper.annotation.BZ)

Aggregations

ExecutorServiceImpl (org.jbpm.executor.impl.ExecutorServiceImpl)32 Test (org.junit.Test)24 KieSession (org.kie.api.runtime.KieSession)18 CountDownAsyncJobListener (org.jbpm.executor.test.CountDownAsyncJobListener)17 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)16 HashMap (java.util.HashMap)13 CountDownAsyncJobListener (org.jbpm.test.listener.CountDownAsyncJobListener)13 QueryContext (org.kie.api.runtime.query.QueryContext)12 AbstractExecutorBaseTest (org.jbpm.test.util.AbstractExecutorBaseTest)8 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)8 RuntimeEnvironment (org.kie.api.runtime.manager.RuntimeEnvironment)8 DefaultRegisterableItemsFactory (org.jbpm.runtime.manager.impl.DefaultRegisterableItemsFactory)6 WorkItemHandler (org.kie.api.runtime.process.WorkItemHandler)6 AsyncWorkItemHandler (org.jbpm.executor.impl.wih.AsyncWorkItemHandler)5 AbstractRuntimeManager (org.jbpm.runtime.manager.impl.AbstractRuntimeManager)5 RequestInfo (org.kie.api.executor.RequestInfo)5 NodeLeftCountDownProcessEventListener (org.jbpm.test.listener.NodeLeftCountDownProcessEventListener)4 CommandContext (org.kie.api.executor.CommandContext)4 WorkItemManager (org.kie.api.runtime.process.WorkItemManager)4 TaskSummary (org.kie.api.task.model.TaskSummary)4