diff --git a/repository/src/test/java/org/alfresco/AppContext05TestSuite.java b/repository/src/test/java/org/alfresco/AppContext05TestSuite.java index 9092900f2a..d8aebf7940 100644 --- a/repository/src/test/java/org/alfresco/AppContext05TestSuite.java +++ b/repository/src/test/java/org/alfresco/AppContext05TestSuite.java @@ -45,7 +45,6 @@ import org.junit.runners.Suite; org.alfresco.repo.security.authority.DuplicateAuthorityTest.class, org.alfresco.repo.security.authority.ExtendedPermissionServiceTest.class, org.alfresco.repo.security.permissions.dynamic.LockOwnerDynamicAuthorityTest.class, - org.alfresco.repo.security.permissions.dynamic.ServiceAccountRoleTest.class, org.alfresco.repo.security.permissions.impl.AclDaoComponentTest.class, org.alfresco.repo.security.permissions.impl.PermissionServiceTest.class, org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationTest.class, @@ -86,6 +85,7 @@ import org.junit.runners.Suite; org.alfresco.repo.model.ModelTestSuite.class, org.alfresco.repo.tenant.MultiTNodeServiceInterceptorTest.class, org.alfresco.repo.transfer.RepoTransferReceiverImplTest.class, + org.alfresco.repo.security.permissions.dynamic.ServiceAccountRoleTest.class }) public class AppContext05TestSuite { diff --git a/repository/src/test/java/org/alfresco/repo/security/permissions/dynamic/ServiceAccountRoleTest.java b/repository/src/test/java/org/alfresco/repo/security/permissions/dynamic/ServiceAccountRoleTest.java index 7efba03be5..7ac12a8bd8 100644 --- a/repository/src/test/java/org/alfresco/repo/security/permissions/dynamic/ServiceAccountRoleTest.java +++ b/repository/src/test/java/org/alfresco/repo/security/permissions/dynamic/ServiceAccountRoleTest.java @@ -83,6 +83,8 @@ import org.springframework.context.ApplicationContext; * * @author Jamal Kaabi-Mofrad */ +// Ignore the PMD warning about having too many test methods in this class; it makes the tests easier to read and maintain. +@SuppressWarnings("PMD.TooManyMethods") public class ServiceAccountRoleTest { // Rule to initialise the default Alfresco spring configuration diff --git a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java index 0bcbe57dab..0b81987e36 100644 --- a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java +++ b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java @@ -66,6 +66,8 @@ import org.springframework.context.ApplicationContext; public abstract class AbstractPermissionTest extends TestCase { + public static final int NUMBER_OF_GLOBAL_PERMISSIONS = 8; + protected static final String USER2_LEMUR = "lemur"; protected static final String USER1_ANDY = "andy"; diff --git a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/model/PermissionModelTest.java b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/model/PermissionModelTest.java index ff4f4ce40e..0fd216f022 100644 --- a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/model/PermissionModelTest.java +++ b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/model/PermissionModelTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.security.permissions.impl.model; import java.util.Collections; @@ -94,7 +94,7 @@ public class PermissionModelTest extends AbstractPermissionTest Set grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject", namespacePrefixResolver), "Coordinator")); - assertEquals(69, grantees.size()); + assertEquals(72, grantees.size()); } public void testIncludePermissionGroups6() @@ -109,17 +109,17 @@ public class PermissionModelTest extends AbstractPermissionTest { Set granters = permissionModelDAO.getGrantingPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver), "ReadProperties")); - assertEquals(14, granters.size()); + assertEquals(17, granters.size()); granters = permissionModelDAO.getGrantingPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver), "_ReadProperties")); - assertEquals(15, granters.size()); + assertEquals(18, granters.size()); } public void testGlobalPermissions() { Set globalPermissions = permissionModelDAO.getGlobalPermissionEntries(); - assertEquals(5, globalPermissions.size()); + assertEquals(NUMBER_OF_GLOBAL_PERMISSIONS, globalPermissions.size()); } public void testRequiredPermissions()