mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Bump reflections from 0.9.12 to 0.10.2 (#776)
This commit is contained in:
@@ -53,7 +53,7 @@ jobs:
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
script:
|
||||
- travis_retry mvn -B test -pl core,data-model
|
||||
- travis_retry mvn -B test -pl repository -Dtest=AllUnitTestsSuite
|
||||
- travis_retry mvn -B test -pl "repository,mmt" "-Dtest=AllUnitTestsSuite,AllMmtUnitTestSuite"
|
||||
|
||||
- name: "Repository - AppContext01TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
|
@@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.api;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Executable;
|
||||
@@ -77,7 +78,7 @@ public class PublicAPITestUtil
|
||||
*/
|
||||
public static void testPublicAPIConsistency(String basePackageName, SetMultimap<Class<?>, Class<?>> knownBadReferences)
|
||||
{
|
||||
Reflections reflections = new Reflections(basePackageName);
|
||||
Reflections reflections = new Reflections(basePackageName, TypesAnnotated);
|
||||
Set<Class<?>> publicAPIClasses = reflections.getTypesAnnotatedWith(AlfrescoPublicApi.class, true);
|
||||
|
||||
SetMultimap<Class<?>, Class<?>> referencedFrom = HashMultimap.create();
|
||||
|
@@ -31,6 +31,11 @@
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
43
mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java
Normal file
43
mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco;
|
||||
|
||||
import org.junit.experimental.categories.Categories;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
/**
|
||||
* All MMT Tool project UNIT test classes (no application context) should be added to this test suite.
|
||||
*/
|
||||
@RunWith(Categories.class)
|
||||
@Suite.SuiteClasses({
|
||||
org.alfresco.repo.module.tool.ModuleManagementToolTest.class,
|
||||
org.alfresco.repo.module.tool.WarHelperImplTest.class,
|
||||
org.alfresco.repo.module.tool.ModuleServiceImplTest.class
|
||||
})
|
||||
public class AllMmtUnitTestSuite
|
||||
{
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
2
pom.xml
2
pom.xml
@@ -850,7 +850,7 @@
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.12</version>
|
||||
<version>0.10.2</version>
|
||||
</dependency>
|
||||
<!-- swagger parser -->
|
||||
<dependency>
|
||||
|
@@ -198,24 +198,6 @@
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-driver-zip</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-file</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.pdfview</groupId>
|
||||
<artifactId>pdfrenderer</artifactId>
|
||||
|
@@ -66,9 +66,6 @@ import org.junit.runners.Suite;
|
||||
org.alfresco.repo.management.subsystems.CryptodocSwitchableApplicationContextFactoryTest.class,
|
||||
org.alfresco.repo.module.ModuleDetailsImplTest.class,
|
||||
org.alfresco.repo.module.ModuleVersionNumberTest.class,
|
||||
org.alfresco.repo.module.tool.ModuleManagementToolTest.class,
|
||||
org.alfresco.repo.module.tool.WarHelperImplTest.class,
|
||||
org.alfresco.repo.module.tool.ModuleServiceImplTest.class,
|
||||
org.alfresco.repo.node.integrity.IntegrityEventTest.class,
|
||||
org.alfresco.repo.policy.MTPolicyComponentTest.class,
|
||||
org.alfresco.repo.policy.PolicyComponentTest.class,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -68,6 +68,10 @@ import org.junit.runners.Suite;
|
||||
org.alfresco.filesys.repo.ContentDiskDriverTest.class,
|
||||
org.alfresco.filesys.repo.LockKeeperImplTest.class,
|
||||
org.alfresco.repo.activities.ActivityServiceImplTest.class,
|
||||
org.alfresco.repo.activities.feed.cleanup.FeedCleanerTestCaseInsensitivity.class,
|
||||
org.alfresco.repo.activities.SiteActivityTestCaseSensitivity.class,
|
||||
org.alfresco.repo.activities.feed.cleanup.FeedCleanerTestCaseSensitivity.class,
|
||||
org.alfresco.repo.activities.SiteActivityTestCaseInsensitivity.class,
|
||||
org.alfresco.repo.admin.registry.RegistryServiceImplTest.class
|
||||
})
|
||||
public class AppContext01TestSuite
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -102,19 +102,11 @@ public abstract class AbstractSiteActivityTest
|
||||
// AppToolId for site membership activities
|
||||
private static String appToolId = "siteService"; // refer to SiteService
|
||||
|
||||
private static boolean membersAddedUpdated = false;
|
||||
private static boolean membersRemoved = false;
|
||||
private static boolean controlsCreated = false;
|
||||
|
||||
public AbstractSiteActivityTest()
|
||||
{
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
applicationContext = ApplicationContextHelper.getApplicationContext();
|
||||
String testid = ""+System.currentTimeMillis();
|
||||
String testid = "" + System.currentTimeMillis();
|
||||
|
||||
// Let's shut down the scheduler so that we aren't competing with the scheduled versions of the post lookup and
|
||||
// feed generator jobs
|
||||
@@ -189,10 +181,6 @@ public abstract class AbstractSiteActivityTest
|
||||
deleteSite(site1);
|
||||
deleteSite(site2);
|
||||
deleteSite(site3);
|
||||
|
||||
membersAddedUpdated = false;
|
||||
membersRemoved = false;
|
||||
controlsCreated = false;
|
||||
}
|
||||
|
||||
protected void createSite(String siteId, boolean isPublic) throws Exception
|
||||
@@ -333,10 +321,7 @@ public abstract class AbstractSiteActivityTest
|
||||
assertEquals(expectedCount, activityService.getUserFeedEntries(userId, siteId, excludeThisUser, excludeOtherUsers, null, null).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUserFeedControls() throws Exception
|
||||
{
|
||||
if (! controlsCreated)
|
||||
public void configureFeedControls() throws Exception
|
||||
{
|
||||
// user 1 opts out of all activities for site 1
|
||||
login(user1, USER_PW);
|
||||
@@ -351,15 +336,9 @@ public abstract class AbstractSiteActivityTest
|
||||
addFeedControl(site1, appToolId);
|
||||
|
||||
// TODO add more here, once we have more appToolIds
|
||||
|
||||
controlsCreated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndUpdateMemberships() throws Exception
|
||||
{
|
||||
if (! membersAddedUpdated)
|
||||
public void addAndUpdateMemberships() throws Exception
|
||||
{
|
||||
login(ADMIN_USER, ADMIN_PW);
|
||||
|
||||
@@ -368,15 +347,12 @@ public abstract class AbstractSiteActivityTest
|
||||
addAndUpdateMemberships(site3, false); // private site, do not include user 4
|
||||
|
||||
generateFeed();
|
||||
|
||||
membersAddedUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSiteFeedsAfterAddAndUpdateMemberships() throws Exception
|
||||
{
|
||||
testAddAndUpdateMemberships();
|
||||
addAndUpdateMemberships();
|
||||
|
||||
login(ADMIN_USER, ADMIN_PW);
|
||||
|
||||
@@ -401,13 +377,8 @@ public abstract class AbstractSiteActivityTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMemberships() throws Exception
|
||||
public void removeMemberships() throws Exception
|
||||
{
|
||||
if (! membersRemoved)
|
||||
{
|
||||
testAddAndUpdateMemberships();
|
||||
|
||||
login(ADMIN_USER, ADMIN_PW);
|
||||
|
||||
removeMemberships(site1, true);
|
||||
@@ -415,9 +386,6 @@ public abstract class AbstractSiteActivityTest
|
||||
removeMemberships(site3, false);
|
||||
|
||||
generateFeed();
|
||||
|
||||
membersRemoved = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void addAndUpdateMemberships(String siteId, boolean includeUser4) throws Exception
|
||||
@@ -456,8 +424,8 @@ public abstract class AbstractSiteActivityTest
|
||||
@Test
|
||||
public void testGetSiteFeedsAfterRemoveMemberships() throws Exception
|
||||
{
|
||||
testAddAndUpdateMemberships();
|
||||
testRemoveMemberships();
|
||||
addAndUpdateMemberships();
|
||||
removeMemberships();
|
||||
|
||||
login(ADMIN_USER, ADMIN_PW);
|
||||
|
||||
@@ -493,11 +461,11 @@ public abstract class AbstractSiteActivityTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserFeedsAfter() throws Exception
|
||||
public void testGetUserFeedsAfterApplyingFeedControls() throws Exception
|
||||
{
|
||||
testUserFeedControls();
|
||||
testAddAndUpdateMemberships();
|
||||
testRemoveMemberships();
|
||||
configureFeedControls();
|
||||
addAndUpdateMemberships();
|
||||
removeMemberships();
|
||||
|
||||
// as admin
|
||||
|
||||
@@ -506,22 +474,23 @@ public abstract class AbstractSiteActivityTest
|
||||
// site 1, with 4 users, each with 1 join, 1 role change = 4x2 = 8
|
||||
// site 2, with 4 users, each with 1 join, 1 role change = 4x2 = 8
|
||||
// site 3, with 3 users, each with 1 join, 1 role change = 3x2 = 6
|
||||
// Every user is removed from sites so in its feed it sees the removal for each site
|
||||
|
||||
// user 1 belongs to 3 sites = (2x8)+(1x6) = 22
|
||||
// user 2 belongs to 3 sites = (2x8)+(1x6) = 22
|
||||
// user 3 belongs to 3 sites = (2x8)+(1x6) = 22
|
||||
// user 4 belongs to 2 sites = (2x8) = 16
|
||||
// user 1 belongs to 3 sites and is removed from 3 sites = (2x8)+(1x6)+3 = 25
|
||||
// user 2 belongs to 3 sites and is removed from 3 sites = (2x8)+(1x6)+3 = 25
|
||||
// user 3 belongs to 3 sites and is removed from 3 sites = (2x8)+(1x6)+3 = 25
|
||||
// user 4 belongs to 2 sites and is removed from 3 sites = (2x8)+2 = 18
|
||||
|
||||
getUserFeed(user1, true, 14); // 14 = (22 - 8) due to feed control - exclude site 1
|
||||
getUserFeed(user1, true, 16); // 16 = (25 - 9) due to feed control - exclude site 1 (4 joins, 4 changes, 1 removal)
|
||||
getUserFeed(user2, true, 0); // 0 = due to feed control - exclude site membership activities (across all sites)
|
||||
getUserFeed(user3, true, 14); // 14 = (22 - 8) due to feed control - exclude site membership activities for site 1
|
||||
getUserFeed(user4, true, 16); // 16 = no feed control
|
||||
getUserFeed(user3, true, 16); // 16 = (25 - 9) due to feed control - exclude site membership activities for site 1
|
||||
getUserFeed(user4, true, 18); // 18 = no feed control
|
||||
|
||||
// as user1
|
||||
|
||||
login(user1, USER_PW);
|
||||
|
||||
getUserFeed(user1, false, 14);
|
||||
getUserFeed(user1, false, 16);
|
||||
|
||||
// as user2
|
||||
|
||||
@@ -529,7 +498,7 @@ public abstract class AbstractSiteActivityTest
|
||||
|
||||
try
|
||||
{
|
||||
getUserFeed(user1, true, 14);
|
||||
getUserFeed(user1, true, 16);
|
||||
|
||||
fail("User feed should only be accessible to user or an admin");
|
||||
}
|
||||
@@ -543,12 +512,12 @@ public abstract class AbstractSiteActivityTest
|
||||
login(user1, USER_PW);
|
||||
|
||||
getUserFeed(null, site1, false, false, false, 0);
|
||||
getUserFeed(null, site2, false, false, false, 8);
|
||||
getUserFeed(null, site3, false, false, false, 6);
|
||||
getUserFeed(null, site2, false, false, false, 9);
|
||||
getUserFeed(null, site3, false, false, false, 7);
|
||||
|
||||
getUserFeed(null, null, false, false, false, 14); // no filter
|
||||
getUserFeed(null, null, false, false, false, 16); // no filter
|
||||
getUserFeed(null, null, false, true, false, 12); // exclude any from user1
|
||||
getUserFeed(null, null, false, false, true, 2); // exclude all except user1
|
||||
getUserFeed(null, null, false, false, true, 4); // exclude all except user1
|
||||
getUserFeed(null, null, false, true, true, 0); // exclude all (NOOP)
|
||||
|
||||
// TODO - add more (eg. other non-admin user activities)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -29,10 +29,16 @@ import static java.util.Collections.emptySet;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.reflections.scanners.Scanners.MethodsAnnotated;
|
||||
import static org.reflections.scanners.Scanners.SubTypes;
|
||||
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -49,6 +55,7 @@ import org.junit.experimental.categories.Category;
|
||||
import org.junit.runners.Suite.SuiteClasses;
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.scanners.MethodAnnotationsScanner;
|
||||
import org.reflections.scanners.Scanners;
|
||||
import org.reflections.scanners.SubTypesScanner;
|
||||
import org.reflections.scanners.TypeAnnotationsScanner;
|
||||
|
||||
@@ -69,7 +76,7 @@ public class OmittedTestClassFinderUnitTest
|
||||
public void checkTestClassesReferencedInTestSuites()
|
||||
{
|
||||
// We assume that all of our tests are in org.alfresco.
|
||||
Reflections reflections = new Reflections("org.alfresco", new MethodAnnotationsScanner(), new TypeAnnotationsScanner(), new SubTypesScanner());
|
||||
Reflections reflections = new Reflections("org.alfresco", MethodsAnnotated, TypesAnnotated, SubTypes);
|
||||
|
||||
// Find the test classes which are not in test suites.
|
||||
Set<String> testClasses = getTestClassesOnPath(reflections);
|
||||
@@ -162,13 +169,14 @@ public class OmittedTestClassFinderUnitTest
|
||||
* @param annotation The class of the annotation to look for.
|
||||
* @return The set of canonical names of classes containing methods annotated with the annotation.
|
||||
*/
|
||||
private Set<String> findClassesWithMethodAnnotation(Reflections reflections, Class annotation)
|
||||
private Set<String> findClassesWithMethodAnnotation(Reflections reflections, Class<? extends Annotation> annotation)
|
||||
{
|
||||
return reflections.getStore()
|
||||
.get(MethodAnnotationsScanner.class, annotation.getName())
|
||||
return reflections.getMethodsAnnotatedWith(annotation)
|
||||
.stream()
|
||||
// Get the class name from the method name.
|
||||
.map(methodName -> methodName.split("\\.[^\\.]+\\(")[0])
|
||||
.map(Method::getDeclaringClass)
|
||||
.flatMap(c -> Stream.concat(Stream.of(c), reflections.getSubTypesOf(c).stream()))
|
||||
.map(Class::getCanonicalName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(toSet());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user