From 44a8acddd06579afcaa3924ae5b7291ea838dd44 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 10:51:48 +0000 Subject: [PATCH] Bump reflections from 0.9.12 to 0.10.2 (#776) --- .travis.yml | 2 +- .../api/PublicAPITestUtil.java | 3 +- mmt/pom.xml | 5 + .../repo/module/tool/InstalledFiles.java | 50 ++--- .../repo/module/tool/ModuleDetailsHelper.java | 64 +++---- .../module/tool/ModuleManagementTool.java | 50 ++--- .../alfresco/repo/module/tool/WarHelper.java | 50 ++--- .../repo/module/tool/WarHelperImpl.java | 50 ++--- .../tool/default-file-mapping.properties | 0 .../org/alfresco/AllMmtUnitTestSuite.java | 43 +++++ .../module/tool/ModuleManagementToolTest.java | 2 +- .../module/tool/ModuleServiceImplTest.java | 2 +- .../repo/module/tool/WarHelperImplTest.java | 2 +- .../alfresco/module/simplemodule.properties | 0 .../test/resources/module/alfresco-4.2.a.war | Bin .../test/resources/module/alfresco-4.2.c.war | Bin .../resources/module/dependent_on_test_v1.amp | Bin .../resources/module/dependent_on_test_v2.amp | Bin .../src/test/resources/module/empty.war | Bin .../test/resources/module/share-3.4.11.war | Bin .../src/test/resources/module/share-4.2.a.war | Bin .../src/test/resources/module/test.war | Bin .../src/test/resources/module/test_v1.amp | Bin .../src/test/resources/module/test_v2.amp | Bin .../src/test/resources/module/test_v3.amp | Bin .../src/test/resources/module/test_v4.amp | Bin .../src/test/resources/module/test_v5.amp | Bin .../src/test/resources/module/test_v6.amp | Bin .../src/test/resources/module/test_v7.amp | Bin pom.xml | 2 +- repository/pom.xml | 18 -- .../java/org/alfresco/AllUnitTestsSuite.java | 3 - .../org/alfresco/AppContext01TestSuite.java | 6 +- .../activities/AbstractSiteActivityTest.java | 179 ++++++++---------- .../test/OmittedTestClassFinderUnitTest.java | 22 ++- 35 files changed, 281 insertions(+), 272 deletions(-) rename {repository => mmt}/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.java (96%) rename {repository => mmt}/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.java (96%) rename {repository => mmt}/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.java (97%) rename {repository => mmt}/src/main/java/org/alfresco/repo/module/tool/WarHelper.java (95%) rename {repository => mmt}/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.java (97%) rename {repository => mmt}/src/main/resources/org/alfresco/repo/module/tool/default-file-mapping.properties (100%) create mode 100644 mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java rename {repository => mmt}/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java (99%) rename {repository => mmt}/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java (98%) rename {repository => mmt}/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java (99%) rename {repository => mmt}/src/test/resources/alfresco/module/simplemodule.properties (100%) rename {repository => mmt}/src/test/resources/module/alfresco-4.2.a.war (100%) rename {repository => mmt}/src/test/resources/module/alfresco-4.2.c.war (100%) rename {repository => mmt}/src/test/resources/module/dependent_on_test_v1.amp (100%) rename {repository => mmt}/src/test/resources/module/dependent_on_test_v2.amp (100%) rename {repository => mmt}/src/test/resources/module/empty.war (100%) rename {repository => mmt}/src/test/resources/module/share-3.4.11.war (100%) rename {repository => mmt}/src/test/resources/module/share-4.2.a.war (100%) rename {repository => mmt}/src/test/resources/module/test.war (100%) rename {repository => mmt}/src/test/resources/module/test_v1.amp (100%) rename {repository => mmt}/src/test/resources/module/test_v2.amp (100%) rename {repository => mmt}/src/test/resources/module/test_v3.amp (100%) rename {repository => mmt}/src/test/resources/module/test_v4.amp (100%) rename {repository => mmt}/src/test/resources/module/test_v5.amp (100%) rename {repository => mmt}/src/test/resources/module/test_v6.amp (100%) rename {repository => mmt}/src/test/resources/module/test_v7.amp (100%) diff --git a/.travis.yml b/.travis.yml index 6b9448db90..8c15590f75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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\]/ diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java index 91fa239d3e..804ed5fced 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java @@ -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> knownBadReferences) { - Reflections reflections = new Reflections(basePackageName); + Reflections reflections = new Reflections(basePackageName, TypesAnnotated); Set> publicAPIClasses = reflections.getTypesAnnotatedWith(AlfrescoPublicApi.class, true); SetMultimap, Class> referencedFrom = HashMultimap.create(); diff --git a/mmt/pom.xml b/mmt/pom.xml index 60c8867bd9..16db1c84f0 100644 --- a/mmt/pom.xml +++ b/mmt/pom.xml @@ -31,6 +31,11 @@ maven-artifact ${dependency.maven-artifact.version} + + org.mockito + mockito-core + test + diff --git a/repository/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.java b/mmt/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.java similarity index 96% rename from repository/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.java rename to mmt/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.java index ddda9dc852..554d2bf6a2 100644 --- a/repository/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.java +++ b/mmt/src/main/java/org/alfresco/repo/module/tool/InstalledFiles.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 - 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 . + * #L% + */ package org.alfresco.repo.module.tool; import java.io.BufferedReader; diff --git a/repository/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.java b/mmt/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.java similarity index 96% rename from repository/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.java rename to mmt/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.java index 05299ad573..99c783c150 100644 --- a/repository/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.java +++ b/mmt/src/main/java/org/alfresco/repo/module/tool/ModuleDetailsHelper.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 - 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 . + * #L% + */ package org.alfresco.repo.module.tool; import java.io.FileNotFoundException; @@ -178,13 +178,13 @@ public class ModuleDetailsHelper } /** - * Saves the module details to the war in the correct location based on the module id - * - * @param warLocation the war location - * @param moduleDetails the module id - */ - public static void saveModuleDetails(String warLocation, ModuleDetails moduleDetails) - { + * Saves the module details to the war in the correct location based on the module id + * + * @param warLocation the war location + * @param moduleDetails the module id + */ + public static void saveModuleDetails(String warLocation, ModuleDetails moduleDetails) + { // Ensure that it is a valid set of properties String moduleId = moduleDetails.getId(); try diff --git a/repository/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.java b/mmt/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.java similarity index 97% rename from repository/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.java rename to mmt/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.java index 9276a2a23b..a8f7f57dd2 100644 --- a/repository/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.java +++ b/mmt/src/main/java/org/alfresco/repo/module/tool/ModuleManagementTool.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 - 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 . + * #L% + */ package org.alfresco.repo.module.tool; import de.schlichtherle.truezip.file.*; diff --git a/repository/src/main/java/org/alfresco/repo/module/tool/WarHelper.java b/mmt/src/main/java/org/alfresco/repo/module/tool/WarHelper.java similarity index 95% rename from repository/src/main/java/org/alfresco/repo/module/tool/WarHelper.java rename to mmt/src/main/java/org/alfresco/repo/module/tool/WarHelper.java index b082ddeddd..3b758a1ac8 100644 --- a/repository/src/main/java/org/alfresco/repo/module/tool/WarHelper.java +++ b/mmt/src/main/java/org/alfresco/repo/module/tool/WarHelper.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 - 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 . + * #L% + */ package org.alfresco.repo.module.tool; import org.alfresco.service.cmr.module.ModuleDetails; diff --git a/repository/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.java b/mmt/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.java similarity index 97% rename from repository/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.java rename to mmt/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.java index e8a57a9e19..7eafe3e566 100644 --- a/repository/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.java +++ b/mmt/src/main/java/org/alfresco/repo/module/tool/WarHelperImpl.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 - 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 . + * #L% + */ package org.alfresco.repo.module.tool; import de.schlichtherle.truezip.file.TArchiveDetector; diff --git a/repository/src/main/resources/org/alfresco/repo/module/tool/default-file-mapping.properties b/mmt/src/main/resources/org/alfresco/repo/module/tool/default-file-mapping.properties similarity index 100% rename from repository/src/main/resources/org/alfresco/repo/module/tool/default-file-mapping.properties rename to mmt/src/main/resources/org/alfresco/repo/module/tool/default-file-mapping.properties diff --git a/mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java b/mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java new file mode 100644 index 0000000000..f34f4a85c5 --- /dev/null +++ b/mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java @@ -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 . + * #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 +{ +} diff --git a/repository/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java b/mmt/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java similarity index 99% rename from repository/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java rename to mmt/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java index 121dfa6b41..0e4610a9a2 100644 --- a/repository/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java +++ b/mmt/src/test/java/org/alfresco/repo/module/tool/ModuleManagementToolTest.java @@ -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 diff --git a/repository/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java b/mmt/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java similarity index 98% rename from repository/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java rename to mmt/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java index 607d8a547c..3f15c37a9f 100644 --- a/repository/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java +++ b/mmt/src/test/java/org/alfresco/repo/module/tool/ModuleServiceImplTest.java @@ -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 diff --git a/repository/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java b/mmt/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java similarity index 99% rename from repository/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java rename to mmt/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java index adb10abb8d..fc072216d6 100644 --- a/repository/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java +++ b/mmt/src/test/java/org/alfresco/repo/module/tool/WarHelperImplTest.java @@ -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 diff --git a/repository/src/test/resources/alfresco/module/simplemodule.properties b/mmt/src/test/resources/alfresco/module/simplemodule.properties similarity index 100% rename from repository/src/test/resources/alfresco/module/simplemodule.properties rename to mmt/src/test/resources/alfresco/module/simplemodule.properties diff --git a/repository/src/test/resources/module/alfresco-4.2.a.war b/mmt/src/test/resources/module/alfresco-4.2.a.war similarity index 100% rename from repository/src/test/resources/module/alfresco-4.2.a.war rename to mmt/src/test/resources/module/alfresco-4.2.a.war diff --git a/repository/src/test/resources/module/alfresco-4.2.c.war b/mmt/src/test/resources/module/alfresco-4.2.c.war similarity index 100% rename from repository/src/test/resources/module/alfresco-4.2.c.war rename to mmt/src/test/resources/module/alfresco-4.2.c.war diff --git a/repository/src/test/resources/module/dependent_on_test_v1.amp b/mmt/src/test/resources/module/dependent_on_test_v1.amp similarity index 100% rename from repository/src/test/resources/module/dependent_on_test_v1.amp rename to mmt/src/test/resources/module/dependent_on_test_v1.amp diff --git a/repository/src/test/resources/module/dependent_on_test_v2.amp b/mmt/src/test/resources/module/dependent_on_test_v2.amp similarity index 100% rename from repository/src/test/resources/module/dependent_on_test_v2.amp rename to mmt/src/test/resources/module/dependent_on_test_v2.amp diff --git a/repository/src/test/resources/module/empty.war b/mmt/src/test/resources/module/empty.war similarity index 100% rename from repository/src/test/resources/module/empty.war rename to mmt/src/test/resources/module/empty.war diff --git a/repository/src/test/resources/module/share-3.4.11.war b/mmt/src/test/resources/module/share-3.4.11.war similarity index 100% rename from repository/src/test/resources/module/share-3.4.11.war rename to mmt/src/test/resources/module/share-3.4.11.war diff --git a/repository/src/test/resources/module/share-4.2.a.war b/mmt/src/test/resources/module/share-4.2.a.war similarity index 100% rename from repository/src/test/resources/module/share-4.2.a.war rename to mmt/src/test/resources/module/share-4.2.a.war diff --git a/repository/src/test/resources/module/test.war b/mmt/src/test/resources/module/test.war similarity index 100% rename from repository/src/test/resources/module/test.war rename to mmt/src/test/resources/module/test.war diff --git a/repository/src/test/resources/module/test_v1.amp b/mmt/src/test/resources/module/test_v1.amp similarity index 100% rename from repository/src/test/resources/module/test_v1.amp rename to mmt/src/test/resources/module/test_v1.amp diff --git a/repository/src/test/resources/module/test_v2.amp b/mmt/src/test/resources/module/test_v2.amp similarity index 100% rename from repository/src/test/resources/module/test_v2.amp rename to mmt/src/test/resources/module/test_v2.amp diff --git a/repository/src/test/resources/module/test_v3.amp b/mmt/src/test/resources/module/test_v3.amp similarity index 100% rename from repository/src/test/resources/module/test_v3.amp rename to mmt/src/test/resources/module/test_v3.amp diff --git a/repository/src/test/resources/module/test_v4.amp b/mmt/src/test/resources/module/test_v4.amp similarity index 100% rename from repository/src/test/resources/module/test_v4.amp rename to mmt/src/test/resources/module/test_v4.amp diff --git a/repository/src/test/resources/module/test_v5.amp b/mmt/src/test/resources/module/test_v5.amp similarity index 100% rename from repository/src/test/resources/module/test_v5.amp rename to mmt/src/test/resources/module/test_v5.amp diff --git a/repository/src/test/resources/module/test_v6.amp b/mmt/src/test/resources/module/test_v6.amp similarity index 100% rename from repository/src/test/resources/module/test_v6.amp rename to mmt/src/test/resources/module/test_v6.amp diff --git a/repository/src/test/resources/module/test_v7.amp b/mmt/src/test/resources/module/test_v7.amp similarity index 100% rename from repository/src/test/resources/module/test_v7.amp rename to mmt/src/test/resources/module/test_v7.amp diff --git a/pom.xml b/pom.xml index b97e2eb4bd..f4ed69178a 100644 --- a/pom.xml +++ b/pom.xml @@ -850,7 +850,7 @@ org.reflections reflections - 0.9.12 + 0.10.2 diff --git a/repository/pom.xml b/repository/pom.xml index 646d5c5224..51939f0d1f 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -198,24 +198,6 @@ maven-artifact ${dependency.maven-artifact.version} - - de.schlichtherle.truezip - truezip-driver-zip - ${dependency.truezip.version} - provided - - - de.schlichtherle.truezip - truezip-file - ${dependency.truezip.version} - provided - - - com.google.code.findbugs - annotations - - - com.sun.pdfview pdfrenderer diff --git a/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java b/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java index 0c113bcaee..eb3be2af41 100644 --- a/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java +++ b/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java @@ -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, diff --git a/repository/src/test/java/org/alfresco/AppContext01TestSuite.java b/repository/src/test/java/org/alfresco/AppContext01TestSuite.java index 8492621e79..1533550859 100644 --- a/repository/src/test/java/org/alfresco/AppContext01TestSuite.java +++ b/repository/src/test/java/org/alfresco/AppContext01TestSuite.java @@ -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 diff --git a/repository/src/test/java/org/alfresco/repo/activities/AbstractSiteActivityTest.java b/repository/src/test/java/org/alfresco/repo/activities/AbstractSiteActivityTest.java index 6cf91fd96f..098acbf537 100644 --- a/repository/src/test/java/org/alfresco/repo/activities/AbstractSiteActivityTest.java +++ b/repository/src/test/java/org/alfresco/repo/activities/AbstractSiteActivityTest.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 - 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 . + * #L% + */ package org.alfresco.repo.activities; import static org.junit.Assert.*; @@ -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 @@ -332,51 +320,39 @@ public abstract class AbstractSiteActivityTest } assertEquals(expectedCount, activityService.getUserFeedEntries(userId, siteId, excludeThisUser, excludeOtherUsers, null, null).size()); } - - @Test - public void testUserFeedControls() throws Exception + + public void configureFeedControls() throws Exception { - if (! controlsCreated) - { - // user 1 opts out of all activities for site 1 - login(user1, USER_PW); - addFeedControl(site1, null); - - // user 2 opts out of site membership activities (across all sites) - login(user2, USER_PW); - addFeedControl(null, appToolId); - - // user 3 opts out of site membership activities for site 1 only - login(user3, USER_PW); - addFeedControl(site1, appToolId); - - // TODO add more here, once we have more appToolIds - - controlsCreated = true; - } + // user 1 opts out of all activities for site 1 + login(user1, USER_PW); + addFeedControl(site1, null); + + // user 2 opts out of site membership activities (across all sites) + login(user2, USER_PW); + addFeedControl(null, appToolId); + + // user 3 opts out of site membership activities for site 1 only + login(user3, USER_PW); + addFeedControl(site1, appToolId); + + // TODO add more here, once we have more appToolIds } - - @Test - public void testAddAndUpdateMemberships() throws Exception + + public void addAndUpdateMemberships() throws Exception { - if (! membersAddedUpdated) - { - login(ADMIN_USER, ADMIN_PW); - - addAndUpdateMemberships(site1, true); // public site, include all users - addAndUpdateMemberships(site2, true); // private site, include all users - addAndUpdateMemberships(site3, false); // private site, do not include user 4 - - generateFeed(); - - membersAddedUpdated = true; - } + login(ADMIN_USER, ADMIN_PW); + + addAndUpdateMemberships(site1, true); // public site, include all users + addAndUpdateMemberships(site2, true); // private site, include all users + addAndUpdateMemberships(site3, false); // private site, do not include user 4 + + generateFeed(); } @Test public void testGetSiteFeedsAfterAddAndUpdateMemberships() throws Exception { - testAddAndUpdateMemberships(); + addAndUpdateMemberships(); login(ADMIN_USER, ADMIN_PW); @@ -400,14 +376,9 @@ public abstract class AbstractSiteActivityTest // ignore } } - - @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 - - getUserFeed(user1, true, 14); // 14 = (22 - 8) due to feed control - exclude site 1 + // 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, 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) diff --git a/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java b/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java index 679c58288a..924813613d 100644 --- a/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java +++ b/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java @@ -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 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 findClassesWithMethodAnnotation(Reflections reflections, Class annotation) + private Set findClassesWithMethodAnnotation(Reflections reflections, Class 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()); }