MNT-24637 Pre-commit formatting.

This commit is contained in:
Tom Page
2024-10-04 15:21:53 +01:00
parent 60a31112ea
commit 7668849a59
5 changed files with 752 additions and 751 deletions

View File

@@ -2,6 +2,11 @@ package org.alfresco.rest.favorites;
import java.util.List; 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.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.RestTest; import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel; 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.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; 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 public class GetFavoritesTests extends RestTest
{ {
@@ -564,8 +565,7 @@ public class GetFavoritesTests extends RestTest
description = "Verify if get favorites response returns allowableOperations object when requested") description = "Verify if get favorites response returns allowableOperations object when requested")
public void checkResponsesForGetFavoritesWithAllowableOperations() public void checkResponsesForGetFavoritesWithAllowableOperations()
{ {
final RestPersonFavoritesModelsCollection adminFavorites = final RestPersonFavoritesModelsCollection adminFavorites = restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().include(ALLOWABLE_OPERATIONS).getFavorites();
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().include(ALLOWABLE_OPERATIONS).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
adminFavorites.getEntries().stream() adminFavorites.getEntries().stream()
@@ -576,18 +576,17 @@ public class GetFavoritesTests extends RestTest
@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") 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 checkSearchResponseContainsIsFavoriteWhenRequested() throws InterruptedException { public void checkSearchResponseContainsIsFavoriteWhenRequested() throws InterruptedException
{
final SearchRequest query = new SearchRequest(); final SearchRequest query = new SearchRequest();
final RestRequestQueryModel queryReq = new RestRequestQueryModel(); final RestRequestQueryModel queryReq = new RestRequestQueryModel();
queryReq.setQuery(firstFileModel.getName()); queryReq.setQuery(firstFileModel.getName());
query.setQuery(queryReq); query.setQuery(queryReq);
query.setInclude(List.of("isFavorite")); query.setInclude(List.of("isFavorite"));
Utility.sleep(500, 60000, () -> Utility.sleep(500, 60000, () -> {
{
restClient.authenticateUser(adminUserModel).withSearchAPI().search(query); restClient.authenticateUser(adminUserModel).withSearchAPI().search(query);
restClient.onResponse().assertThat().body("list.entries.entry[0].isFavorite", Matchers.notNullValue()); restClient.onResponse().assertThat().body("list.entries.entry[0].isFavorite", Matchers.notNullValue());
} });
);
} }
} }

View File

@@ -38,6 +38,10 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; 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.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingResults; 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.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair; 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. * 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_TITLE,
ContentModel.PROP_DESCRIPTION, ContentModel.PROP_DESCRIPTION,
SiteModel.PROP_SITE_VISIBILITY, SiteModel.PROP_SITE_VISIBILITY,
SiteModel.PROP_SITE_PRESET SiteModel.PROP_SITE_PRESET);
);
public void setPeople(People people) public void setPeople(People people)
{ {
@@ -212,8 +212,7 @@ public class FavouritesImpl implements Favourites
private CollectionWithPagingInfo<Favourite> wrap(Paging paging, PagingResults<PersonFavourite> personFavourites, Parameters parameters) private CollectionWithPagingInfo<Favourite> wrap(Paging paging, PagingResults<PersonFavourite> personFavourites, Parameters parameters)
{ {
final List<PersonFavourite> page = personFavourites.getPage(); final List<PersonFavourite> page = personFavourites.getPage();
final List<Favourite> list = new AbstractList<Favourite>() final List<Favourite> list = new AbstractList<Favourite>() {
{
@Override @Override
public Favourite get(int index) public Favourite get(int index)
{ {
@@ -371,17 +370,18 @@ public class FavouritesImpl implements Favourites
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>' // filterType is of the form 'target.<site|file|folder>'
QueryHelper.walk(parameters.getQuery(), new WalkerCallbackAdapter() QueryHelper.walk(parameters.getQuery(), new WalkerCallbackAdapter() {
{
@Override @Override
public void or() { public void or()
{
// OR is supported but exists() will be called for each EXISTS so we don't // 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 // need to do anything here. If we don't override it then it will be assumed
// that OR in the grammar is not supported. // that OR in the grammar is not supported.
} }
@Override @Override
public void exists(String filteredByClient, boolean negated) { public void exists(String filteredByClient, boolean negated)
{
if (filteredByClient != null) if (filteredByClient != null)
{ {
int idx = filteredByClient.lastIndexOf("/"); int idx = filteredByClient.lastIndexOf("/");
@@ -419,8 +419,7 @@ public class FavouritesImpl implements Favourites
} }
/** /**
* Returns a {@code {@link Parameters} object where almost all of its values are null. * 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}
* 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) private Parameters getDefaultParameters(String personId, String favouriteId)
{ {

View File

@@ -86,11 +86,13 @@ public class Favourite
this.properties = properties; this.properties = properties;
} }
public List<String> getAllowableOperations() { public List<String> getAllowableOperations()
{
return allowableOperations; return allowableOperations;
} }
public void setAllowableOperations(List<String> allowableOperations) { public void setAllowableOperations(List<String> allowableOperations)
{
this.allowableOperations = allowableOperations; this.allowableOperations = allowableOperations;
} }

View File

@@ -25,13 +25,14 @@
*/ */
package org.alfresco; 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.experimental.categories.Categories;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Suite; 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) @RunWith(Categories.class)
@Categories.ExcludeCategory({DBTests.class, NonBuildTests.class}) @Categories.ExcludeCategory({DBTests.class, NonBuildTests.class})
@Suite.SuiteClasses({ @Suite.SuiteClasses({