PRODENG-276: Fixed test failures.

This commit is contained in:
Jamal Kaabi-Mofrad
2024-05-30 15:57:46 +01:00
parent d999558b33
commit e59bb3261c
4 changed files with 34 additions and 30 deletions

View File

@@ -45,7 +45,6 @@ import org.junit.runners.Suite;
org.alfresco.repo.security.authority.DuplicateAuthorityTest.class, org.alfresco.repo.security.authority.DuplicateAuthorityTest.class,
org.alfresco.repo.security.authority.ExtendedPermissionServiceTest.class, org.alfresco.repo.security.authority.ExtendedPermissionServiceTest.class,
org.alfresco.repo.security.permissions.dynamic.LockOwnerDynamicAuthorityTest.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.AclDaoComponentTest.class,
org.alfresco.repo.security.permissions.impl.PermissionServiceTest.class, org.alfresco.repo.security.permissions.impl.PermissionServiceTest.class,
org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationTest.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.model.ModelTestSuite.class,
org.alfresco.repo.tenant.MultiTNodeServiceInterceptorTest.class, org.alfresco.repo.tenant.MultiTNodeServiceInterceptorTest.class,
org.alfresco.repo.transfer.RepoTransferReceiverImplTest.class, org.alfresco.repo.transfer.RepoTransferReceiverImplTest.class,
org.alfresco.repo.security.permissions.dynamic.ServiceAccountRoleTest.class
}) })
public class AppContext05TestSuite public class AppContext05TestSuite
{ {

View File

@@ -83,6 +83,8 @@ import org.springframework.context.ApplicationContext;
* *
* @author Jamal Kaabi-Mofrad * @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 public class ServiceAccountRoleTest
{ {
// Rule to initialise the default Alfresco spring configuration // Rule to initialise the default Alfresco spring configuration

View File

@@ -66,6 +66,8 @@ import org.springframework.context.ApplicationContext;
public abstract class AbstractPermissionTest extends TestCase 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 USER2_LEMUR = "lemur";
protected static final String USER1_ANDY = "andy"; protected static final String USER1_ANDY = "andy";

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.security.permissions.impl.model; package org.alfresco.repo.security.permissions.impl.model;
import java.util.Collections; import java.util.Collections;
@@ -94,7 +94,7 @@ public class PermissionModelTest extends AbstractPermissionTest
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject", Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject",
namespacePrefixResolver), "Coordinator")); namespacePrefixResolver), "Coordinator"));
assertEquals(69, grantees.size()); assertEquals(72, grantees.size());
} }
public void testIncludePermissionGroups6() public void testIncludePermissionGroups6()
@@ -109,17 +109,17 @@ public class PermissionModelTest extends AbstractPermissionTest
{ {
Set<PermissionReference> granters = permissionModelDAO.getGrantingPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", Set<PermissionReference> granters = permissionModelDAO.getGrantingPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base",
namespacePrefixResolver), "ReadProperties")); namespacePrefixResolver), "ReadProperties"));
assertEquals(14, granters.size()); assertEquals(17, granters.size());
granters = permissionModelDAO.getGrantingPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver), granters = permissionModelDAO.getGrantingPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
"_ReadProperties")); "_ReadProperties"));
assertEquals(15, granters.size()); assertEquals(18, granters.size());
} }
public void testGlobalPermissions() public void testGlobalPermissions()
{ {
Set<? extends PermissionEntry> globalPermissions = permissionModelDAO.getGlobalPermissionEntries(); Set<? extends PermissionEntry> globalPermissions = permissionModelDAO.getGlobalPermissionEntries();
assertEquals(5, globalPermissions.size()); assertEquals(NUMBER_OF_GLOBAL_PERMISSIONS, globalPermissions.size());
} }
public void testRequiredPermissions() public void testRequiredPermissions()