Search in sources :

Example 1 with WorkflowTaskExecInput

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);
}
Also used : UserWorkflowTaskService(org.apache.syncope.common.rest.api.service.UserWorkflowTaskService) WorkflowTaskExecInput(org.apache.syncope.common.lib.to.WorkflowTaskExecInput)

Example 2 with WorkflowTaskExecInput

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());
}
Also used : UserRequestForm(org.apache.syncope.common.lib.to.UserRequestForm) UserTO(org.apache.syncope.common.lib.to.UserTO) WorkflowTaskExecInput(org.apache.syncope.common.lib.to.WorkflowTaskExecInput) UserRequestService(org.apache.syncope.common.rest.api.service.UserRequestService) UserRequestQuery(org.apache.syncope.common.rest.api.beans.UserRequestQuery) SyncopeClient(org.apache.syncope.client.lib.SyncopeClient) UserRequest(org.apache.syncope.common.lib.to.UserRequest) Test(org.junit.jupiter.api.Test)

Aggregations

WorkflowTaskExecInput (org.apache.syncope.common.lib.to.WorkflowTaskExecInput)2 SyncopeClient (org.apache.syncope.client.lib.SyncopeClient)1 UserRequest (org.apache.syncope.common.lib.to.UserRequest)1 UserRequestForm (org.apache.syncope.common.lib.to.UserRequestForm)1 UserTO (org.apache.syncope.common.lib.to.UserTO)1 UserRequestQuery (org.apache.syncope.common.rest.api.beans.UserRequestQuery)1 UserRequestService (org.apache.syncope.common.rest.api.service.UserRequestService)1 UserWorkflowTaskService (org.apache.syncope.common.rest.api.service.UserWorkflowTaskService)1 Test (org.junit.jupiter.api.Test)1