new org.springframework.security.acls.domain.AclAuthorizationStrategyImpl(
new GrantedAuthorityImpl("some_role")
);
ObjectIdentity entityIdentity = new AclUtil(null).createIdentity(entityId,
entity.getClass().getSimpleName());
ExtendedMutableAcl mutableAcl = mock(ExtendedMutableAcl.class);
List<AccessControlEntry> accessControlEntries = new ArrayList<>();
Acl acl = new AclImpl(entityIdentity, entityId + 1, aclAuthorizationStrategy, auditLogger);
long lastGroupId = 1;
for (int i = 0; i < permissions.length; i++) {
for (int j = 0, count = RandomUtils.nextInt(20) + 10; j < count; j++) {
Group group = randomGroup(lastGroupId++);
groups.add(group);
this.permissions.add(permissions[i]);
groupAces.add(buildGroupAce(entity, permissions[i], (i % 2 == 1), acl,
new UserGroupSid(group.getId())));
}
AccessControlEntry controlEntry = mock(AccessControlEntry.class);
when(controlEntry.getPermission()).thenReturn(permissions[i]);
when(controlEntry.getSid()).thenReturn(UserSid.createAnonymous());
when(controlEntry.isGranting()).thenReturn((i % 2 == 1));
accessControlEntries.add(controlEntry);
}
when(mutableAcl.getEntries()).thenReturn(accessControlEntries);
when(aclUtil.getAclFor(entity)).thenReturn(mutableAcl);
}