mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
MNT-24637 Pre-commit formatting.
This commit is contained in:
@@ -2,6 +2,11 @@ package org.alfresco.rest.favorites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
@@ -20,10 +25,6 @@ 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.hamcrest.Matchers;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetFavoritesTests extends RestTest
|
||||
{
|
||||
@@ -64,9 +65,9 @@ public class GetFavoritesTests extends RestTest
|
||||
restClient.withCoreAPI().usingUser(userModel).addSiteToFavorites(thirdSiteModel);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Manager user gets favorites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY})
|
||||
public void managerIsAbleToRetrieveFavorites()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
@@ -79,10 +80,10 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertThat().entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.SANITY,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user gets status code 401 if authentication call fails")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY })
|
||||
// @Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.SANITY})
|
||||
// @Bug(id = "MNT-16904", description = "It fails only on environment with tenants")
|
||||
public void userIsNotAbleToRetrieveFavoritesIfAuthenticationFails()
|
||||
{
|
||||
UserModel siteManager = firstSiteUsers.getOneUserWithRole(UserRole.SiteManager);
|
||||
@@ -91,9 +92,9 @@ public class GetFavoritesTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Admin user gets favorites sites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void adminIsAbleToRetrieveFavoritesSites()
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addSiteToFavorites(firstSiteModel);
|
||||
@@ -106,9 +107,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Admin user gets favorites folders with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void adminIsAbleToRetrieveFavoritesFolders()
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addFolderToFavorites(firstFolderModel);
|
||||
@@ -121,9 +122,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListContains("targetGuid", secondFolderModel.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Admin user gets favorites files with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void adminIsAbleToRetrieveFavoritesFiles()
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).addFileToFavorites(firstFileModel);
|
||||
@@ -136,9 +137,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListContains("targetGuid", secondFileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Collaborator user gets favorites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void collaboratorIsAbleToRetrieveFavorites()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
@@ -151,9 +152,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Contributor user gets favorites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void contributorIsAbleToRetrieveFavorites()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteContributor))
|
||||
@@ -166,9 +167,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Consumer user gets favorites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void consumerIsAbleToRetrieveFavorites()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
@@ -181,9 +182,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertThat().entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user doesn't have permission to get favorites of another user with Rest API and status code is 404")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsNotAbleToRetrieveFavoritesOfAnotherUser()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
@@ -192,9 +193,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user doesn't have permission to get favorites of admin user with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsNotAbleToRetrieveFavoritesOfAdminUser()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI()
|
||||
@@ -203,9 +204,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, adminUserModel.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user doesn't have permission to get favorites of another user with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void adminIsNotAbleToRetrieveFavoritesOfAnotherUser()
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
@@ -214,9 +215,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets only favorites sites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveOnlyFavoritesSites()
|
||||
{
|
||||
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
@@ -232,9 +233,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", firstFolderModel.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets only favorites files with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveOnlyFavoritesFiles()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
@@ -250,9 +251,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", firstFolderModel.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets only favorites folders with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveOnlyFavoritesFolders()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
@@ -268,9 +269,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", firstFileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets only favorites files or folders with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveFavoritesFilesOrFolders()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
@@ -289,9 +290,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", firstSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets only favorites files or sites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveFavoritesFilesOrSites()
|
||||
{
|
||||
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
@@ -310,9 +311,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", firstFolderModel.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets only favorites folders or sites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveFavoritesFoldersOrSites()
|
||||
{
|
||||
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
@@ -331,9 +332,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", firstFileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets all favorites with Rest API and status code is 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToRetrieveAllFavorites()
|
||||
{
|
||||
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
@@ -362,9 +363,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", secondFileModel.getNodeRefWithoutVersion());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request for a user with no favorites returns status 200")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userHasNoFavorites()
|
||||
{
|
||||
restClient.authenticateUser(secondSiteUsers.getOneUserWithRole(UserRole.SiteContributor));
|
||||
@@ -374,9 +375,9 @@ public class GetFavoritesTests extends RestTest
|
||||
userFavorites.assertThat().entriesListIsEmpty().and().paginationField("totalItems").is("0");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request using invalid where parameter returns status 400")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void getFavoritesUsingInvalidWhereParameter()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
@@ -390,9 +391,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User gets correct favorites after deleting a favorite")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void checkFavoriteFolderIsRemoved()
|
||||
{
|
||||
restClient.authenticateUser(firstSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
@@ -408,9 +409,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().paginationField("totalItems").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites specifying -me- string in place of <personid> for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFavoritesWhenUsingMeAsUsername()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getFavorites();
|
||||
@@ -418,9 +419,9 @@ public class GetFavoritesTests extends RestTest
|
||||
userFavorites.assertThat().entriesListContains("targetGuid", firstSiteModel.getGuid()).and().entriesListContains("targetGuid", secondSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using empty for where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFavoritesWhenUsingEmptyWhereParameter()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().where().getFavorites();
|
||||
@@ -428,27 +429,27 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that for invalid maxItems parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void checkInvalidMaxItemsStatusCode()
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withParams("maxItems=AB").withCoreAPI().usingUser(adminUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that for invalid skipCount parameter status code returned is 400.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void checkInvalidSkipCountStatusCode()
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withParams("skipCount=AB").withCoreAPI().usingUser(adminUserModel).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary("Invalid paging parameter");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites when using invalid network id for non-tenant user")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void getFavoritesWhenNetworkIdIsInvalid()
|
||||
{
|
||||
UserModel networkUserModel = dataUser.createRandomTestUser();
|
||||
@@ -457,9 +458,9 @@ public class GetFavoritesTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, networkUserModel.getUsername()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using AND instead of OR in where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsNotAbleToGetFavoritesWhenUsingANDInWhereParameter()
|
||||
{
|
||||
userFavorites = restClient.withCoreAPI().usingAuthUser().where().targetFolderExist().invalidWhereParameter("AND").targetFileExist().getFavorites();
|
||||
@@ -467,9 +468,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites using wrong name instead of EXISTS in where parameter for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsNotAbleToGetFavoritesWhenUsingWrongWhereParameter()
|
||||
{
|
||||
userFavorites = restClient.withCoreAPI().usingAuthUser().where().invalidWhereParameter("EXIST((target/site))").targetFileExist().getFavorites();
|
||||
@@ -477,9 +478,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites except the first one for request")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFavoritesExceptTheFirstOne()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(userModel).withParams("skipCount=1").withCoreAPI().usingUser(userModel).getFavorites();
|
||||
@@ -490,9 +491,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().entriesListDoesNotContain("targetGuid", thirdSiteModel.getGuid());
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get first two favorites sites")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFirstTwoFavorites()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(userModel).withParams("maxItems=2").withCoreAPI().usingUser(userModel).getFavorites();
|
||||
@@ -506,9 +507,9 @@ public class GetFavoritesTests extends RestTest
|
||||
.and().field("count").is("2");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get favorites sites when using empty values for skipCount and maxItems")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFavoritesWhenSkipCountAndMaxItemsAreEmpty()
|
||||
{
|
||||
restClient.authenticateUser(userModel).withParams("skipCount= ").withCoreAPI().usingUser(userModel).getFavorites();
|
||||
@@ -518,9 +519,9 @@ public class GetFavoritesTests extends RestTest
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, " "));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the get favorites request for a high value for skipCount parameter")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFavoritesWithHighSkipCount()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(userModel).withParams("skipCount=999999999").withCoreAPI().usingUser(userModel).getFavorites();
|
||||
@@ -529,9 +530,9 @@ public class GetFavoritesTests extends RestTest
|
||||
userFavorites.assertThat().entriesListIsEmpty().assertThat().paginationField("skipCount").is("999999999");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the get favorites request with properties parameter applied")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void userIsAbleToGetFavoritesWithPropertiesParamApplied()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(userModel).withParams("properties=targetGuid").withCoreAPI().usingUser(userModel).getFavorites();
|
||||
@@ -541,8 +542,8 @@ public class GetFavoritesTests extends RestTest
|
||||
restPersonFavoritesModel.assertThat().field("targetGuid").is(thirdSiteModel.getGuid()).and().field("createdAt").isNull();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get favorites response with Rest API")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get favorites response with Rest API")
|
||||
public void checkResponseSchemaForGetFavorites()
|
||||
{
|
||||
userFavorites = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getFavorites();
|
||||
@@ -564,8 +565,7 @@ public class GetFavoritesTests extends RestTest
|
||||
description = "Verify if get favorites response returns allowableOperations object when requested")
|
||||
public void checkResponsesForGetFavoritesWithAllowableOperations()
|
||||
{
|
||||
final RestPersonFavoritesModelsCollection adminFavorites =
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().include(ALLOWABLE_OPERATIONS).getFavorites();
|
||||
final RestPersonFavoritesModelsCollection adminFavorites = restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().include(ALLOWABLE_OPERATIONS).getFavorites();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
adminFavorites.getEntries().stream()
|
||||
@@ -576,18 +576,17 @@ public class GetFavoritesTests extends RestTest
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.FAVORITES}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify the get favorites request with properties parameter applied")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION})
|
||||
public void checkSearchResponseContainsIsFavoriteWhenRequested() throws InterruptedException {
|
||||
public void checkSearchResponseContainsIsFavoriteWhenRequested() throws InterruptedException
|
||||
{
|
||||
final SearchRequest query = new SearchRequest();
|
||||
final RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
||||
queryReq.setQuery(firstFileModel.getName());
|
||||
query.setQuery(queryReq);
|
||||
query.setInclude(List.of("isFavorite"));
|
||||
|
||||
Utility.sleep(500, 60000, () ->
|
||||
{
|
||||
Utility.sleep(500, 60000, () -> {
|
||||
restClient.authenticateUser(adminUserModel).withSearchAPI().search(query);
|
||||
restClient.onResponse().assertThat().body("list.entries.entry[0].isFavorite", Matchers.notNullValue());
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -38,6 +38,10 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.query.PagingResults;
|
||||
@@ -77,9 +81,6 @@ import org.alfresco.service.cmr.site.SiteService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Public REST API: Centralises access to favourites functionality and maps between representations repository and api representations.
|
||||
@@ -105,8 +106,7 @@ public class FavouritesImpl implements Favourites
|
||||
ContentModel.PROP_TITLE,
|
||||
ContentModel.PROP_DESCRIPTION,
|
||||
SiteModel.PROP_SITE_VISIBILITY,
|
||||
SiteModel.PROP_SITE_PRESET
|
||||
);
|
||||
SiteModel.PROP_SITE_PRESET);
|
||||
|
||||
public void setPeople(People people)
|
||||
{
|
||||
@@ -143,19 +143,19 @@ public class FavouritesImpl implements Favourites
|
||||
Target target = null;
|
||||
NodeRef nodeRef = personFavourite.getNodeRef();
|
||||
Type type = personFavourite.getType();
|
||||
if(type.equals(Type.FILE))
|
||||
if (type.equals(Type.FILE))
|
||||
{
|
||||
Document document = nodes.getDocument(nodeRef);
|
||||
setPathInfo(document, parameters.getInclude());
|
||||
target = new DocumentTarget(document);
|
||||
}
|
||||
else if(type.equals(Type.FOLDER))
|
||||
else if (type.equals(Type.FOLDER))
|
||||
{
|
||||
Folder folder = nodes.getFolder(nodeRef);
|
||||
setPathInfo(folder, parameters.getInclude());
|
||||
target = new FolderTarget(folder);
|
||||
}
|
||||
else if(type.equals(Type.SITE))
|
||||
else if (type.equals(Type.SITE))
|
||||
{
|
||||
SiteInfo siteInfo = siteService.getSite(nodeRef);
|
||||
String role = sites.getSiteRole(siteInfo.getShortName());
|
||||
@@ -187,7 +187,7 @@ public class FavouritesImpl implements Favourites
|
||||
Node node = nodes.getFolderOrDocument(personFavourite.getNodeRef(), null, null, includes, null);
|
||||
// Create a map from node properties excluding properties already in this Favorite
|
||||
Map<String, Object> filteredNodeProperties = filterProps(node.getProperties(), EXCLUDED_PROPS);
|
||||
if(filteredNodeProperties.size() > 0 && paramsInclude.contains(PARAM_INCLUDE_PROPERTIES))
|
||||
if (filteredNodeProperties.size() > 0 && paramsInclude.contains(PARAM_INCLUDE_PROPERTIES))
|
||||
{
|
||||
fav.setProperties(filteredNodeProperties);
|
||||
}
|
||||
@@ -212,8 +212,7 @@ public class FavouritesImpl implements Favourites
|
||||
private CollectionWithPagingInfo<Favourite> wrap(Paging paging, PagingResults<PersonFavourite> personFavourites, Parameters parameters)
|
||||
{
|
||||
final List<PersonFavourite> page = personFavourites.getPage();
|
||||
final List<Favourite> list = new AbstractList<Favourite>()
|
||||
{
|
||||
final List<Favourite> list = new AbstractList<Favourite>() {
|
||||
@Override
|
||||
public Favourite get(int index)
|
||||
{
|
||||
@@ -230,7 +229,7 @@ public class FavouritesImpl implements Favourites
|
||||
};
|
||||
Pair<Integer, Integer> pair = personFavourites.getTotalResultCount();
|
||||
Integer total = null;
|
||||
if(pair.getFirst().equals(pair.getSecond()))
|
||||
if (pair.getFirst().equals(pair.getSecond()))
|
||||
{
|
||||
total = pair.getFirst();
|
||||
}
|
||||
@@ -251,13 +250,13 @@ public class FavouritesImpl implements Favourites
|
||||
|
||||
personId = people.validatePerson(personId, true);
|
||||
Target target = favourite.getTarget();
|
||||
if(target == null)
|
||||
if (target == null)
|
||||
{
|
||||
throw new InvalidArgumentException("target is missing");
|
||||
}
|
||||
else if(target instanceof SiteTarget)
|
||||
else if (target instanceof SiteTarget)
|
||||
{
|
||||
SiteTarget siteTarget = (SiteTarget)target;
|
||||
SiteTarget siteTarget = (SiteTarget) target;
|
||||
String guid = siteTarget.getSite().getGuid();
|
||||
SiteInfo siteInfo = sites.validateSite(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, guid));
|
||||
NodeRef siteNodeRef = siteInfo.getNodeRef();
|
||||
@@ -268,16 +267,16 @@ public class FavouritesImpl implements Favourites
|
||||
PersonFavourite personFavourite = favouritesService.addFavourite(personId, siteNodeRef);
|
||||
ret = getFavourite(personFavourite, parameters);
|
||||
}
|
||||
catch(SiteDoesNotExistException e)
|
||||
catch (SiteDoesNotExistException e)
|
||||
{
|
||||
throw new RelationshipResourceNotFoundException(personId, siteId);
|
||||
}
|
||||
}
|
||||
else if(target instanceof DocumentTarget)
|
||||
else if (target instanceof DocumentTarget)
|
||||
{
|
||||
DocumentTarget documentTarget = (DocumentTarget)target;
|
||||
DocumentTarget documentTarget = (DocumentTarget) target;
|
||||
NodeRef nodeRef = documentTarget.getFile().getGuid();
|
||||
if(!nodes.nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null))
|
||||
if (!nodes.nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null))
|
||||
{
|
||||
throw new RelationshipResourceNotFoundException(personId, nodeRef.getId());
|
||||
}
|
||||
@@ -285,11 +284,11 @@ public class FavouritesImpl implements Favourites
|
||||
PersonFavourite personFavourite = favouritesService.addFavourite(personId, nodeRef);
|
||||
ret = getFavourite(personFavourite, parameters);
|
||||
}
|
||||
else if(target instanceof FolderTarget)
|
||||
else if (target instanceof FolderTarget)
|
||||
{
|
||||
FolderTarget folderTarget = (FolderTarget)target;
|
||||
FolderTarget folderTarget = (FolderTarget) target;
|
||||
NodeRef nodeRef = folderTarget.getFolder().getGuid();
|
||||
if(!nodes.nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_FOLDER), Collections.singleton(SiteModel.TYPE_SITE)))
|
||||
if (!nodes.nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_FOLDER), Collections.singleton(SiteModel.TYPE_SITE)))
|
||||
{
|
||||
throw new RelationshipResourceNotFoundException(personId, nodeRef.getId());
|
||||
}
|
||||
@@ -309,25 +308,25 @@ public class FavouritesImpl implements Favourites
|
||||
boolean exists = false;
|
||||
|
||||
Type type = favouritesService.getType(nodeRef);
|
||||
if(type.equals(Type.SITE))
|
||||
if (type.equals(Type.SITE))
|
||||
{
|
||||
SiteInfo siteInfo = siteService.getSite(nodeRef);
|
||||
if(siteInfo == null)
|
||||
if (siteInfo == null)
|
||||
{
|
||||
// shouldn't happen because the type implies it's a site
|
||||
throw new AlfrescoRuntimeException("Unable to find site with nodeRef " + nodeRef);
|
||||
}
|
||||
exists = favouritesService.removeFavourite(personId, siteInfo.getNodeRef());
|
||||
}
|
||||
else if(type.equals(Type.FILE))
|
||||
else if (type.equals(Type.FILE))
|
||||
{
|
||||
exists = favouritesService.removeFavourite(personId, nodeRef);
|
||||
}
|
||||
else if(type.equals(Type.FOLDER))
|
||||
else if (type.equals(Type.FOLDER))
|
||||
{
|
||||
exists = favouritesService.removeFavourite(personId, nodeRef);
|
||||
}
|
||||
if(!exists)
|
||||
if (!exists)
|
||||
{
|
||||
throw new RelationshipResourceNotFoundException(personId, id);
|
||||
}
|
||||
@@ -347,7 +346,7 @@ public class FavouritesImpl implements Favourites
|
||||
personId = people.validatePerson(personId, true);
|
||||
|
||||
PersonFavourite personFavourite = favouritesService.getFavourite(personId, nodeRef);
|
||||
if(personFavourite != null)
|
||||
if (personFavourite != null)
|
||||
{
|
||||
Favourite favourite = getFavourite(personFavourite, parameters);
|
||||
return favourite;
|
||||
@@ -368,24 +367,25 @@ public class FavouritesImpl implements Favourites
|
||||
List<Pair<FavouritesService.SortFields, Boolean>> sortProps = getSortProps(parameters);
|
||||
|
||||
final Set<Type> filteredByClientQuery = new HashSet<Type>();
|
||||
Set<Type> filterTypes = FavouritesService.Type.ALL_FILTER_TYPES; //Default all
|
||||
Set<Type> filterTypes = FavouritesService.Type.ALL_FILTER_TYPES; // Default all
|
||||
|
||||
// filterType is of the form 'target.<site|file|folder>'
|
||||
QueryHelper.walk(parameters.getQuery(), new WalkerCallbackAdapter()
|
||||
{
|
||||
QueryHelper.walk(parameters.getQuery(), new WalkerCallbackAdapter() {
|
||||
@Override
|
||||
public void or() {
|
||||
//OR is supported but exists() will be called for each EXISTS so we don't
|
||||
//need to do anything here. If we don't override it then it will be assumed
|
||||
//that OR in the grammar is not supported.
|
||||
public void or()
|
||||
{
|
||||
// OR is supported but exists() will be called for each EXISTS so we don't
|
||||
// need to do anything here. If we don't override it then it will be assumed
|
||||
// that OR in the grammar is not supported.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exists(String filteredByClient, boolean negated) {
|
||||
if(filteredByClient != null)
|
||||
public void exists(String filteredByClient, boolean negated)
|
||||
{
|
||||
if (filteredByClient != null)
|
||||
{
|
||||
int idx = filteredByClient.lastIndexOf("/");
|
||||
if(idx == -1 || idx == filteredByClient.length())
|
||||
if (idx == -1 || idx == filteredByClient.length())
|
||||
{
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
@@ -419,8 +419,7 @@ public class FavouritesImpl implements Favourites
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code {@link Parameters} object where almost all of its values are null.
|
||||
* the non-null value is the {@literal include} and whatever value is passed for {@code personId} and {@code favouriteId}
|
||||
* Returns a {@code {@link Parameters} object where almost all of its values are null. the non-null value is the {@literal include} and whatever value is passed for {@code personId} and {@code favouriteId}
|
||||
*/
|
||||
private Parameters getDefaultParameters(String personId, String favouriteId)
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ public class Favourite
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
@UniqueId(name="targetGuid")
|
||||
@UniqueId(name = "targetGuid")
|
||||
public String getTargetGuid()
|
||||
{
|
||||
return targetGuid;
|
||||
@@ -86,11 +86,13 @@ public class Favourite
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public List<String> getAllowableOperations() {
|
||||
public List<String> getAllowableOperations()
|
||||
{
|
||||
return allowableOperations;
|
||||
}
|
||||
|
||||
public void setAllowableOperations(List<String> allowableOperations) {
|
||||
public void setAllowableOperations(List<String> allowableOperations)
|
||||
{
|
||||
this.allowableOperations = allowableOperations;
|
||||
}
|
||||
|
||||
|
@@ -25,13 +25,14 @@
|
||||
*/
|
||||
package org.alfresco;
|
||||
|
||||
import org.alfresco.repo.web.scripts.TestWebScriptRepoServer;
|
||||
import org.alfresco.util.testing.category.DBTests;
|
||||
import org.alfresco.util.testing.category.NonBuildTests;
|
||||
import org.junit.experimental.categories.Categories;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
import org.alfresco.repo.web.scripts.TestWebScriptRepoServer;
|
||||
import org.alfresco.util.testing.category.DBTests;
|
||||
import org.alfresco.util.testing.category.NonBuildTests;
|
||||
|
||||
@RunWith(Categories.class)
|
||||
@Categories.ExcludeCategory({DBTests.class, NonBuildTests.class})
|
||||
@Suite.SuiteClasses({
|
||||
|
Reference in New Issue
Block a user