mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-29 15:21:53 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			14.97
			...
			bugfix/map
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3b465bca1d | 
							
								
								
									
										21
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							@@ -38,6 +38,27 @@ updates:
 | 
			
		||||
  - dependency-name: org.activiti:activiti-spring
 | 
			
		||||
    versions:
 | 
			
		||||
    - ">= 7.1.a, < 7.2"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-activemq
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-amqp
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-direct
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-directvm
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-jackson
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-mock
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.camel:camel-spring
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 3.7.1"
 | 
			
		||||
  - dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-client-impl
 | 
			
		||||
    versions:
 | 
			
		||||
    - "> 1.0.0"
 | 
			
		||||
 
 | 
			
		||||
@@ -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,mmt" "-Dtest=AllUnitTestsSuite,AllMmtUnitTestSuite"
 | 
			
		||||
        - travis_retry mvn -B test -pl repository -Dtest=AllUnitTestsSuite
 | 
			
		||||
 | 
			
		||||
    - name: "Repository - AppContext01TestSuite"
 | 
			
		||||
      if: commit_message !~ /\[skip repo\]/
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
   <parent>
 | 
			
		||||
      <groupId>org.alfresco</groupId>
 | 
			
		||||
      <artifactId>alfresco-community-repo-amps</artifactId>
 | 
			
		||||
      <version>14.97</version>
 | 
			
		||||
      <version>14.93-SNAPSHOT</version>
 | 
			
		||||
   </parent>
 | 
			
		||||
 | 
			
		||||
   <modules>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
   <parent>
 | 
			
		||||
      <groupId>org.alfresco</groupId>
 | 
			
		||||
      <artifactId>alfresco-governance-services-community-parent</artifactId>
 | 
			
		||||
      <version>14.97</version>
 | 
			
		||||
      <version>14.93-SNAPSHOT</version>
 | 
			
		||||
   </parent>
 | 
			
		||||
 | 
			
		||||
   <modules>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
   <parent>
 | 
			
		||||
      <groupId>org.alfresco</groupId>
 | 
			
		||||
      <artifactId>alfresco-governance-services-automation-community-repo</artifactId>
 | 
			
		||||
      <version>14.97</version>
 | 
			
		||||
      <version>14.93-SNAPSHOT</version>
 | 
			
		||||
   </parent>
 | 
			
		||||
 | 
			
		||||
   <build>
 | 
			
		||||
@@ -45,7 +45,7 @@
 | 
			
		||||
      <dependency>
 | 
			
		||||
         <groupId>org.slf4j</groupId>
 | 
			
		||||
         <artifactId>slf4j-log4j12</artifactId>
 | 
			
		||||
         <version>1.7.35</version>
 | 
			
		||||
         <version>1.7.33</version>
 | 
			
		||||
         <scope>test</scope>
 | 
			
		||||
      </dependency>
 | 
			
		||||
      <dependency>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
   <parent>
 | 
			
		||||
      <groupId>org.alfresco</groupId>
 | 
			
		||||
      <artifactId>alfresco-governance-services-community-parent</artifactId>
 | 
			
		||||
      <version>14.97</version>
 | 
			
		||||
      <version>14.93-SNAPSHOT</version>
 | 
			
		||||
   </parent>
 | 
			
		||||
 | 
			
		||||
   <modules>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
   <parent>
 | 
			
		||||
      <groupId>org.alfresco</groupId>
 | 
			
		||||
      <artifactId>alfresco-governance-services-community-repo-parent</artifactId>
 | 
			
		||||
      <version>14.97</version>
 | 
			
		||||
      <version>14.93-SNAPSHOT</version>
 | 
			
		||||
   </parent>
 | 
			
		||||
 | 
			
		||||
   <properties>
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,6 @@ 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;
 | 
			
		||||
