mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
update tests based on new refactored DSL
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.model.RestItemModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
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.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author iulia.cojocea
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public class DeleteProcessItemSanityTests extends RestWorkflowTest
|
||||
{
|
||||
private FileModel document, document2;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee, adminUser;
|
||||
private RestProcessModel processModel;
|
||||
private RestItemModel processItem;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userWhoStartsTask = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Delete existing process item")
|
||||
public void deleteProcessItem() throws Exception
|
||||
{
|
||||
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
|
||||
document2 = dataContent.usingAdmin().usingSite(siteModel).createContent(DocumentType.MSWORD);
|
||||
processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessItem(processItem);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).getProcessItems()
|
||||
.assertThat().entriesListDoesNotContain("id", processItem.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Try to delete existing process item using invalid processId")
|
||||
public void deleteProcessItemUsingInvalidProcessId() throws Exception
|
||||
{
|
||||
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
|
||||
document2 = dataContent.usingAdmin().usingSite(siteModel).createContent(DocumentType.MSPOWERPOINT);
|
||||
processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(document2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processModel.setId("incorrectProcessId");
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessItem(processItem);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -25,14 +25,14 @@ public class GetProcessSanityTests extends RestWorkflowTest
|
||||
{
|
||||
userWhoStartsProcess = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
addedProcess = restClient.authenticateUser(userWhoStartsProcess).addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
|
||||
addedProcess = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI().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
|
||||
{
|
||||
process = restClient.authenticateUser(userWhoStartsProcess).usingProcess(addedProcess).getProcess();
|
||||
process = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI().usingProcess(addedProcess).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
process.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
@@ -42,7 +42,7 @@ public class GetProcessSanityTests extends RestWorkflowTest
|
||||
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
|
||||
{
|
||||
process = restClient.authenticateUser(assignee).usingProcess(addedProcess).getProcess();
|
||||
process = restClient.authenticateUser(assignee).withWorkflowAPI().usingProcess(addedProcess).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
process.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
@@ -52,7 +52,7 @@ public class GetProcessSanityTests extends RestWorkflowTest
|
||||
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
|
||||
{
|
||||
process = restClient.authenticateUser(dataUser.getAdminUser()).usingProcess(addedProcess).getProcess();
|
||||
process = restClient.authenticateUser(dataUser.getAdminUser()).withWorkflowAPI().usingProcess(addedProcess).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
process.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestItemModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.requests.Processes;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author iulia.cojocea
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public class RemoveProcessItemSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
private Processes processesApi;
|
||||
|
||||
private FileModel document, document2, document3;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private RestProcessModel processModel;
|
||||
private UserModel adminUser;
|
||||
private RestItemModel processItem;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userWhoStartsTask = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
processesApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Delete existing process item")
|
||||
public void deleteProcessItem() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.MSWORD);
|
||||
processItem = processesApi.addProcessItem(processModel, document2);
|
||||
processesApi.deleteProcessItem(processModel, processItem);
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
processesApi.getProcessesItems(processModel).assertThat().entriesListDoesNotContain("id", processItem.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Try to delete existing process item using invalid processId")
|
||||
public void deleteProcessItemUsingInvalidProcessId() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
document3 = dataContent.usingSite(siteModel).createContent(DocumentType.MSPOWERPOINT);
|
||||
processItem = processesApi.addProcessItem(processModel, document3);
|
||||
processModel.onModel().setId("incorrectProcessId");
|
||||
processesApi.deleteProcessItem(processModel, processItem);
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user