Skip to content

Commit

Permalink
ACS-5506 Cleanup and test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalKinas committed Feb 8, 2024
1 parent 11030f5 commit 5e85b81
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
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;

/**
Expand All @@ -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<String, String> SORT_PARAMS_TO_NAMES;
static
{
Expand Down Expand Up @@ -140,7 +136,6 @@ public void setPeople(People people)

public Group create(Group group, Parameters parameters)
{
logger.info("Create from impl called");
validateGroup(group, false);

// Create authority with default zones.
Expand All @@ -156,7 +151,6 @@ public Group create(Group group, Parameters parameters)
{
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
import org.mockito.Mock;

import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;

Expand All @@ -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;

Expand Down Expand Up @@ -1426,17 +1421,14 @@ public void testCreateGroup() throws Exception
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);

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.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());
Expand All @@ -1447,7 +1439,7 @@ public void testCreateGroup() throws Exception
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());
Expand Down Expand Up @@ -1631,7 +1623,7 @@ public void testUpdateGroup() throws Exception
final Groups groupsProxy = publicApiClient.groups();

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);

Expand All @@ -1641,7 +1633,6 @@ public void testUpdateGroup() throws Exception
subGroupParents.add(group.getId());

Group generatedSubGroup = generateGroup();
generatedSubGroup.setDescription("initialDesc");
generatedSubGroup.setParentIds(subGroupParents);

Group subGroup = groupsProxy.createGroup(generatedSubGroup, otherParams, HttpServletResponse.SC_CREATED);
Expand All @@ -1664,11 +1655,9 @@ public void testUpdateGroup() throws Exception


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);

Expand All @@ -1678,9 +1667,8 @@ public void testUpdateGroup() throws Exception
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
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.
Expand All @@ -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)
Expand Down Expand Up @@ -115,7 +112,6 @@ public static Group parseGroup(JSONObject jsonObject)
Boolean hasSubgroups = (Boolean) jsonObject.get("hasSubgroups");
List<String> parentIds = (List<String>) jsonObject.get("parentIds");
List<String> zones = (List<String>) jsonObject.get("zones");
logger.info("Parse group: " + description + " " + displayName);
Group group = new Group();
group.setId(id);
group.setDisplayName(displayName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
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;

Expand All @@ -70,8 +68,6 @@
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<String> DEFAULT_ZONES = new HashSet<String>();

static
Expand Down Expand Up @@ -671,7 +667,6 @@ public String createAuthority(AuthorityType type, String shortName, String autho
{
checkTypeIsMutable(type);
String name = getName(type, shortName);
logger.info("Before authority DAO created");
authorityDAO.createAuthority(name, authorityDisplayName, authorityZones, properties);

return name;
Expand Down

0 comments on commit 5e85b81

Please sign in to comment.