mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'master' into TAS-2049
This commit is contained in:
@@ -50,6 +50,9 @@ public abstract class RestTest extends AbstractTestNGSpringContextTests
|
||||
|
||||
@Autowired
|
||||
protected DataLink dataLink;
|
||||
|
||||
@Autowired
|
||||
protected DataDiscussion dataDiscussion;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void checkServerHealth() throws Exception
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
@@ -43,6 +44,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
|
||||
.usingMe()
|
||||
.addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ALREADY_Site_MEMBER, newMember.getUsername(), siteModel.getId()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -53,6 +55,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
|
||||
.withCoreAPI()
|
||||
.usingUser(new UserModel("invalidUser", "password")).addSiteMembershipRequest(siteModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidUser"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -63,6 +66,7 @@ public class AddSiteMembershipRequestCoreTests extends RestTest
|
||||
.withCoreAPI()
|
||||
.usingMe().addSiteMembershipRequest(new SiteModel("invalidSiteID"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), "invalidSiteID"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
@@ -56,6 +57,7 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidPersonId"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -69,6 +71,37 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
|
||||
restClient.withParams("maxItems=-1")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
|
||||
restClient.withParams("maxItems=test")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "test"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get site membership information request returns status code 200 for valid maxItems parameter")
|
||||
public void getSiteMembershipInformationRequestReturns200ForValidMaxItemsParameter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withParams("maxItems=5")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.getPagination().assertThat().field("maxItems").is("5");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -82,6 +115,29 @@ public class GetSiteMembershipInformationCoreTests extends RestTest
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT);
|
||||
|
||||
restClient.withParams("skipCount=test")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "test"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get site membership information request returns status code 200 for valid skipCount parameter")
|
||||
public void getSiteMembershipInformationRequestReturns200ForValidSkipCountParameter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel)
|
||||
.withParams("skipCount=1")
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.getSitesMembershipInformation()
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.getPagination().assertThat().field("skipCount").is("1");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
|
||||
@@ -126,7 +126,7 @@ public class UpdateSiteMembershipRequestCoreTests extends RestTest
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel, updatedMessage);
|
||||
.addSiteMembershipRequest(updatedMessage, siteModel, "Accept me");
|
||||
returnedResponse = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage)
|
||||
@@ -142,7 +142,7 @@ public class UpdateSiteMembershipRequestCoreTests extends RestTest
|
||||
restClient.authenticateUser(newMember)
|
||||
.withCoreAPI()
|
||||
.usingAuthUser()
|
||||
.addSiteMembershipRequest(siteModel, "");
|
||||
.addSiteMembershipRequest("", siteModel, "Accept me");
|
||||
returnedResponse = restClient.withCoreAPI().usingMe().updateSiteMembershipRequest(siteModel, updatedMessage);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertMembershipRequestMessageIs(updatedMessage)
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package org.alfresco.rest.ratings;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestRatingModel;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
|
||||
public class GetRatingCoreTests extends RestTest
|
||||
{
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUserModel, userModel;
|
||||
private FileModel document;
|
||||
private RestRatingModel returnedRatingModel;
|
||||
private FolderModel firstFolderModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingAdmin().createPublicRandomSite();
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void setUp() throws DataPreparationException, Exception
|
||||
{
|
||||
document = dataContent.usingSite(siteModel).usingAdmin().createContent(DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Check that using invalid ratingId for get rating call returns status code 400.")
|
||||
public void checkInvalidRatingIdStatusCode() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/ratings/{ratingId}", document.getNodeRef(), "invalid ratingId");
|
||||
restClient.processModel(RestRatingModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_RATING, "invalid ratingId"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Check that using invalid node ID for get rating call returns status code 404.")
|
||||
public void getRatingUsingInvalidNodeId() throws Exception
|
||||
{
|
||||
document.setNodeRef(RandomStringUtils.randomAlphanumeric(20));
|
||||
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getFiveStarRating();
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, document.getNodeRef()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get rating of a file that has only likes.")
|
||||
public void getRatingOfFileThatHasOnlyLikes() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).likeDocument();
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getLikeRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("1");
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getFiveStarRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get rating of a file that has only stars.")
|
||||
public void getRatingOfFileThatHasOnlyStars() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingResource(document).rateStarsToDocument(5);
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getFiveStarRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty();
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("1");
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getLikeRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get rating of a file that has likes and stars.")
|
||||
public void getRatingOfFileThatHasLikesAndStars() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingResource(document).likeDocument();
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingResource(document).rateStarsToDocument(5);
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getLikeRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("1");
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getFiveStarRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty();
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get rating of a folder that has only likes.")
|
||||
public void getRatingOfFolderThatHasOnlyLikes() throws Exception
|
||||
{
|
||||
firstFolderModel = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(firstFolderModel).likeDocument();
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(firstFolderModel).getLikeRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.assertThat().field("id").is("likes").and().field("myRating").is("true");
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("1");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.REGRESSION, description = "Get rating of a file that has no ratings.")
|
||||
public void getRatingOfFileThatHasNoRatings() throws Exception
|
||||
{
|
||||
returnedRatingModel = restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(document).getLikeRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0");
|
||||
|
||||
returnedRatingModel = restClient.withCoreAPI().usingResource(document).getFiveStarRating();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package org.alfresco.rest.sites;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.ContainerName;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
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;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.CORE })
|
||||
public class GetSiteContainersCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel publicSiteModel, publicSiteWithContainers;
|
||||
private SiteModel moderatedSiteModel, privateSiteModel;
|
||||
private ListUserWithRoles publicSiteUsers;
|
||||
private ListUserWithRoles publicSiteWithContainersUsers;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
|
||||
publicSiteModel = dataSite.usingAdmin().createPublicRandomSite();
|
||||
publicSiteWithContainers = dataSite.usingAdmin().createPublicRandomSite();
|
||||
moderatedSiteModel = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
privateSiteModel = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
publicSiteUsers = dataUser
|
||||
.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
|
||||
publicSiteWithContainersUsers = dataUser
|
||||
.addUsersWithRolesToSite(publicSiteWithContainers, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
|
||||
dataLink.usingAdmin().usingSite(publicSiteWithContainers).createRandomLink();
|
||||
dataDiscussion.usingAdmin().usingSite(publicSiteWithContainers).createRandomDiscussion();
|
||||
|
||||
dataLink.usingAdmin().usingSite(moderatedSiteModel).createRandomLink();
|
||||
dataDiscussion.usingAdmin().usingSite(moderatedSiteModel).createRandomDiscussion();
|
||||
|
||||
dataLink.usingAdmin().usingSite(privateSiteModel).createRandomLink();
|
||||
dataDiscussion.usingAdmin().usingSite(privateSiteModel).createRandomDiscussion();
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 200 with valid maxItems parameter")
|
||||
public void getContainersWithValidMaxItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteWithContainersUsers.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withParams("maxItems=5")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(3)
|
||||
.and().entriesListContains("folderId" ,ContainerName.documentLibrary.toString())
|
||||
.and().entriesListContains("folderId", ContainerName.links.toString())
|
||||
.and().entriesListContains("folderId", ContainerName.discussions.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.withParams("maxItems=1")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(1);
|
||||
|
||||
restClient.withParams("maxItems=3")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(1)
|
||||
.and().entriesListContains("folderId", ContainerName.documentLibrary.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 400 when invalid maxItems parameter is used")
|
||||
public void getContainersWithMaxItemsZero () throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withParams("maxItems=0")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("Only positive values supported for maxItems");
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 400 when invalid maxItems parameter is used")
|
||||
public void getContainersWithMaxItemsCharacter () throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withParams("maxItems=test")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "test"));
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 200 when maxItems parameter starts with multiple zero")
|
||||
public void getContainersWithMaxItemsMultipleZero () throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteWithContainersUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withParams("maxItems=000007")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(3);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 200 when valid skipCount parameter is used")
|
||||
public void getSitesWithValidSkipCount() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager)).withParams("skipCount=1")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(0);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.authenticateUser(publicSiteWithContainersUsers.getOneUserWithRole(UserRole.SiteCollaborator)).withParams("skipCount=1")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.authenticateUser(publicSiteWithContainersUsers.getOneUserWithRole(UserRole.SiteConsumer)).withParams("skipCount=2")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.authenticateUser(publicSiteWithContainersUsers.getOneUserWithRole(UserRole.SiteCollaborator)).withParams("skipCount=0")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(3);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 400 when invalid skipCount parameter is used")
|
||||
public void getSitesWithSkipCountCharacter() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator)).withParams("skipCount=abc")
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 200 when skipCount parameter starts with multiple zero")
|
||||
public void getSitesWithSkipCountMultipleZero() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator)).withParams("skipCount=00002")
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if get site container request returns status code 400 when invalid skipCount parameter is used")
|
||||
public void getSiteContainerWithNonExistentSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingSite("NonExistentSiteId").getSiteContainers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "NonExistentSiteId"));
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site container request returns status 200 for private site")
|
||||
public void getSiteContainerForPrivateSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(privateSiteModel).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(3);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site container request returns status 200 for moderated site")
|
||||
public void getSiteContainerForModeratedSite() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(moderatedSiteModel).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(3);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site container request returns status 200 for several containers")
|
||||
public void getSiteContainerForSeveralItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteWithContainers).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(3)
|
||||
.and().entriesListContains("folderId" ,ContainerName.documentLibrary.toString())
|
||||
.and().entriesListContains("folderId", ContainerName.links.toString())
|
||||
.and().entriesListContains("folderId", ContainerName.discussions.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.CORE, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site container request returns status 200 for one container")
|
||||
public void getSiteContainerWithOneItem() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteModel).getSiteContainers()
|
||||
.assertThat().entriesListCountIs(1)
|
||||
.and().entriesListContains("folderId" ,ContainerName.documentLibrary.toString());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class GetSitesCoreTests extends RestTest
|
||||
description= "Verify if get sites request returns status code 400 when invalid maxItems parameter is used")
|
||||
public void getSitesWithInvalidMaxItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withParams("maxItems=0")
|
||||
restClient.authenticateUser(regularUser).withParams("maxItems=0=09")
|
||||
.withCoreAPI().getSites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("Only positive values supported for maxItems");
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package org.alfresco.rest.tags;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
|
||||
public class AddTagCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private UserModel testUser;
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private String tagValue;
|
||||
private RestTagModel returnedModel;
|
||||
private FolderModel folderModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
folderModel = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomTag()
|
||||
{
|
||||
tagValue = RandomData.getRandomName("tag");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that adding empty tag returns status code 400")
|
||||
public void emptyTagTest() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag("");
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.NULL_ARGUMENT, "tag"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that adding tag with user that has no permissions returns status code 403")
|
||||
public void addTagWithUserThatDoesNotHavePermissions() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(testUser);
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that adding tag to a node that does not exist returns status code 404")
|
||||
public void addTagToInexistentNode() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
|
||||
String nodeRef = RandomStringUtils.randomAlphanumeric(10);
|
||||
document.setNodeRef(nodeRef);
|
||||
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, nodeRef));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that adding tag to a node that does not accepts tags returns status code 405")
|
||||
public void addTagToANodeThatDoesNotAcceptsTags() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
FileModel document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
document.setNodeRef(returnedModel.getId());
|
||||
restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError().containsSummary(RestErrorModel.CANNOT_TAG);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager is able to tag a file")
|
||||
public void managerIsAbleToTagAFile() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedModel.assertThat().field("tag").is(tagValue).and().field("id").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager is able to tag a folder")
|
||||
public void managerIsAbleToTagAFolder() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
returnedModel = restClient.withCoreAPI().usingResource(folderModel).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedModel.assertThat().field("tag").is(tagValue).and().field("id").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that tagged file can be tagged again")
|
||||
public void addTagToATaggedFile() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedModel.assertThat().field("tag").is(tagValue).and().field("id").isNotEmpty();
|
||||
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag(tagValue);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedModel.assertThat().field("tag").is(tagValue).and().field("id").isNotEmpty();
|
||||
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag("random_tag_value");
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedModel.assertThat().field("tag").is("random_tag_value").and().field("id").isNotEmpty();
|
||||
|
||||
restClient.withCoreAPI().usingResource(document).getNodeTags().assertThat()
|
||||
.entriesListContains("tag", tagValue.toLowerCase())
|
||||
.and().entriesListContains("tag", "random_tag_value");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that user cannot add invalid tag")
|
||||
public void addInvalidTag() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
returnedModel = restClient.withCoreAPI().usingResource(document).addTag("-1~!|@#$%^&*()_=");
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_TAG, "|"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package org.alfresco.rest.tags;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.CORE })
|
||||
public class DeleteTagCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel, userModel;
|
||||
private SiteModel siteModel;
|
||||
private RestTagModel tag;
|
||||
private FileModel document;
|
||||
private FolderModel folderModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
folderModel = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() throws Exception {
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
tag = restClient.withCoreAPI().usingResource(document).addTag(RandomData.getRandomName("tag"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that if user has no permission to remove tag returned status code is 403")
|
||||
public void deleteTagWithUserWithoutPermission() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that if node does not exist returned status code is 404")
|
||||
public void deleteTagForAnInexistentNode() throws Exception
|
||||
{
|
||||
FileModel document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
String nodeRef = RandomStringUtils.randomAlphanumeric(10);
|
||||
document.setNodeRef(nodeRef);
|
||||
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, nodeRef));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that if tag does not exist returned status code is 404")
|
||||
public void deleteTagThatDoesNotExist() throws Exception
|
||||
{
|
||||
tag.setId("abc");
|
||||
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "abc"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that if tag id is empty returned status code is 405")
|
||||
public void deleteTagWithEmptyId() throws Exception
|
||||
{
|
||||
tag.setId("");
|
||||
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED).assertLastError().containsSummary(RestErrorModel.DELETE_EMPTY_ARGUMENT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that file tag can be deleted")
|
||||
public void deleteFileTag() throws Exception
|
||||
{
|
||||
restClient.withCoreAPI().usingResource(document).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingResource(document).getNodeTags()
|
||||
.assertThat().entriesListDoesNotContain("tag", tag.getTag());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that folder tag can be deleted")
|
||||
public void deleteFolderTag() throws Exception
|
||||
{
|
||||
tag = restClient.withCoreAPI().usingResource(folderModel).addTag(RandomData.getRandomName("tag"));
|
||||
restClient.withCoreAPI().usingResource(folderModel).deleteTag(tag);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withCoreAPI().usingResource(folderModel).getNodeTags()
|
||||
.assertThat().entriesListDoesNotContain("tag", tag.getTag());
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class GetNodeTagsCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "abc"));
|
||||
|
||||
restClient.withParams("skipCount=-1").withCoreAPI().usingResource(document).getNodeTags();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.NEGATIVE_VALUE, "skipCount"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -62,7 +62,7 @@ public class GetNodeTagsCoreTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "abc"));
|
||||
|
||||
restClient.withParams("maxItems=-1").withCoreAPI().usingResource(document).getNodeTags();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.POSITIVE_VALUES, "maxItems"));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.alfresco.rest.workflow.deployments;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestDeploymentModel;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
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;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.DEPLOYMENTS, TestGroup.CORE, TestGroup.WORKFLOW })
|
||||
public class DeleteDeploymentCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser;
|
||||
private UserModel userModel;
|
||||
private RestDeploymentModel deployment;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16996")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleteDeployment is unsupported for empty deployment id with REST API and status code is 404")
|
||||
public void deleteDeploymentIsUnsupportedForEmptyId() throws Exception
|
||||
{
|
||||
deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel();
|
||||
deployment.setId("");
|
||||
restClient.withWorkflowAPI().usingDeployment(deployment).deleteDeployment();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16996")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleteDeployment is forbidden using non admin user or different user than creator with REST API and status code is 403")
|
||||
public void deleteDeploymentUsingNonAdminUser() throws Exception
|
||||
{
|
||||
deployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel();
|
||||
restClient.authenticateUser(userModel).withWorkflowAPI().usingDeployment(deployment).deleteDeployment();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.alfresco.rest.workflow.deployments;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestDeploymentModel;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 12/7/2016.
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS, TestGroup.CORE })
|
||||
public class GetDeploymentCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser, adminTenantUser;
|
||||
private RestDeploymentModel expectedDeployment, actualDeployment;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify if get deployment request returns status code 404 when invalid deploymentId is used.")
|
||||
public void getNonNetworkDeploymentUsingInvalidDeploymentId() throws Exception
|
||||
{
|
||||
expectedDeployment = restClient.authenticateUser(adminUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel();
|
||||
expectedDeployment.setId("invalidId");
|
||||
|
||||
restClient.withWorkflowAPI().usingDeployment(expectedDeployment).getDeployment();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidId"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify if network admin user gets a network deployment using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
public void adminGetsNetworkDeploymentWithSuccess() throws Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
|
||||
expectedDeployment = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel();
|
||||
actualDeployment = restClient.withWorkflowAPI().usingDeployment(expectedDeployment).getDeployment();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
actualDeployment.assertThat().field("deployedAt").isNotEmpty()
|
||||
.and().field("name").is(expectedDeployment.getName())
|
||||
.and().field("id").equals(expectedDeployment.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify non admin user is forbidden to get a network deployment using REST API (403)")
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
public void nonAdminUserIsForbiddenToGetNetworkDeployment() throws Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
expectedDeployment = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().getDeployments().getOneRandomEntry().onModel();
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
restClient.authenticateUser(tenantUser).withWorkflowAPI().usingDeployment(expectedDeployment).getDeployment();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package org.alfresco.rest.workflow.processDefinitions;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessDefinitionModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 12/5/2016.
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.CORE })
|
||||
public class GetProcessDefinitionCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser, adminTenantUser;
|
||||
private RestProcessDefinitionModel randomProcessDefinition, returnedProcessDefinition;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get process definition returns status code 404 when invalid processDefinitionId is used")
|
||||
public void getProcessDefinitionUsingInvalidProcessDefinitionId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
randomProcessDefinition.setId("invalidID");
|
||||
|
||||
restClient.withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinition();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidID"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify network admin is able to get a process definition using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
public void networkAdminGetProcessDefinition() throws Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
|
||||
randomProcessDefinition = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
returnedProcessDefinition = restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedProcessDefinition.assertThat().field("name").is(randomProcessDefinition.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify network user is able to get a process definition using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
public void networkUserGetProcessDefinition() throws Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
randomProcessDefinition = restClient.authenticateUser(adminTenantUser).withWorkflowAPI()
|
||||
.getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
returnedProcessDefinition = restClient.authenticateUser(tenantUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinition();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedProcessDefinition.assertThat().field("name").is(randomProcessDefinition.getName());
|
||||
}
|
||||
|
||||
}
|
||||
+6
-12
@@ -2,12 +2,10 @@ package org.alfresco.rest.workflow.processDefinitions;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestProcessDefinitionModel;
|
||||
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;
|
||||
@@ -18,17 +16,15 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.SANITY })
|
||||
public class GetProcessDefinitionSanityTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
private UserModel testUser;
|
||||
private RestProcessDefinitionModel randomProcessDefinition;
|
||||
private RestProcessDefinitionModel randomProcessDefinition, returnedProcessDefinition;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser());
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
@@ -36,11 +32,9 @@ public class GetProcessDefinitionSanityTests extends RestTest
|
||||
description = "Verify Admin user gets a specific process definition for non-network deployments using REST API and status code is OK (200)")
|
||||
public void adminGetsProcessDefinition() throws Exception
|
||||
{
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().
|
||||
assertThat().field("name").is(randomProcessDefinition.onModel().getName());
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().assertThat().field("name")
|
||||
.is(randomProcessDefinition.onModel().getName());
|
||||
returnedProcessDefinition = restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedProcessDefinition.assertThat().field("name").is(randomProcessDefinition.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
@@ -49,8 +43,8 @@ public class GetProcessDefinitionSanityTests extends RestTest
|
||||
public void anyUserGetsProcessDefinition() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(testUser);
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition().assertThat().field("name")
|
||||
.is(randomProcessDefinition.onModel().getName());
|
||||
returnedProcessDefinition = restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinition();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedProcessDefinition.assertThat().field("name").is(randomProcessDefinition.getName());
|
||||
}
|
||||
}
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package org.alfresco.rest.workflow.processDefinitions;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessDefinitionModel;
|
||||
import org.alfresco.rest.model.RestProcessDefinitionModelsCollection;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 12/6/2016.
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.CORE })
|
||||
public class GetProcessDefinitionStartFormModelCoreTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser, adminTenantUser;
|
||||
private RestProcessDefinitionModel randomProcessDefinition;
|
||||
private RestProcessDefinitionModelsCollection allProcessDefinitions;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
allProcessDefinitions = restClient.authenticateUser(adminUser).withWorkflowAPI().getAllProcessDefinitions();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify any user gets a model of the start form type definition for non-network deployments using REST API and status code is OK (200)")
|
||||
public void nonNetworkUserGetsStartFormModel() throws Exception
|
||||
{
|
||||
UserModel nonNetworkUser = dataUser.createRandomTestUser();
|
||||
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry();
|
||||
restClient.authenticateUser(nonNetworkUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel()
|
||||
.assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Bug(id = "ALF-20187")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get request returns status code 404 when invalid processDefinitionId is used")
|
||||
public void getStartFormModelUsingInvalidProcessDefinitionId() throws Exception
|
||||
{
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry();
|
||||
randomProcessDefinition.onModel().setId("invalidID");
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidID"));
|
||||
}
|
||||
|
||||
@Bug(id = "ALF-20187")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if get request returns status code 404 when empty processDefinitionId is used")
|
||||
public void getStartFormModelUsingEmptyProcessDefinitionId() throws Exception
|
||||
{
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry();
|
||||
randomProcessDefinition.onModel().setId("");
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Tenant User gets a model of the start form type definition for network deployments using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
public void networkUserGetsStartFormModel() throws Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser)
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
|
||||
randomProcessDefinition = restClient.authenticateUser(adminTenantUser).withWorkflowAPI()
|
||||
.getAllProcessDefinitions().getOneRandomEntry();
|
||||
restClient.authenticateUser(tenantUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel()
|
||||
.assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
-3
@@ -18,9 +18,6 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.SANITY })
|
||||
public class GetProcessDefinitionStartFormModelSanityTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
|
||||
private UserModel adminUserModel, adminTenantUser;
|
||||
private RestProcessDefinitionModel randomProcessDefinition;
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.Priority;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestProcessModelsCollection;
|
||||
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.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public class AddProcessCoreTests extends RestTest
|
||||
{
|
||||
private UserModel assignee, adminUser;
|
||||
private RestProcessModel addedProcess;
|
||||
private RestProcessModelsCollection processes;
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify non network admin is able to start new process using REST API and status code is OK (200)")
|
||||
public void nonNetworkAdminUserStartsNewProcess() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
addedProcess = restClient.authenticateUser(adminUser).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
addedProcess.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(adminUser.getUsername());
|
||||
|
||||
processes = restClient.withWorkflowAPI().getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processes.assertThat().entriesListContains("id", addedProcess.getId())
|
||||
.assertThat().entriesListContains("processDefinitionId", "activitiAdhoc:1:4")
|
||||
.assertThat().entriesListContains("startUserId", adminUser.getUsername())
|
||||
.assertThat().entriesListContains("startActivityId", "start")
|
||||
.assertThat().entriesListContains("completed", "false")
|
||||
.assertThat().entriesListContains("processDefinitionKey", "activitiAdhoc");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify start new process with empty request body using REST API returns status code is Bad Request (400)")
|
||||
public void startNewProcessWithEmptyProcessBody() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "", "processes");
|
||||
restClient.processModel(RestProcessModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.NO_CONTENT, "No content to map to Object due to end of input"));
|
||||
}
|
||||
|
||||
@Bug(id = "ACE-5671")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify start new process with invalid request body using REST API returns status code is Bad Request (400)")
|
||||
public void startNewProcessWithInvalidProcessDefInProcessBody() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "{\"processDefinitionKey\":\"activitiAdhoc\"}", "processes");
|
||||
restClient.processModel(RestProcessModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify start new process with invalid request body using REST API returns status code is Bad Request (400)")
|
||||
public void startNewProcessWithInvalidVariablesInProcessBody1() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "{\"variables\":{\"bpm_sendEMailNotifications\":false}}", "processes");
|
||||
restClient.processModel(RestProcessModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("Either processDefinitionId or processDefinitionKey is required");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify start new process with invalid request body using REST API returns status code is Bad Request (400)")
|
||||
public void startNewProcessWithInvalidVariablesInProcessBody2() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "{\"variables\":{\"bpm_assignee\":\"admin\"}}", "processes");
|
||||
restClient.processModel(RestProcessModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("Either processDefinitionId or processDefinitionKey is required");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES },
|
||||
executionType = ExecutionType.REGRESSION, description = "Verify start new process with invalid request body using REST API returns status code is Bad Request (400)")
|
||||
public void startNewProcessWithInvalidVariablesInProcessBody3() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "{\"variables\":{\"bpm_workflowPriority\":2}}", "processes");
|
||||
restClient.processModel(RestProcessModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("Either processDefinitionId or processDefinitionKey is required");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
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.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;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public class DeleteProcessCoreTests extends RestTest
|
||||
{
|
||||
private UserModel userWhoAddsProcess, assignee;
|
||||
private RestProcessModel process;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userWhoAddsProcess = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user is able to delete a process started by another user.")
|
||||
public void deleteProcessByAdminUser() throws Exception
|
||||
{
|
||||
process = restClient.authenticateUser(userWhoAddsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.withWorkflowAPI().usingProcess(process).deleteProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withWorkflowAPI().getProcesses()
|
||||
.assertThat().entriesListDoesNotContain("id", process.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User is not able to delete process with invalid id")
|
||||
public void deleteProcessWithInvalidId() throws Exception
|
||||
{
|
||||
process = restClient.authenticateUser(userWhoAddsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
process.setId("00001");
|
||||
restClient.withWorkflowAPI().usingProcess(process).deleteProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "00001"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User is not able to delete process with empty id")
|
||||
public void deleteProcessWithEmptyId() throws Exception
|
||||
{
|
||||
process = restClient.authenticateUser(userWhoAddsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
process.setId("");
|
||||
restClient.withWorkflowAPI().usingProcess(process).deleteProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
.assertLastError().containsSummary(RestErrorModel.DELETE_EMPTY_ARGUMENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestItemModel;
|
||||
import org.alfresco.rest.model.RestItemModelsCollection;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
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;
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public class DeleteProcessItemCoreTests extends RestTest
|
||||
{
|
||||
private FileModel document, secondDoc;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private RestProcessModel restProcessModel;
|
||||
private ProcessModel processModel;
|
||||
private RestItemModelsCollection items;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userWhoStartsTask = 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)
|
||||
.createSingleReviewerTaskAndAssignTo(assignee);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process item with invalid id")
|
||||
public void deleteProcessItemWithInvalidItemId() throws Exception
|
||||
{
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
secondDoc = dataContent.usingUser(userWhoStartsTask).usingSite(siteModel).createContent(DocumentType.MSWORD);
|
||||
RestItemModel processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(secondDoc);
|
||||
processItem.setId("invalid-id");
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessItem(processItem);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.PROCESS_ENTITY_NOT_FOUND, "invalid-id"));
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process item with empty id")
|
||||
public void deleteProcessItemWithEmptyItemId() throws Exception
|
||||
{
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
secondDoc = dataContent.usingUser(userWhoStartsTask).usingSite(siteModel).createContent(DocumentType.MSWORD);
|
||||
RestItemModel processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(secondDoc);
|
||||
processItem.setId("");
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessItem(processItem);
|
||||
restClient.assertStatusCodeIs(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.DELETE_EMPTY_ARGUMENT));
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process item twice")
|
||||
public void deleteProcessItemTwice() throws Exception
|
||||
{
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.getProcesses().getProcessModelByProcessDefId(processModel.getId());
|
||||
items = restClient.withWorkflowAPI().usingProcess(restProcessModel).getProcessItems();
|
||||
RestItemModel processItem = items.getEntries().get(0);
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessItem(processItem.onModel());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withWorkflowAPI().usingProcess(processModel).deleteProcessItem(processItem.onModel());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.PROCESS_ENTITY_NOT_FOUND, processItem.onModel().getId()));
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
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.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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author bogdan.bocancea
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public class DeleteProcessVariableCoreTests extends RestTest
|
||||
{
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private RestProcessModel restProcessModel;
|
||||
private ProcessModel processModel;
|
||||
private RestProcessVariableModel variableModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userWhoStartsTask = 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)
|
||||
.createSingleReviewerTaskAndAssignTo(assignee);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete invalid process variable")
|
||||
public void deleteInvalidProcessVariable() throws Exception
|
||||
{
|
||||
variableModel = RestProcessVariableModel.getRandomProcessVariableModel("x:InvalidVar");
|
||||
restProcessModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI()
|
||||
.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")
|
||||
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);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete process variable twice")
|
||||
public void deleteProcessVariableTwice() 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.withWorkflowAPI().usingProcess(restProcessModel).deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.withWorkflowAPI().usingProcess(restProcessModel).deleteProcessVariable(variableModel);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, variableModel.getName()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.CMISUtil.Priority;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestProcessModelsCollection;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.ProcessModel;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
|
||||
public class GetProcessesCoreTests extends RestTest
|
||||
{
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUser, userWhoStartsTask, assignee, adminTenantUser;
|
||||
private TaskModel task1, task2;
|
||||
private ProcessModel process3;
|
||||
|
||||
@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);
|
||||
task1 = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
task2 = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(adminUser);
|
||||
process3 = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createSingleReviewerTaskAndAssignTo(assignee);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin gets all processes from same network")
|
||||
public void getProcessFromSameNetworkUsingAdmin() throws Exception
|
||||
{
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
UserModel tenantUserAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenantAssignee");
|
||||
RestProcessModel process = restClient.authenticateUser(tenantUser).withWorkflowAPI().addProcess("activitiAdhoc", tenantUserAssignee, false, Priority.Normal);
|
||||
|
||||
RestProcessModelsCollection tenantProcesses = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
tenantProcesses.assertThat().entriesListContains("id", process.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user gets all processes started by him ordered descending by id")
|
||||
public void getProcessesOrderedByIdDESC() throws Exception
|
||||
{
|
||||
RestProcessModelsCollection processes = restClient.authenticateUser(userWhoStartsTask).withParams("orderBy=id DESC")
|
||||
.withWorkflowAPI().getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processes.assertThat().entriesListIsNotEmpty();
|
||||
List<RestProcessModel> processesList = processes.getEntries();
|
||||
processesList.get(0).onModel().assertThat().field("id").is(process3.getId());
|
||||
processesList.get(1).onModel().assertThat().field("id").is(task2.getNodeRef());
|
||||
processesList.get(2).onModel().assertThat().field("id").is(task1.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user gets processes that matches a where clause")
|
||||
public void getProcessesWithWhereClauseAsParameter() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
RestProcessModelsCollection processes = restClient.authenticateUser(userWhoStartsTask).where("processDefinitionKey='activitiReview'")
|
||||
.withWorkflowAPI().getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processes.assertThat().entriesListIsNotEmpty().and().entriesListContains("processDefinitionId", "activitiReview:1:8")
|
||||
.and().entriesListDoesNotContain("processDefinitionId", "activitiAdhoc:1:4");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
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.RestFormModelsCollection;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author bogdan.bocancea
|
||||
*
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
public class GetTaskFormModelCoreTests extends RestTest
|
||||
{
|
||||
UserModel userModel;
|
||||
SiteModel siteModel;
|
||||
FileModel fileModel;
|
||||
TaskModel taskModel;
|
||||
RestFormModelsCollection returnedCollection;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non involved user in task cannot get form models with Rest API and response is FORBIDDEN (403)")
|
||||
public void nonInvolvedUserCannotGetTaskFormModels() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userModel)
|
||||
.usingSite(siteModel)
|
||||
.usingResource(fileModel).createNewTaskAndAssignTo(userModel);
|
||||
UserModel nonInvolvedUser = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(nonInvolvedUser);
|
||||
restClient.withWorkflowAPI().usingTask(taskModel).getTaskFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user involved in task cannot get task form models with invalid task id")
|
||||
public void getTaskFormModelsInvalidTaskId() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userModel)
|
||||
.usingSite(siteModel)
|
||||
.usingResource(fileModel).createNewTaskAndAssignTo(userModel);
|
||||
taskModel.setId("0000");
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withWorkflowAPI().usingTask(taskModel).getTaskFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "0000"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user involved in task cannot get task form models with invalid task id")
|
||||
public void getTaskFormModelsEmptyTaskId() throws Exception
|
||||
{
|
||||
taskModel = dataWorkflow.usingUser(userModel)
|
||||
.usingSite(siteModel)
|
||||
.usingResource(fileModel).createNewTaskAndAssignTo(userModel);
|
||||
taskModel.setId("");
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withWorkflowAPI().usingTask(taskModel).getTaskFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user involved in task cannot get completed task form models")
|
||||
public void getTaskFormModelsForCompletedTask() throws Exception
|
||||
{
|
||||
UserModel assignedUser = dataUser.createRandomTestUser();
|
||||
taskModel = dataWorkflow.usingUser(userModel)
|
||||
.usingSite(siteModel)
|
||||
.usingResource(fileModel).createNewTaskAndAssignTo(assignedUser);
|
||||
dataWorkflow.usingUser(assignedUser).taskDone(taskModel);
|
||||
dataWorkflow.usingUser(userModel).taskDone(taskModel);
|
||||
restClient.authenticateUser(userModel);
|
||||
returnedCollection = restClient.withWorkflowAPI().usingTask(taskModel).getTaskFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedCollection.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user