@@ -78,7 +77,7 @@ public class PublicAPITestUtil
 | 
			
		||||
     */
 | 
			
		||||
    public static void testPublicAPIConsistency(String basePackageName, SetMultimap<Class<?>, Class<?>> knownBadReferences)
 | 
			
		||||
    {
 | 
			
		||||
        Reflections reflections = new Reflections(basePackageName, TypesAnnotated);
 | 
			
		||||
        Reflections reflections = new Reflections(basePackageName);
 | 
			
		||||
        Set<Class<?>> publicAPIClasses = reflections.getTypesAnnotatedWith(AlfrescoPublicApi.class, true);
 | 
			
		||||
 | 
			
		||||
        SetMultimap<Class<?>, Class<?>> referencedFrom = HashMultimap.create();
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-governance-services-community-repo-parent</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <build>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <modules>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-amps</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
   <parent>
 | 
			
		||||
      <groupId>org.alfresco</groupId>
 | 
			
		||||
      <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
      <version>14.97</version>
 | 
			
		||||
      <version>14.93-SNAPSHOT</version>
 | 
			
		||||
   </parent>
 | 
			
		||||
 | 
			
		||||
   <dependencies>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <dependencies>
 | 
			
		||||
@@ -31,11 +31,6 @@
 | 
			
		||||
            <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>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
@@ -9,6 +9,6 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-packaging</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
</project>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-packaging</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <modules>
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-packaging</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <modules>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-tests</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <developers>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-tests</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <developers>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-tests</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <developers>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-tests</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <developers>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-tests</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <developers>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo-packaging</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								pom.xml
									
									
									
									
									
								
							@@ -2,7 +2,7 @@
 | 
			
		||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
    <version>14.97</version>
 | 
			
		||||
    <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    <packaging>pom</packaging>
 | 
			
		||||
    <name>Alfresco Community Repo Parent</name>
 | 
			
		||||
 | 
			
		||||
@@ -51,13 +51,13 @@
 | 
			
		||||
        <dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
 | 
			
		||||
        <dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
 | 
			
		||||
        <dependency.activiti.version>5.23.0</dependency.activiti.version>
 | 
			
		||||
        <dependency.alfresco-transform-model.version>1.4.8</dependency.alfresco-transform-model.version>
 | 
			
		||||
        <dependency.alfresco-transform-model.version>1.4.7</dependency.alfresco-transform-model.version>
 | 
			
		||||
        <dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
 | 
			
		||||
        <dependency.acs-event-model.version>0.0.13</dependency.acs-event-model.version>
 | 
			
		||||
 | 
			
		||||
        <dependency.spring.version>5.3.15</dependency.spring.version>
 | 
			
		||||
        <dependency.antlr.version>3.5.2</dependency.antlr.version>
 | 
			
		||||
        <dependency.jackson.version>2.13.1</dependency.jackson.version>
 | 
			
		||||
        <dependency.jackson.version>2.13.0</dependency.jackson.version>
 | 
			
		||||
        <dependency.jackson-databind.version>2.13.1</dependency.jackson-databind.version>
 | 
			
		||||
        <dependency.cxf.version>3.5.0</dependency.cxf.version>
 | 
			
		||||
        <dependency.opencmis.version>1.0.0</dependency.opencmis.version>
 | 
			
		||||
@@ -72,7 +72,7 @@
 | 
			
		||||
        <dependency.httpcore.version>4.4.15</dependency.httpcore.version>
 | 
			
		||||
        <dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
 | 
			
		||||
        <dependency.xercesImpl.version>2.12.1</dependency.xercesImpl.version>
 | 
			
		||||
        <dependency.slf4j.version>1.7.35</dependency.slf4j.version>
 | 
			
		||||
        <dependency.slf4j.version>1.7.33</dependency.slf4j.version>
 | 
			
		||||
        <dependency.gytheio.version>0.12</dependency.gytheio.version>
 | 
			
		||||
        <dependency.groovy.version>3.0.9</dependency.groovy.version>
 | 
			
		||||
        <dependency.tika.version>2.2.1</dependency.tika.version> 
 | 
			
		||||
@@ -146,7 +146,7 @@
 | 
			
		||||
        <connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
 | 
			
		||||
        <developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
 | 
			
		||||
        <url>https://github.com/Alfresco/alfresco-community-repo</url>
 | 
			
		||||
        <tag>14.97</tag>
 | 
			
		||||
        <tag>HEAD</tag>
 | 
			
		||||
    </scm>
 | 
			
		||||
 | 
			
		||||
    <distributionManagement>
 | 
			
		||||
@@ -631,7 +631,7 @@
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>com.github.junrar</groupId>
 | 
			
		||||
                <artifactId>junrar</artifactId>
 | 
			
		||||
                <version>7.4.1</version>
 | 
			
		||||
                <version>7.4.0</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>com.github.fge</groupId>
 | 
			
		||||
@@ -850,7 +850,7 @@
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>org.reflections</groupId>
 | 
			
		||||
                <artifactId>reflections</artifactId>
 | 
			
		||||
                <version>0.10.2</version>
 | 
			
		||||
                <version>0.9.12</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
            <!-- swagger parser -->
 | 
			
		||||
            <dependency>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <dependencies>
 | 
			
		||||
 
 | 
			
		||||
@@ -167,6 +167,10 @@ public class NodesMetaDataGet extends DeclarativeWebScript
 | 
			
		||||
            {
 | 
			
		||||
                filter.setIncludeType(o.getBoolean("includeType"));
 | 
			
		||||
            }
 | 
			
		||||
            if(o.has("includeChildAssociations"))
 | 
			
		||||
            {
 | 
			
		||||
                filter.setIncludeChildAssociations(o.getBoolean("includeChildAssociations"));
 | 
			
		||||
            }
 | 
			
		||||
            if(o.has("includeParentAssociations"))
 | 
			
		||||
            {
 | 
			
		||||
                filter.setIncludeParentAssociations(o.getBoolean("includeParentAssociations"));
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <groupId>org.alfresco</groupId>
 | 
			
		||||
        <artifactId>alfresco-community-repo</artifactId>
 | 
			
		||||
        <version>14.97</version>
 | 
			
		||||
        <version>14.93-SNAPSHOT</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
 | 
			
		||||
    <dependencies>
 | 
			
		||||
@@ -198,6 +198,24 @@
 | 
			
		||||
            <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>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,28 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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%
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * #%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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 * #L%
 | 
			
		||||
 */
 | 
			
		||||
package org.alfresco.repo.module.tool;
 | 
			
		||||
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
@@ -1,28 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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%
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * #%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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 * #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
 | 
			
		||||
@@ -1,28 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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%
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * #%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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 * #L%
 | 
			
		||||
 */
 | 
			
		||||
package org.alfresco.repo.module.tool;
 | 
			
		||||
 | 
			
		||||
import de.schlichtherle.truezip.file.*;
 | 
			
		||||
@@ -1,28 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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%
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * #%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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 * #L%
 | 
			
		||||
 */
 | 
			
		||||
package org.alfresco.repo.module.tool;
 | 
			
		||||
 | 
			
		||||
import org.alfresco.service.cmr.module.ModuleDetails;
 | 
			
		||||
@@ -1,28 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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%
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * #%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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 * #L%
 | 
			
		||||
 */
 | 
			
		||||
package org.alfresco.repo.module.tool;
 | 
			
		||||
 | 
			
		||||
import de.schlichtherle.truezip.file.TArchiveDetector;
 | 
			
		||||
@@ -66,6 +66,9 @@ 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,
 | 
			
		||||
@@ -116,7 +119,6 @@ import org.junit.runners.Suite;
 | 
			
		||||
    org.alfresco.util.schemacomp.validator.SchemaVersionValidatorTest.class,
 | 
			
		||||
    org.alfresco.util.schemacomp.validator.TypeNameOnlyValidatorTest.class,
 | 
			
		||||
    org.alfresco.util.test.OmittedTestClassFinderUnitTest.class,
 | 
			
		||||
    org.alfresco.util.test.junitrules.RetryAtMostRuleTest.class,
 | 
			
		||||
    org.alfresco.util.test.junitrules.TemporaryMockOverrideTest.class,
 | 
			
		||||
    org.alfresco.repo.search.impl.solr.AbstractSolrQueryHTTPClientTest.class,
 | 
			
		||||
    org.alfresco.repo.search.impl.solr.SpellCheckDecisionManagerTest.class,
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * #%L
 | 
			
		||||
 * Alfresco Repository
 | 
			
		||||
 * %%
 | 
			
		||||
 * Copyright (C) 2005 - 2022 Alfresco Software Limited
 | 
			
		||||
 * Copyright (C) 2005 - 2020 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,10 +68,6 @@ 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,28 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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%
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * #%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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
 * #L%
 | 
			
		||||
 */
 | 
			
		||||
package org.alfresco.repo.activities;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.*;
 | 
			
		||||
@@ -102,11 +102,19 @@ 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
 | 
			
		||||
@@ -181,6 +189,10 @@ 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
 | 
			
		||||
@@ -320,39 +332,51 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
        }
 | 
			
		||||
        assertEquals(expectedCount, activityService.getUserFeedEntries(userId, siteId, excludeThisUser, excludeOtherUsers, null, null).size());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void configureFeedControls() throws Exception
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testUserFeedControls() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        // 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
 | 
			
		||||
        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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addAndUpdateMemberships() throws Exception
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testAddAndUpdateMemberships() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        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();
 | 
			
		||||
        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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testGetSiteFeedsAfterAddAndUpdateMemberships() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        addAndUpdateMemberships();
 | 
			
		||||
        testAddAndUpdateMemberships();
 | 
			
		||||
        
 | 
			
		||||
        login(ADMIN_USER, ADMIN_PW);
 | 
			
		||||
        
 | 
			
		||||
@@ -376,9 +400,14 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
            // ignore
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void removeMemberships() throws Exception
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testRemoveMemberships() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        if (! membersRemoved)
 | 
			
		||||
        {
 | 
			
		||||
            testAddAndUpdateMemberships();
 | 
			
		||||
            
 | 
			
		||||
            login(ADMIN_USER, ADMIN_PW);
 | 
			
		||||
            
 | 
			
		||||
            removeMemberships(site1, true);
 | 
			
		||||
@@ -386,6 +415,9 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
            removeMemberships(site3, false);
 | 
			
		||||
            
 | 
			
		||||
            generateFeed();
 | 
			
		||||
            
 | 
			
		||||
            membersRemoved = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    protected void addAndUpdateMemberships(String siteId, boolean includeUser4) throws Exception
 | 
			
		||||
@@ -424,8 +456,8 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testGetSiteFeedsAfterRemoveMemberships() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        addAndUpdateMemberships();
 | 
			
		||||
        removeMemberships();
 | 
			
		||||
        testAddAndUpdateMemberships();
 | 
			
		||||
        testRemoveMemberships();
 | 
			
		||||
        
 | 
			
		||||
        login(ADMIN_USER, ADMIN_PW);
 | 
			
		||||
        
 | 
			
		||||
@@ -461,11 +493,11 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testGetUserFeedsAfterApplyingFeedControls() throws Exception
 | 
			
		||||
    public void testGetUserFeedsAfter() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        configureFeedControls();
 | 
			
		||||
        addAndUpdateMemberships();
 | 
			
		||||
        removeMemberships();
 | 
			
		||||
        testUserFeedControls();
 | 
			
		||||
        testAddAndUpdateMemberships();
 | 
			
		||||
        testRemoveMemberships();
 | 
			
		||||
        
 | 
			
		||||
        // as admin
 | 
			
		||||
        
 | 
			
		||||
@@ -474,23 +506,22 @@ 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 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)
 | 
			
		||||
        // 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
 | 
			
		||||
        getUserFeed(user2, true, 0);   // 0 = due to feed control - exclude site membership activities (across all sites)
 | 
			
		||||
        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
 | 
			
		||||
        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
 | 
			
		||||
        
 | 
			
		||||
        // as user1
 | 
			
		||||
        
 | 
			
		||||
        login(user1, USER_PW);
 | 
			
		||||
        
 | 
			
		||||
        getUserFeed(user1, false, 16);
 | 
			
		||||
        getUserFeed(user1, false, 14);
 | 
			
		||||
        
 | 
			
		||||
        // as user2
 | 
			
		||||
        
 | 
			
		||||
@@ -498,7 +529,7 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
        
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            getUserFeed(user1, true, 16);
 | 
			
		||||
            getUserFeed(user1, true, 14);
 | 
			
		||||
            
 | 
			
		||||
            fail("User feed should only be accessible to user or an admin");
 | 
			
		||||
        }
 | 
			
		||||
