mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
test- added new test cases: Core/Full
This commit is contained in:
+50
-18
@@ -2,6 +2,7 @@ package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestProcessVariableModel;
|
||||
@@ -25,7 +26,7 @@ public class DeleteProcessVariableCoreTests extends RestTest
|
||||
{
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private UserModel userWhoStartsTask, assignee, adminUser;
|
||||
private RestProcessModel restProcessModel;
|
||||
private ProcessModel processModel;
|
||||
private RestProcessVariableModel variableModel;
|
||||
@@ -33,8 +34,9 @@ public class DeleteProcessVariableCoreTests extends RestTest
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userWhoStartsTask = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userWhoStartsTask).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
processModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document)
|
||||
@@ -51,22 +53,12 @@ public class DeleteProcessVariableCoreTests extends RestTest
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, variableModel.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete empty process variable")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public void deleteEmptyProcessVariable() throws Exception
|
||||
{
|
||||
variableModel = new RestProcessVariableModel("","", "d:text");
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
.assertLastError().containsSummary(RestErrorModel.DELETE_EMPTY_ARGUMENT);
|
||||
}
|
||||
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, variableModel.getName()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process variable twice")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
@@ -83,4 +75,44 @@ public class DeleteProcessVariableCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, variableModel.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Remove process variables with empty processId")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public void deleteProcessVariableEmptyProcessId() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).addProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restProcessModel.setId("");
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""))
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process variable with admin.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public void deleteProcessVariableWithAdmin() throws Exception
|
||||
{
|
||||
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).addProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI().usingProcess(processModel)
|
||||
.deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).getProcessVariables()
|
||||
.assertThat().entriesListDoesNotContain("name", variableModel.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.CMISUtil.Priority;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestProcessVariableModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.ProcessModel;
|
||||
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;
|
||||
|
||||
public class DeleteProcessVariableFullTests extends RestTest
|
||||
{
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee, anotherUser;
|
||||
private RestProcessModel restProcessModel;
|
||||
private ProcessModel processModel;
|
||||
private RestProcessVariableModel variableModel, updatedVariable;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userWhoStartsTask = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
anotherUser = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userWhoStartsTask).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
processModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document)
|
||||
.createSingleReviewerTaskAndAssignTo(assignee);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete empty process variable")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void deleteEmptyProcessVariable() throws Exception
|
||||
{
|
||||
variableModel = new RestProcessVariableModel("","", "d:text");
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
.assertLastError().containsSummary(RestErrorModel.DELETE_EMPTY_ARGUMENT)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.containsErrorKey(RestErrorModel.DELETE_EMPTY_ARGUMENT)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);;
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process variable using any user.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void deleteProcessVariableWithAnyUser() throws Exception
|
||||
{
|
||||
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
processModel = restClient.authenticateUser(anotherUser).withWorkflowAPI()
|
||||
.addProcess("activitiAdhoc", anotherUser, false, Priority.Normal);
|
||||
|
||||
variableModel = restClient.withWorkflowAPI().usingProcess(processModel).updateProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variableModel.assertThat().field("name").is(variableModel.getName()).and().field("type")
|
||||
.is(variableModel.getType()).and().field("value")
|
||||
.is(variableModel.getValue());
|
||||
|
||||
restClient.authenticateUser(anotherUser).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.REGRESSION,
|
||||
description = "Add a new process varaiables, update the variable and then delete.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void createUpdateDeleteVariableProcess() throws Exception
|
||||
{
|
||||
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("d:text");
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).addProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
variableModel.setValue("newValue");
|
||||
updatedVariable = restClient.withWorkflowAPI().usingProcess(processModel).updateProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
updatedVariable.assertThat().field("value").is("newValue");
|
||||
|
||||
restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().usingProcess(processModel)
|
||||
.deleteProcessVariable(updatedVariable);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).getProcessVariables()
|
||||
.assertThat().entriesListDoesNotContain("name", updatedVariable.getName());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user