use of org.kie.api.executor.ExecutionResults in project jbpm by kiegroup.
the class CheckCallCommand method execute.
@Override
public ExecutionResults execute(CommandContext ctx) throws Exception {
logger.debug("Command executed on executor with data {}", ctx.getData());
// wait for all parties to wait on barrier
barrier.await();
ExecutionResults executionResults = new ExecutionResults();
executionResults.setData("commandExecuted", true);
return executionResults;
}
use of org.kie.api.executor.ExecutionResults in project jbpm by kiegroup.
the class UserCommand method execute.
public ExecutionResults execute(CommandContext ctx) {
System.out.println("[INFO] Command executed on executor with " + ctx.getData());
WorkItem workItem = (WorkItem) ctx.getData("workItem");
User user = (User) workItem.getParameter("UserIn");
user.setName(user.getName() + " after command execution");
ExecutionResults executionResults = new ExecutionResults();
executionResults.setData("UserOut", user);
double item = 0;
for (int i = 0; i < 99; i++) {
System.out.println("[INFO] User item:" + item);
item++;
}
return executionResults;
}
use of org.kie.api.executor.ExecutionResults in project jbpm by kiegroup.
the class WebServiceCommandTest method testExecuteCommandWithBasicAuth.
@Test
public void testExecuteCommandWithBasicAuth() throws Exception {
Object[] clientObject = Arrays.asList("testResults").toArray();
when(clients.containsKey(anyObject())).thenReturn(true);
when(clients.get(anyObject())).thenReturn(client);
when(client.invoke(anyString(), any(Object[].class))).thenReturn(clientObject);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("Interface", "someInterface");
workItem.setParameter("Operation", "someOperation");
workItem.setParameter("Username", "testUserName");
workItem.setParameter("Password", "testPassword");
when(commandContext.getData(anyString())).thenReturn(workItem);
HTTPConduit http = Mockito.mock(HTTPConduit.class, Mockito.CALLS_REAL_METHODS);
when(client.getConduit()).thenReturn(http);
WebServiceCommand command = new WebServiceCommand();
command.setClients(clients);
ExecutionResults results = command.execute(commandContext);
assertNotNull(results);
assertEquals("testResults", results.getData("Result"));
assertNotNull(http.getAuthorization());
AuthorizationPolicy authorizationPolicy = http.getAuthorization();
assertEquals("Basic", authorizationPolicy.getAuthorizationType());
assertEquals("testUserName", authorizationPolicy.getUserName());
assertEquals("testPassword", authorizationPolicy.getPassword());
}
Aggregations