@@ -512,12 +543,12 @@ public abstract class AbstractSiteActivityTest
 | 
			
		||||
        login(user1, USER_PW);
 | 
			
		||||
        
 | 
			
		||||
        getUserFeed(null, site1, false, false, false, 0);
 | 
			
		||||
        getUserFeed(null, site2, false, false, false, 9);
 | 
			
		||||
        getUserFeed(null, site3, false, false, false, 7);
 | 
			
		||||
        getUserFeed(null, site2, false, false, false, 8);
 | 
			
		||||
        getUserFeed(null, site3, false, false, false, 6);
 | 
			
		||||
        
 | 
			
		||||
        getUserFeed(null, null, false, false, false, 16); // no filter
 | 
			
		||||
        getUserFeed(null, null, false, false, false, 14); // no filter
 | 
			
		||||
        getUserFeed(null, null, false, true, false, 12);  // exclude any from user1
 | 
			
		||||
        getUserFeed(null, null, false, false, true, 4);   // exclude all except user1
 | 
			
		||||
        getUserFeed(null, null, false, false, true, 2);   // exclude all except user1
 | 
			
		||||
        getUserFeed(null, null, false, true, true, 0);    // exclude all (NOOP)
 | 
			
		||||
        
 | 
			
		||||
        // TODO - add more (eg. other non-admin user activities)
 | 
			
		||||
 
 | 
			
		||||
