mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch '5.1.N-newDSL' of https://gitlab.alfresco.com/tas/alfresco-tas-restapi-test into TAS-1924
This commit is contained in:
@@ -46,7 +46,7 @@ public class AddCommentSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
String newContent = "This is a new comment added by " + adminUserModel.getUsername();
|
||||
restClient.usingNode(document).addComment(newContent)
|
||||
restClient.usingResource(document).addComment(newContent)
|
||||
.assertThat().field("content").isNotEmpty()
|
||||
.and().field("content").is(newContent);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
@@ -57,7 +57,7 @@ public class AddCommentSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
String contentSiteManger = "This is a new comment added by user with role: " + UserRole.SiteManager;
|
||||
restClient.usingNode(document).addComment(contentSiteManger)
|
||||
restClient.usingResource(document).addComment(contentSiteManger)
|
||||
.assertThat().field("content").isNotEmpty()
|
||||
.and().field("content").is(contentSiteManger);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
@@ -68,7 +68,7 @@ public class AddCommentSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
String contentSiteContributor = "This is a new comment added by user with role" + UserRole.SiteContributor;
|
||||
restClient.usingNode(document).addComment(contentSiteContributor)
|
||||
restClient.usingResource(document).addComment(contentSiteContributor)
|
||||
.assertThat().field("content").isNotEmpty()
|
||||
.and().field("content").is(contentSiteContributor);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
@@ -79,7 +79,7 @@ public class AddCommentSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
String contentSiteCollaborator = "This is a new comment added by user with role: " + UserRole.SiteCollaborator;
|
||||
restClient.usingNode(document).addComment(contentSiteCollaborator)
|
||||
restClient.usingResource(document).addComment(contentSiteCollaborator)
|
||||
.assertThat().field("content").isNotEmpty()
|
||||
.and().field("content").is(contentSiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
@@ -90,7 +90,7 @@ public class AddCommentSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
String contentSiteConsumer = "This is a new comment added by user with role: " + UserRole.SiteConsumer;
|
||||
restClient.usingNode(document).addComment(contentSiteConsumer);
|
||||
restClient.usingResource(document).addComment(contentSiteConsumer);
|
||||
restClient
|
||||
.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
@@ -101,7 +101,7 @@ public class AddCommentSanityTests extends RestTest
|
||||
public void unauthenticatedUserIsNotAbleToAddComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
restClient.usingNode(document).addComment("This is a new comment");
|
||||
restClient.usingResource(document).addComment("This is a new comment");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AddCommentsSanityTests extends RestTest
|
||||
public void adminIsAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.usingNode(document).addComments(comment1, comment2)
|
||||
.usingResource(document).addComments(comment1, comment2)
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("content", comment1)
|
||||
.and().entriesListContains("content", comment2);
|
||||
@@ -69,7 +69,7 @@ public class AddCommentsSanityTests extends RestTest
|
||||
public void managerIsAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingNode(document).addComments(comment1, comment2)
|
||||
.usingResource(document).addComments(comment1, comment2)
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("content", comment1)
|
||||
.and().entriesListContains("content", comment2);
|
||||
@@ -81,7 +81,7 @@ public class AddCommentsSanityTests extends RestTest
|
||||
public void contributorIsAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingNode(document).addComments(comment1, comment2)
|
||||
.usingResource(document).addComments(comment1, comment2)
|
||||
.assertThat().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("content", comment1)
|
||||
.and().entriesListContains("content", comment2);
|
||||
@@ -93,7 +93,7 @@ public class AddCommentsSanityTests extends RestTest
|
||||
public void collaboratorIsAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingNode(document).addComments(comment1, comment2)
|
||||
.usingResource(document).addComments(comment1, comment2)
|
||||
.assertThat().paginationExist().and().entriesListIsNotEmpty()
|
||||
.and().entriesListContains("content", comment1)
|
||||
.and().entriesListContains("content", comment2);
|
||||
@@ -106,7 +106,7 @@ public class AddCommentsSanityTests extends RestTest
|
||||
public void consumerIsAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingNode(document).addComments(comment1, comment2);
|
||||
.usingResource(document).addComments(comment1, comment2);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class AddCommentsSanityTests extends RestTest
|
||||
public void unauthenticatedUserIsNotAbleToAddComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"))
|
||||
.usingNode(document).addComments(comment1, comment2);
|
||||
.usingResource(document).addComments(comment1, comment2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
public void addCommentToDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
comment = restClient.usingNode(document).addComment("This is a new comment");
|
||||
comment = restClient.usingResource(document).addComment("This is a new comment");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -60,7 +60,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
public void adminIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingNode(document).deleteComment(comment);
|
||||
restClient.usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
public void managerIsAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.usingNode(document).deleteComment(comment);
|
||||
restClient.usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
public void collaboratorIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.usingNode(document).deleteComment(comment);
|
||||
restClient.usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
public void contributorIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
restClient.usingNode(document).deleteComment(comment);
|
||||
restClient.usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
public void consumerIsNotAbleToDeleteComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
restClient.usingNode(document).deleteComment(comment);
|
||||
restClient.usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class DeleteCommentsSanityTests extends RestTest
|
||||
{
|
||||
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
|
||||
restClient.authenticateUser(nonexistentModel);
|
||||
restClient.usingNode(document).deleteComment(comment);
|
||||
restClient.usingResource(document).deleteComment(comment);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
content = "This is a new comment";
|
||||
restClient.usingNode(document).addComment(content);
|
||||
restClient.usingResource(document).addComment(content);
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingNode(document).getNodeComments();
|
||||
restClient.usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
public void managerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.usingNode(document).getNodeComments()
|
||||
restClient.usingResource(document).getNodeComments()
|
||||
.assertThat().entriesListContains("content", content);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
@@ -74,7 +74,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
public void contributorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
restClient.usingNode(document).getNodeComments()
|
||||
restClient.usingResource(document).getNodeComments()
|
||||
.assertThat().entriesListContains("content", content);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
@@ -85,7 +85,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
public void collaboratorIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.usingNode(document).getNodeComments()
|
||||
restClient.usingResource(document).getNodeComments()
|
||||
.assertThat().entriesListContains("content", content);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
public void consumerIsAbleToRetrieveComments() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
restClient.usingNode(document).getNodeComments()
|
||||
restClient.usingResource(document).getNodeComments()
|
||||
.assertThat().entriesListContains("content", content);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class GetCommentsSanityTests extends RestTest
|
||||
{
|
||||
UserModel nonexistentModel = new UserModel("nonexistentUser", "nonexistentPassword");
|
||||
restClient.authenticateUser(nonexistentModel);
|
||||
restClient.usingNode(document).getNodeComments();
|
||||
restClient.usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@@ -118,10 +118,10 @@ public class GetCommentsSanityTests extends RestTest
|
||||
userModel = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(userModel);
|
||||
String contentManager = "This is a new comment added by " + userModel.getUsername();
|
||||
restClient.usingNode(document).addComment(contentManager);
|
||||
restClient.usingResource(document).addComment(contentManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.usingNode(document).getNodeComments()
|
||||
restClient.usingResource(document).getNodeComments()
|
||||
.assertThat().entriesListContains("content", contentManager);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
@@ -134,10 +134,10 @@ public class GetCommentsSanityTests extends RestTest
|
||||
userModel = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
|
||||
restClient.authenticateUser(userModel);
|
||||
String contentCollaborator = "This is a new comment added by " + userModel.getUsername();
|
||||
restClient.usingNode(document).addComment(contentCollaborator);
|
||||
restClient.usingResource(document).addComment(contentCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.usingNode(document).getNodeComments()
|
||||
restClient.usingResource(document).getNodeComments()
|
||||
.assertThat().entriesListContains("content", contentCollaborator);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
|
||||
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
commentModel = restClient.usingNode(document).addComment("This is a new comment");
|
||||
commentModel = restClient.usingResource(document).addComment("This is a new comment");
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
String updatedContent = "This is the updated comment with admin user";
|
||||
restClient.usingNode(document).updateComment(commentModel, updatedContent)
|
||||
restClient.usingResource(document).updateComment(commentModel, updatedContent)
|
||||
.assertThat().field("content").isNotEmpty()
|
||||
.and().field("content").is(updatedContent);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
@@ -67,7 +67,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
public void managerIsAbleToUpdateComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Manager user")
|
||||
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Manager user")
|
||||
.and().field("content").is("This is the updated comment with Manager user")
|
||||
.and().field("canEdit").is(true)
|
||||
.and().field("canDelete").is(true);
|
||||
@@ -80,7 +80,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
String updatedContent = "This is the updated comment with Contributor user";
|
||||
restClient.usingNode(document).updateComment(commentModel, updatedContent);
|
||||
restClient.usingResource(document).updateComment(commentModel, updatedContent);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
public void consumerIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Consumer user");
|
||||
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Consumer user");
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
public void collaboratorIsNotAbleToUpdateComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
|
||||
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user");
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(ErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
{
|
||||
UserModel incorrectUserModel = new UserModel("userName", "password");
|
||||
restClient.authenticateUser(incorrectUserModel)
|
||||
.usingNode(document).getNodeComments();
|
||||
.usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
|
||||
FolderModel content = FolderModel.getRandomFolderModel();
|
||||
content.setNodeRef("node ref that does not exist");
|
||||
restClient.usingNode(content).updateComment(commentModel, "This is the updated comment.");
|
||||
restClient.usingResource(content).updateComment(commentModel, "This is the updated comment.");
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary("node ref that does not exist was not found");
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class UpdateCommentsSanityTests extends RestTest
|
||||
RestCommentModel comment = new RestCommentModel();
|
||||
String id = "comment id that does not exist";
|
||||
comment.setId(id);
|
||||
restClient.usingNode(document).updateComment(comment, "This is the updated comment.");
|
||||
restClient.usingResource(document).updateComment(comment, "This is the updated comment.");
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(ErrorModel.ENTITY_NOT_FOUND, id));
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ public class RestDemoTests extends RestTest
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.createContent(DocumentType.TEXT_PLAIN);
|
||||
// add new comment
|
||||
restClient.usingNode(fileModel).addComment("This is a new comment");
|
||||
restClient.usingNode(fileModel).getNodeComments()
|
||||
restClient.usingResource(fileModel).addComment("This is a new comment");
|
||||
restClient.usingResource(fileModel).getNodeComments()
|
||||
.assertThat().entriesListIsNotEmpty().and()
|
||||
.entriesListContains("content", "This is a new comment");
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SampleCommentsTests extends RestTest
|
||||
description= "Verify admin user adds comments with Rest API and status code is 200")
|
||||
public void admiShouldAddComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.usingNode(document).addComment("This is a new comment");
|
||||
restClient.usingResource(document).addComment("This is a new comment");
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SampleCommentsTests extends RestTest
|
||||
description= "Verify admin user gets comments with Rest API and status code is 200")
|
||||
public void admiShouldRetrieveComments() throws Exception
|
||||
{
|
||||
restClient.usingNode(document).getNodeComments();
|
||||
restClient.usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public class SampleCommentsTests extends RestTest
|
||||
description= "Verify admin user updates comments with Rest API")
|
||||
public void adminShouldUpdateComment() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
RestCommentModel commentModel = restClient.usingNode(document).addComment("This is a new comment");
|
||||
RestCommentModel commentModel = restClient.usingResource(document).addComment("This is a new comment");
|
||||
|
||||
restClient.usingNode(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
|
||||
restClient.usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
|
||||
.assertThat().field("content").is("This is the updated comment with Collaborator user");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.requests.RestNetworksApi;
|
||||
import org.alfresco.rest.requests.RestTenantApi;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -16,13 +13,6 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
{
|
||||
|
||||
@Autowired
|
||||
RestTenantApi tenantApi;
|
||||
|
||||
@Autowired
|
||||
RestNetworksApi networkApi;
|
||||
|
||||
private UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
@@ -33,11 +23,8 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
tenantApi.useRestClient(restClient);
|
||||
tenantApi.createTenant(adminTenantUser);
|
||||
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
networkApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@@ -49,8 +36,8 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetworkForUser(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.usingUser(tenantUser).getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -59,8 +46,8 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetworkForUser(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingUser(adminTenantUser).getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -69,8 +56,8 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetworkForUser(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.usingUser(tenantUser).getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -79,11 +66,10 @@ public class RestGetNetworkForPersonSanityTests extends RestTest
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
tenantApi.createTenant(secondAdminTenantUser);
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetworkForUser(secondTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.usingUser(adminTenantUser).getNetwork(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.requests.RestNetworksApi;
|
||||
import org.alfresco.rest.requests.RestTenantApi;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
@@ -10,7 +8,6 @@ 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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -21,12 +18,6 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS })
|
||||
public class RestGetNetworkTest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestNetworksApi networkApi;
|
||||
|
||||
@Autowired
|
||||
RestTenantApi tenantApi;
|
||||
|
||||
UserModel adminTenantUser;
|
||||
UserModel adminAnotherTenantUser;
|
||||
SiteModel site;
|
||||
@@ -38,15 +29,12 @@ public class RestGetNetworkTest extends RestTest
|
||||
UserModel adminuser = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminuser);
|
||||
tenantApi.useRestClient(restClient);
|
||||
tenantApi.createTenant(adminTenantUser);
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
adminAnotherTenantUser = UserModel.getAdminTenantUser();
|
||||
tenantApi.createTenant(adminAnotherTenantUser);
|
||||
restClient.usingTenant().createTenant(adminAnotherTenantUser);
|
||||
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
site = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
|
||||
networkApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@@ -58,8 +46,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -68,8 +56,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingNetworks().getNetwork();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -77,7 +65,7 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void adminTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
restClient.usingNetworks().getNetwork().assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -85,8 +73,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void adminTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetwork(UserModel.getRandomTenantUser());
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.usingNetworks().getNetwork(UserModel.getRandomTenantUser());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -94,16 +82,16 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void adminTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetwork(adminAnotherTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
restClient.usingNetworks().getNetwork(adminAnotherTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.NETWORKS }, description = "Verify any tenant user gets its network with Rest API and response is not empty")
|
||||
public void userTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -111,7 +99,7 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void userTenantChecksNetworkParamsAreCorrect() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser).assertNetworkHasName(adminTenantUser).assertNetworkIsEnabled();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -119,8 +107,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void userTenantChecksIfNonExistingNetworkIsNotFound() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetwork(UserModel.getRandomTenantUser());
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.usingNetworks().getNetwork(UserModel.getRandomTenantUser());
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -129,8 +117,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
public void userTenantChecksIfAnotherExistingNetworkIsForbidden() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetwork(adminAnotherTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
restClient.usingNetworks().getNetwork(adminAnotherTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -142,8 +130,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(managerTenantUser, site, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(managerTenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -155,8 +143,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(collaboratorTenantUser, site, UserRole.SiteCollaborator);
|
||||
|
||||
restClient.authenticateUser(collaboratorTenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -168,8 +156,8 @@ public class RestGetNetworkTest extends RestTest
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(consumerTenantUser, site, UserRole.SiteConsumer);
|
||||
|
||||
restClient.authenticateUser(consumerTenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -181,7 +169,7 @@ public class RestGetNetworkTest extends RestTest
|
||||
dataUser.usingUser(adminTenantUser).addUserToSite(contributorTenantUser, site, UserRole.SiteContributor);
|
||||
|
||||
restClient.authenticateUser(contributorTenantUser);
|
||||
networkApi.getNetwork(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingNetworks().getNetwork(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package org.alfresco.rest.networks;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.requests.RestNetworksApi;
|
||||
import org.alfresco.rest.requests.RestTenantApi;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -16,12 +13,6 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.SANITY })
|
||||
public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestTenantApi tenantApi;
|
||||
|
||||
@Autowired
|
||||
RestNetworksApi networkApi;
|
||||
|
||||
private UserModel adminUserModel;
|
||||
UserModel adminTenantUser;
|
||||
UserModel tenantUser;
|
||||
@@ -32,11 +23,8 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
tenantApi.useRestClient(restClient);
|
||||
tenantApi.createTenant(adminTenantUser);
|
||||
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
networkApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-16904")
|
||||
@@ -48,8 +36,8 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
UserModel tenantUser = new UserModel("nonexisting", "password");
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetworksForUser(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.usingUser(tenantUser).getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -58,8 +46,8 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
public void adminTenantChecksIfNetworkIsPresent() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
networkApi.getNetworksForUser(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
restClient.usingUser(adminTenantUser).getNetworks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -68,8 +56,8 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
public void tenantUserIsNotAuthorizedToCheckNetworkOfAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(tenantUser);
|
||||
networkApi.getNetworksForUser(adminTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.usingUser(tenantUser).getNetworks(adminTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test(groups = TestGroup.COMMENTS)
|
||||
@@ -78,10 +66,10 @@ public class RestGetNetworksForPersonSanityTests extends RestTest
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondAdminTenantUser = UserModel.getAdminTenantUser();
|
||||
tenantApi.createTenant(secondAdminTenantUser);
|
||||
restClient.usingTenant().createTenant(secondAdminTenantUser);
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(secondAdminTenantUser);
|
||||
networkApi.getNetworksForUser(secondTenantUser);
|
||||
networkApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
restClient.usingUser(secondAdminTenantUser).getNetworks(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.alfresco.rest.ratings;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.requests.RestRatingsApi;
|
||||
import org.alfresco.rest.model.RestRatingModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
@@ -15,7 +15,6 @@ import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
@@ -24,15 +23,13 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.SANITY })
|
||||
public class AddRatingSanityTests extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestRatingsApi ratingsApi;
|
||||
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
private UserModel adminUser;
|
||||
private FolderModel folderModel;
|
||||
private FileModel document;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private RestRatingModel returnedRatingModel; //placeholder for returned model
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
@@ -40,7 +37,6 @@ public class AddRatingSanityTests extends RestTest
|
||||
userModel = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20));
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
ratingsApi.useRestClient(restClient);
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(siteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
@@ -57,60 +53,62 @@ public class AddRatingSanityTests extends RestTest
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role is able to post like rating to a document")
|
||||
public void managerIsAbleToLikeDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
ratingsApi.likeDocument(document)
|
||||
.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedRatingModel.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Collaborator role is able to post like rating to a document")
|
||||
public void collaboratorIsAbleToLikeDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
ratingsApi.likeDocument(document)
|
||||
.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedRatingModel.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role is able to post like rating to a document")
|
||||
public void contributorIsAbleToLikeDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
ratingsApi.likeDocument(document)
|
||||
.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel =restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedRatingModel.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role is able to post like rating to a document")
|
||||
public void consumerIsAbleToLikeDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
ratingsApi.likeDocument(document)
|
||||
.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedRatingModel.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to post like rating to a document")
|
||||
public void adminIsAbleToLikeDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
ratingsApi.likeDocument(document)
|
||||
.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(adminUser).usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
returnedRatingModel.assertThat().field("myRating").is("true")
|
||||
.and().field("id").is("likes")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -118,70 +116,64 @@ public class AddRatingSanityTests extends RestTest
|
||||
@Bug(id = "MNT-16904")
|
||||
public void unauthenticatedUserIsNotAbleToLikeDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
ratingsApi.likeDocument(document);
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).usingResource(document).likeDocument();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Manager role is able to post stars rating to a document")
|
||||
public void managerIsAbleToAddStarsToDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
ratingsApi.rateStarsToDocument(document, 5)
|
||||
.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingResource(document).rateStarsToDocument(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Collaborator role is able to post stars rating to a document")
|
||||
public void collaboratorIsAbleToAddStarsToDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
ratingsApi.rateStarsToDocument(document, 5)
|
||||
.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();;
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(document).rateStarsToDocument(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Contributor role is able to post stars rating to a document")
|
||||
public void contributorIsAbleToAddStarsToDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
ratingsApi.rateStarsToDocument(document, 5)
|
||||
.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();;
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(document).rateStarsToDocument(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify user with Consumer role is able to post stars rating to a document")
|
||||
public void consumerIsAbleToAddStarsToDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
ratingsApi.rateStarsToDocument(document, 5)
|
||||
.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();;
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(document).rateStarsToDocument(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel.assertThat().field("myRating").is("5")
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.RATINGS }, executionType = ExecutionType.SANITY, description = "Verify admin user is able to post stars rating to a document")
|
||||
public void adminIsAbleToAddStarsToDocument() throws Exception
|
||||
{
|
||||
int starsNo=3;
|
||||
restClient.authenticateUser(adminUser);
|
||||
ratingsApi.rateStarsToDocument(document, starsNo)
|
||||
.assertThat().field("myRating").is(String.valueOf(starsNo))
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();;
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
{
|
||||
returnedRatingModel = restClient.authenticateUser(adminUser).usingResource(document).rateStarsToDocument(3);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
returnedRatingModel.assertThat().field("myRating").is(String.valueOf(3))
|
||||
.and().field("id").is("fiveStar")
|
||||
.and().field("aggregate").isNotEmpty();;
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -189,8 +181,7 @@ public class AddRatingSanityTests extends RestTest
|
||||
@Bug(id = "MNT-16904")
|
||||
public void unauthenticatedUserIsNotAbleToRateStarsToDocument() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(new UserModel("random user", "random password"));
|
||||
ratingsApi.rateStarsToDocument(document, 5);
|
||||
ratingsApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.authenticateUser(new UserModel("random user", "random password")).usingResource(document).rateStarsToDocument(5);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,10 @@ import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestItemModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
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;
|
||||
@@ -25,14 +19,10 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY})
|
||||
public class AddProcessItemSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
private FileModel document, document2, document3;
|
||||
private FileModel document, document2;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private UserModel userWhoStartsTask, assignee, adminUser;
|
||||
private RestProcessModel processModel;
|
||||
private UserModel adminUser;
|
||||
|
||||
private RestItemModel processItem;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
@@ -43,18 +33,19 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Create non-existing process item")
|
||||
public void addProcessItem() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
document2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file content");
|
||||
dataContent.usingSite(siteModel).createContent(document2);
|
||||
processModel = restClient.getProcesses().getOneRandomEntry();
|
||||
|
||||
processModel = restClient.authenticateUser(adminUser).getProcesses().getOneRandomEntry().onModel();
|
||||
processItem = restClient.usingProcess(processModel).addProcessItem(document2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processItem.assertThat().field("createdAt").isNotEmpty()
|
||||
.and().field("size").is(document2.getContent().length())
|
||||
.and().field("createdBy").is(adminUser.getUsername())
|
||||
@@ -63,35 +54,34 @@ public class AddProcessItemSanityTests extends RestWorkflowTest
|
||||
.and().field("modifiedBy").is(adminUser.getUsername())
|
||||
.and().field("id").isNotEmpty()
|
||||
.and().field("mimeType").is(document2.getFileType().mimeType);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
restClient.usingProcess(processModel).getProcessesItems().assertThat().entriesListContains("id", processItem.getId());
|
||||
|
||||
|
||||
restClient.usingProcess(processModel).getProcessItems()
|
||||
.assertThat().entriesListContains("id", processItem.getId());
|
||||
}
|
||||
|
||||
|
||||
@Bug(id= "MNT-16966")
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Add process item that already exists")
|
||||
public void addProcessItemThatAlreadyExists() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
document3 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processItem = processesApi.addProcessItem(processModel, document3);
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.XML);
|
||||
|
||||
processModel = restClient.authenticateUser(adminUser).getProcesses().getOneRandomEntry().onModel();
|
||||
processItem = restClient.usingProcess(processModel).addProcessItem(document2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processItem.assertThat().field("createdAt").isNotEmpty()
|
||||
.and().field("size").is("19")
|
||||
.and().field("createdBy").is(adminUser.getUsername())
|
||||
.and().field("modifiedAt").isNotEmpty()
|
||||
.and().field("name").is(document3.getName())
|
||||
.and().field("name").is(document2.getName())
|
||||
.and().field("modifiedBy").is(adminUser.getUsername())
|
||||
.and().field("id").isNotEmpty()
|
||||
.and().field("mimeType").is(document3.getFileType().mimeType);
|
||||
.and().field("mimeType").is(document2.getFileType().mimeType);
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcessesItems(processModel)
|
||||
.assertThat().entriesListContains("id", processItem.getId()).and()
|
||||
.entriesListContains("name", document3.getName());
|
||||
processItem = processesApi.addProcessItem(processModel, document3);
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
restClient.usingProcess(processModel).getProcessItems()
|
||||
.assertThat().entriesListContains("id", processItem.getId())
|
||||
.and().entriesListContains("name", document2.getName());
|
||||
restClient.usingProcess(processModel).addProcessItem(document2);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,13 @@ import org.alfresco.dataprep.CMISUtil.Priority;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.requests.Processes;
|
||||
import org.alfresco.rest.requests.RestTenantApi;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.rest.model.RestProcessModelsCollection;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -22,27 +19,10 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public class AddProcessSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
private Processes processesApi;
|
||||
|
||||
@Autowired
|
||||
private RestTenantApi tenantApi;
|
||||
|
||||
private UserModel userWhoStartsProcess, assignee;
|
||||
private UserModel adminTenantUser, tenantUserWhoStartsProcess, tenantAssignee;
|
||||
private RestProcessModel addedProcess;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
processesApi.useRestClient(restClient);
|
||||
tenantApi.useRestClient(restClient);
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser());
|
||||
}
|
||||
private RestProcessModelsCollection processes;
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify non network user is able to start new process using REST API and status code is OK (200)")
|
||||
@@ -51,14 +31,14 @@ public class AddProcessSanityTests extends RestWorkflowTest
|
||||
userWhoStartsProcess = dataUser.createRandomTestUser();
|
||||
assignee = dataUser.createRandomTestUser();
|
||||
|
||||
restClient.authenticateUser(userWhoStartsProcess);
|
||||
addedProcess = processesApi.addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
addedProcess = restClient.authenticateUser(userWhoStartsProcess).addProcess("activitiAdhoc", assignee, false, Priority.Normal);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
addedProcess.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcesses().assertThat().entriesListContains("id", addedProcess.getId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
|
||||
processes = restClient.getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processes.assertThat().entriesListContains("id", addedProcess.getId());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
@@ -66,17 +46,19 @@ public class AddProcessSanityTests extends RestWorkflowTest
|
||||
@Test(groups = { TestGroup.NETWORKS })
|
||||
public void networkUserStartsNewProcess() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
tenantApi.createTenant(adminTenantUser);
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
adminTenantUser = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
tenantUserWhoStartsProcess = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
tenantAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("u2Tenant");
|
||||
|
||||
restClient.authenticateUser(tenantUserWhoStartsProcess);
|
||||
addedProcess = processesApi.addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
|
||||
addedProcess = restClient.authenticateUser(tenantUserWhoStartsProcess).addProcess("activitiAdhoc", tenantAssignee, false, Priority.Normal);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
addedProcess.assertThat().field("id").is(addedProcess.getId())
|
||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.CREATED);
|
||||
processesApi.getProcesses().assertThat().entriesListContains("id", addedProcess.getId());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
processes = restClient.getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processes.assertThat().entriesListContains("id", addedProcess.getId());
|
||||
}
|
||||
}
|
||||
|
||||
+16
-26
@@ -3,35 +3,27 @@ package org.alfresco.rest.workflow.processes;
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.requests.Processes;
|
||||
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.rest.model.RestTaskModelsCollection;
|
||||
import org.alfresco.utility.model.*;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Tests for GET "/processes/{processId}/tasks" REST API call
|
||||
*
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public class GetProcessTasksSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
private Processes processesApi;
|
||||
|
||||
private UserModel userModel;
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel assignee1, assignee2, assignee3;
|
||||
private UserModel userModel, assignee1, assignee2, assignee3;
|
||||
private ProcessModel process;
|
||||
private RestTaskModelsCollection processTasks;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -44,44 +36,42 @@ public class GetProcessTasksSanityTests extends RestWorkflowTest
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
process = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(document)
|
||||
.createMoreReviewersWorkflowAndAssignTo(assignee1, assignee2, assignee3);
|
||||
processesApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify user who started the process gets all tasks of started process with Rest API and response is successfull (200)")
|
||||
public void userWhoStartedProcessCanGetProcessTasks() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
processesApi.getProcessTasks(process).assertThat()
|
||||
processTasks = restClient.authenticateUser(userModel).usingProcess(process).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat()
|
||||
.entriesListIsNotEmpty().and()
|
||||
.entriesListContains("assignee", assignee1.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify any assignee user of the process gets all tasks of the process with Rest API and response is successfull (200)")
|
||||
public void assigneeUserCanGetAllProcessTasks() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(assignee1);
|
||||
processesApi.getProcessTasks(process).assertThat()
|
||||
.entriesListIsNotEmpty().and()
|
||||
processTasks = restClient.authenticateUser(assignee1).usingProcess(process).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat()
|
||||
.entriesListContains("assignee", assignee1.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername()).and()
|
||||
.entriesListContains("assignee", assignee2.getUsername());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify any assignee user of the process gets all tasks of the process with Rest API and response is successfull (200)")
|
||||
public void involvedUserCanGetAllProcessTasks() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
ProcessModel process = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(document)
|
||||
.createMoreReviewersWorkflowAndAssignTo(assignee1, assignee2, assignee3);
|
||||
dataWorkflow.usingUser(assignee1).approveTask(process);
|
||||
|
||||
restClient.authenticateUser(assignee2);
|
||||
processesApi.getProcessTasks(process).assertThat()
|
||||
|
||||
processTasks = restClient.authenticateUser(assignee2).usingProcess(process).getProcessTasks();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
processTasks.assertThat()
|
||||
.entriesListIsNotEmpty().assertThat()
|
||||
.entriesListContains("assignee", userModel.getUsername());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-22
@@ -4,15 +4,13 @@ import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.requests.Processes;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.rest.model.RestProcessVariableCollection;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -21,18 +19,13 @@ import org.testng.annotations.Test;
|
||||
* @author iulia.cojocea
|
||||
*/
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public class GetProcessesVariablesSanityTests extends RestWorkflowTest
|
||||
public class GetProcessVariablesSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
private Processes processesApi;
|
||||
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee;
|
||||
private RestProcessModel processModel;
|
||||
private RestProcessVariableCollection variables;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -42,26 +35,25 @@ public class GetProcessesVariablesSanityTests extends RestWorkflowTest
|
||||
siteModel = dataSite.usingUser(userWhoStartsTask).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
processesApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that user that started the process gets all process variables")
|
||||
public void getProcessVariablesUsingTheUserWhoStartedProcess() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesVariables(processModel).assertThat().entriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
processModel = restClient.authenticateUser(userWhoStartsTask).getProcesses().getOneRandomEntry().onModel();
|
||||
variables = restClient.usingProcess(processModel).getProcessVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variables.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify get all process variables call using a user that is involved in the process")
|
||||
public void getProcessVariablesUsingUserInvolvedInProcess() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.authenticateUser(assignee);
|
||||
processModel = processesApi.getProcesses().getOneRandomEntry();
|
||||
processesApi.getProcessesVariables(processModel).assertThat().entriesListIsNotEmpty();
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
processModel = restClient.authenticateUser(assignee).getProcesses().getOneRandomEntry().onModel();
|
||||
variables = restClient.usingProcess(processModel).getProcessVariables();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
variables.assertThat().entriesListIsNotEmpty();
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,10 @@ package org.alfresco.rest.workflow.processes;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestWorkflowTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.requests.Processes;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TaskModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.rest.model.RestProcessModelsCollection;
|
||||
import org.alfresco.utility.model.*;
|
||||
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;
|
||||
@@ -23,16 +16,11 @@ import org.testng.annotations.Test;
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||
public class GetProcessesSanityTests extends RestWorkflowTest
|
||||
{
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
private Processes processesApi;
|
||||
|
||||
private FileModel document;
|
||||
private SiteModel siteModel;
|
||||
private UserModel userWhoStartsTask, assignee, anotherUser;
|
||||
private TaskModel task;
|
||||
private RestProcessModelsCollection allProcesses;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -43,46 +31,41 @@ public class GetProcessesSanityTests extends RestWorkflowTest
|
||||
siteModel = dataSite.usingUser(userWhoStartsTask).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
task = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(assignee);
|
||||
processesApi.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User gets all processes started by him using REST API and status code is OK (200)")
|
||||
public void getProcessesByUserWhoStartedProcess() throws JsonToModelConversionException, Exception
|
||||
public void getProcessesByUserWhoStartedProcess() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userWhoStartsTask);
|
||||
|
||||
processesApi.getProcesses().assertThat().entriesListContains("id", task.getNodeRef());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses = restClient.authenticateUser(userWhoStartsTask).getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses.assertThat().entriesListContains("id", task.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User gets all processes assigned to him using REST API and status code is OK (200)")
|
||||
public void getProcessesByAssignedUser() throws JsonToModelConversionException, Exception
|
||||
public void getProcessesByAssignedUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(assignee);
|
||||
|
||||
processesApi.getProcesses().assertThat().entriesListContains("id", task.getNodeRef());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses = restClient.authenticateUser(assignee).getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses.assertThat().entriesListContains("id", task.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify User that is not involved in a process can not get that process using REST API and status code is OK (200)")
|
||||
public void getProcessesByAnotherUser() throws JsonToModelConversionException, Exception
|
||||
public void getProcessesByAnotherUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(anotherUser);
|
||||
|
||||
processesApi.getProcesses().assertThat().entriesListDoesNotContain("id", task.getNodeRef());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses = restClient.authenticateUser(anotherUser).getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses.assertThat().entriesListDoesNotContain("id", task.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify Admin gets all processes, even if he isn't involved in a process, using REST API and status code is OK (200)")
|
||||
public void getProcessesByAdmin() throws JsonToModelConversionException, Exception
|
||||
public void getProcessesByAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.getAdminUser());
|
||||
|
||||
processesApi.getProcesses().assertThat().entriesListContains("id", task.getNodeRef());
|
||||
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses = restClient.authenticateUser(dataUser.getAdminUser()).getProcesses();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
allProcesses.assertThat().entriesListContains("id", task.getNodeRef());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user