ACS-5506 Cleanup and test fixes

This commit is contained in:
MichalKinas
2024-02-08 11:12:30 +01:00
parent 11030f52fa
commit 5e85b8149b
4 changed files with 4 additions and 31 deletions

View File

@@ -78,8 +78,6 @@ import org.alfresco.util.AlfrescoCollator;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.extensions.surf.util.I18NUtil; 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 AUTHORITY_NAME = "authorityName";
private static final String ERR_MSG_MODIFY_FIXED_AUTHORITY = "Trying to modify a fixed authority"; 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<String, String> SORT_PARAMS_TO_NAMES; private final static Map<String, String> SORT_PARAMS_TO_NAMES;
static static
{ {
@@ -140,7 +136,6 @@ public class GroupsImpl implements Groups
public Group create(Group group, Parameters parameters) public Group create(Group group, Parameters parameters)
{ {
logger.info("Create from impl called");
validateGroup(group, false); validateGroup(group, false);
// Create authority with default zones. // Create authority with default zones.
@@ -156,7 +151,6 @@ public class GroupsImpl implements Groups
{ {
props.put(ContentModel.PROP_DESCRIPTION, group.getDescription()); props.put(ContentModel.PROP_DESCRIPTION, group.getDescription());
} }
logger.info("Before authority created");
String authority = authorityService.createAuthority(AuthorityType.GROUP, group.getId(), authorityDisplayName, authorityZones, props); String authority = authorityService.createAuthority(AuthorityType.GROUP, group.getId(), authorityDisplayName, authorityZones, props);
// Set a given child authority to be included by the given parent // Set a given child authority to be included by the given parent

View File

@@ -49,8 +49,6 @@ import org.junit.Test;
import org.mockito.Mock; import org.mockito.Mock;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; 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_GROUP = "GROUP";
private static final String MEMBER_TYPE_PERSON = "PERSON"; private static final String MEMBER_TYPE_PERSON = "PERSON";
private static final String GROUP_EVERYONE = "GROUP_EVERYONE"; 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; protected AuthorityService authorityService;
@@ -1426,17 +1421,14 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD); setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
Map<String, String> otherParams = new HashMap<>(); Map<String, String> 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 group = generateGroup();
group.setDescription("testDesc");
logger.info("" + otherParams);
Group createdGroup01 = groupsProxy.createGroup(group, otherParams, HttpServletResponse.SC_CREATED); Group createdGroup01 = groupsProxy.createGroup(group, otherParams, HttpServletResponse.SC_CREATED);
assertNotNull(createdGroup01); assertNotNull(createdGroup01);
assertNotNull(createdGroup01.getId()); assertNotNull(createdGroup01.getId());
assertEquals(createdGroup01.getDescription(), "testDesc");
assertTrue(createdGroup01.getIsRoot()); assertTrue(createdGroup01.getIsRoot());
assertNull(createdGroup01.getParentIds()); assertNull(createdGroup01.getParentIds());
assertFalse(createdGroup01.getHasSubgroups()); assertFalse(createdGroup01.getHasSubgroups());
@@ -1447,7 +1439,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
Group subGroup01 = generateGroup(); Group subGroup01 = generateGroup();
subGroup01.setParentIds(subGroup01Parents); 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); Group createdSubGroup01 = groupsProxy.createGroup(subGroup01, otherParams, HttpServletResponse.SC_CREATED);
assertNotNull(createdSubGroup01); assertNotNull(createdSubGroup01);
assertNotNull(createdSubGroup01.getId()); assertNotNull(createdSubGroup01.getId());
@@ -1631,7 +1623,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
final Groups groupsProxy = publicApiClient.groups(); final Groups groupsProxy = publicApiClient.groups();
Map<String, String> otherParams = new HashMap<>(); Map<String, String> 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); setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
@@ -1641,7 +1633,6 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
subGroupParents.add(group.getId()); subGroupParents.add(group.getId());
Group generatedSubGroup = generateGroup(); Group generatedSubGroup = generateGroup();
generatedSubGroup.setDescription("initialDesc");
generatedSubGroup.setParentIds(subGroupParents); generatedSubGroup.setParentIds(subGroupParents);
Group subGroup = groupsProxy.createGroup(generatedSubGroup, otherParams, HttpServletResponse.SC_CREATED); Group subGroup = groupsProxy.createGroup(generatedSubGroup, otherParams, HttpServletResponse.SC_CREATED);
@@ -1664,11 +1655,9 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
String displayName = "newDisplayName"; String displayName = "newDisplayName";
String description = "newDesc";
Group mySubGroup = new Group(); Group mySubGroup = new Group();
mySubGroup.setDisplayName(displayName); mySubGroup.setDisplayName(displayName);
mySubGroup.setDescription(description);
Group updateGroup = groupsProxy.updateGroup(subGroup.getId(), mySubGroup, otherParams, HttpServletResponse.SC_OK); Group updateGroup = groupsProxy.updateGroup(subGroup.getId(), mySubGroup, otherParams, HttpServletResponse.SC_OK);
@@ -1678,9 +1667,8 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
assertFalse(updateGroup.getIsRoot()); assertFalse(updateGroup.getIsRoot());
assertNotNull(updateGroup.getParentIds()); assertNotNull(updateGroup.getParentIds());
// Check that only display name and description changed. // Check that only display name changed.
assertEquals(displayName, updateGroup.getDisplayName()); assertEquals(displayName, updateGroup.getDisplayName());
assertEquals(description, updateGroup.getDescription());
// Check that nothing else changed. // Check that nothing else changed.
assertEquals(subGroup.getId(), updateGroup.getId()); assertEquals(subGroup.getId(), updateGroup.getId());

View File

@@ -37,8 +37,6 @@ import org.alfresco.rest.api.tests.client.PublicApiClient.ExpectedPaging;
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse; import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Represents a group. * 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; private static final long serialVersionUID = -3580248429177260831L;
protected static final Logger logger = LoggerFactory.getLogger(Group.class);
@Override @Override
public void expected(Object o) 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"); Boolean hasSubgroups = (Boolean) jsonObject.get("hasSubgroups");
List<String> parentIds = (List<String>) jsonObject.get("parentIds"); List<String> parentIds = (List<String>) jsonObject.get("parentIds");
List<String> zones = (List<String>) jsonObject.get("zones"); List<String> zones = (List<String>) jsonObject.get("zones");
logger.info("Parse group: " + description + " " + displayName);
Group group = new Group(); Group group = new Group();
group.setId(id); group.setId(id);
group.setDisplayName(displayName); group.setDisplayName(displayName);

View File

@@ -57,8 +57,6 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.extensions.surf.util.ParameterCheck; 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 class AuthorityServiceImpl implements AuthorityService, InitializingBean
{ {
public static final String GROUP_ALFRESCO_SYSTEM_ADMINISTRATORS_AUTHORITY = PermissionService.GROUP_PREFIX + "ALFRESCO_SYSTEM_ADMINISTRATORS"; 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<String> DEFAULT_ZONES = new HashSet<String>(); private static Set<String> DEFAULT_ZONES = new HashSet<String>();
static static
@@ -671,7 +667,6 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
{ {
checkTypeIsMutable(type); checkTypeIsMutable(type);
String name = getName(type, shortName); String name = getName(type, shortName);
logger.info("Before authority DAO created");
authorityDAO.createAuthority(name, authorityDisplayName, authorityZones, properties); authorityDAO.createAuthority(name, authorityDisplayName, authorityZones, properties);
return name; return name;