From 5e85b8149b13304a4857229966efe2782f8d4fe3 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Thu, 8 Feb 2024 11:12:30 +0100 Subject: [PATCH] ACS-5506 Cleanup and test fixes --- .../alfresco/rest/api/impl/GroupsImpl.java | 6 ------ .../alfresco/rest/api/tests/GroupsTest.java | 20 ++++--------------- .../rest/api/tests/client/data/Group.java | 4 ---- .../authority/AuthorityServiceImpl.java | 5 ----- 4 files changed, 4 insertions(+), 31 deletions(-) diff --git a/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java b/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java index 17e43c26e3..d291b1293b 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java @@ -78,8 +78,6 @@ import org.alfresco.util.AlfrescoCollator; import org.alfresco.util.Pair; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.extensions.surf.util.I18NUtil; /** @@ -96,8 +94,6 @@ public class GroupsImpl implements Groups private static final String AUTHORITY_NAME = "authorityName"; private static final String ERR_MSG_MODIFY_FIXED_AUTHORITY = "Trying to modify a fixed authority"; - protected static final Logger logger = LoggerFactory.getLogger(GroupsImpl.class); - private final static Map SORT_PARAMS_TO_NAMES; static { @@ -140,7 +136,6 @@ public class GroupsImpl implements Groups public Group create(Group group, Parameters parameters) { - logger.info("Create from impl called"); validateGroup(group, false); // Create authority with default zones. @@ -156,7 +151,6 @@ public class GroupsImpl implements Groups { props.put(ContentModel.PROP_DESCRIPTION, group.getDescription()); } - logger.info("Before authority created"); String authority = authorityService.createAuthority(AuthorityType.GROUP, group.getId(), authorityDisplayName, authorityZones, props); // Set a given child authority to be included by the given parent diff --git a/remote-api/src/test/java/org/alfresco/rest/api/tests/GroupsTest.java b/remote-api/src/test/java/org/alfresco/rest/api/tests/GroupsTest.java index 68a02484cd..1b09ca88c3 100644 --- a/remote-api/src/test/java/org/alfresco/rest/api/tests/GroupsTest.java +++ b/remote-api/src/test/java/org/alfresco/rest/api/tests/GroupsTest.java @@ -49,8 +49,6 @@ import org.junit.Test; import org.mockito.Mock; import jakarta.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.*; @@ -71,9 +69,6 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest private static final String MEMBER_TYPE_GROUP = "GROUP"; private static final String MEMBER_TYPE_PERSON = "PERSON"; private static final String GROUP_EVERYONE = "GROUP_EVERYONE"; - private static final String INCLUDE_DESCRIPTION_HAS_SUBGROUPS = "description,hasSubgroups"; - - protected static final Logger logger = LoggerFactory.getLogger(GroupsTest.class); protected AuthorityService authorityService; @@ -1426,17 +1421,14 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD); Map otherParams = new HashMap<>(); - otherParams.put("include", INCLUDE_DESCRIPTION_HAS_SUBGROUPS); + otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_HAS_SUBGROUPS); Group group = generateGroup(); - group.setDescription("testDesc"); - logger.info("" + otherParams); Group createdGroup01 = groupsProxy.createGroup(group, otherParams, HttpServletResponse.SC_CREATED); assertNotNull(createdGroup01); assertNotNull(createdGroup01.getId()); - assertEquals(createdGroup01.getDescription(), "testDesc"); assertTrue(createdGroup01.getIsRoot()); assertNull(createdGroup01.getParentIds()); assertFalse(createdGroup01.getHasSubgroups()); @@ -1447,7 +1439,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest Group subGroup01 = generateGroup(); subGroup01.setParentIds(subGroup01Parents); - otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_PARENT_IDS + "," + INCLUDE_DESCRIPTION_HAS_SUBGROUPS); + otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_PARENT_IDS + "," + org.alfresco.rest.api.Groups.PARAM_INCLUDE_HAS_SUBGROUPS); Group createdSubGroup01 = groupsProxy.createGroup(subGroup01, otherParams, HttpServletResponse.SC_CREATED); assertNotNull(createdSubGroup01); assertNotNull(createdSubGroup01.getId()); @@ -1631,7 +1623,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest final Groups groupsProxy = publicApiClient.groups(); Map otherParams = new HashMap<>(); - otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_PARENT_IDS + "," + org.alfresco.rest.api.Groups.PARAM_INCLUDE_DESCRIPTION); + otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_PARENT_IDS); setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD); @@ -1641,7 +1633,6 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest subGroupParents.add(group.getId()); Group generatedSubGroup = generateGroup(); - generatedSubGroup.setDescription("initialDesc"); generatedSubGroup.setParentIds(subGroupParents); Group subGroup = groupsProxy.createGroup(generatedSubGroup, otherParams, HttpServletResponse.SC_CREATED); @@ -1664,11 +1655,9 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest String displayName = "newDisplayName"; - String description = "newDesc"; Group mySubGroup = new Group(); mySubGroup.setDisplayName(displayName); - mySubGroup.setDescription(description); Group updateGroup = groupsProxy.updateGroup(subGroup.getId(), mySubGroup, otherParams, HttpServletResponse.SC_OK); @@ -1678,9 +1667,8 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest assertFalse(updateGroup.getIsRoot()); assertNotNull(updateGroup.getParentIds()); - // Check that only display name and description changed. + // Check that only display name changed. assertEquals(displayName, updateGroup.getDisplayName()); - assertEquals(description, updateGroup.getDescription()); // Check that nothing else changed. assertEquals(subGroup.getId(), updateGroup.getId()); diff --git a/remote-api/src/test/java/org/alfresco/rest/api/tests/client/data/Group.java b/remote-api/src/test/java/org/alfresco/rest/api/tests/client/data/Group.java index 03a70f20a6..ec530ca244 100644 --- a/remote-api/src/test/java/org/alfresco/rest/api/tests/client/data/Group.java +++ b/remote-api/src/test/java/org/alfresco/rest/api/tests/client/data/Group.java @@ -37,8 +37,6 @@ import org.alfresco.rest.api.tests.client.PublicApiClient.ExpectedPaging; import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse; import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Represents a group. @@ -50,7 +48,6 @@ public class Group extends org.alfresco.rest.api.model.Group implements Serializ { private static final long serialVersionUID = -3580248429177260831L; - protected static final Logger logger = LoggerFactory.getLogger(Group.class); @Override public void expected(Object o) @@ -115,7 +112,6 @@ public class Group extends org.alfresco.rest.api.model.Group implements Serializ Boolean hasSubgroups = (Boolean) jsonObject.get("hasSubgroups"); List parentIds = (List) jsonObject.get("parentIds"); List zones = (List) jsonObject.get("zones"); - logger.info("Parse group: " + description + " " + displayName); Group group = new Group(); group.setId(id); group.setDisplayName(displayName); diff --git a/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityServiceImpl.java b/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityServiceImpl.java index 343c5cb54d..13aa81f947 100644 --- a/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityServiceImpl.java +++ b/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityServiceImpl.java @@ -57,8 +57,6 @@ import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.namespace.QName; import org.alfresco.util.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.extensions.surf.util.ParameterCheck; @@ -70,8 +68,6 @@ import org.springframework.extensions.surf.util.ParameterCheck; public class AuthorityServiceImpl implements AuthorityService, InitializingBean { public static final String GROUP_ALFRESCO_SYSTEM_ADMINISTRATORS_AUTHORITY = PermissionService.GROUP_PREFIX + "ALFRESCO_SYSTEM_ADMINISTRATORS"; - protected static final Logger logger = LoggerFactory.getLogger(AuthorityServiceImpl.class); - private static Set DEFAULT_ZONES = new HashSet(); static @@ -671,7 +667,6 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean { checkTypeIsMutable(type); String name = getName(type, shortName); - logger.info("Before authority DAO created"); authorityDAO.createAuthority(name, authorityDisplayName, authorityZones, properties); return name;