update tests based on new refactored DSL

This commit is contained in:
cagache
2016-11-16 16:49:18 +02:00
parent 3ae63583de
commit da586d155c
2 changed files with 64 additions and 76 deletions
@@ -0,0 +1,64 @@
package org.alfresco.rest.workflow.processes;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.model.RestProcessVariableModel;
import org.alfresco.utility.model.*;
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 DeleteProcessVariableSanityTests extends RestWorkflowTest
{
private FileModel document;
private SiteModel siteModel;
private UserModel userWhoStartsTask, assignee, adminUser;
private RestProcessModel processModel;
private RestProcessVariableModel variableModel;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
adminUser = dataUser.getAdminUser();
userWhoStartsTask = dataUser.createRandomTestUser();
assignee = dataUser.createRandomTestUser();
siteModel = dataSite.usingUser(userWhoStartsTask).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 variable")
public void deleteProcessVariable() throws Exception
{
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.withWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withWorkflowAPI().usingProcess(processModel).getProcessVariables()
.assertThat().entriesListDoesNotContain("name", variableModel.getName());
}
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
description = "Try to delete existing variable using invalid processId")
public void deleteProcessVariableUsingInvalidProcessId() throws Exception
{
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.withWorkflowAPI().usingProcess(processModel).addProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processModel.setId("incorrectProcessId");
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessVariable(variableModel);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, "incorrectProcessId"));
}
}
@@ -1,76 +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.RestProcessModel;
import org.alfresco.rest.model.RestProcessVariableModel;
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 RemoveProcessVariableSanityTests extends RestWorkflowTest
{
@Autowired
private DataUser dataUser;
@Autowired
private Processes processesApi;
private FileModel document;
private SiteModel siteModel;
private UserModel userWhoStartsTask, assignee;
private RestProcessModel processModel;
private UserModel adminUser;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
adminUser = dataUser.getAdminUser();
userWhoStartsTask = dataUser.createRandomTestUser();
assignee = dataUser.createRandomTestUser();
siteModel = dataSite.usingUser(userWhoStartsTask).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 variable")
public void deleteProcessVariable() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUser);
RestProcessVariableModel variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = processesApi.getProcesses().getOneRandomEntry();
processesApi.addProcessVariable(processModel, variableModel);
processesApi.deleteProcessVariable(processModel, variableModel);
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NO_CONTENT);
processesApi.getProcessesVariables(processModel).assertThat().entriesListDoesNotContain("name", variableModel.getName());
}
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
description = "Try to delete existing variable using invalid processId")
public void deleteProcessVariableUsingInvalidProcessId() throws JsonToModelConversionException, Exception
{
restClient.authenticateUser(adminUser);
RestProcessVariableModel variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
processModel = processesApi.getProcesses().getOneRandomEntry();
processesApi.addProcessVariable(processModel, variableModel);
processModel.onModel().setId("incorrectProcessId");
processesApi.deleteProcessVariable(processModel, variableModel);
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
}
}