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 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
{
@@ -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());
}
);
});
}
}

View File

@@ -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)
{
@@ -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)
{
@@ -371,17 +370,18 @@ public class FavouritesImpl implements Favourites
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() {
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) {
public void exists(String filteredByClient, boolean negated)
{
if (filteredByClient != null)
{
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.
* 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)
{

View File

@@ -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;
}

View File

@@ -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({