@@ -4,32 +4,27 @@
 | 
			
		||||
 * %%
 | 
			
		||||
 * Copyright (C) 2005 - 2021 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
 | 
			
		||||
 * 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.repo.domain.permissions;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.assertEquals;
 | 
			
		||||
import static org.junit.Assert.assertFalse;
 | 
			
		||||
import static org.junit.Assert.assertNotNull;
 | 
			
		||||
import static org.junit.Assert.assertTrue;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
@@ -66,26 +61,23 @@ import org.alfresco.service.cmr.security.PermissionService;
 | 
			
		||||
import org.alfresco.service.namespace.QName;
 | 
			
		||||
import org.alfresco.util.ApplicationContextHelper;
 | 
			
		||||
import org.alfresco.util.Pair;
 | 
			
		||||
import org.alfresco.util.test.junitrules.RetryAtMostRule;
 | 
			
		||||
import org.alfresco.util.test.junitrules.RetryAtMostRule.RetryAtMost;
 | 
			
		||||
import org.junit.After;
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Rule;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.context.ApplicationContext;
 | 
			
		||||
import org.springframework.dao.ConcurrencyFailureException;
 | 
			
		||||
 | 
			
		||||
import junit.framework.TestCase;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Test class for {@link FixedAclUpdater}
 | 
			
		||||
 *
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Andreea Dragoi
 | 
			
		||||
 * @author sglover
 | 
			
		||||
 * @since 4.2.7
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class FixedAclUpdaterTest
 | 
			
		||||
