use of org.apache.syncope.common.lib.to.WorkflowTaskExecInput in project syncope by apache.
the class UserWorkflowTaskRestClient method executeNextTask.
public static UserTO executeNextTask(final UserTO userTO) {
WorkflowTaskExecInput input = new WorkflowTaskExecInput();
input.setUserKey(userTO.getKey());
return getService(UserWorkflowTaskService.class).executeNextTask(input);
}
use of org.apache.syncope.common.lib.to.WorkflowTaskExecInput in project syncope by apache.
the class UserRequestITCase method addVariablesToUserRequestAtStart.
@Test
public void addVariablesToUserRequestAtStart() {
PagedResult<UserRequestForm> forms = userRequestService.listForms(new UserRequestQuery.Builder().build());
int preForms = forms.getTotalCount();
UserTO user = createUser(UserITCase.getUniqueSample("addVariables@tirasa.net")).getEntity();
assertNotNull(user);
SyncopeClient client = clientFactory.create(user.getUsername(), "password123");
WorkflowTaskExecInput testInput = new WorkflowTaskExecInput();
testInput.getVariables().put("providedVariable", "test");
// start request as user
UserRequest req = client.getService(UserRequestService.class).startRequest("verifyAddedVariables", null, testInput);
assertNotNull(req);
// check that a new form is available
forms = userRequestService.listForms(new UserRequestQuery.Builder().build());
assertEquals(preForms + 1, forms.getTotalCount());
// get the form and verify the property value
PagedResult<UserRequestForm> userForms = userRequestService.listForms(new UserRequestQuery.Builder().user(user.getKey()).build());
assertEquals(1, userForms.getTotalCount());
UserRequestForm form = userForms.getResult().get(0);
form = userRequestService.claimForm(form.getTaskId());
assertEquals(form.getProperty("providedVariable").get().getValue(), "test");
// cancel request
userRequestService.cancelRequest(req.getExecutionId(), "nothing in particular");
// no more forms available
forms = userRequestService.listForms(new UserRequestQuery.Builder().build());
assertEquals(preForms, forms.getTotalCount());
assertTrue(client.getService(UserRequestService.class).listRequests(new UserRequestQuery.Builder().user(user.getKey()).build()).getResult().isEmpty());
}
Aggregations