Tabnine Logo
CommandContext.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.jbpm.executor.api.CommandContext
constructor

Best Java code snippets using org.jbpm.executor.api.CommandContext.<init> (Showing top 7 results out of 315)

origin: org.jbpm/executor-services

public void FIXMEfutureRequestTest() throws InterruptedException {
  CommandContext ctxCMD = new CommandContext();
  ctxCMD.setData("businessKey", UUID.randomUUID().toString());
  Long requestId = executorService.scheduleRequest("org.jbpm.executor.commands.PrintOutCommand", new Date(new Date().getTime() + 10000), ctxCMD);
  
  Thread.sleep(5000);
  
  List<RequestInfo> runningRequests = executorService.getRunningRequests();
  assertEquals(0, runningRequests.size());
  
  List<RequestInfo> futureQueuedRequests = executorService.getFutureQueuedRequests();
  assertEquals(1, futureQueuedRequests.size());
  
  Thread.sleep(10000);
  
  List<RequestInfo> completedRequests = executorService.getCompletedRequests();
  assertEquals(1, completedRequests.size());
}

origin: org.jbpm/executor-services

@Test
public void defaultRequestRetryTest() throws InterruptedException {
  CommandContext ctxCMD = new CommandContext();
  ctxCMD.setData("businessKey", UUID.randomUUID().toString());
  executorService.scheduleRequest("org.jbpm.executor.ThrowExceptionCommand", ctxCMD);
  Thread.sleep(12000);
  List<RequestInfo> inErrorRequests = executorService.getInErrorRequests();
  assertEquals(1, inErrorRequests.size());
  List<ErrorInfo> errors = executorService.getAllErrors();
  System.out.println(" >>> Errors: " + errors);
  // Three retries means 4 executions in total 1(regular) + 3(retries)
  assertEquals(4, errors.size());
}
origin: salaboy/jBPM5-Developer-Guide

    String callbacks = (String) workItem.getParameter("callbacks");
this.execKey = workItem.getName() + "_" + workItem.getProcessInstanceId() + "_" + workItemId + "@sessionId="+this.sessionId;
CommandContext ctx = new CommandContext();
for (Map.Entry<String, Object> entry : workItem.getParameters().entrySet()) {
  if (entry.getValue() instanceof Object) {
origin: org.jbpm/executor-services

@Test
public void executorExceptionTest() throws InterruptedException {
  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.SimpleIncrementCallback");
  commandContext.setData("retries", 0);
  executorService.scheduleRequest("org.jbpm.executor.ThrowExceptionCommand", commandContext);
  System.out.println(System.currentTimeMillis() + "  >>> Sleeping for 10 secs");
  Thread.sleep(10000);
  List<RequestInfo> inErrorRequests = executorService.getInErrorRequests();
  assertEquals(1, inErrorRequests.size());
  System.out.println("Error: " + inErrorRequests.get(0));
  List<ErrorInfo> errors = executorService.getAllErrors();
  System.out.println(" >>> Errors: " + errors);
  assertEquals(1, errors.size());
}
origin: org.jbpm/executor-services

@Test
public void cancelRequestTest() throws InterruptedException {
  //  The executor is on purpose not started to not fight against race condition 
  // with the request cancelations.
  CommandContext ctxCMD = new CommandContext();
  ctxCMD.setData("businessKey", UUID.randomUUID().toString());
  Long requestId = executorService.scheduleRequest("org.jbpm.executor.commands.PrintOutCommand", ctxCMD);
  // cancel the task immediately
  executorService.cancelRequest(requestId);
  List<RequestInfo> cancelledRequests = executorService.getCancelledRequests();
  assertEquals(1, cancelledRequests.size());
}

origin: org.jbpm/executor-services

@Test
public void simpleExcecutionTest() throws InterruptedException {
  CommandContext ctxCMD = new CommandContext();
  ctxCMD.setData("businessKey", UUID.randomUUID().toString());
  executorService.scheduleRequest("org.jbpm.executor.commands.PrintOutCommand", ctxCMD);
  Thread.sleep(10000);
  List<RequestInfo> inErrorRequests = executorService.getInErrorRequests();
  assertEquals(0, inErrorRequests.size());
  List<RequestInfo> queuedRequests = executorService.getQueuedRequests();
  assertEquals(0, queuedRequests.size());
  List<RequestInfo> executedRequests = executorService.getCompletedRequests();
  assertEquals(1, executedRequests.size());
}
origin: org.jbpm/executor-services

@Test
public void callbackTest() throws InterruptedException {
  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.SimpleIncrementCallback");
  executorService.scheduleRequest("org.jbpm.executor.commands.PrintOutCommand", commandContext);
  Thread.sleep(10000);
  List<RequestInfo> inErrorRequests = executorService.getInErrorRequests();
  assertEquals(0, inErrorRequests.size());
  List<RequestInfo> queuedRequests = executorService.getQueuedRequests();
  assertEquals(0, queuedRequests.size());
  List<RequestInfo> executedRequests = executorService.getCompletedRequests();
  assertEquals(1, executedRequests.size());
  assertEquals(2, ((AtomicLong) cachedEntities.get((String) commandContext.getData("businessKey"))).longValue());
}
org.jbpm.executor.apiCommandContext<init>

Popular methods of CommandContext

  • getData
  • setData

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • setRequestProperty (URLConnection)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • JCheckBox (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now