public class FixedAclUpdaterTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    private static final Logger LOG = LoggerFactory.getLogger(FixedAclUpdaterTest.class);
 | 
			
		||||
 | 
			
		||||
@@ -111,10 +103,7 @@ public class FixedAclUpdaterTest
 | 
			
		||||
    private static String TEST_GROUP_NAME_FULL = PermissionService.GROUP_PREFIX + TEST_GROUP_NAME;
 | 
			
		||||
    private static String DEFAULT_PERMISSION = PermissionService.CONTRIBUTOR;
 | 
			
		||||
 | 
			
		||||
    @Rule
 | 
			
		||||
    public RetryAtMostRule retryAtMostRule = new RetryAtMostRule();
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    @Override
 | 
			
		||||
    public void setUp() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        ctx = ApplicationContextHelper.getApplicationContext();
 | 
			
		||||
@@ -137,7 +126,7 @@ public class FixedAclUpdaterTest
 | 
			
		||||
        setFixedAclMaxTransactionTime(permissionsDaoComponent, homeFolderNodeRef, maxTransactionTime);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @After
 | 
			
		||||
    @Override
 | 
			
		||||
    public void tearDown() throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        AuthenticationUtil.clearCurrentSecurityContext();
 | 
			
		||||
@@ -213,7 +202,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Test setting permissions explicitly as async
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsync()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncFolder");
 | 
			
		||||
@@ -260,7 +248,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * MNT-21847 - Create a new content in folder that has the aspect applied
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeCreation()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCreationFolder");
 | 
			
		||||
@@ -291,7 +278,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * MNT-22009 - Delete node that has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeDeletion()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeDeletionFolder");
 | 
			
		||||
@@ -382,7 +368,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * MNT-22040 - Copy node that has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeCopy()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder");
 | 
			
		||||
@@ -462,7 +447,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Copy node that has the aspect to another folder that also has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeCopyToPendingFolder()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder");
 | 
			
		||||
@@ -554,7 +538,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeCopyParentToChildPendingFolder()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder");
 | 
			
		||||
@@ -666,7 +649,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeMoveChildToChildPendingFolder()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveChildToChildPendingFolderOrigin");
 | 
			
		||||
@@ -752,7 +734,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * ACL
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithErrorsForceSharedACL()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithErrorsForceSharedACL");
 | 
			
		||||
@@ -811,7 +792,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * MNT-22040 - Move node that has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeMove()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveOriginFolder");
 | 
			
		||||
@@ -888,7 +868,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Move node that has the aspect to another folder that also has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeMoveToPendingFolder()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveOriginFolder");
 | 
			
		||||
@@ -977,7 +956,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Lock node that has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeLock()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeLockFolder");
 | 
			
		||||
@@ -1007,7 +985,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Checkout a node for editing that has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeCheckout()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeCheckoutFolder");
 | 
			
		||||
@@ -1038,7 +1015,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Update the permissions of a node that has the aspect applied (new permissions: fixed)
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeUpdatePermissionsFixed()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeUpdatePermissionsFixedFolder");
 | 
			
		||||
@@ -1080,7 +1056,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Update the permissions of a node that has the aspect applied (new permissions: shared)
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeUpdatePermissionsShared()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeUpdatePermissionsSharedFolder");
 | 
			
		||||
@@ -1119,7 +1094,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Update the permissions of the parent of a node that has the aspect applied (new permissions: fixed)
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithParentUpdatePermissionsFixed()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithParentUpdatePermissionsFixedFolder");
 | 
			
		||||
@@ -1161,7 +1135,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Update the permissions of the parent of a node that has the aspect applied (new permissions: shared)
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithParentUpdatePermissionsShared()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithParentUpdatePermissionsSharedFolder");
 | 
			
		||||
@@ -1200,7 +1173,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncCascadeUpdatePermissions()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncCascadeUpdatePermissionsFolder");
 | 
			
		||||
