mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'master' into updateTask
This commit is contained in:
@@ -75,8 +75,7 @@ public class GetTagsFullTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
tagsWithSkipCount.assertThat().entriesListDoesNotContain("tag", firstTag.getTag())
|
||||
.assertThat().entriesListDoesNotContain("tag", secondTag.getTag())
|
||||
.assertThat().entriesListCountIs(returnedCollection.getEntries().size()-2);
|
||||
.assertThat().entriesListDoesNotContain("tag", secondTag.getTag());
|
||||
tagsWithSkipCount.assertThat().paginationField("skipCount").is("2");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.alfresco.rest.workflow.processes;
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
@@ -10,7 +11,6 @@ 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.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -21,7 +21,7 @@ public class GetProcessTasksCoreTests extends RestTest
|
||||
{
|
||||
private FileModel document, document1, document2, document3;
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUser, userModel, userModel1, userModel2, assignee;
|
||||
private UserModel adminUser, userWhoStartsProcess, candidate, anotherAssignee, assignee;
|
||||
private ProcessModel process;
|
||||
private GroupModel group;
|
||||
|
||||
@@ -29,57 +29,52 @@ public class GetProcessTasksCoreTests extends RestTest
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
userModel1 = dataUser.createRandomTestUser();
|
||||
userModel2 = dataUser.createRandomTestUser();
|
||||
userWhoStartsProcess = dataUser.createRandomTestUser();
|
||||
candidate = dataUser.createRandomTestUser();
|
||||
anotherAssignee = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
siteModel = dataSite.usingUser(userWhoStartsProcess).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
document1 = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
document2 = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
process = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(document)
|
||||
process = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(siteModel).usingResource(document)
|
||||
.createSingleReviewerTaskAndAssignTo(assignee);
|
||||
group = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(group, userModel1);
|
||||
dataGroup.addListOfUsersToGroup(group, candidate);
|
||||
}
|
||||
|
||||
@Bug(id = "TBD")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "getProcessTaks with user that is candidate with REST API and status code is OK (200)")
|
||||
description = "getProcessTasks with user that is candidate with REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public void getProcessTasksWithUserThatIsCandidate() throws Exception
|
||||
{
|
||||
ProcessModel processModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(document1)
|
||||
ProcessModel processModel = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(siteModel).usingResource(document1)
|
||||
.createGroupReviewTaskAndAssignTo(group);
|
||||
|
||||
restClient.authenticateUser(assignee).withWorkflowAPI()
|
||||
restClient.authenticateUser(candidate).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks().assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("assignee", assignee.getUsername());
|
||||
.and().entriesListContains("assignee", candidate.getUsername());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "TBD")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getProcessTasks using admin from same network with REST API and status code is FORBIDDEN (403)")
|
||||
description = "Verify getProcessTasks using admin from same network with REST API and status code is OK")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
public void getProcessTasksWithAdminFromSameNetwork() throws Exception
|
||||
{
|
||||
UserModel adminTenant, tenantAssignee;
|
||||
adminTenant = UserModel.getAdminTenantUser();
|
||||
UserModel adminTenant = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenant);
|
||||
SiteModel siteModel = dataSite.usingUser(adminTenant).createPublicRandomSite();
|
||||
tenantAssignee = dataUser.usingUser(adminTenant).createUserWithTenant("uTenant");
|
||||
UserModel tenantAssignee = dataUser.usingUser(adminTenant).createUserWithTenant("uTenant");
|
||||
document3 = dataContent.usingUser(adminTenant).usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
|
||||
ProcessModel processModel = dataWorkflow.usingUser(adminTenant).usingSite(siteModel).usingResource(document3)
|
||||
.createSingleReviewerTaskAndAssignTo(tenantAssignee);
|
||||
RestProcessModel processModel = restClient.authenticateUser(tenantAssignee).withWorkflowAPI().addProcess("activitiAdhoc", tenantAssignee, false, CMISUtil.Priority.Normal);
|
||||
|
||||
restClient.withWorkflowAPI()
|
||||
restClient.authenticateUser(adminTenant).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "TBD")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getProcessTasks using admin from different network with REST API and status code is FORBIDDEN (403)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE, TestGroup.NETWORKS })
|
||||
@@ -93,14 +88,13 @@ public class GetProcessTasksCoreTests extends RestTest
|
||||
SiteModel siteModel = dataSite.usingUser(adminTenant).createPublicRandomSite();
|
||||
document3 = dataContent.usingUser(adminTenant).usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
tenantAssignee = dataUser.usingUser(adminTenant).createUserWithTenant("uTenant");
|
||||
ProcessModel processModel = dataWorkflow.usingUser(adminTenant).usingSite(siteModel).usingResource(document3)
|
||||
.createSingleReviewerTaskAndAssignTo(tenantAssignee);
|
||||
RestProcessModel processModel = restClient.authenticateUser(adminTenant).withWorkflowAPI().addProcess("activitiAdhoc", tenantAssignee, false, CMISUtil.Priority.Normal);
|
||||
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(secondAdminTenant);
|
||||
restClient.authenticateUser(secondAdminTenant).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
.assertLastError().containsSummary(RestErrorModel.PROCESS_RUNNING_IN_ANOTHER_TENANT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -110,7 +104,7 @@ public class GetProcessTasksCoreTests extends RestTest
|
||||
{
|
||||
ProcessModel processModel = process;
|
||||
processModel.setId("invalidProcessId");
|
||||
restClient.authenticateUser(userModel).withWorkflowAPI()
|
||||
restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
@@ -123,7 +117,7 @@ public class GetProcessTasksCoreTests extends RestTest
|
||||
{
|
||||
ProcessModel processModel = process;
|
||||
processModel.setId("");
|
||||
restClient.authenticateUser(userModel).withWorkflowAPI()
|
||||
restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks().assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
@@ -134,9 +128,9 @@ public class GetProcessTasksCoreTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public void completeTaskThenGetProcessTasks() throws Exception
|
||||
{
|
||||
ProcessModel processModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(document2)
|
||||
.createMoreReviewersWorkflowAndAssignTo(userModel2);
|
||||
RestTaskModel restTaskModel = restClient.authenticateUser(userModel2).withWorkflowAPI()
|
||||
ProcessModel processModel = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(siteModel).usingResource(document2)
|
||||
.createMoreReviewersWorkflowAndAssignTo(anotherAssignee);
|
||||
RestTaskModel restTaskModel = restClient.authenticateUser(anotherAssignee).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks().assertThat().entriesListIsNotEmpty().getOneRandomEntry().onModel();
|
||||
restTaskModel = restClient.withParams("select=state").withWorkflowAPI().usingTask(restTaskModel).updateTask("completed");
|
||||
restTaskModel.assertThat().field("id").is(restTaskModel.getId()).and().field("state").is("completed");
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTaskModelsCollection;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 2/3/2017.
|
||||
*/
|
||||
public class GetProcessTasksFullTests extends RestTest
|
||||
{
|
||||
private FileModel document;
|
||||
private SiteModel publicSite;
|
||||
private UserModel adminUser, userWhoStartsProcess, assignee1, assignee2, assignee3;
|
||||
private ProcessModel processWithSingleTask, processWithMultipleTasks;
|
||||
private RestTaskModelsCollection processTasks;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userWhoStartsProcess = dataUser.createRandomTestUser();
|
||||
assignee1 = dataUser.createRandomTestUser();
|
||||
assignee2 = dataUser.createRandomTestUser();
|
||||
assignee3 = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(userWhoStartsProcess).createPublicRandomSite();
|
||||
document = dataContent.usingSite(publicSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
processWithSingleTask = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(publicSite).usingResource(document)
|
||||
.createSingleReviewerTaskAndAssignTo(assignee1);
|
||||
processWithMultipleTasks = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(publicSite).usingResource(document)
|
||||
.createMoreReviewersWorkflowAndAssignTo(assignee1, assignee2, assignee3);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user is able to getProcessTasks even if he wasn't involved in process. Check status code is OK")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void getProcessTasksWithAdmin() throws Exception
|
||||
{
|
||||
processTasks = restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
.usingProcess(processWithSingleTask).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat().entriesListCountIs(1)
|
||||
.and().entriesListContains("assignee", assignee1.getUsername());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get process tasks with valid skipCount parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL})
|
||||
public void getProcessTasksWithValidSkipCount() throws Exception
|
||||
{
|
||||
processTasks = restClient.authenticateUser(userWhoStartsProcess)
|
||||
.withParams("skipCount=2").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat().entriesListContains("assignee", assignee3.getUsername())
|
||||
.assertThat().entriesListDoesNotContain("assignee", assignee1.getUsername())
|
||||
.assertThat().entriesListDoesNotContain("assignee", assignee2.getUsername())
|
||||
.assertThat().entriesListCountIs(1)
|
||||
.assertThat().paginationField("skipCount").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get process tasks with negative skipCount parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL})
|
||||
public void getProcessTasksWithNegativeSkipCount() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsProcess)
|
||||
.withParams("skipCount=-2").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT)
|
||||
.containsErrorKey(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.statusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get process tasks with non numeric skipCount parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL})
|
||||
public void getProcessTasksWithNonNumericSkipCount() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsProcess)
|
||||
.withParams("skipCount=A").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "A"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get process tasks with valid maxItems parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL})
|
||||
public void getProcessTasksWithValidMaxItems() throws Exception
|
||||
{
|
||||
processTasks = restClient.authenticateUser(userWhoStartsProcess)
|
||||
.withParams("maxItems=2").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat().entriesListDoesNotContain("assignee", assignee3.getUsername())
|
||||
.assertThat().entriesListContains("assignee", assignee1.getUsername())
|
||||
.assertThat().entriesListContains("assignee", assignee2.getUsername())
|
||||
.assertThat().entriesListCountIs(2)
|
||||
.assertThat().paginationField("maxItems").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get process tasks with negative maxItems parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL})
|
||||
public void getProcessTasksWithNegativeMaxItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsProcess)
|
||||
.withParams("maxItems=-2").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.statusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Get process tasks with non numeric maxItems parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL})
|
||||
public void getProcessTasksWithNonNumericMaxItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsProcess)
|
||||
.withParams("maxItems=A").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "A"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify getProcessTasks with properties parameter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void getProcessTasksWithPropertiesParameter() throws Exception
|
||||
{
|
||||
processTasks = restClient.authenticateUser(adminUser)
|
||||
.withParams("properties=name,assignee,state").withWorkflowAPI()
|
||||
.usingProcess(processWithSingleTask).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat().entriesListCountIs(1);
|
||||
processTasks.getOneRandomEntry().onModel().assertThat()
|
||||
.field("dueAt").isNull().and()
|
||||
.field("processDefinitionId").isNull().and()
|
||||
.field("processId").isNull().and()
|
||||
.field("description").isNull().and()
|
||||
.field("startedAt").isNull().and()
|
||||
.field("id").isNull().and()
|
||||
.field("activityDefinitionId").isNull().and()
|
||||
.field("priority").isNull().and()
|
||||
.field("formResourceKey").isNull().and()
|
||||
.field("name").is("Review Task").and()
|
||||
.field("state").is("claimed").and()
|
||||
.field("assignee").is(assignee1.getUsername());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin gets Process Tasks ordered by assignee ascendant using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void getProcessTasksOrderedByAssignee() throws Exception
|
||||
{
|
||||
processTasks = restClient.authenticateUser(adminUser)
|
||||
.withParams("orderBy=assignee").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat().entriesListIsSortedAscBy("assignee");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin doesn't get Process Tasks ordered by many fields")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void getProcessTasksOrderedByMultipleFields() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser)
|
||||
.withParams("orderBy=assignee,state").withWorkflowAPI()
|
||||
.usingProcess(processWithMultipleTasks).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("Only one order by parameter is supported");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get all process tasks after process is deleted.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.FULL })
|
||||
public void getProcessTasksAfterDeletingProcess() throws Exception
|
||||
{
|
||||
ProcessModel processModel = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(publicSite).usingResource(document)
|
||||
.createSingleReviewerTaskAndAssignTo(assignee1);
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI().usingProcess(processModel).deleteProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
processTasks = restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
.usingProcess(processModel).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -49,10 +49,10 @@ public class GetProcessTasksSanityTests extends RestTest
|
||||
processTasks = restClient.authenticateUser(userModel).withWorkflowAPI().usingProcess(process).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat()
|
||||
.entriesListIsNotEmpty().and()
|
||||
.entriesListCountIs(3).and()
|
||||
.entriesListContains("assignee", assignee1.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername());
|
||||
.entriesListContains("assignee", assignee3.getUsername());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
@@ -65,7 +65,7 @@ public class GetProcessTasksSanityTests extends RestTest
|
||||
processTasks.assertThat()
|
||||
.entriesListContains("assignee", assignee1.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername());
|
||||
.entriesListContains("assignee", assignee3.getUsername());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package org.alfresco.rest.workflow.tasks;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
import org.alfresco.rest.model.RestVariableModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TaskModel;
|
||||
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 AddTaskVariablesFullTests extends RestTest
|
||||
{
|
||||
private UserModel userWhoStartsTask, adminUser;
|
||||
private SiteModel siteModel;
|
||||
private FileModel fileModel;
|
||||
private UserModel assigneeUser;
|
||||
private TaskModel taskModel;
|
||||
private RestVariableModel restVariablemodel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userWhoStartsTask = dataUser.createRandomTestUser();
|
||||
assigneeUser = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
|
||||
}
|
||||
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Create task variable with name containing symbols")
|
||||
public void createTaskVariableWithSymbolsInName() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
variableModel.setName("!@#$%^&*({}<>.,;'=_|");
|
||||
restVariablemodel = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restVariablemodel.assertThat()
|
||||
.field("scope").is(variableModel.getScope())
|
||||
.and().field("name").is(variableModel.getName())
|
||||
.and().field("value").is(variableModel.getValue())
|
||||
.and().field("type").is(variableModel.getType());
|
||||
}
|
||||
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Create task variable with empty name")
|
||||
public void createTaskVariableWithEmptyName() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
variableModel.setName("");
|
||||
restVariablemodel = restClient.withWorkflowAPI().usingTask(taskModel).addTaskVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.VARIABLE_NAME_REQUIRED)
|
||||
.containsSummary(RestErrorModel.VARIABLE_NAME_REQUIRED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin from the same network is able to add task variables")
|
||||
public void addTaskVariablesByTenantAdmin() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser1);
|
||||
UserModel tenantUser1 = dataUser.usingUser(adminTenantUser1).createUserWithTenant("uTenant1");
|
||||
|
||||
RestProcessModel networkProcess1 = restClient.authenticateUser(tenantUser1).withWorkflowAPI()
|
||||
.addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
|
||||
RestTaskModel task = restClient.authenticateUser(adminTenantUser1)
|
||||
.withWorkflowAPI().usingProcess(networkProcess1).getProcessTasks().getOneRandomEntry();
|
||||
restClient.authenticateUser(adminTenantUser1);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
restVariablemodel = restClient.withWorkflowAPI()
|
||||
.usingTask(task.onModel())
|
||||
.addTaskVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restVariablemodel.assertThat()
|
||||
.field("scope").is(variableModel.getScope())
|
||||
.and().field("name").is(variableModel.getName())
|
||||
.and().field("value").is(variableModel.getValue())
|
||||
.and().field("type").is(variableModel.getType());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin from another network is not able to add task variables")
|
||||
public void addTaskVariablesByTenantFromAnotherNetwork() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
|
||||
UserModel adminTenantUser2 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser1);
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser2);
|
||||
UserModel tenantUser1 = dataUser.usingUser(adminTenantUser1).createUserWithTenant("uTenant1");
|
||||
|
||||
RestProcessModel networkProcess1 = restClient.authenticateUser(tenantUser1).withWorkflowAPI()
|
||||
.addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
|
||||
RestTaskModel task = restClient.authenticateUser(adminTenantUser1)
|
||||
.withWorkflowAPI().usingProcess(networkProcess1).getProcessTasks().getOneRandomEntry();
|
||||
restClient.authenticateUser(adminTenantUser1);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
restVariablemodel = restClient.authenticateUser(adminTenantUser2).withWorkflowAPI()
|
||||
.usingTask(task.onModel())
|
||||
.addTaskVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package org.alfresco.rest.workflow.tasks;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
import org.alfresco.rest.model.RestVariableModelsCollection;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TaskModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
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 GetTaskVariablesFullTests extends RestTest
|
||||
{
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private SiteModel siteModel;
|
||||
private FileModel fileModel;
|
||||
private TaskModel taskModel;
|
||||
private RestVariableModelsCollection variableModels;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userWhoStartsTask = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userWhoStartsTask).createPublicRandomSite();
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify default error shema for get task variables")
|
||||
public void getTaskVariablesCheckDefaultErrorSchema() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask)
|
||||
.usingSite(siteModel).usingResource(fileModel)
|
||||
.createNewTaskAndAssignTo(assignee);
|
||||
taskModel.setId("invalidId");
|
||||
|
||||
restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().usingTask(taskModel).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidId"))
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-17438")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user gets task with 'maxItems' parameter")
|
||||
public void getTaskVariablesWithMaxItems() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assignee);
|
||||
variableModels = restClient.authenticateUser(userWhoStartsTask)
|
||||
.withWorkflowAPI().usingParams("maxItems=2").usingTask(taskModel).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variableModels.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationField("count").is("2");
|
||||
}
|
||||
|
||||
@Bug(id="MNT-17438")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user gets task with 'skipCount' parameter")
|
||||
public void getTaskVariablesWithSkipCount() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assignee);
|
||||
variableModels = restClient.authenticateUser(userWhoStartsTask)
|
||||
.withWorkflowAPI().usingParams("skipCount=10").usingTask(taskModel).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variableModels.assertThat().entriesListIsNotEmpty()
|
||||
.and().paginationField("count").is("20");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot get task variables with invalid where clause.")
|
||||
public void getTaskVariablesWithInvalidWhereClauseAsParameter() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assignee);
|
||||
variableModels = restClient.authenticateUser(userWhoStartsTask).where("scope='fake-where'")
|
||||
.withWorkflowAPI().usingTask(taskModel).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_WHERE_QUERY, "Invalid value for 'scope' used in query: fake-where."))
|
||||
.containsErrorKey(RestErrorModel.INVALID_QUERY_ERRORKEY)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user gets tasks variables with 'properties' parameter")
|
||||
public void getTaskVariablesWithValidProperties() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assignee);
|
||||
variableModels = restClient.authenticateUser(userWhoStartsTask).withParams("properties=scope,name")
|
||||
.withWorkflowAPI().usingTask(taskModel).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variableModels.assertThat().entriesListIsNotEmpty();
|
||||
variableModels.getOneRandomEntry().onModel().assertThat()
|
||||
.fieldsCount().is(2).and()
|
||||
.field("type").isNull().and()
|
||||
.field("value").isNull().and()
|
||||
.field("scope").isNotEmpty().and()
|
||||
.field("name").isNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot get tasks variables with invalid 'properties' parameter")
|
||||
public void getTaskVariablesWithInvalidProperties() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assignee);
|
||||
variableModels = restClient.authenticateUser(userWhoStartsTask).withParams("properties=fake")
|
||||
.withWorkflowAPI().usingTask(taskModel).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variableModels.getOneRandomEntry().onModel().assertThat()
|
||||
.fieldsCount().is(0).and()
|
||||
.field("type").isNull().and()
|
||||
.field("value").isNull().and()
|
||||
.field("scope").isNull().and()
|
||||
.field("name").isNull();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin from the same network is able to retrieve network task variables")
|
||||
public void getTaskVariablesByTenantAdmin() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser1);
|
||||
UserModel tenantUser1 = dataUser.usingUser(adminTenantUser1).createUserWithTenant("uTenant1");
|
||||
|
||||
RestProcessModel networkProcess1 = restClient.authenticateUser(tenantUser1).withWorkflowAPI()
|
||||
.addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
|
||||
RestTaskModel task = restClient.authenticateUser(adminTenantUser1)
|
||||
.withWorkflowAPI().usingProcess(networkProcess1).getProcessTasks().getOneRandomEntry();
|
||||
|
||||
variableModels = restClient.withWorkflowAPI().usingTask(task.onModel()).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variableModels.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin from another network is not able to retrieve network task variables")
|
||||
public void getTaskVariablesByTenantFromAnotherNetwork() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
|
||||
UserModel adminTenantUser2= UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser1);
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser2);
|
||||
UserModel tenantUser1 = dataUser.usingUser(adminTenantUser1).createUserWithTenant("uTenant1");
|
||||
|
||||
RestProcessModel networkProcess1 = restClient.authenticateUser(tenantUser1).withWorkflowAPI()
|
||||
.addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
|
||||
RestTaskModel task = restClient.authenticateUser(adminTenantUser1)
|
||||
.withWorkflowAPI().usingProcess(networkProcess1).getProcessTasks().getOneRandomEntry();
|
||||
|
||||
variableModels = restClient.authenticateUser(adminTenantUser2).withWorkflowAPI().usingTask(task.onModel()).getTaskVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
package org.alfresco.rest.workflow.tasks;
|
||||
|
||||
import javax.json.JsonObject;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessDefinitionModel;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TaskModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
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.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class UpdateTaskFullTestsBulk1 extends RestTest
|
||||
{
|
||||
UserModel owner;
|
||||
SiteModel siteModel;
|
||||
UserModel candidateUser;
|
||||
FileModel fileModel;
|
||||
UserModel assigneeUser;
|
||||
TaskModel taskModel;
|
||||
RestTaskModel restTaskModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
owner = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(owner).createPublicRandomSite();
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
assigneeUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun=true)
|
||||
public void createTask() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(owner).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant user that created the task can update task only in its network and response is 200, for other networks is 403")
|
||||
public void ownerTenantCanUpdatedTaskOnlyInItsNetwork() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
|
||||
UserModel adminTenant1 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenant1);
|
||||
|
||||
UserModel ownerTenant1 = dataUser.usingUser(adminTenant1).createUserWithTenant("ownerTenant1");
|
||||
UserModel assigneeTenant1 = dataUser.usingUser(adminTenant1).createUserWithTenant("assigneeTenant1");
|
||||
SiteModel siteModel1 = dataSite.usingUser(ownerTenant1).createPublicRandomSite();
|
||||
FileModel fileModel1 = dataContent.usingUser(ownerTenant1).usingSite(siteModel1).createContent(DocumentType.TEXT_PLAIN);
|
||||
RestProcessDefinitionModel def1 = restClient.authenticateUser(ownerTenant1).withWorkflowAPI().getAllProcessDefinitions().getEntries().get(0).onModel();
|
||||
TaskModel taskModel1 = dataWorkflow.usingUser(ownerTenant1).usingSite(siteModel1).usingResource(fileModel1)
|
||||
.createTaskWithProcessDefAndAssignTo(def1.getId(), assigneeTenant1);
|
||||
|
||||
UserModel adminTenant2 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenant2);
|
||||
|
||||
UserModel ownerTenant2 = dataUser.usingUser(adminTenant2).createUserWithTenant("ownerTenant2");
|
||||
UserModel assigneeTenant2 = dataUser.usingUser(adminTenant2).createUserWithTenant("userTenantAssignee2");
|
||||
SiteModel siteModel2 = dataSite.usingUser(ownerTenant2).createPublicRandomSite();
|
||||
FileModel fileModel2 = dataContent.usingUser(ownerTenant2).usingSite(siteModel2).createContent(DocumentType.TEXT_PLAIN);
|
||||
RestProcessDefinitionModel def2 = restClient.authenticateUser(ownerTenant2).withWorkflowAPI().getAllProcessDefinitions().getEntries().get(0).onModel();
|
||||
TaskModel taskModel2 = dataWorkflow.usingUser(ownerTenant2).usingSite(siteModel2).usingResource(fileModel2)
|
||||
.createTaskWithProcessDefAndAssignTo(def2.getId(), assigneeTenant2);
|
||||
|
||||
restTaskModel = restClient.authenticateUser(ownerTenant2).withParams("select=state").withWorkflowAPI().usingTask(taskModel2).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel2.getId())
|
||||
.and().field("state").is("completed");
|
||||
|
||||
restTaskModel = restClient.authenticateUser(ownerTenant2).withParams("select=state").withWorkflowAPI().usingTask(taskModel1).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
}
|
||||
|
||||
@Bug(id = "REPO-1980")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify tenant admin can update only task from its network and response is 200")
|
||||
public void adminTenantCanUpdateOnlyTaskInItsNetwork() throws Exception
|
||||
{
|
||||
UserModel adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
|
||||
UserModel adminTenant1 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenant1);
|
||||
|
||||
UserModel ownerTenant1 = dataUser.usingUser(adminTenant1).createUserWithTenant("ownerTenant1");
|
||||
UserModel assigneeTenant1 = dataUser.usingUser(adminTenant1).createUserWithTenant("assigneeTenant1");
|
||||
SiteModel siteModel1 = dataSite.usingUser(ownerTenant1).createPublicRandomSite();
|
||||
FileModel fileModel1 = dataContent.usingUser(ownerTenant1).usingSite(siteModel1).createContent(DocumentType.TEXT_PLAIN);
|
||||
RestProcessDefinitionModel def1 = restClient.authenticateUser(ownerTenant1).withWorkflowAPI().getAllProcessDefinitions().getEntries().get(0).onModel();
|
||||
TaskModel taskModel1 = dataWorkflow.usingUser(ownerTenant1).usingSite(siteModel1).usingResource(fileModel1)
|
||||
.createTaskWithProcessDefAndAssignTo(def1.getId(), assigneeTenant1);
|
||||
|
||||
UserModel adminTenant2 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenant2);
|
||||
|
||||
UserModel ownerTenant2 = dataUser.usingUser(adminTenant2).createUserWithTenant("ownerTenant2");
|
||||
UserModel assigneeTenant2 = dataUser.usingUser(adminTenant2).createUserWithTenant("userTenantAssignee2");
|
||||
SiteModel siteModel2 = dataSite.usingUser(ownerTenant2).createPublicRandomSite();
|
||||
FileModel fileModel2 = dataContent.usingUser(ownerTenant2).usingSite(siteModel2).createContent(DocumentType.TEXT_PLAIN);
|
||||
RestProcessDefinitionModel def2 = restClient.authenticateUser(ownerTenant2).withWorkflowAPI().getAllProcessDefinitions().getEntries().get(0).onModel();
|
||||
TaskModel taskModel2 = dataWorkflow.usingUser(ownerTenant2).usingSite(siteModel2).usingResource(fileModel2)
|
||||
.createTaskWithProcessDefAndAssignTo(def2.getId(), assigneeTenant2);
|
||||
|
||||
restTaskModel = restClient.authenticateUser(adminTenant2).withParams("select=state").withWorkflowAPI().usingTask(taskModel2).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel2.getId())
|
||||
.and().field("state").is("completed");
|
||||
|
||||
restTaskModel = restClient.authenticateUser(adminTenant2).withParams("select=state").withWorkflowAPI().usingTask(taskModel1).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task cannot be updated from status completed to delegated and response is 404")
|
||||
public void taskCannotBeUpdatedFromCompletedToDelegated() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("completed");
|
||||
|
||||
restClient.authenticateUser(assigneeUser)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("delegated");
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError()
|
||||
.containsErrorKey(String.format(RestErrorModel.TASK_ALREADY_COMPLETED, taskModel.getId()))
|
||||
.containsSummary(String.format(RestErrorModel.TASK_ALREADY_COMPLETED, taskModel.getId()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task cannot be updated from status completed to resolved and response is 404")
|
||||
public void taskCannotBeUpdatedFromCompletedToResolved() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("completed");
|
||||
|
||||
restClient.authenticateUser(assigneeUser)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("resolved");
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError()
|
||||
.containsErrorKey(String.format(RestErrorModel.TASK_ALREADY_COMPLETED, taskModel.getId()))
|
||||
.containsSummary(String.format(RestErrorModel.TASK_ALREADY_COMPLETED, taskModel.getId()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task cannot be updated from status completed to completed and response is 404")
|
||||
public void taskCannotBeUpdatedFromCompletedToCompleted() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("completed");
|
||||
|
||||
restClient.authenticateUser(assigneeUser)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("completed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError()
|
||||
.containsErrorKey(String.format(RestErrorModel.TASK_ALREADY_COMPLETED, taskModel.getId()))
|
||||
.containsSummary(String.format(RestErrorModel.TASK_ALREADY_COMPLETED, taskModel.getId()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task can be updated from status claimed to unclaimed and response is 200")
|
||||
public void taskCanBeUpdatedFromClaimedToUnclaimed() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner).withWorkflowAPI().usingTask(taskModel).getTask();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("claimed");
|
||||
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("unclaimed");
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("unclaimed");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task can be updated from status claimed to delegated and response is 200")
|
||||
public void taskCanBeUpdatedFromClaimedToDelegated() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner).withWorkflowAPI().usingTask(taskModel).getTask();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("claimed");
|
||||
|
||||
UserModel newAssignee = dataUser.createRandomTestUser();
|
||||
JsonObject inputJson = JsonBodyGenerator.defineJSON()
|
||||
.add("state", "delegated")
|
||||
.add("assignee", newAssignee.getUsername()).build();
|
||||
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state,assignee").withWorkflowAPI().usingTask(taskModel).updateTask(inputJson);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("delegated")
|
||||
.and().field("assignee").is(newAssignee.getUsername());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task can be updated from status claimed to resolved and response is 200")
|
||||
public void taskCanBeUpdatedFromClaimedToResolved() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner).withWorkflowAPI().usingTask(taskModel).getTask();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("claimed");
|
||||
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state,assignee").withWorkflowAPI().usingTask(taskModel).updateTask("resolved");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("resolved");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify task can be updated from status claimed to claimed and response is 200")
|
||||
public void taskCanBeUpdatedFromClaimedToClaimed() throws Exception
|
||||
{
|
||||
restTaskModel = restClient.authenticateUser(owner).withWorkflowAPI().usingTask(taskModel).getTask();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
restTaskModel.assertThat().field("id").is(taskModel.getId())
|
||||
.and().field("state").is("claimed");
|
||||
|
||||
restTaskModel = restClient.authenticateUser(owner)
|
||||
.withParams("select=state,assignee").withWorkflowAPI().usingTask(taskModel).updateTask("claimed");
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT).assertLastError()
|
||||
.containsErrorKey(RestErrorModel.TAS_ALREADY_CLAIMED)
|
||||
.containsSummary(RestErrorModel.TAS_ALREADY_CLAIMED)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user