mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
- set utility to 1.0.16-SNAPSHOT
- update site visibility (from dataprep) and user role in test
This commit is contained in:
@@ -2,6 +2,7 @@ package org.alfresco.rest;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.model.RestActivityModelsCollection;
|
||||
import org.alfresco.rest.model.RestCommentModel;
|
||||
import org.alfresco.rest.model.RestCommentModelsCollection;
|
||||
@@ -23,7 +24,6 @@ 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.springframework.social.alfresco.api.entities.Site;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -540,7 +540,7 @@ public class FunctionalCasesTests extends RestTest
|
||||
.assertThat().entriesListContains("target.site.visibility", favoriteSite.getVisibility().name())
|
||||
.assertThat().entriesListContains("target.site.id", favoriteSite.getId());
|
||||
|
||||
dataSite.usingUser(manager).updateSiteVisibility(favoriteSite, Site.Visibility.MODERATED);
|
||||
dataSite.usingUser(manager).updateSiteVisibility(favoriteSite, Visibility.MODERATED);
|
||||
|
||||
userFavoriteSites = restClient.authenticateUser(regularUser).withCoreAPI().usingAuthUser().where().targetSiteExist().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
@@ -548,13 +548,13 @@ public class FunctionalCasesTests extends RestTest
|
||||
.assertThat().entriesListContains("target.site.visibility", "MODERATED")
|
||||
.assertThat().entriesListContains("target.site.id", favoriteSite.getId());
|
||||
|
||||
dataSite.usingUser(manager).updateSiteVisibility(favoriteSite, Site.Visibility.PRIVATE);
|
||||
dataSite.usingUser(manager).updateSiteVisibility(favoriteSite, Visibility.PRIVATE);
|
||||
|
||||
userFavoriteSites = restClient.authenticateUser(regularUser).withCoreAPI().usingAuthUser().where().targetSiteExist().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
userFavoriteSites.assertThat().entriesListIsEmpty();
|
||||
|
||||
dataSite.usingUser(manager).updateSiteVisibility(favoriteSite, Site.Visibility.PUBLIC);
|
||||
dataSite.usingUser(manager).updateSiteVisibility(favoriteSite, Visibility.PUBLIC);
|
||||
|
||||
userFavoriteSites = restClient.authenticateUser(regularUser).withCoreAPI().usingAuthUser().where().targetSiteExist().getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.demo;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
@@ -10,14 +11,11 @@ import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.social.alfresco.api.entities.Role;
|
||||
import org.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class RestDemoTests extends RestTest
|
||||
{
|
||||
{
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@@ -26,7 +24,7 @@ public class RestDemoTests extends RestTest
|
||||
{
|
||||
userModel = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.authenticateUser(userModel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,8 +45,8 @@ public class RestDemoTests extends RestTest
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSite()
|
||||
.assertThat().field("id").isNotNull()
|
||||
.assertThat().field("description").is(siteModel.getDescription())
|
||||
.assertThat().field("title").is(siteModel.getTitle())
|
||||
.assertThat().field("visibility").is(Visibility.PUBLIC);
|
||||
.assertThat().field("title").is(siteModel.getTitle())
|
||||
.assertThat().field("visibility").is(Visibility.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +60,7 @@ public class RestDemoTests extends RestTest
|
||||
public void adminCanPostAndUpdateComments() throws Exception
|
||||
{
|
||||
FileModel fileModel = dataContent.usingUser(userModel)
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.createContent(DocumentType.TEXT_PLAIN);
|
||||
// add new comment
|
||||
restClient.withCoreAPI().usingResource(fileModel).addComment("This is a new comment");
|
||||
@@ -87,10 +85,10 @@ public class RestDemoTests extends RestTest
|
||||
testUser.setUserRole(UserRole.SiteConsumer);
|
||||
|
||||
// add user as Consumer to site
|
||||
restClient.withCoreAPI().usingSite(siteModel).addPerson(testUser);
|
||||
restClient.withCoreAPI().usingSite(siteModel).addPerson(testUser);
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListContains("id", testUser.getUsername())
|
||||
.when().getSiteMember(testUser.getUsername())
|
||||
.assertSiteMemberHasRole(Role.SiteConsumer);
|
||||
.assertSiteMemberHasRole(UserRole.SiteConsumer);
|
||||
|
||||
// update site member to Manager
|
||||
testUser.setUserRole(UserRole.SiteCollaborator);
|
||||
@@ -98,7 +96,7 @@ public class RestDemoTests extends RestTest
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSiteMembers().and()
|
||||
.entriesListContains("id", testUser.getUsername())
|
||||
.when().getSiteMember(testUser.getUsername())
|
||||
.assertSiteMemberHasRole(Role.SiteCollaborator);
|
||||
.assertSiteMemberHasRole(UserRole.SiteCollaborator);
|
||||
|
||||
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -16,11 +17,11 @@ 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.springframework.social.alfresco.api.entities.Site;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetFavoriteFullTests extends RestTest {
|
||||
public class GetFavoriteFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel siteModel;
|
||||
private FolderModel folderModel;
|
||||
@@ -172,7 +173,7 @@ public class GetFavoriteFullTests extends RestTest {
|
||||
|
||||
favoriteSite.assertThat().field("targetGuid").is(siteModel.getGuid())
|
||||
.and().field("target.site.role").is(UserRole.SiteContributor.toString())
|
||||
.and().field("target.site.visibility").is(Site.Visibility.PUBLIC.toString())
|
||||
.and().field("target.site.visibility").is(Visibility.PUBLIC.toString())
|
||||
.and().field("target.site.guid").is(siteModel.getGuid())
|
||||
.and().field("target.site.description").is(siteModel.getDescription())
|
||||
.and().field("target.site.id").is(siteModel.getId())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -17,7 +18,6 @@ import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ 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.springframework.social.alfresco.api.entities.Role;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -189,7 +188,7 @@ public class DeleteSiteMemberFullTests extends RestTest
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers().assertThat().entriesListContains("id", usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator).getUsername())
|
||||
.when().getSiteMember(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator).getUsername())
|
||||
.assertSiteMemberHasRole(Role.SiteCollaborator);
|
||||
.assertSiteMemberHasRole(UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.alfresco.rest.search;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.builder.NodesBuilder;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.model.ContentModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
|
||||
@@ -4,6 +4,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
@@ -21,7 +22,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
public class GetSiteFullTests extends RestTest
|
||||
@@ -35,7 +35,7 @@ public class GetSiteFullTests extends RestTest
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
restClient.authenticateUser(adminUserModel);
|
||||
publicSite = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class GetSiteFullTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, newSite.getId()))
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.FULL } )
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
@@ -14,7 +15,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.alfresco.rest.sites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteContainerModelsCollection;
|
||||
@@ -17,7 +18,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
||||
@@ -10,7 +10,6 @@ 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.springframework.social.alfresco.api.entities.Role;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -134,7 +133,7 @@ public class GetSiteMembersFullTests extends RestTest
|
||||
siteMembers = restClient.authenticateUser(userModel).withCoreAPI()
|
||||
.usingSite(moderatedSite2).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListContains("role", Role.SiteManager.toString())
|
||||
siteMembers.assertThat().entriesListContains("role", UserRole.SiteManager.toString())
|
||||
.and().entriesListContains("id", userModel.getUsername())
|
||||
.and().entriesListDoesNotContain("id", userNotJoined.getUsername());
|
||||
}
|
||||
@@ -155,7 +154,7 @@ public class GetSiteMembersFullTests extends RestTest
|
||||
.usingSite(moderatedSite2).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(1)
|
||||
.and().entriesListContains("role", Role.SiteManager.toString())
|
||||
.and().entriesListContains("role", UserRole.SiteManager.toString())
|
||||
.and().entriesListContains("id", userModel.getUsername());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,6 @@
|
||||
package org.alfresco.rest.sites.membershipRequests;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -16,7 +17,6 @@ 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.springframework.social.alfresco.api.entities.Site;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -304,7 +304,7 @@ public class AddSiteMembershipRequestFullTests extends RestTest
|
||||
siteMembershipRequest.assertThat().field("id").is(moderatedThenPrivateSite.getId())
|
||||
.assertThat().field("site").isNotEmpty();
|
||||
|
||||
dataSite.usingUser(adminUser).updateSiteVisibility(moderatedThenPrivateSite, Site.Visibility.PRIVATE);
|
||||
dataSite.usingUser(adminUser).updateSiteVisibility(moderatedThenPrivateSite, Visibility.PRIVATE);
|
||||
|
||||
siteMembershipRequests = restClient.withCoreAPI().usingAuthUser().getSiteMembershipRequests();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
+1
-1
@@ -1,5 +1,6 @@
|
||||
package org.alfresco.rest.sites.membershipRequests;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -14,7 +15,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,6 @@
|
||||
package org.alfresco.rest.sites.membershipRequests;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -14,7 +15,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,6 @@
|
||||
package org.alfresco.rest.sites.membershipRequests;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -13,7 +14,6 @@ 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.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user