@@ -1253,7 +1225,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Update the content of a node that has the aspect applied before job runs
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncWithNodeContentUpdate()
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeContentUpdateFolder");
 | 
			
		||||
@@ -1286,7 +1257,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * Test setting permissions concurrently to actually cause the expected concurrency exception
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncConcurrentPermissionsUpdate() throws Throwable
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncConcurrentPermissionsUpdateFolder");
 | 
			
		||||
@@ -1358,7 +1328,6 @@ public class FixedAclUpdaterTest
 | 
			
		||||
     * exception but the job should be able to recover
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testAsyncConcurrentUpdateAndJob() throws Throwable
 | 
			
		||||
    {
 | 
			
		||||
        NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncConcurrentUpdateAndJobFolder");
 | 
			
		||||
@@ -1833,7 +1802,7 @@ public class FixedAclUpdaterTest
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a level in folder/file hierarchy. Intermediate levels will contain folders and last ones files
 | 
			
		||||
     *
 | 
			
		||||
     * 
 | 
			
		||||
     * @param fileFolderService
 | 
			
		||||
     * @param parent
 | 
			
		||||
     *            - parent node of the of hierarchy level
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * #%L
 | 
			
		||||
 * Alfresco Repository
 | 
			
		||||
 * %%
 | 
			
		||||
 * Copyright (C) 2005 - 2022 Alfresco Software Limited
 | 
			
		||||
 * 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 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * #%L
 | 
			
		||||
 * Alfresco Repository
 | 
			
		||||
 * %%
 | 
			
		||||
 * Copyright (C) 2005 - 2022 Alfresco Software Limited
 | 
			
		||||
 * 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 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * #%L
 | 
			
		||||
 * Alfresco Repository
 | 
			
		||||
 * %%
 | 
			
		||||
 * Copyright (C) 2005 - 2022 Alfresco Software Limited
 | 
			
		||||
 * 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 
 | 
			
		||||
@@ -99,7 +99,7 @@ public class SecurityTestSuite extends TestSuite
 | 
			
		||||
 | 
			
		||||
        suite.addTest(new JUnit4TestAdapter(HomeFolderProviderSynchronizerTest.class));
 | 
			
		||||
        suite.addTest(new JUnit4TestAdapter(AlfrescoSSLSocketFactoryTest.class));
 | 
			
		||||
		suite.addTest(new JUnit4TestAdapter(FixedAclUpdaterTest.class));
 | 
			
		||||
		suite.addTestSuite(FixedAclUpdaterTest.class);
 | 
			
		||||
 | 
			
		||||
		suite.addTestSuite(DefaultRemoteUserMapperTest.class);
 | 
			
		||||
		suite.addTestSuite(IdentityServiceRemoteUserMapperTest.class);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * #%L
 | 
			
		||||
 * Alfresco Repository
 | 
			
		||||
 * %%
 | 
			
		||||
 * Copyright (C) 2005 - 2022 Alfresco Software Limited
 | 
			
		||||
 * Copyright (C) 2005 - 2020 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,16 +29,10 @@ 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;
 | 
			
		||||
 | 
			
		||||
@@ -55,7 +49,6 @@ 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;
 | 
			
		||||
 | 
			
		||||
@@ -76,7 +69,7 @@ public class OmittedTestClassFinderUnitTest
 | 
			
		||||
    public void checkTestClassesReferencedInTestSuites()
 | 
			
		||||
    {
 | 
			
		||||
        // We assume that all of our tests are in org.alfresco.
 | 
			
		||||
        Reflections reflections = new Reflections("org.alfresco", MethodsAnnotated, TypesAnnotated, SubTypes);
 | 
			
		||||
        Reflections reflections = new Reflections("org.alfresco", new MethodAnnotationsScanner(), new TypeAnnotationsScanner(), new SubTypesScanner());
 | 
			
		||||
 | 
			
		||||
        // Find the test classes which are not in test suites.
 | 
			
		||||
        Set<String> testClasses =  getTestClassesOnPath(reflections);
 | 
			
		||||
@@ -169,14 +162,13 @@ 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<? extends Annotation> annotation)
 | 
			
		||||
    private Set<String> findClassesWithMethodAnnotation(Reflections reflections, Class annotation)
 | 
			
		||||
    {
 | 
			
		||||
        return reflections.getMethodsAnnotatedWith(annotation)
 | 
			
		||||
        return reflections.getStore()
 | 
			
		||||
                          .get(MethodAnnotationsScanner.class, annotation.getName())
 | 
			
		||||
                          .stream()
 | 
			
		||||
                          .map(Method::getDeclaringClass)
 | 
			
		||||
                          .flatMap(c -> Stream.concat(Stream.of(c), reflections.getSubTypesOf(c).stream()))
 | 
			
		||||
                          .map(Class::getCanonicalName)
 | 
			
		||||
                          .filter(Objects::nonNull)
 | 
			
		||||
                          // Get the class name from the method name.
 | 
			
		||||
                          .map(methodName -> methodName.split("\\.[^\\.]+\\(")[0])
 | 
			
		||||
                          .collect(toSet());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,132 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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.util.test.junitrules;
 | 
			
		||||
 | 
			
		||||
import java.lang.annotation.Documented;
 | 
			
		||||
import java.lang.annotation.ElementType;
 | 
			
		||||
import java.lang.annotation.Retention;
 | 
			
		||||
import java.lang.annotation.RetentionPolicy;
 | 
			
		||||
import java.lang.annotation.Target;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.logging.Log;
 | 
			
		||||
import org.apache.commons.logging.LogFactory;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.junit.rules.TestRule;
 | 
			
		||||
import org.junit.runner.Description;
 | 
			
		||||
import org.junit.runners.model.Statement;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This JUnit rule can be used to turn existing test code into retryable tests.
 | 
			
		||||
 * The test methods marked with the {@link RetryAtMost} annotation will be attempted at most the specified
 | 
			
		||||
 * amount of times, stopping at the first successful execution.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Domenico Sibilio
 | 
			
		||||
 */
 | 
			
		||||
public class RetryAtMostRule implements TestRule
 | 
			
		||||
{
 | 
			
		||||
    private static final Log LOG = LogFactory.getLog(RetryAtMostRule.class);
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Statement apply(final Statement statement, final Description description)
 | 
			
		||||
    {
 | 
			
		||||
        RetryAtMost retryAtMost = description.getAnnotation(RetryAtMost.class);
 | 
			
		||||
 | 
			
		||||
        if (retryAtMost != null)
 | 
			
		||||
        {
 | 
			
		||||
            return new RetryAtMostTestStatement(statement, description, retryAtMost.value());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return statement;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class RetryAtMostTestStatement extends Statement
 | 
			
		||||
    {
 | 
			
		||||
        private final Statement statement;
 | 
			
		||||
        private final Description description;
 | 
			
		||||
        private final int retryCount;
 | 
			
		||||
 | 
			
		||||
        private RetryAtMostTestStatement(Statement statement, Description description, int retryCount)
 | 
			
		||||
        {
 | 
			
		||||
            this.statement = statement;
 | 
			
		||||
            this.description = description;
 | 
			
		||||
            this.retryCount = retryCount;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void evaluate() throws Throwable
 | 
			
		||||
        {
 | 
			
		||||
            validate();
 | 
			
		||||
            for (int i = 0; i < retryCount; i++)
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    LOG.debug(
 | 
			
		||||
                        "Retryable testing configured for method: " + description.getMethodName()
 | 
			
		||||
                            + " // Attempt #" + (i + 1));
 | 
			
		||||
                    statement.evaluate();
 | 
			
		||||
                    break; // stop at the first successful execution
 | 
			
		||||
                }
 | 
			
		||||
                catch (Throwable t)
 | 
			
		||||
                {
 | 
			
		||||
                    // ignore failed test runs unless it's the last possible execution
 | 
			
		||||
                    if (isLastExecution(i))
 | 
			
		||||
                    {
 | 
			
		||||
                        throw t;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void validate()
 | 
			
		||||
        {
 | 
			
		||||
            if (retryCount < 1)
 | 
			
		||||
            {
 | 
			
		||||
                String methodName = description.getMethodName();
 | 
			
		||||
                throw new IllegalArgumentException(
 | 
			
		||||
                    "Invalid value for @RetryAtMost on method " + methodName + ": " + retryCount + " is less than 1.");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private boolean isLastExecution(int i)
 | 
			
		||||
        {
 | 
			
		||||
            return i == retryCount - 1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This annotation is a marker used to identify a JUnit @{@link Test} method as a retryable test.
 | 
			
		||||
     */
 | 
			
		||||
    @Target(ElementType.METHOD)
 | 
			
		||||
    @Retention(RetentionPolicy.RUNTIME)
 | 
			
		||||
    @Documented
 | 
			
		||||
    public @interface RetryAtMost
 | 
			
		||||
    {
 | 
			
		||||
        /**
 | 
			
		||||
         * @return The amount of times a test will be attempted, at most.
 | 
			
		||||
         */
 | 
			
		||||
        int value() default 1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,138 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * #%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.util.test.junitrules;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.assertSame;
 | 
			
		||||
import static org.mockito.Mockito.doThrow;
 | 
			
		||||
import static org.mockito.Mockito.times;
 | 
			
		||||
import static org.mockito.Mockito.verify;
 | 
			
		||||
import static org.mockito.Mockito.verifyNoInteractions;
 | 
			
		||||
 | 
			
		||||
import java.lang.annotation.Annotation;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
import org.alfresco.util.test.junitrules.RetryAtMostRule.RetryAtMost;
 | 
			
		||||
import org.junit.Rule;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.junit.rules.TestName;
 | 
			
		||||
import org.junit.runner.Description;
 | 
			
		||||
import org.junit.runner.RunWith;
 | 
			
		||||
import org.junit.runners.model.Statement;
 | 
			
		||||
import org.mockito.Mock;
 | 
			
		||||
import org.mockito.junit.MockitoJUnitRunner;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Test class for {@link RetryAtMostRule}.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Domenico Sibilio
 | 
			
		||||
 */
 | 
			
		||||
@RunWith(MockitoJUnitRunner.class)
 | 
			
		||||
public class RetryAtMostRuleTest
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    private static final String ANNOTATION_WITH_NEGATIVE_VALUE = "annotationRetryAtMostNegativeTimes";
 | 
			
		||||
    private static final String ANNOTATION_RETRY_AT_MOST_THRICE = "annotationRetryAtMostThrice";
 | 
			
		||||
    private static final AtomicInteger EXECUTION_COUNT = new AtomicInteger(0);
 | 
			
		||||
    @Rule
 | 
			
		||||
    public RetryAtMostRule retryAtMostRule = new RetryAtMostRule();
 | 
			
		||||
    @Rule
 | 
			
		||||
    public TestName testNameRule = new TestName();
 | 
			
		||||
    @Mock
 | 
			
		||||
    private Statement statementMock;
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testSucceedOnFirstAttempt() throws Throwable
 | 
			
		||||
    {
 | 
			
		||||
        Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(),
 | 
			
		||||
            testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_RETRY_AT_MOST_THRICE));
 | 
			
		||||
 | 
			
		||||
        Statement statement = retryAtMostRule.apply(statementMock, description);
 | 
			
		||||
        statement.evaluate();
 | 
			
		||||
        verify(statementMock, times(1)).evaluate();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testSucceedOnSecondAttempt() throws Throwable
 | 
			
		||||
    {
 | 
			
		||||
        doThrow(new AssertionError("First execution should fail")).doNothing().when(statementMock).evaluate();
 | 
			
		||||
 | 
			
		||||
        Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(),
 | 
			
		||||
            testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_RETRY_AT_MOST_THRICE));
 | 
			
		||||
 | 
			
		||||
        Statement statement = retryAtMostRule.apply(statementMock, description);
 | 
			
		||||
        statement.evaluate();
 | 
			
		||||
        verify(statementMock, times(2)).evaluate();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void testSucceedOnThirdAttempt()
 | 
			
		||||
    {
 | 
			
		||||
        int currentExecution = EXECUTION_COUNT.incrementAndGet();
 | 
			
		||||
        assertSame("This test should be executed 3 times", 3, currentExecution);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test(expected = AssertionError.class)
 | 
			
		||||
    public void testFailAfterMaxAttempts() throws Throwable
 | 
			
		||||
    {
 | 
			
		||||
        doThrow(new AssertionError("All executions should fail")).when(statementMock).evaluate();
 | 
			
		||||
 | 
			
		||||
        Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(),
 | 
			
		||||
            testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_RETRY_AT_MOST_THRICE));
 | 
			
		||||
 | 
			
		||||
        Statement statement = retryAtMostRule.apply(statementMock, description);
 | 
			
		||||
        statement.evaluate();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test(expected = IllegalArgumentException.class)
 | 
			
		||||
    public void testInvalidRetryAtMostTimes() throws Throwable
 | 
			
		||||
    {
 | 
			
		||||
        Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(),
 | 
			
		||||
            testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_WITH_NEGATIVE_VALUE));
 | 
			
		||||
 | 
			
		||||
        Statement statement = retryAtMostRule.apply(statementMock, description);
 | 
			
		||||
        statement.evaluate();
 | 
			
		||||
        verifyNoInteractions(statementMock);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Annotation getAnnotationByMethodName(String methodName) throws NoSuchMethodException
 | 
			
		||||
    {
 | 
			
		||||
        return this.getClass().getMethod(methodName).getAnnotation(RetryAtMost.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RetryAtMost(-1)
 | 
			
		||||
    public void annotationRetryAtMostNegativeTimes()
 | 
			
		||||
    {
 | 
			
		||||
        // intentionally empty
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RetryAtMost(3)
 | 
			
		||||
    public void annotationRetryAtMostThrice()
 | 
			
		||||
    {
 | 
			
		||||
        // intentionally empty
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user