Search in sources :

Example 11 with ErrorInfo

use of org.kie.api.executor.ErrorInfo in project jbpm by kiegroup.

the class BasicExecutorIntegrationTest method executorExceptionTrimmingTest.

@Test
public void executorExceptionTrimmingTest() throws InterruptedException {
    System.setProperty("org.kie.executor.msg.length", "10");
    System.setProperty("org.kie.executor.stacktrace.length", "20");
    CommandContext commandContext = new CommandContext();
    commandContext.setData("businessKey", UUID.randomUUID().toString());
    cachedEntities.put((String) commandContext.getData("businessKey"), new AtomicLong(1));
    commandContext.setData("callbacks", "org.jbpm.executor.ejb.impl.test.SimpleIncrementCallback");
    commandContext.setData("retries", 0);
    executorService.scheduleRequest("org.jbpm.executor.ejb.impl.test.ThrowExceptionCommand", commandContext);
    logger.info("{} Sleeping for 10 secs", System.currentTimeMillis());
    Thread.sleep(10000);
    List<RequestInfo> inErrorRequests = executorService.getInErrorRequests(new QueryContext());
    assertEquals(1, inErrorRequests.size());
    logger.info("Error: {}", inErrorRequests.get(0));
    List<ErrorInfo> errors = executorService.getAllErrors(new QueryContext());
    logger.info("Errors: {}", errors);
    assertEquals(1, errors.size());
    ErrorInfo error = errors.get(0);
    assertEquals(10, error.getMessage().length());
    assertEquals(20, error.getStacktrace().length());
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) CommandContext(org.kie.api.executor.CommandContext) ErrorInfo(org.kie.api.executor.ErrorInfo) QueryContext(org.kie.api.runtime.query.QueryContext) RequestInfo(org.kie.api.executor.RequestInfo) Test(org.junit.Test)

Aggregations

ErrorInfo (org.kie.api.executor.ErrorInfo)11 Test (org.junit.Test)10 QueryContext (org.kie.api.runtime.query.QueryContext)10 CommandContext (org.kie.api.executor.CommandContext)9 RequestInfo (org.kie.api.executor.RequestInfo)9 CountDownAsyncJobListener (org.jbpm.executor.test.CountDownAsyncJobListener)6 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 HashMap (java.util.HashMap)1 ExecutorServiceImpl (org.jbpm.executor.impl.ExecutorServiceImpl)1 AsyncWorkItemHandler (org.jbpm.executor.impl.wih.AsyncWorkItemHandler)1 RemoveObjectCommand (org.jbpm.shared.services.impl.commands.RemoveObjectCommand)1 CountDownAsyncJobListener (org.jbpm.test.listener.CountDownAsyncJobListener)1 KieSession (org.kie.api.runtime.KieSession)1 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)1 WorkItemManager (org.kie.api.runtime.process.WorkItemManager)1 BZ (qa.tools.ikeeper.annotation.BZ)1