mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
68 Commits
rm_testbra
...
rm_communi
Author | SHA1 | Date | |
---|---|---|---|
|
af926a53d5 | ||
|
2177ffcea8 | ||
|
2ce43b09d8 | ||
|
05660a94ab | ||
|
3e4c191ff9 | ||
|
8a3817649b | ||
|
82b737062b | ||
|
e6b32e7e61 | ||
|
b9979caf40 | ||
|
e6367cdc70 | ||
|
eceba2679c | ||
|
cf4abfe101 | ||
|
2a5f03889e | ||
|
0e11091d19 | ||
|
3cb838865a | ||
|
f89d85b431 | ||
|
9d91ee4cae | ||
|
1e792eb625 | ||
|
3d881b9022 | ||
|
b890af95b4 | ||
|
706aac3ffa | ||
|
22230ea04b | ||
|
798a3faa5b | ||
|
105c83ca7e | ||
|
64b9564dc7 | ||
|
a3ccf20a74 | ||
|
fa7f74f2ee | ||
|
30e339db12 | ||
|
8f5aed72d2 | ||
|
dc0582b1ab | ||
|
92eb339237 | ||
|
3b6983170b | ||
|
338e2b93dd | ||
|
fea50a2206 | ||
|
85b5b2660e | ||
|
085e2acaac | ||
|
58b4d9f18f | ||
|
336e7cf817 | ||
|
13a2bea2ce | ||
|
9139500fa5 | ||
|
2a43657e2f | ||
|
8145e2ea39 | ||
|
db1bc1d9e2 | ||
|
2f0f3aa310 | ||
|
873508bfb7 | ||
|
e71f681e6e | ||
|
4cb4f6f023 | ||
|
98aebf77ad | ||
|
25b7d8c480 | ||
|
641ea57895 | ||
|
c0d2d444ca | ||
|
212c2cefec | ||
|
6bacd51841 | ||
|
2db4bf0a90 | ||
|
7381e578a8 | ||
|
44a8acddd0 | ||
|
9bcf7eed9a | ||
|
d540a25a88 | ||
|
f113724f9a | ||
|
ad04e79141 | ||
|
51ed184126 | ||
|
5d740eba37 | ||
|
5c9cc4dd04 | ||
|
430e92dbce | ||
|
f0aa9b6004 | ||
|
4471654e40 | ||
|
e1fa082b6e | ||
|
903672b82b |
21
.github/dependabot.yml
vendored
21
.github/dependabot.yml
vendored
@@ -38,27 +38,6 @@ 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"
|
||||
|
20
.travis.yml
20
.travis.yml
@@ -53,14 +53,14 @@ 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\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext02TestSuite"
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext04TestSuite"
|
||||
@@ -83,7 +83,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext05TestSuite"
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContextExtraTestSuite"
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MiscContextTestSuite"
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - SearchTestSuite"
|
||||
@@ -241,7 +241,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext03TestSuite"
|
||||
@@ -249,7 +249,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext04TestSuite"
|
||||
@@ -257,7 +257,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.5
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.7-A1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContextExtraTestSuite"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
@@ -44,8 +44,8 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<version>1.7.35</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="TestNG AllTestSuite" configfailurepolicy="continue" verbose="1" time-out="300000">
|
||||
<suite name="TestNG AllTestSuite" configfailurepolicy="continue" verbose="1" time-out="300000" parallel="false">
|
||||
<test name="restapi">
|
||||
<packages>
|
||||
<package name="org.alfresco.rest.rm.community.*"/>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.5.5
|
||||
TRANSFORMERS_TAG=2.5.7-A1
|
||||
SOLR6_TAG=2.0.2
|
||||
POSTGRES_TAG=13.3
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -1,4 +1,17 @@
|
||||
### Apply AGS community repo AMP to ACS image
|
||||
# BUILD STAGE AGS
|
||||
FROM debian:11-slim AS AGSBUILDER
|
||||
|
||||
RUN export DEBIAN_FRONTEND=noninteractive; \
|
||||
apt-get update -qqy && apt-get -yqq install unzip && \
|
||||
mkdir -p /build/gs-api-explorer
|
||||
|
||||
### Copy the AGS war from the local context
|
||||
COPY target/gs-api-explorer-*.war /build
|
||||
|
||||
RUN unzip -q /build/gs-api-explorer-*.war -d /build/gs-api-explorer && \
|
||||
chmod -R g-w,o= /build
|
||||
|
||||
# ACTUAL IMAGE
|
||||
FROM alfresco/alfresco-community-repo-base:${image.tag}
|
||||
|
||||
# Alfresco user does not have permissions to modify webapps or configuration. Switch to root.
|
||||
@@ -13,18 +26,13 @@ RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \
|
||||
/usr/local/tomcat/amps \
|
||||
/usr/local/tomcat/webapps/alfresco -directory -nobackup
|
||||
|
||||
### Copy gs-api-explorer war into webapps folder
|
||||
COPY target/gs-api-explorer-*.war /usr/local/tomcat/webapps/
|
||||
|
||||
### Unpack gs-api-explorer.war
|
||||
RUN mkdir /usr/local/tomcat/webapps/gs-api-explorer && cd /usr/local/tomcat/webapps/gs-api-explorer && \
|
||||
jar -xvf /usr/local/tomcat/webapps/gs-api-explorer-*.war && rm -f /usr/local/tomcat/webapps/gs-api-explorer-*.war
|
||||
### Copy gs-api-explorer
|
||||
COPY --chown=root:Alfresco --from=AGSBUILDER /build/gs-api-explorer /usr/local/tomcat/webapps/gs-api-explorer
|
||||
|
||||
# All files in the tomcat folder must be owned by root user and Alfresco group as mentioned in the parent Dockerfile
|
||||
RUN chgrp -R Alfresco /usr/local/tomcat && \
|
||||
find /usr/local/tomcat/webapps -type d -exec chmod 0750 {} \; && \
|
||||
find /usr/local/tomcat/webapps -type f -exec chmod 0640 {} \; && \
|
||||
chmod -R g+r /usr/local/tomcat/webapps
|
||||
find /usr/local/tomcat/webapps -type f -exec chmod 0640 {} \;
|
||||
|
||||
# Switching back to alfresco user after having added amps files to run the container as non-root
|
||||
USER alfresco
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.api;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Executable;
|
||||
@@ -77,7 +78,7 @@ public class PublicAPITestUtil
|
||||
*/
|
||||
public static void testPublicAPIConsistency(String basePackageName, SetMultimap<Class<?>, Class<?>> knownBadReferences)
|
||||
{
|
||||
Reflections reflections = new Reflections(basePackageName);
|
||||
Reflections reflections = new Reflections(basePackageName, TypesAnnotated);
|
||||
Set<Class<?>> publicAPIClasses = reflections.getTypesAnnotatedWith(AlfrescoPublicApi.class, true);
|
||||
|
||||
SetMultimap<Class<?>, Class<?>> referencedFrom = HashMultimap.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
10
core/pom.xml
10
core/pom.xml
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -54,9 +54,9 @@
|
||||
<classifier>asl</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
@@ -114,7 +114,7 @@
|
||||
<!-- Test only dependencies, as popped up while running mvn test -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -31,6 +31,11 @@
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <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 - 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%
|
||||
*/
|
||||
/*
|
||||
* #%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.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 - 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%
|
||||
*/
|
||||
/*
|
||||
* #%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.repo.module.tool;
|
||||
|
||||
import de.schlichtherle.truezip.file.*;
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <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 - 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%
|
||||
*/
|
||||
/*
|
||||
* #%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.repo.module.tool;
|
||||
|
||||
import de.schlichtherle.truezip.file.TArchiveDetector;
|
43
mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java
Normal file
43
mmt/src/test/java/org/alfresco/AllMmtUnitTestSuite.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco;
|
||||
|
||||
import org.junit.experimental.categories.Categories;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
/**
|
||||
* All MMT Tool project UNIT test classes (no application context) should be added to this test suite.
|
||||
*/
|
||||
@RunWith(Categories.class)
|
||||
@Suite.SuiteClasses({
|
||||
org.alfresco.repo.module.tool.ModuleManagementToolTest.class,
|
||||
org.alfresco.repo.module.tool.WarHelperImplTest.class,
|
||||
org.alfresco.repo.module.tool.ModuleServiceImplTest.class
|
||||
})
|
||||
public class AllMmtUnitTestSuite
|
||||
{
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.5.5
|
||||
TRANSFORMERS_TAG=2.5.7-A1
|
||||
SOLR6_TAG=2.0.2
|
||||
POSTGRES_TAG=13.3
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -347,13 +347,30 @@ public class GetSitesTests extends RestTest
|
||||
public void checkPaginationWithSkipCountAndMaxItems() throws Exception
|
||||
{
|
||||
sites = restClient.authenticateUser(regularUser).withParams("skipCount=10&maxItems=110").withCoreAPI().getSites();
|
||||
|
||||
int expectedCount;
|
||||
if (sites.getPagination().isHasMoreItems())
|
||||
{
|
||||
expectedCount = sites.getPagination().getMaxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sites.getPagination().getTotalItems() < sites.getPagination().getSkipCount())
|
||||
{
|
||||
expectedCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedCount = sites.getPagination().getTotalItems() - sites.getPagination().getSkipCount();
|
||||
}
|
||||
}
|
||||
|
||||
sites.getPagination().assertThat()
|
||||
.field("totalItems").isNotEmpty().and()
|
||||
.field("maxItems").is("110").and()
|
||||
.field("hasMoreItems").is((sites.getPagination().getTotalItems() - sites.getPagination().getSkipCount() > sites.getPagination().getMaxItems())?"true":"false").and()
|
||||
.field("skipCount").is("10").and()
|
||||
.field("count").is((sites.getPagination().isHasMoreItems()) ? sites.getPagination().getMaxItems()
|
||||
: sites.getPagination().getTotalItems() - sites.getPagination().getSkipCount());
|
||||
.field("count").is(expectedCount);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION})
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
32
pom.xml
32
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.92-SNAPSHOT</version>
|
||||
<version>14.111-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.7</dependency.alfresco-transform-model.version>
|
||||
<dependency.alfresco-transform-model.version>1.4.9</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.0</dependency.jackson.version>
|
||||
<dependency.jackson.version>2.13.1</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>
|
||||
@@ -71,9 +71,9 @@
|
||||
<dependency.httpclient.version>4.5.13</dependency.httpclient.version>
|
||||
<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.33</dependency.slf4j.version>
|
||||
<dependency.gytheio.version>0.12</dependency.gytheio.version>
|
||||
<dependency.xercesImpl.version>2.12.2</dependency.xercesImpl.version>
|
||||
<dependency.slf4j.version>1.7.35</dependency.slf4j.version>
|
||||
<dependency.gytheio.version>0.13</dependency.gytheio.version>
|
||||
<dependency.groovy.version>3.0.9</dependency.groovy.version>
|
||||
<dependency.tika.version>2.2.1</dependency.tika.version>
|
||||
<dependency.spring-security.version>5.6.1</dependency.spring-security.version>
|
||||
@@ -102,23 +102,23 @@
|
||||
<dependency.jakarta-jws-api.version>2.1.0</dependency.jakarta-jws-api.version>
|
||||
<dependency.jakarta-mail-api.version>1.6.5</dependency.jakarta-mail-api.version>
|
||||
<dependency.jakarta-json-api.version>1.1.6</dependency.jakarta-json-api.version>
|
||||
<dependency.jakarta-json-path.version>2.5.0</dependency.jakarta-json-path.version>
|
||||
<dependency.jakarta-json-path.version>2.7.0</dependency.jakarta-json-path.version>
|
||||
<dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
|
||||
|
||||
<alfresco.googledrive.version>3.2.1.3</alfresco.googledrive.version>
|
||||
<alfresco.aos-module.version>1.4.0.1</alfresco.aos-module.version>
|
||||
<alfresco.api-explorer.version>7.2.0-M2</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
|
||||
<alfresco.api-explorer.version>7.2.0-A3</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
|
||||
|
||||
<alfresco.maven-plugin.version>2.2.0</alfresco.maven-plugin.version>
|
||||
<license-maven-plugin.version>2.0.1.alfresco-1</license-maven-plugin.version>
|
||||
|
||||
<dependency.postgresql.version>42.3.1</dependency.postgresql.version>
|
||||
<dependency.postgresql.version>42.3.2</dependency.postgresql.version>
|
||||
<dependency.mysql.version>8.0.27</dependency.mysql.version>
|
||||
<dependency.mysql-image.version>8</dependency.mysql-image.version>
|
||||
<dependency.mariadb.version>2.7.4</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.47</dependency.tas-utility.version>
|
||||
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
|
||||
<dependency.tas-restapi.version>1.68</dependency.tas-restapi.version>
|
||||
<dependency.tas-restapi.version>1.71</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.31</dependency.tas-cmis.version>
|
||||
<dependency.tas-email.version>1.8</dependency.tas-email.version>
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
@@ -563,6 +563,12 @@
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-log-sanitizer</artifactId>
|
||||
<version>${dependency.alfresco-log-sanitizer.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
@@ -606,7 +612,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<version>${dependency.slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -631,7 +637,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
<artifactId>junrar</artifactId>
|
||||
<version>7.4.0</version>
|
||||
<version>7.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.fge</groupId>
|
||||
@@ -850,7 +856,7 @@
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.12</version>
|
||||
<version>0.10.2</version>
|
||||
</dependency>
|
||||
<!-- swagger parser -->
|
||||
<dependency>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -26,18 +26,28 @@
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.content.directurl.DirectAccessUrlDisabledException;
|
||||
import org.alfresco.rest.api.DirectAccessUrlHelper;
|
||||
import org.alfresco.rest.api.Renditions;
|
||||
import org.alfresco.rest.api.model.DirectAccessUrlRequest;
|
||||
import org.alfresco.rest.api.model.Rendition;
|
||||
import org.alfresco.rest.framework.BinaryProperties;
|
||||
import org.alfresco.rest.framework.Operation;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.WebApiParam;
|
||||
import org.alfresco.rest.framework.core.ResourceParameter;
|
||||
import org.alfresco.rest.framework.core.exceptions.DisabledServiceException;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceBinaryAction;
|
||||
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
@@ -53,6 +63,7 @@ import org.springframework.extensions.webscripts.Status;
|
||||
* - GET /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}
|
||||
* - DELETE /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}
|
||||
* - GET /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content
|
||||
* - POST /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/request-direct-access-url
|
||||
*
|
||||
* @author janv
|
||||
*/
|
||||
@@ -65,12 +76,18 @@ public class NodeVersionRenditionsRelation implements RelationshipResourceAction
|
||||
InitializingBean
|
||||
{
|
||||
private Renditions renditions;
|
||||
private DirectAccessUrlHelper directAccessUrlHelper;
|
||||
|
||||
public void setRenditions(Renditions renditions)
|
||||
{
|
||||
this.renditions = renditions;
|
||||
}
|
||||
|
||||
public void setDirectAccessUrlHelper(DirectAccessUrlHelper directAccessUrlHelper)
|
||||
{
|
||||
this.directAccessUrlHelper = directAccessUrlHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
@@ -117,6 +134,36 @@ public class NodeVersionRenditionsRelation implements RelationshipResourceAction
|
||||
return renditions.getContent(nodeRef, versionId, renditionId, parameters);
|
||||
}
|
||||
|
||||
@Operation ("request-direct-access-url")
|
||||
@WebApiParam (name = "directAccessUrlRequest",
|
||||
title = "Request direct access url",
|
||||
description = "Options for direct access url request",
|
||||
kind = ResourceParameter.KIND.HTTP_BODY_OBJECT)
|
||||
@WebApiDescription(title = "Request content url",
|
||||
description="Generates a direct access URL.",
|
||||
successStatus = HttpServletResponse.SC_OK)
|
||||
public DirectAccessUrl requestContentDirectUrl(String nodeId,
|
||||
String versionId,
|
||||
DirectAccessUrlRequest directAccessUrlRequest,
|
||||
Parameters parameters, WithResponse withResponse)
|
||||
{
|
||||
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
|
||||
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
|
||||
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
String renditionId = parameters.getRelationship2Id();
|
||||
|
||||
DirectAccessUrl directAccessUrl;
|
||||
try
|
||||
{
|
||||
directAccessUrl = renditions.requestContentDirectUrl(nodeRef, versionId, renditionId, attachment, validFor);
|
||||
}
|
||||
catch (DirectAccessUrlDisabledException ex)
|
||||
{
|
||||
throw new DisabledServiceException(ex.getMessage());
|
||||
}
|
||||
return directAccessUrl;
|
||||
}
|
||||
|
||||
@WebApiDescription(title = "Delete rendition")
|
||||
@Override
|
||||
public void delete(String nodeId, String versionId, Parameters parameters)
|
||||
|
@@ -1452,6 +1452,7 @@
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeVersionRenditionsRelation">
|
||||
<property name="renditions" ref="Renditions" />
|
||||
<property name="directAccessUrlHelper" ref="directAccessUrlHelper" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.quicksharelinks.QuickShareLinkRenditionsRelation">
|
||||
|
@@ -53,6 +53,7 @@ import org.junit.runners.Suite;
|
||||
org.alfresco.rest.api.tests.NodeApiTest.class,
|
||||
org.alfresco.rest.api.tests.NodeAssociationsApiTest.class,
|
||||
org.alfresco.rest.api.tests.NodeVersionsApiTest.class,
|
||||
org.alfresco.rest.api.tests.NodeVersionRenditionsApiTest.class,
|
||||
org.alfresco.rest.api.tests.QueriesNodesApiTest.class,
|
||||
org.alfresco.rest.api.tests.QueriesPeopleApiTest.class,
|
||||
org.alfresco.rest.api.tests.QueriesSitesApiTest.class,
|
||||
|
@@ -25,6 +25,8 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.tests;
|
||||
|
||||
import org.alfresco.repo.content.directurl.SystemWideDirectUrlConfig;
|
||||
import org.alfresco.rest.api.impl.directurl.RestApiDirectUrlConfig;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiHttpClient;
|
||||
import static org.alfresco.rest.api.tests.util.RestApiUtil.toJsonAsString;
|
||||
import static org.alfresco.rest.api.tests.util.RestApiUtil.toJsonAsStringNonNull;
|
||||
@@ -219,6 +221,11 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
return URL_NODES + "/" + nodeId + "/" + REQUEST_DIRECT_ACCESS_URL;
|
||||
}
|
||||
|
||||
protected String getRequestVersionRenditionContentDirectUrl(String nodeId, String versionId, String renditionId)
|
||||
{
|
||||
return getNodeVersionRenditionIdUrl(nodeId, versionId, renditionId) + "/" + REQUEST_DIRECT_ACCESS_URL;
|
||||
}
|
||||
|
||||
protected String getRequestArchivedContentDirectUrl(String nodeId)
|
||||
{
|
||||
return URL_DELETED_NODES + "/" + nodeId + "/" + REQUEST_DIRECT_ACCESS_URL;
|
||||
@@ -229,6 +236,17 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
return URL_DELETED_NODES + "/" + nodeId + "/" + URL_RENDITIONS + "/" + renditionID + "/" + REQUEST_DIRECT_ACCESS_URL;
|
||||
}
|
||||
|
||||
protected String getRequestRenditionDirectAccessUrl(String nodeId, String renditionID)
|
||||
{
|
||||
return URL_NODES + "/" + nodeId + "/" + URL_RENDITIONS + "/" + renditionID + "/" + REQUEST_DIRECT_ACCESS_URL;
|
||||
}
|
||||
|
||||
protected String getRequestVersionDirectAccessUrl(String nodeId, String versionId)
|
||||
{
|
||||
return URL_NODES + "/" + nodeId + "/" + URL_VERSIONS + "/" + versionId + "/" + REQUEST_DIRECT_ACCESS_URL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The api scope. either public or private
|
||||
*
|
||||
@@ -724,6 +742,18 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
return createNode(parentId, folderName, TYPE_CM_FOLDER, props, Folder.class);
|
||||
}
|
||||
|
||||
protected String createUniqueFolder(String parentId) throws Exception
|
||||
{
|
||||
return createFolder(parentId, "folder-" + System.currentTimeMillis()).getId();
|
||||
}
|
||||
|
||||
protected String createUniqueContent(String folderId) throws Exception
|
||||
{
|
||||
Document documentResp = createTextFile(folderId, "file-" + System.currentTimeMillis(),
|
||||
"some text-" + System.currentTimeMillis(), "UTF-8", null);
|
||||
return documentResp.getId();
|
||||
}
|
||||
|
||||
protected Node createNode(String parentId, String nodeName, String nodeType, Map<String, Object> props) throws Exception
|
||||
{
|
||||
return createNode(parentId, nodeName, nodeType, props, Node.class);
|
||||
@@ -1075,5 +1105,20 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
return URL_NODES + "/" + nodeId;
|
||||
}
|
||||
|
||||
protected void enableRestDirectAccessUrls()
|
||||
{
|
||||
SystemWideDirectUrlConfig systemDauConfig = (SystemWideDirectUrlConfig) applicationContext.getBean("systemWideDirectUrlConfig");
|
||||
systemDauConfig.setEnabled(true);
|
||||
RestApiDirectUrlConfig restDauConfig = (RestApiDirectUrlConfig) applicationContext.getBean("restApiDirectUrlConfig");
|
||||
restDauConfig.setEnabled(true);
|
||||
}
|
||||
|
||||
protected void disableRestDirectAccessUrls()
|
||||
{
|
||||
SystemWideDirectUrlConfig systemDauConfig = (SystemWideDirectUrlConfig) applicationContext.getBean("systemWideDirectUrlConfig");
|
||||
systemDauConfig.setEnabled(false);
|
||||
RestApiDirectUrlConfig restDauConfig = (RestApiDirectUrlConfig) applicationContext.getBean("restApiDirectUrlConfig");
|
||||
restDauConfig.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6279,92 +6279,70 @@ public class NodeApiTest extends AbstractSingleNetworkSiteTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestVersionsContentDirectUrl() throws Exception
|
||||
public void testRequestContentDirectUrlClientErrorResponseForNodes() throws Exception
|
||||
{
|
||||
enableRestDirectAccessUrls();
|
||||
|
||||
//Node does not exist
|
||||
setRequestContext(user1);
|
||||
|
||||
String myNodeId = getMyNodeId();
|
||||
HttpResponse nodeDoesNotExistResponse = post(getRequestContentDirectUrl("non-existing-node-id"), null, 404);
|
||||
|
||||
Document d1 = new Document();
|
||||
d1.setName("d1.txt");
|
||||
d1.setNodeType(TYPE_CM_CONTENT);
|
||||
//Node is not a file
|
||||
String folderId = createFolder(tDocLibNodeId, "some-folder-name").getId();
|
||||
HttpResponse nodeIsNotAFileReponse = post(getRequestContentDirectUrl(folderId), null, 400);
|
||||
|
||||
// create *empty* text file - as of now, versioning is not enabled by default
|
||||
HttpResponse response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1), 201);
|
||||
Document documentResp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
|
||||
String docId = documentResp.getId();
|
||||
assertFalse(documentResp.getAspectNames().contains("cm:versionable"));
|
||||
assertNull(documentResp.getProperties()); // no properties (ie. no "cm:versionLabel")
|
||||
|
||||
int majorVersion = 1;
|
||||
int minorVersion = 0;
|
||||
|
||||
String content = "The quick brown fox jumps over the lazy dog ";
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("comment", "my version ");
|
||||
|
||||
documentResp = updateTextFile(docId, content, params);
|
||||
assertTrue(documentResp.getAspectNames().contains("cm:versionable"));
|
||||
assertNotNull(documentResp.getProperties());
|
||||
assertEquals(majorVersion+"."+minorVersion, documentResp.getProperties().get("cm:versionLabel"));
|
||||
|
||||
final String contentNodeId = documentResp.getId();
|
||||
|
||||
// Check the upload response
|
||||
assertNotNull(documentResp.getProperties());
|
||||
assertTrue(documentResp.getAspectNames().contains("cm:versionable"));
|
||||
ContentInfo contentInfo = documentResp.getContent();
|
||||
assertNotNull(contentInfo);
|
||||
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, contentInfo.getMimeType());
|
||||
|
||||
HttpResponse dauResponse = post(getRequestContentDirectUrl(contentNodeId), null, null, null, null, 501);
|
||||
disableRestDirectAccessUrls();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestRenditionContentDirectUrl() throws Exception
|
||||
public void testRequestContentDirectUrlClientErrorResponseForVersions() throws Exception
|
||||
{
|
||||
enableRestDirectAccessUrls();
|
||||
// Create a document
|
||||
setRequestContext(user1);
|
||||
|
||||
RepoService.TestNetwork networkN1;
|
||||
RepoService.TestPerson userOneN1;
|
||||
Site userOneN1Site;
|
||||
String folderNodeId = createUniqueFolder(getMyNodeId());
|
||||
String contentNodeId = createUniqueContent(folderNodeId);
|
||||
|
||||
networkN1 = repoService.createNetworkWithAlias("ping", true);
|
||||
networkN1.create();
|
||||
userOneN1 = networkN1.createUser();
|
||||
// Verify versions
|
||||
HttpResponse versionIdDoesNotExistReponse = post(getRequestVersionDirectAccessUrl(contentNodeId, "1.2"), null, null, null, null, 404);
|
||||
HttpResponse versionIdInvalidReponse = post(getRequestVersionDirectAccessUrl(contentNodeId, "invalid-version"), null, null, null, null, 404);
|
||||
|
||||
setRequestContext(networkN1.getId(), userOneN1.getId(), null);
|
||||
disableRestDirectAccessUrls();
|
||||
}
|
||||
|
||||
String siteTitle = "RandomSite" + System.currentTimeMillis();
|
||||
userOneN1Site = createSite(siteTitle, SiteVisibility.PRIVATE);
|
||||
@Test
|
||||
public void testRequestContentDirectUrlClientErrorResponseForRenditions() throws Exception
|
||||
{
|
||||
enableRestDirectAccessUrls();
|
||||
// Create a document
|
||||
setRequestContext(user1);
|
||||
|
||||
// Create a folder within the site document's library
|
||||
String folderName = "folder" + System.currentTimeMillis();
|
||||
String parentId = getSiteContainerNodeId(userOneN1Site.getId(), "documentLibrary");
|
||||
String folder_Id = createNode(parentId, folderName, TYPE_CM_FOLDER, null).getId();
|
||||
String folderNodeId = createUniqueFolder(getMyNodeId());
|
||||
String contentNodeId = createUniqueContent(folderNodeId);
|
||||
|
||||
// Create multipart request - pdf file
|
||||
String renditionName = "doclib";
|
||||
String fileName = "quick.pdf";
|
||||
File file = getResourceFile(fileName);
|
||||
MultiPartRequest reqBody = MultiPartBuilder.create()
|
||||
.setFileData(new FileData(fileName, file))
|
||||
.setRenditions(Collections.singletonList(renditionName))
|
||||
.build();
|
||||
// Verify renditions
|
||||
HttpResponse renditionIdDoesNotExistReponse = post(getRequestRenditionDirectAccessUrl(contentNodeId, "pdf"), null, null, null, null, 404);
|
||||
HttpResponse renditionIdInvalidReponse = post(getRequestRenditionDirectAccessUrl(contentNodeId, "invalid-rendition"), null, null, null, null, 404);
|
||||
|
||||
// Upload quick.pdf file into 'folder' - including request to create 'doclib' thumbnail
|
||||
HttpResponse response = post(getNodeChildrenUrl(folder_Id), reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||
Document document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
String contentNodeId = document.getId();
|
||||
disableRestDirectAccessUrls();
|
||||
}
|
||||
|
||||
// wait and check that rendition is created ...
|
||||
Rendition rendition = waitAndGetRendition(contentNodeId, null, renditionName);
|
||||
assertNotNull(rendition);
|
||||
assertEquals(Rendition.RenditionStatus.CREATED, rendition.getStatus());
|
||||
@Test
|
||||
public void testRequestContentDirectUrlClientErrorResponseForDeletion() throws Exception
|
||||
{
|
||||
enableRestDirectAccessUrls();
|
||||
// Create a document
|
||||
setRequestContext(user1);
|
||||
|
||||
HttpResponse dauResponse = post(getRequestContentDirectUrl(contentNodeId), null, null, null, null, 501);
|
||||
String folderNodeId = createUniqueFolder(getMyNodeId());
|
||||
String contentNodeId = createUniqueContent(folderNodeId);
|
||||
|
||||
// Verify deletion
|
||||
HttpResponse nodeNotDeletedReponse = post(getRequestArchivedContentDirectUrl(contentNodeId), null, null, null, null, 404);
|
||||
|
||||
disableRestDirectAccessUrls();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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
|
||||
@@ -27,20 +27,32 @@ package org.alfresco.rest.api.tests;
|
||||
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.web.scripts.RepositoryContainer;
|
||||
import org.alfresco.rest.AbstractSingleNetworkSiteTest;
|
||||
import org.alfresco.rest.api.DirectAccessUrlHelper;
|
||||
import org.alfresco.rest.api.impl.directurl.RestApiDirectUrlConfig;
|
||||
import org.alfresco.rest.api.model.Site;
|
||||
import org.alfresco.rest.api.nodes.NodesEntityResource;
|
||||
import org.alfresco.rest.api.tests.client.HttpResponse;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiClient.Paging;
|
||||
import org.alfresco.rest.api.tests.client.data.ContentInfo;
|
||||
import org.alfresco.rest.api.tests.client.data.Document;
|
||||
import org.alfresco.rest.api.tests.client.data.Node;
|
||||
import org.alfresco.rest.api.tests.client.data.Rendition;
|
||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder;
|
||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder.FileData;
|
||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder.MultiPartRequest;
|
||||
import org.alfresco.rest.api.tests.util.RestApiUtil;
|
||||
import static org.alfresco.rest.api.tests.util.RestApiUtil.toJsonAsString;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -273,6 +285,138 @@ public class NodeVersionRenditionsApiTest extends AbstractSingleNetworkSiteTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestVersionRenditionContentDirectUrl() throws Exception
|
||||
{
|
||||
setRequestContext(user1);
|
||||
|
||||
RepoService.TestNetwork networkN1;
|
||||
RepoService.TestPerson userOneN1;
|
||||
Site userOneN1Site;
|
||||
|
||||
networkN1 = repoService.createNetworkWithAlias("ping", true);
|
||||
networkN1.create();
|
||||
userOneN1 = networkN1.createUser();
|
||||
|
||||
setRequestContext(networkN1.getId(), userOneN1.getId(), null);
|
||||
|
||||
String siteTitle = "RandomSite" + System.currentTimeMillis();
|
||||
userOneN1Site = createSite(siteTitle, SiteVisibility.PRIVATE);
|
||||
|
||||
String PROP_LTM = "cm:lastThumbnailModification";
|
||||
|
||||
String RENDITION_NAME = "imgpreview";
|
||||
|
||||
String userId = userOneN1.getId();
|
||||
setRequestContext(networkN1.getId(), userOneN1.getId(), null);
|
||||
|
||||
// Create a folder within the site document's library
|
||||
String folderName = "folder" + System.currentTimeMillis();
|
||||
String parentId = getSiteContainerNodeId(userOneN1Site.getId(), "documentLibrary");
|
||||
String folder_Id = createNode(parentId, folderName, TYPE_CM_FOLDER, null).getId();
|
||||
|
||||
// Create multipart request - pdf file
|
||||
String fileName = "quick.pdf";
|
||||
File file = getResourceFile(fileName);
|
||||
MultiPartRequest reqBody = MultiPartBuilder.create()
|
||||
.setFileData(new FileData(fileName, file))
|
||||
.build();
|
||||
Map<String, String> params = Collections.singletonMap("include", "properties");
|
||||
|
||||
// Upload quick.pdf file into 'folder' - do not include request to create 'doclib' thumbnail
|
||||
HttpResponse response = post(getNodeChildrenUrl(folder_Id), reqBody.getBody(), params, null, "alfresco", reqBody.getContentType(), 201);
|
||||
Document document1 = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
String contentNodeId = document1.getId();
|
||||
assertNotNull(document1.getProperties());
|
||||
|
||||
// pause briefly
|
||||
Thread.sleep(DELAY_IN_MS);
|
||||
|
||||
// Get rendition (not created yet) information for node
|
||||
response = getSingle(getNodeRenditionsUrl(contentNodeId), RENDITION_NAME, 200);
|
||||
Rendition rendition = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Rendition.class);
|
||||
assertNotNull(rendition);
|
||||
assertEquals(Rendition.RenditionStatus.NOT_CREATED, rendition.getStatus());
|
||||
|
||||
params = new HashMap<>();
|
||||
params.put("placeholder", "false");
|
||||
getSingle(getNodeRenditionsUrl(contentNodeId), (RENDITION_NAME + "/content"), params, 404);
|
||||
|
||||
// Create and get 'imgpreview' rendition
|
||||
rendition = createAndGetRendition(contentNodeId, RENDITION_NAME);
|
||||
assertNotNull(rendition);
|
||||
|
||||
params = new HashMap<>();
|
||||
params.put("placeholder", "false");
|
||||
response = getSingle(getNodeRenditionsUrl(contentNodeId), (RENDITION_NAME + "/content"), params, 200);
|
||||
|
||||
byte[] renditionBytes1 = response.getResponseAsBytes();
|
||||
assertNotNull(renditionBytes1);
|
||||
|
||||
// check node details ...
|
||||
params = Collections.singletonMap("include", "properties");
|
||||
response = getSingle(NodesEntityResource.class, contentNodeId, params, 200);
|
||||
Document document1b = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
assertEquals(document1b.getModifiedByUser().getId(), document1.getModifiedByUser().getId());
|
||||
|
||||
// upload another version of "quick.pdf" and check again
|
||||
fileName = "quick-2.pdf";
|
||||
file = getResourceFile(fileName);
|
||||
reqBody = MultiPartBuilder.create()
|
||||
.setFileData(new FileData("quick.pdf", file))
|
||||
.setOverwrite(true)
|
||||
.build();
|
||||
|
||||
response = post(getNodeChildrenUrl(folder_Id), reqBody.getBody(), null, null, "alfresco", reqBody.getContentType(), 201);
|
||||
Document document2 = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
assertEquals(contentNodeId, document2.getId());
|
||||
|
||||
// wait to allow new version of the rendition to be created ...
|
||||
Thread.sleep(DELAY_IN_MS * 4);
|
||||
|
||||
params = new HashMap<>();
|
||||
params.put("placeholder", "false");
|
||||
response = getSingle(getNodeRenditionsUrl(contentNodeId), (RENDITION_NAME + "/content"), params, 200);
|
||||
assertNotNull(response.getResponseAsBytes());
|
||||
|
||||
// check rendition binary has changed
|
||||
assertNotEquals(renditionBytes1, response.getResponseAsBytes());
|
||||
|
||||
params = Collections.singletonMap("include", "properties");
|
||||
response = getSingle(NodesEntityResource.class, contentNodeId, params, 200);
|
||||
Document document2b = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
|
||||
String contentNodeId2b = document2b.getId();
|
||||
HttpResponse dauResponse = post(getRequestVersionRenditionContentDirectUrl(contentNodeId2b, "1.0", RENDITION_NAME), null, null, null, null, 501);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestVersionRenditionContentDirectUrlErrorResponses () throws Exception
|
||||
{
|
||||
setRequestContext(user1);
|
||||
|
||||
String folderNodeId = createUniqueFolder(getMyNodeId());
|
||||
String contentNodeId = createUniqueContent(folderNodeId);
|
||||
createVersionRendition(contentNodeId, "1.0", "doclib");
|
||||
|
||||
// REST direct access URLs must be enabled in order to test DAU error responses
|
||||
enableRestDirectAccessUrls();
|
||||
|
||||
// Test error response for node does not exist
|
||||
HttpResponse dauResponseForNoSuchNode = post(getRequestVersionRenditionContentDirectUrl("nosuchnode", "1.0", "doclib"), null, 404);
|
||||
|
||||
// Test error response for node is not a file
|
||||
HttpResponse dauResponseForNodeIsNotAFile = post(getRequestVersionRenditionContentDirectUrl(folderNodeId, "1.0", "doclib"), null, 400);
|
||||
|
||||
// Test error response for version does not exist
|
||||
HttpResponse dauResponseForNoSuchVersion = post(getRequestVersionRenditionContentDirectUrl(contentNodeId, "2.0", "doclib"), null, 404);
|
||||
|
||||
// Test error response for rendition does not exist
|
||||
HttpResponse dauResponseForNoSuchRendition = post(getRequestVersionRenditionContentDirectUrl(contentNodeId, "1.0", "avatar"), null, 404);
|
||||
|
||||
disableRestDirectAccessUrls();
|
||||
}
|
||||
|
||||
private void checkCreateAndGetVersionRendition(String docId, String versionId, String renditionId) throws Exception
|
||||
{
|
||||
String getRenditionsUrl;
|
||||
@@ -361,6 +505,12 @@ public class NodeVersionRenditionsApiTest extends AbstractSingleNetworkSiteTest
|
||||
assertTrue(contentInfo.getSizeInBytes() > 0);
|
||||
}
|
||||
|
||||
private void createVersionRendition(String contentNodeId, String versionId, String renditionId) throws Exception
|
||||
{
|
||||
getAll(getNodeVersionRenditionsUrl(contentNodeId, versionId), null, 200);
|
||||
checkCreateAndGetVersionRendition(contentNodeId, versionId, renditionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScope()
|
||||
{
|
||||
|
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.tests;
|
||||
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.rest.AbstractSingleNetworkSiteTest;
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.rest.api.model.VersionOptions;
|
||||
@@ -33,6 +34,7 @@ import org.alfresco.rest.api.tests.client.HttpResponse;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiClient;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiClient.Paging;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiHttpClient;
|
||||
import org.alfresco.rest.api.tests.client.data.ContentInfo;
|
||||
import org.alfresco.rest.api.tests.client.data.Document;
|
||||
import org.alfresco.rest.api.tests.client.data.Node;
|
||||
import org.alfresco.rest.api.tests.util.RestApiUtil;
|
||||
@@ -1083,6 +1085,50 @@ public class NodeVersionsApiTest extends AbstractSingleNetworkSiteTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestVersionsContentDirectUrl() throws Exception
|
||||
{
|
||||
setRequestContext(user1);
|
||||
|
||||
String myNodeId = getMyNodeId();
|
||||
|
||||
Document d1 = new Document();
|
||||
d1.setName("d1.txt");
|
||||
d1.setNodeType(TYPE_CM_CONTENT);
|
||||
|
||||
// create *empty* text file - as of now, versioning is not enabled by default
|
||||
HttpResponse response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1), 201);
|
||||
Document documentResp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
|
||||
String docId = documentResp.getId();
|
||||
assertFalse(documentResp.getAspectNames().contains("cm:versionable"));
|
||||
assertNull(documentResp.getProperties()); // no properties (ie. no "cm:versionLabel")
|
||||
|
||||
int majorVersion = 1;
|
||||
int minorVersion = 0;
|
||||
|
||||
String content = "The quick brown fox jumps over the lazy dog ";
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("comment", "my version ");
|
||||
|
||||
documentResp = updateTextFile(docId, content, params);
|
||||
assertTrue(documentResp.getAspectNames().contains("cm:versionable"));
|
||||
assertNotNull(documentResp.getProperties());
|
||||
assertEquals(majorVersion+"."+minorVersion, documentResp.getProperties().get("cm:versionLabel"));
|
||||
|
||||
final String contentNodeId = documentResp.getId();
|
||||
|
||||
// Check the upload response
|
||||
assertNotNull(documentResp.getProperties());
|
||||
assertTrue(documentResp.getAspectNames().contains("cm:versionable"));
|
||||
ContentInfo contentInfo = documentResp.getContent();
|
||||
assertNotNull(contentInfo);
|
||||
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, contentInfo.getMimeType());
|
||||
|
||||
HttpResponse dauResponse = post(getRequestVersionDirectAccessUrl(contentNodeId, majorVersion+"."+minorVersion), null, null, null, null, 501);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test version creation when updating file binary content.
|
||||
*
|
||||
|
@@ -515,6 +515,51 @@ public class RenditionsTest extends AbstractBaseApiTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestRenditionContentDirectUrl() throws Exception
|
||||
{
|
||||
setRequestContext(user1);
|
||||
|
||||
RepoService.TestNetwork networkN1;
|
||||
RepoService.TestPerson userOneN1;
|
||||
Site userOneN1Site;
|
||||
|
||||
networkN1 = repoService.createNetworkWithAlias("ping", true);
|
||||
networkN1.create();
|
||||
userOneN1 = networkN1.createUser();
|
||||
|
||||
setRequestContext(networkN1.getId(), userOneN1.getId(), null);
|
||||
|
||||
String siteTitle = "RandomSite" + System.currentTimeMillis();
|
||||
userOneN1Site = createSite(siteTitle, SiteVisibility.PRIVATE);
|
||||
|
||||
// Create a folder within the site document's library
|
||||
String folderName = "folder" + System.currentTimeMillis();
|
||||
String parentId = getSiteContainerNodeId(userOneN1Site.getId(), "documentLibrary");
|
||||
String folder_Id = createNode(parentId, folderName, TYPE_CM_FOLDER, null).getId();
|
||||
|
||||
// Create multipart request - pdf file
|
||||
String renditionName = "doclib";
|
||||
String fileName = "quick.pdf";
|
||||
File file = getResourceFile(fileName);
|
||||
MultiPartRequest reqBody = MultiPartBuilder.create()
|
||||
.setFileData(new FileData(fileName, file))
|
||||
.setRenditions(Collections.singletonList(renditionName))
|
||||
.build();
|
||||
|
||||
// Upload quick.pdf file into 'folder' - including request to create 'doclib' thumbnail
|
||||
HttpResponse response = post(getNodeChildrenUrl(folder_Id), reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||
Document document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
String contentNodeId = document.getId();
|
||||
|
||||
// wait and check that rendition is created ...
|
||||
Rendition rendition = waitAndGetRendition(contentNodeId, null, renditionName);
|
||||
assertNotNull(rendition);
|
||||
assertEquals(Rendition.RenditionStatus.CREATED, rendition.getStatus());
|
||||
|
||||
HttpResponse dauResponse = post(getRequestRenditionDirectAccessUrl(contentNodeId, renditionName), null, null, null, null, 501);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests create rendition when on upload/create of a file
|
||||
*
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.92-SNAPSHOT</version>
|
||||
<version>14.111-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -46,6 +46,10 @@
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
@@ -198,24 +202,6 @@
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-driver-zip</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-file</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.pdfview</groupId>
|
||||
<artifactId>pdfrenderer</artifactId>
|
||||
@@ -237,7 +223,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
|
@@ -86,6 +86,7 @@ public abstract class AbstractLocalTransform implements LocalTransform
|
||||
String renditionName, NodeRef sourceNodeRef)
|
||||
throws UnsupportedTransformationException, ContentIOException;
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2019 Alfresco Software Limited
|
||||
* Copyright (C) 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
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.transform;
|
||||
|
||||
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -49,4 +50,10 @@ public class DummyTransformServiceRegistry implements TransformServiceRegistry
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(CoreFunction function, String transformerName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2019 Alfresco Software Limited
|
||||
* Copyright (C) 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
|
||||
@@ -54,4 +54,9 @@ public interface LocalTransform
|
||||
void transform(ContentReader reader, ContentWriter writer, Map<String, String> transformOptions,
|
||||
String renditionName, NodeRef sourceNodeRef)
|
||||
throws UnsupportedTransformationException, ContentIOException;
|
||||
|
||||
/**
|
||||
* @return the name of the transform.
|
||||
*/
|
||||
String getName();
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2019 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2019 - 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
|
||||
@@ -36,6 +36,7 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||
import org.alfresco.transform.client.model.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.client.registry.CombinedConfig;
|
||||
import org.alfresco.transform.client.model.config.TransformOption;
|
||||
@@ -473,4 +474,17 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
|
||||
}
|
||||
return localTransform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the {@code function} is supported by the transform. Not all transforms are
|
||||
* able to support all functionality, as newer features may have been introduced into the core t-engine code since
|
||||
* it was released.
|
||||
* @param function to be checked.
|
||||
* @param transform the local transform.
|
||||
* @return {@code true} is supported, {@code false} otherwise.
|
||||
*/
|
||||
boolean isSupported(CoreFunction function, LocalTransform transform)
|
||||
{
|
||||
return isSupported(function, transform.getName());
|
||||
}
|
||||
}
|
||||
|
@@ -352,13 +352,20 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks the node up based on the NodeRef of the given node
|
||||
* Looks the entity up based on the ContentURL of the given node
|
||||
*/
|
||||
@Override
|
||||
public Pair<Long, ContentUrlEntity> findByValue(ContentUrlEntity entity)
|
||||
{
|
||||
String contentUrl = entity.getContentUrl();
|
||||
ContentUrlEntity ret = getContentUrlEntity(contentUrl);
|
||||
// Validate if this entity has exactly the value we are looking for or if it is a CRC collision
|
||||
if (ret != null && !entity.getContentUrl().equals(ret.getContentUrl()))
|
||||
{
|
||||
throw new IllegalArgumentException("Collision detected for this contentURL. '" + entity.getContentUrl()
|
||||
+ "' collides with existing contentURL '" + ret.getContentUrl() + "'. (ContentUrlShort;ContentUrlCrc) pair collision: ('"
|
||||
+ entity.getContentUrlShort() + "';'" + entity.getContentUrlCrc() + "')");
|
||||
}
|
||||
return (ret != null ? new Pair<Long, ContentUrlEntity>(ret.getId(), ret) : null);
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.rendition2;
|
||||
|
||||
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -78,4 +79,10 @@ public class SwitchingTransformServiceRegistry implements TransformServiceRegist
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(CoreFunction function, String transformerName)
|
||||
{
|
||||
return primary.isSupported(function, transformerName) && secondary.isSupported(function, transformerName);
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,8 @@ import java.io.StringReader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.alfresco.transform.client.util.RequestParamMap.INCLUDE_CORE_VERSION;
|
||||
|
||||
/**
|
||||
* This class reads multiple T-Engine config and local files and registers as if they were all
|
||||
* in one file. Transform options are shared between all sources.<p>
|
||||
@@ -104,7 +106,7 @@ public class CombinedConfig extends CombinedTransformConfig
|
||||
|
||||
private boolean addRemoteConfig(String baseUrl, String remoteType)
|
||||
{
|
||||
String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "transform/config";
|
||||
String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "transform/config?" + INCLUDE_CORE_VERSION + "=" + true;
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
boolean successReadingConfig = true;
|
||||
try
|
||||
|
@@ -33,9 +33,12 @@
|
||||
<view:properties>
|
||||
<cm:description></cm:description>
|
||||
<cm:name>extensions</cm:name>
|
||||
<cm:isIndexed>false</cm:isIndexed>
|
||||
<cm:isContentIndexed>false</cm:isContentIndexed>
|
||||
</view:properties>
|
||||
<view:aspects>
|
||||
<sys:hidden/>
|
||||
<cm:indexControl/>
|
||||
</view:aspects>
|
||||
</cm:folder>
|
||||
</cm:contains>
|
||||
@@ -50,9 +53,12 @@
|
||||
<view:properties>
|
||||
<cm:description></cm:description>
|
||||
<cm:name>module-deployments</cm:name>
|
||||
<cm:isIndexed>false</cm:isIndexed>
|
||||
<cm:isContentIndexed>false</cm:isContentIndexed>
|
||||
</view:properties>
|
||||
<view:aspects>
|
||||
<sys:hidden/>
|
||||
<cm:indexControl/>
|
||||
</view:aspects>
|
||||
</cm:folder>
|
||||
</cm:contains>
|
||||
|
@@ -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,
|
||||
@@ -119,6 +116,7 @@ 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 - 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
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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)
|
||||
|
@@ -4,27 +4,32 @@
|
||||
* %%
|
||||
* 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;
|
||||
@@ -61,23 +66,26 @@ 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 extends TestCase
|
||||
public class FixedAclUpdaterTest
|
||||
{
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FixedAclUpdaterTest.class);
|
||||
|
||||
@@ -103,7 +111,10 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
private static String TEST_GROUP_NAME_FULL = PermissionService.GROUP_PREFIX + TEST_GROUP_NAME;
|
||||
private static String DEFAULT_PERMISSION = PermissionService.CONTRIBUTOR;
|
||||
|
||||
@Override
|
||||
@Rule
|
||||
public RetryAtMostRule retryAtMostRule = new RetryAtMostRule();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
ctx = ApplicationContextHelper.getApplicationContext();
|
||||
@@ -126,7 +137,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
setFixedAclMaxTransactionTime(permissionsDaoComponent, homeFolderNodeRef, maxTransactionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
@@ -202,6 +213,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Test setting permissions explicitly as async
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsync()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncFolder");
|
||||
@@ -248,6 +260,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* MNT-21847 - Create a new content in folder that has the aspect applied
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeCreation()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCreationFolder");
|
||||
@@ -278,6 +291,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* MNT-22009 - Delete node that has the aspect applied before job runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeDeletion()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeDeletionFolder");
|
||||
@@ -368,6 +382,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* MNT-22040 - Copy node that has the aspect applied before job runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeCopy()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder");
|
||||
@@ -447,6 +462,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* 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");
|
||||
@@ -538,6 +554,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeCopyParentToChildPendingFolder()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder");
|
||||
@@ -649,6 +666,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeMoveChildToChildPendingFolder()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveChildToChildPendingFolderOrigin");
|
||||
@@ -734,6 +752,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* ACL
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithErrorsForceSharedACL()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithErrorsForceSharedACL");
|
||||
@@ -792,6 +811,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* MNT-22040 - Move node that has the aspect applied before job runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeMove()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveOriginFolder");
|
||||
@@ -868,6 +888,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* 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");
|
||||
@@ -956,6 +977,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Lock node that has the aspect applied before job runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeLock()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeLockFolder");
|
||||
@@ -985,6 +1007,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Checkout a node for editing that has the aspect applied before job runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeCheckout()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeCheckoutFolder");
|
||||
@@ -1015,6 +1038,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Update the permissions of a node that has the aspect applied (new permissions: fixed)
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeUpdatePermissionsFixed()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeUpdatePermissionsFixedFolder");
|
||||
@@ -1056,6 +1080,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Update the permissions of a node that has the aspect applied (new permissions: shared)
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeUpdatePermissionsShared()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeUpdatePermissionsSharedFolder");
|
||||
@@ -1094,6 +1119,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* 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");
|
||||
@@ -1135,6 +1161,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* 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");
|
||||
@@ -1173,6 +1200,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
}
|
||||
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncCascadeUpdatePermissions()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncCascadeUpdatePermissionsFolder");
|
||||
@@ -1225,6 +1253,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Update the content of a node that has the aspect applied before job runs
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncWithNodeContentUpdate()
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeContentUpdateFolder");
|
||||
@@ -1257,6 +1286,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* Test setting permissions concurrently to actually cause the expected concurrency exception
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncConcurrentPermissionsUpdate() throws Throwable
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncConcurrentPermissionsUpdateFolder");
|
||||
@@ -1328,6 +1358,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
* exception but the job should be able to recover
|
||||
*/
|
||||
@Test
|
||||
@RetryAtMost(3)
|
||||
public void testAsyncConcurrentUpdateAndJob() throws Throwable
|
||||
{
|
||||
NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncConcurrentUpdateAndJobFolder");
|
||||
@@ -1802,7 +1833,7 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@@ -113,6 +113,31 @@ public class ImporterComponentTest extends BaseSpringTest
|
||||
importerService.importView(testReader, location, null, new ImportTimerProgress());
|
||||
System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportNotIndexedSubfolder() throws Exception
|
||||
{
|
||||
InputStream test = getClass().getClassLoader().getResourceAsStream(
|
||||
"org/alfresco/repo/importer/import_not_indexed_subfolder.xml");
|
||||
|
||||
try (InputStreamReader testReader = new InputStreamReader(test, "UTF-8"))
|
||||
{
|
||||
Location location = new Location(storeRef);
|
||||
importerService.importView(testReader, location, null, new ImportTimerProgress());
|
||||
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
NodeRef testParentFolderRef = nodeService.getChildAssocs(rootNodeRef).get(0).getChildRef();
|
||||
NodeRef testSubfolderRef = nodeService.getChildAssocs(testParentFolderRef).get(0).getChildRef();
|
||||
|
||||
assertFalse("The node's isIndexed property should be false.",
|
||||
DefaultTypeConverter.INSTANCE.convert(Boolean.class,
|
||||
nodeService.getProperty(testSubfolderRef, ContentModel.PROP_IS_INDEXED)));
|
||||
assertFalse("The node's isContentIndexed property should be false.",
|
||||
DefaultTypeConverter.INSTANCE.convert(Boolean.class,
|
||||
nodeService.getProperty(testSubfolderRef, ContentModel.PROP_IS_CONTENT_INDEXED)));
|
||||
assertTrue("The node should be marked with the indexControl aspect.",
|
||||
nodeService.getAspects(testSubfolderRef).contains(ContentModel.ASPECT_INDEX_CONTROL));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportWithAuditableProperties() throws Exception
|
||||
|
@@ -41,6 +41,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -52,6 +53,8 @@ import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.repo.cache.TransactionalCache;
|
||||
import org.alfresco.repo.cache.TransactionalCache.ValueHolder;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.domain.contentdata.ContentDataDAO;
|
||||
import org.alfresco.repo.domain.contentdata.ContentUrlEntity;
|
||||
import org.alfresco.repo.domain.node.Node;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.domain.node.NodeEntity;
|
||||
@@ -95,6 +98,9 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionHistory;
|
||||
import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
@@ -145,12 +151,15 @@ public class NodeServiceTest
|
||||
private static ContentService contentService;
|
||||
private static PermissionService permissionService;
|
||||
private static NodeDAO nodeDAO;
|
||||
private static VersionService versionService;
|
||||
private static TransactionService txnService;
|
||||
private static PolicyComponent policyComponent;
|
||||
private static CannedQueryDAO cannedQueryDAOForTesting;
|
||||
private static SimpleCache<Serializable, ValueHolder<Serializable>> nodesCache;
|
||||
private static SimpleCache<Serializable, ValueHolder<Serializable>> propsCache;
|
||||
private static SimpleCache<Serializable, ValueHolder<Serializable>> aspectsCache;
|
||||
private static SimpleCache<Long, ContentUrlEntity> contentDataCache;
|
||||
private static SimpleCache<Long, ContentUrlEntity> contentUrlCache;
|
||||
|
||||
private static Long deletedTypeQNameId;
|
||||
|
||||
@@ -168,6 +177,7 @@ public class NodeServiceTest
|
||||
contentService = serviceRegistry.getContentService();
|
||||
permissionService = serviceRegistry.getPermissionService();
|
||||
nodeDAO = (NodeDAO) APP_CONTEXT_INIT.getApplicationContext().getBean("nodeDAO");
|
||||
versionService = serviceRegistry.getVersionService();
|
||||
txnService = serviceRegistry.getTransactionService();
|
||||
policyComponent = (PolicyComponent) APP_CONTEXT_INIT.getApplicationContext().getBean("policyComponent");
|
||||
cannedQueryDAOForTesting = (CannedQueryDAO) APP_CONTEXT_INIT.getApplicationContext().getBean("cannedQueryDAOForTesting");
|
||||
@@ -176,11 +186,15 @@ public class NodeServiceTest
|
||||
nodesCache = (SimpleCache<Serializable, ValueHolder<Serializable>>) APP_CONTEXT_INIT.getApplicationContext().getBean("node.nodesSharedCache");
|
||||
propsCache = (SimpleCache<Serializable, ValueHolder<Serializable>>) APP_CONTEXT_INIT.getApplicationContext().getBean("node.propertiesSharedCache");
|
||||
aspectsCache = (SimpleCache<Serializable, ValueHolder<Serializable>>) APP_CONTEXT_INIT.getApplicationContext().getBean("node.aspectsSharedCache");
|
||||
contentDataCache = (SimpleCache<Long, ContentUrlEntity>) APP_CONTEXT_INIT.getApplicationContext().getBean("contentDataCache");
|
||||
contentUrlCache = (SimpleCache<Long, ContentUrlEntity>) APP_CONTEXT_INIT.getApplicationContext().getBean("contentUrlCache");
|
||||
|
||||
// Clear the caches to remove fluff
|
||||
nodesCache.clear();
|
||||
propsCache.clear();
|
||||
aspectsCache.clear();
|
||||
contentDataCache.clear();
|
||||
contentUrlCache.clear();
|
||||
|
||||
AuthenticationUtil.setRunAsUserSystem();
|
||||
|
||||
@@ -2433,6 +2447,125 @@ public class NodeServiceTest
|
||||
return null;
|
||||
}, userName1);
|
||||
}
|
||||
|
||||
/**
|
||||
* See MNT-22710
|
||||
*/
|
||||
@Test
|
||||
public void testChangeContentURLSameCRC()
|
||||
{
|
||||
ContentPropertyRestrictionInterceptor contentPropertyRestrictionInterceptor =
|
||||
(ContentPropertyRestrictionInterceptor) APP_CONTEXT_INIT.getApplicationContext().getBean("contentPropertyRestrictionInterceptor");
|
||||
|
||||
contentPropertyRestrictionInterceptor.setGlobalContentPropertyRestrictionWhiteList(this.getClass().getName());
|
||||
|
||||
try
|
||||
{
|
||||
NodeRef workspaceRootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||
Map<QName, Serializable> props = new HashMap<>(3);
|
||||
props.put(ContentModel.PROP_NAME, GUID.generate());
|
||||
NodeRef testFolder = nodeService.createNode(
|
||||
workspaceRootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName(NAMESPACE, GUID.generate()),
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
|
||||
NodeRef nodeRef1 = nodeService.createNode(
|
||||
testFolder,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName("180225704974-DSA Correspondence 1"),
|
||||
ContentModel.TYPE_CONTENT).getChildRef();
|
||||
|
||||
NodeRef nodeRef2 = nodeService.createNode(
|
||||
testFolder,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName("090502800600-General Correspondence 1"),
|
||||
ContentModel.TYPE_CONTENT).getChildRef();
|
||||
|
||||
// CRC: 2997538036
|
||||
String contentURL1 = "s3v2://contentstore/1597325412593_1610985343942_3708/SLC/IC/DSA/2018/02/16/20/180225704974-DSA Correspondence 1";
|
||||
// CRC: 2921900407
|
||||
String contentURL2 = "s3v2://contentstore/1639588316822_1642775862393_49/SLC/IC/GENERAL/2009/05/27/16/090502800600-General Correspondence 1";
|
||||
// CRC: 2997538036 (same CRC as contentURL1)
|
||||
String contentURL3 = "s3v2://contentstore/1639588316821_1642775862393_49/SLC/IC/GENERAL/2009/05/27/16/090502800600-General Correspondence 1";
|
||||
|
||||
ContentData contentData1 = new ContentData(
|
||||
contentURL1,
|
||||
"application/pdf",
|
||||
100L,
|
||||
"UTF-8"
|
||||
);
|
||||
|
||||
ContentData contentData2 = new ContentData(
|
||||
contentURL2,
|
||||
"application/pdf",
|
||||
100L,
|
||||
"UTF-8"
|
||||
);
|
||||
|
||||
ContentData contentData3 = new ContentData(
|
||||
contentURL3,
|
||||
"application/pdf",
|
||||
100L,
|
||||
"UTF-8"
|
||||
);
|
||||
|
||||
// Setting same contentURLs
|
||||
nodeService.setProperty(nodeRef1, ContentModel.PROP_CONTENT, contentData1);
|
||||
nodeService.setProperty(nodeRef2, ContentModel.PROP_CONTENT, contentData1);
|
||||
|
||||
//Validate the data
|
||||
ContentData cdNode1Val0= (ContentData) nodeService.getProperty(nodeRef1, ContentModel.PROP_CONTENT);
|
||||
ContentData cdNode2Val0= (ContentData) nodeService.getProperty(nodeRef2, ContentModel.PROP_CONTENT);
|
||||
assertEquals("ContentURL for node1 should be contentURL1",contentURL1,cdNode1Val0.getContentUrl());
|
||||
assertEquals("ContentURL for node2 should also be the same as node1",contentURL1,cdNode2Val0.getContentUrl());
|
||||
|
||||
// Setting non colliding URLS
|
||||
nodeService.setProperty(nodeRef2, ContentModel.PROP_CONTENT, contentData2);
|
||||
|
||||
//Validate the data
|
||||
ContentData cdNode1Val1= (ContentData) nodeService.getProperty(nodeRef1, ContentModel.PROP_CONTENT);
|
||||
ContentData cdNode2Val1= (ContentData) nodeService.getProperty(nodeRef2, ContentModel.PROP_CONTENT);
|
||||
assertEquals("ContentURL for node1 should be contentURL1",contentURL1,cdNode1Val1.getContentUrl());
|
||||
assertEquals("ContentURL for node2 should be contentURL2",contentURL2,cdNode2Val1.getContentUrl());
|
||||
|
||||
//Set a colliding URL
|
||||
try
|
||||
{
|
||||
nodeService.setProperty(nodeRef2, ContentModel.PROP_CONTENT, contentData3);
|
||||
fail("Should not be possible to set a contentUrl with the same CRC and different value");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
//Expected
|
||||
}
|
||||
|
||||
//Validate the contentURL values
|
||||
ContentData cdNode1Val2= (ContentData) nodeService.getProperty(nodeRef1, ContentModel.PROP_CONTENT);
|
||||
ContentData cdNode2Val2= (ContentData) nodeService.getProperty(nodeRef2, ContentModel.PROP_CONTENT);
|
||||
assertFalse("Collision detected on node 1",contentURL3.equals(cdNode1Val2.getContentUrl()));
|
||||
assertFalse("Collision detected on node 2",contentURL1.equals(cdNode2Val2.getContentUrl()));
|
||||
|
||||
//Clear caches and validate again
|
||||
propsCache.clear();
|
||||
contentDataCache.clear();
|
||||
contentUrlCache.clear();
|
||||
|
||||
ContentData cdNode1Val3= (ContentData) nodeService.getProperty(nodeRef1, ContentModel.PROP_CONTENT);
|
||||
ContentData cdNode2Val3= (ContentData) nodeService.getProperty(nodeRef2, ContentModel.PROP_CONTENT);
|
||||
assertFalse("Collision detected on node 1 after clear caches",contentURL3.equals(cdNode1Val3.getContentUrl()));
|
||||
assertFalse("Collision detected on node 2 after clear caches",contentURL1.equals(cdNode2Val3.getContentUrl()));
|
||||
|
||||
assertEquals("ContentURL for node1 should be contentURL1",contentURL1,cdNode1Val3.getContentUrl());
|
||||
assertEquals("ContentURL for node2 should be contentURL2",contentURL2,cdNode2Val3.getContentUrl());
|
||||
}
|
||||
finally
|
||||
{
|
||||
contentPropertyRestrictionInterceptor.setGlobalContentPropertyRestrictionWhiteList("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addContentToNode(NodeRef nodeRef)
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2019 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
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.rendition2;
|
||||
|
||||
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -69,4 +70,10 @@ public class TestTransformServiceRegistry implements TransformServiceRegistry
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(CoreFunction function, String transformerName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -99,7 +99,7 @@ public class SecurityTestSuite extends TestSuite
|
||||
|
||||
suite.addTest(new JUnit4TestAdapter(HomeFolderProviderSynchronizerTest.class));
|
||||
suite.addTest(new JUnit4TestAdapter(AlfrescoSSLSocketFactoryTest.class));
|
||||
suite.addTestSuite(FixedAclUpdaterTest.class);
|
||||
suite.addTest(new JUnit4TestAdapter(FixedAclUpdaterTest.class));
|
||||
|
||||
suite.addTestSuite(DefaultRemoteUserMapperTest.class);
|
||||
suite.addTestSuite(IdentityServiceRemoteUserMapperTest.class);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -29,10 +29,16 @@ import static java.util.Collections.emptySet;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.reflections.scanners.Scanners.MethodsAnnotated;
|
||||
import static org.reflections.scanners.Scanners.SubTypes;
|
||||
import static org.reflections.scanners.Scanners.TypesAnnotated;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -49,6 +55,7 @@ import org.junit.experimental.categories.Category;
|
||||
import org.junit.runners.Suite.SuiteClasses;
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.scanners.MethodAnnotationsScanner;
|
||||
import org.reflections.scanners.Scanners;
|
||||
import org.reflections.scanners.SubTypesScanner;
|
||||
import org.reflections.scanners.TypeAnnotationsScanner;
|
||||
|
||||
@@ -69,7 +76,7 @@ public class OmittedTestClassFinderUnitTest
|
||||
public void checkTestClassesReferencedInTestSuites()
|
||||
{
|
||||
// We assume that all of our tests are in org.alfresco.
|
||||
Reflections reflections = new Reflections("org.alfresco", new MethodAnnotationsScanner(), new TypeAnnotationsScanner(), new SubTypesScanner());
|
||||
Reflections reflections = new Reflections("org.alfresco", MethodsAnnotated, TypesAnnotated, SubTypes);
|
||||
|
||||
// Find the test classes which are not in test suites.
|
||||
Set<String> testClasses = getTestClassesOnPath(reflections);
|
||||
@@ -162,13 +169,14 @@ public class OmittedTestClassFinderUnitTest
|
||||
* @param annotation The class of the annotation to look for.
|
||||
* @return The set of canonical names of classes containing methods annotated with the annotation.
|
||||
*/
|
||||
private Set<String> findClassesWithMethodAnnotation(Reflections reflections, Class annotation)
|
||||
private Set<String> findClassesWithMethodAnnotation(Reflections reflections, Class<? extends Annotation> annotation)
|
||||
{
|
||||
return reflections.getStore()
|
||||
.get(MethodAnnotationsScanner.class, annotation.getName())
|
||||
return reflections.getMethodsAnnotatedWith(annotation)
|
||||
.stream()
|
||||
// Get the class name from the method name.
|
||||
.map(methodName -> methodName.split("\\.[^\\.]+\\(")[0])
|
||||
.map(Method::getDeclaringClass)
|
||||
.flatMap(c -> Stream.concat(Stream.of(c), reflections.getSubTypesOf(c).stream()))
|
||||
.map(Class::getCanonicalName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(toSet());
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* #%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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* #%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
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0">
|
||||
<cm:folder view:childName="cm:test-parent-folder">
|
||||
<view:properties>
|
||||
<cm:description>Test Parent Folder</cm:description>
|
||||
<cm:name>test-parent-folder</cm:name>
|
||||
</view:properties>
|
||||
<view:aspects>
|
||||
<sys:hidden />
|
||||
</view:aspects>
|
||||
<cm:contains>
|
||||
<cm:folder view:childName="cm:test-not-indexed-subfolder">
|
||||
<view:properties>
|
||||
<cm:description>Test Subfolder</cm:description>
|
||||
<cm:name>test-not-indexed-subfolder</cm:name>
|
||||
<cm:isIndexed>false</cm:isIndexed>
|
||||
<cm:isContentIndexed>false</cm:isContentIndexed>
|
||||
</view:properties>
|
||||
<view:aspects>
|
||||
<sys:hidden />
|
||||
<cm:indexControl />
|
||||
</view:aspects>
|
||||
</cm:folder>
|
||||
</cm:contains>
|
||||
</cm:folder>
|
||||
</view:view>
|
Reference in New Issue
Block a user