Merge branch 'TAS-1946' into '5.1.N-newDSL'

Tas 1946

See merge request !176
This commit is contained in:
Paul Brodner
2016-11-16 13:59:56 +00:00
@@ -3,13 +3,10 @@ package org.alfresco.rest.workflow.processes;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.requests.Processes;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -20,52 +17,44 @@ import org.testng.annotations.Test;
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
public class GetProcessSanityTests extends RestWorkflowTest
{
@Autowired
private DataUser dataUser;
@Autowired
private Processes processesApi;
private UserModel userWhoStartsProcess, assignee;
private RestProcessModel addedProcess;
private RestProcessModel addedProcess, process;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
processesApi.useRestClient(restClient);
userWhoStartsProcess = dataUser.createRandomTestUser();
assignee = dataUser.createRandomTestUser();
restClient.authenticateUser(userWhoStartsProcess);
addedProcess = processesApi.addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
addedProcess = restClient.authenticateUser(userWhoStartsProcess).addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify user is able to get the process started by him using REST API and status code is OK (200)")
public void getProcessByOwner() throws Exception
{
restClient.authenticateUser(userWhoStartsProcess);
processesApi.getProcess(addedProcess).and().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
process = restClient.authenticateUser(userWhoStartsProcess).usingProcess(addedProcess).getProcess();
restClient.assertStatusCodeIs(HttpStatus.OK);
process.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify user is able to get the process assigned to him using REST API and status code is OK (200)")
public void getProcessByAssignee() throws Exception
{
restClient.authenticateUser(assignee);
processesApi.getProcess(addedProcess).and().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
process = restClient.authenticateUser(assignee).usingProcess(addedProcess).getProcess();
restClient.assertStatusCodeIs(HttpStatus.OK);
process.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify admin is able to get any process using REST API and status code is OK (200)")
public void getProcessByAdmin() throws Exception
{
restClient.authenticateUser(dataUser.getAdminUser());
processesApi.getProcess(addedProcess).and().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
process = restClient.authenticateUser(dataUser.getAdminUser()).usingProcess(addedProcess).getProcess();
restClient.assertStatusCodeIs(HttpStatus.OK);
process.assertThat().field("id").is(addedProcess.getId())
.and().field("startUserId").is(addedProcess.getStartUserId());
}
}