mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-01 14:41:46 +00:00
Compare commits
51 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
abdeddcabf | ||
|
4aa2f30cf6 | ||
|
5984d62107 | ||
|
0035c997ca | ||
|
b9686dc9b2 | ||
|
3e16565272 | ||
|
154efed2eb | ||
|
956ce6c1a2 | ||
|
c68be19071 | ||
|
bcda52f5e2 | ||
|
d92603ef2b | ||
|
9f1abd5db0 | ||
|
c4f567e7ba | ||
|
dd03941907 | ||
|
b5ee3c06a9 | ||
|
5b6d080e8a | ||
|
e03c8a72d1 | ||
|
70e7f68a4b | ||
|
19053341b8 | ||
|
24c41b97cc | ||
|
97de175cde | ||
|
6a719bb5f6 | ||
|
b8a3724ee7 | ||
|
0077d31bed | ||
|
342bd5a103 | ||
|
d848e12981 | ||
|
9cb2b23ef5 | ||
|
7db90ee90c | ||
|
9d0106e000 | ||
|
26c991a563 | ||
|
ddfabba4ba | ||
|
ab7d757412 | ||
|
fe028f5b85 | ||
|
2baf1b9c91 | ||
|
3818f94268 | ||
|
53b41068d4 | ||
|
c302bc31ff | ||
|
9a30044064 | ||
|
41edced9f1 | ||
|
15ca9e21be | ||
|
36bf6d2f81 | ||
|
cf01f167ae | ||
|
4c94059bbf | ||
|
5efe11008d | ||
|
3225eefd0b | ||
|
b6de89aa8d | ||
|
4cc1c10ce5 | ||
|
7641c128c5 | ||
|
a62ad8715e | ||
|
542f189907 | ||
|
a006b5acaf |
57
.travis.yml
57
.travis.yml
@@ -46,11 +46,13 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
|
|
||||||
- name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test"
|
- name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
script:
|
script:
|
||||||
- travis_retry mvn -B test -pl core,data-model
|
- 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 -Dtest=AllUnitTestsSuite
|
||||||
|
|
||||||
- name: "Repository - AppContext01TestSuite"
|
- name: "Repository - AppContext01TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -58,12 +60,14 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Repository - AppContext02TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Repository - AppContext03TestSuite"
|
- name: "Repository - AppContext03TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -71,6 +75,7 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Repository - AppContext04TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -78,6 +83,7 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Repository - AppContext05TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -88,6 +94,7 @@ jobs:
|
|||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth"
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth"
|
||||||
|
|
||||||
- name: "Repository - AppContext06TestSuite"
|
- name: "Repository - AppContext06TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -95,6 +102,7 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Repository - AppContextExtraTestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -102,6 +110,7 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Repository - MiscContextTestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -109,81 +118,85 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Repository - SearchTestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=SearchTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=SearchTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6
|
||||||
|
|
||||||
- name: "Repository - MariaDB 10.2.18 tests"
|
- name: "Repository - MariaDB 10.2.18 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||||
|
|
||||||
- name: "Repository - MariaDB 10.4 tests"
|
- name: "Repository - MariaDB 10.4 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.4 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.4 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||||
|
|
||||||
- name: "Repository - MariaDB 10.5 tests"
|
- name: "Repository - MariaDB 10.5 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.5 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.5 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||||
|
|
||||||
- name: "Repository - MySQL 5.7.23 tests"
|
- name: "Repository - MySQL 5.7.28 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED'
|
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.28 --transaction-isolation='READ-COMMITTED'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Repository - MySQL 8 tests"
|
- name: "Repository - MySQL 8 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:8 --transaction-isolation='READ-COMMITTED'
|
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:8 --transaction-isolation='READ-COMMITTED'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Repository - PostgreSQL 10.9 tests"
|
- name: "Repository - PostgreSQL 10.9 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Repository - PostgreSQL 11.7 tests"
|
- name: "Repository - PostgreSQL 11.7 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Repository - PostgreSQL 12.4 tests"
|
- name: "Repository - PostgreSQL 12.4 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:12.4 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:12.4 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Repository - PostgreSQL 13.1 tests"
|
- name: "Repository - PostgreSQL 13.1 tests"
|
||||||
if: commit_message !~ /\[skip db\]/
|
# We only run DB tests on the latest version of PostgreSQL on feature branches
|
||||||
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Remote-api - AppContext01TestSuite"
|
- name: "Remote-api - AppContext01TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "Remote-api - AppContext02TestSuite"
|
- name: "Remote-api - AppContext02TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -191,6 +204,7 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Remote-api - AppContext03TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -198,6 +212,7 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Remote-api - AppContext04TestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
@@ -205,13 +220,15 @@ jobs:
|
|||||||
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
|
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"
|
- name: "Remote-api - AppContextExtraTestSuite"
|
||||||
|
if: commit_message !~ /\[skip repo\]/
|
||||||
before_script:
|
before_script:
|
||||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||||
|
|
||||||
- name: "REST API TAS tests part1"
|
- name: "REST API TAS tests part1"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
# TAS tests are generally skipped on feature branches as they will be repeated on the enterprise repo or community packaging builds
|
||||||
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -219,7 +236,7 @@ jobs:
|
|||||||
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
|
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "REST API TAS tests part2"
|
- name: "REST API TAS tests part2"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -227,7 +244,7 @@ jobs:
|
|||||||
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
|
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "REST API TAS tests part3"
|
- name: "REST API TAS tests part3"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -235,7 +252,7 @@ jobs:
|
|||||||
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
|
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "CMIS TAS tests - BROWSER binding"
|
- name: "CMIS TAS tests - BROWSER binding"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -243,7 +260,7 @@ jobs:
|
|||||||
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-browser -Denvironment=default -DrunBugs=false
|
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-browser -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "CMIS TAS tests - ATOM binding"
|
- name: "CMIS TAS tests - ATOM binding"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -251,7 +268,7 @@ jobs:
|
|||||||
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-atom -Denvironment=default -DrunBugs=false
|
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-atom -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "CMIS TAS tests - WEBSERVICES binding"
|
- name: "CMIS TAS tests - WEBSERVICES binding"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -259,7 +276,7 @@ jobs:
|
|||||||
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-webservices -Denvironment=default -DrunBugs=false
|
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-webservices -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "Email TAS tests"
|
- name: "Email TAS tests"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -267,7 +284,7 @@ jobs:
|
|||||||
- travis_wait 30 mvn -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
- travis_wait 30 mvn -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "WebDAV TAS tests"
|
- name: "WebDAV TAS tests"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
@@ -275,7 +292,7 @@ jobs:
|
|||||||
- travis_wait 30 mvn -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
- travis_wait 30 mvn -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
- name: "Integration TAS tests"
|
- name: "Integration TAS tests"
|
||||||
if: branch = master OR commit_message =~ /\[tas\]/
|
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||||
before_script:
|
before_script:
|
||||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Data model classes
|
* Alfresco Data model classes
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
@@ -60,12 +60,15 @@ public abstract class ConfigScheduler<Data>
|
|||||||
// Synchronized has little effect in normal operation, but on laptops that are suspended, there can be a number
|
// Synchronized has little effect in normal operation, but on laptops that are suspended, there can be a number
|
||||||
// of Threads calling execute concurrently without it, resulting in errors in the log. Theoretically possible in
|
// of Threads calling execute concurrently without it, resulting in errors in the log. Theoretically possible in
|
||||||
// production but not very likely.
|
// production but not very likely.
|
||||||
public synchronized void execute(JobExecutionContext context) throws JobExecutionException
|
public void execute(JobExecutionContext context) throws JobExecutionException
|
||||||
{
|
{
|
||||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||||
ConfigScheduler configScheduler = (ConfigScheduler)dataMap.get(CONFIG_SCHEDULER);
|
ConfigScheduler configScheduler = (ConfigScheduler)dataMap.get(CONFIG_SCHEDULER);
|
||||||
boolean successReadingConfig = configScheduler.readConfigAndReplace(true);
|
synchronized (configScheduler)
|
||||||
configScheduler.changeScheduleOnStateChange(successReadingConfig);
|
{
|
||||||
|
boolean successReadingConfig = configScheduler.readConfigAndReplace(true);
|
||||||
|
configScheduler.changeScheduleOnStateChange(successReadingConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,6 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# Fetch image based on Tomcat 9.0, Java 11 and Centos 8
|
# Fetch image based on Tomcat 9.0, Java 11 and Centos 8
|
||||||
# More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat
|
# More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat
|
||||||
FROM alfresco/alfresco-base-tomcat:9.0.45-java-11-centos-8
|
FROM alfresco/alfresco-base-tomcat:9.0.52-java-11-centos-7
|
||||||
|
|
||||||
# Set default docker_context.
|
# Set default docker_context.
|
||||||
ARG resource_path=target
|
ARG resource_path=target
|
||||||
@@ -65,12 +65,12 @@ RUN sed -i -e "s_log4j.appender.File.File\=alfresco.log_log4j.appender.File.File
|
|||||||
|
|
||||||
# fontconfig is required by Activiti worflow diagram generator
|
# fontconfig is required by Activiti worflow diagram generator
|
||||||
# installing pinned dependencies as well
|
# installing pinned dependencies as well
|
||||||
RUN yum install -y fontconfig-2.13.1-3.el8 \
|
RUN yum install -y fontconfig-2.13.0-4.3.el7 \
|
||||||
dejavu-fonts-common-2.35-7.el8 \
|
dejavu-fonts-common-2.33-6.el7 \
|
||||||
fontpackages-filesystem-1.44-22.el8 \
|
fontpackages-filesystem-1.44-8.el7 \
|
||||||
freetype-2.9.1-4.el8_3.1 \
|
freetype-2.8-14.el7_9.1 \
|
||||||
libpng-1.6.34-5.el8 \
|
libpng-1.5.13-8.el7 \
|
||||||
dejavu-sans-fonts-2.35-7.el8 && \
|
dejavu-sans-fonts-2.33-6.el7 && \
|
||||||
yum clean all
|
yum clean all
|
||||||
|
|
||||||
# The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,
|
# The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
TRANSFORMERS_TAG=2.4.0
|
TRANSFORMERS_TAG=2.4.0
|
||||||
SOLR6_TAG=2.0.1
|
SOLR6_TAG=2.0.2-RC2
|
||||||
POSTGRES_TAG=13.1
|
POSTGRES_TAG=13.1
|
||||||
ACTIVEMQ_TAG=5.16.1
|
ACTIVEMQ_TAG=5.16.1
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
10
pom.xml
10
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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Alfresco Community Repo Parent</name>
|
<name>Alfresco Community Repo Parent</name>
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<dependency.jackson-databind.version>2.12.3</dependency.jackson-databind.version>
|
<dependency.jackson-databind.version>2.12.3</dependency.jackson-databind.version>
|
||||||
<dependency.cxf.version>3.4.4</dependency.cxf.version>
|
<dependency.cxf.version>3.4.4</dependency.cxf.version>
|
||||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||||
<dependency.webscripts.version>8.19</dependency.webscripts.version>
|
<dependency.webscripts.version>8.27</dependency.webscripts.version>
|
||||||
<dependency.bouncycastle.version>1.69</dependency.bouncycastle.version>
|
<dependency.bouncycastle.version>1.69</dependency.bouncycastle.version>
|
||||||
<dependency.mockito-core.version>3.9.0</dependency.mockito-core.version>
|
<dependency.mockito-core.version>3.9.0</dependency.mockito-core.version>
|
||||||
<dependency.org-json.version>20210307</dependency.org-json.version>
|
<dependency.org-json.version>20210307</dependency.org-json.version>
|
||||||
@@ -78,9 +78,9 @@
|
|||||||
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
||||||
<dependency.poi.version>4.1.2</dependency.poi.version>
|
<dependency.poi.version>4.1.2</dependency.poi.version>
|
||||||
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
|
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
|
||||||
<dependency.keycloak.version>11.0.0-alfresco-001</dependency.keycloak.version>
|
<dependency.keycloak.version>13.0.1</dependency.keycloak.version>
|
||||||
<dependency.jboss.logging.version>3.4.1.Final</dependency.jboss.logging.version>
|
<dependency.jboss.logging.version>3.4.1.Final</dependency.jboss.logging.version>
|
||||||
<dependency.camel.version>3.7.1</dependency.camel.version>
|
<dependency.camel.version>3.7.4</dependency.camel.version>
|
||||||
<dependency.activemq.version>5.16.1</dependency.activemq.version>
|
<dependency.activemq.version>5.16.1</dependency.activemq.version>
|
||||||
<dependency.apache-compress.version>1.20</dependency.apache-compress.version>
|
<dependency.apache-compress.version>1.20</dependency.apache-compress.version>
|
||||||
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
|
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||||
<tag>9.20</tag>
|
<tag>9.37</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -41,7 +41,11 @@ public class DefaultExceptionResolver implements ExceptionResolver<Exception>
|
|||||||
@Override
|
@Override
|
||||||
public ErrorResponse resolveException(Exception ex)
|
public ErrorResponse resolveException(Exception ex)
|
||||||
{
|
{
|
||||||
return new ErrorResponse(DEFAULT_MESSAGE_ID, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getLocalizedMessage(), ex.getStackTrace(), null);
|
return new ErrorResponse(DEFAULT_MESSAGE_ID,
|
||||||
|
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
|
ex.getLocalizedMessage(),
|
||||||
|
ex.getStackTrace(),
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Remote API
|
||||||
|
* %%
|
||||||
|
* 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
|
||||||
|
* 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.rest.framework.core.exceptions;
|
||||||
|
|
||||||
|
import org.alfresco.repo.search.QueryParserException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QueryParserException is related with search requests to Search Services.
|
||||||
|
*/
|
||||||
|
public class QueryParserExceptionResolver implements ExceptionResolver<QueryParserException>
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErrorResponse resolveException(QueryParserException ex)
|
||||||
|
{
|
||||||
|
return new ErrorResponse(
|
||||||
|
DefaultExceptionResolver.DEFAULT_MESSAGE_ID,
|
||||||
|
// Mapping the original HTTP Status code returned by Search Services
|
||||||
|
ex.getHttpStatusCode(),
|
||||||
|
ex.getLocalizedMessage(),
|
||||||
|
ex.getStackTrace(),
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -26,10 +26,12 @@
|
|||||||
package org.alfresco.rest.framework.tools;
|
package org.alfresco.rest.framework.tools;
|
||||||
|
|
||||||
import org.alfresco.metrics.rest.RestMetricsReporter;
|
import org.alfresco.metrics.rest.RestMetricsReporter;
|
||||||
|
import org.alfresco.repo.search.QueryParserException;
|
||||||
import org.alfresco.rest.framework.Api;
|
import org.alfresco.rest.framework.Api;
|
||||||
import org.alfresco.rest.framework.core.exceptions.DefaultExceptionResolver;
|
import org.alfresco.rest.framework.core.exceptions.DefaultExceptionResolver;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ErrorResponse;
|
import org.alfresco.rest.framework.core.exceptions.ErrorResponse;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ExceptionResolver;
|
import org.alfresco.rest.framework.core.exceptions.ExceptionResolver;
|
||||||
|
import org.alfresco.rest.framework.core.exceptions.QueryParserExceptionResolver;
|
||||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -48,6 +50,7 @@ public class ApiAssistant {
|
|||||||
|
|
||||||
private ExceptionResolver<Exception> defaultResolver = new DefaultExceptionResolver();
|
private ExceptionResolver<Exception> defaultResolver = new DefaultExceptionResolver();
|
||||||
private ExceptionResolver<WebScriptException> webScriptExceptionResolver;
|
private ExceptionResolver<WebScriptException> webScriptExceptionResolver;
|
||||||
|
private ExceptionResolver<QueryParserException> queryParserExceptionResolver;
|
||||||
private ExceptionResolver<Exception> resolver;
|
private ExceptionResolver<Exception> resolver;
|
||||||
private JacksonHelper jsonHelper;
|
private JacksonHelper jsonHelper;
|
||||||
private RestMetricsReporter restMetricsReporter;
|
private RestMetricsReporter restMetricsReporter;
|
||||||
@@ -77,6 +80,10 @@ public class ApiAssistant {
|
|||||||
{
|
{
|
||||||
error = webScriptExceptionResolver.resolveException((WebScriptException) ex);
|
error = webScriptExceptionResolver.resolveException((WebScriptException) ex);
|
||||||
}
|
}
|
||||||
|
else if (ex instanceof QueryParserException)
|
||||||
|
{
|
||||||
|
error = queryParserExceptionResolver.resolveException((QueryParserException) ex);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error = resolver.resolveException(ex);
|
error = resolver.resolveException(ex);
|
||||||
@@ -100,6 +107,11 @@ public class ApiAssistant {
|
|||||||
this.webScriptExceptionResolver = webScriptExceptionResolver;
|
this.webScriptExceptionResolver = webScriptExceptionResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setQueryParserExceptionResolver(ExceptionResolver<QueryParserException> queryParserExceptionResolver)
|
||||||
|
{
|
||||||
|
this.queryParserExceptionResolver = queryParserExceptionResolver;
|
||||||
|
}
|
||||||
|
|
||||||
public void setResolver(ExceptionResolver<Exception> resolver) {
|
public void setResolver(ExceptionResolver<Exception> resolver) {
|
||||||
this.resolver = resolver;
|
this.resolver = resolver;
|
||||||
}
|
}
|
||||||
|
@@ -134,6 +134,8 @@
|
|||||||
</bean>
|
</bean>
|
||||||
<bean id="webScriptExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.WebScriptExceptionResolver">
|
<bean id="webScriptExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.WebScriptExceptionResolver">
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean id="queryParserExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.QueryParserExceptionResolver">
|
||||||
|
</bean>
|
||||||
<bean id="simpleMappingExceptionResolverParent" abstract="true" class="org.alfresco.rest.framework.core.exceptions.SimpleMappingExceptionResolver">
|
<bean id="simpleMappingExceptionResolverParent" abstract="true" class="org.alfresco.rest.framework.core.exceptions.SimpleMappingExceptionResolver">
|
||||||
<property name="exceptionMappings">
|
<property name="exceptionMappings">
|
||||||
<map>
|
<map>
|
||||||
@@ -182,6 +184,7 @@
|
|||||||
<property name="resolver" ref="simpleMappingExceptionResolver" />
|
<property name="resolver" ref="simpleMappingExceptionResolver" />
|
||||||
<property name="webScriptExceptionResolver" ref="webScriptExceptionResolver" />
|
<property name="webScriptExceptionResolver" ref="webScriptExceptionResolver" />
|
||||||
<property name="restMetricsReporter" ref="restMetricsReporter"/>
|
<property name="restMetricsReporter" ref="restMetricsReporter"/>
|
||||||
|
<property name="queryParserExceptionResolver" ref="queryParserExceptionResolver" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Using annotation-config=false means AutowiredAnnotationBeanPostProcessor
|
<!-- Using annotation-config=false means AutowiredAnnotationBeanPostProcessor
|
||||||
|
@@ -23,45 +23,46 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.framework.tests.core;
|
package org.alfresco.rest.framework.tests.core;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
|
||||||
import org.alfresco.repo.forms.FormNotFoundException;
|
import org.alfresco.repo.forms.FormNotFoundException;
|
||||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ApiException;
|
import org.alfresco.repo.search.QueryParserException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException;
|
import org.alfresco.rest.framework.core.exceptions.ApiException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.DeletedResourceException;
|
import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.DeletedResourceException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ErrorResponse;
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
|
import org.alfresco.rest.framework.core.exceptions.ErrorResponse;
|
||||||
import org.alfresco.rest.framework.core.exceptions.InsufficientStorageException;
|
import org.alfresco.rest.framework.core.exceptions.InsufficientStorageException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.NotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.NotFoundException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.StaleEntityException;
|
import org.alfresco.rest.framework.core.exceptions.StaleEntityException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException;
|
import org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException;
|
||||||
import org.alfresco.rest.framework.resource.parameters.where.InvalidQueryException;
|
import org.alfresco.rest.framework.resource.parameters.where.InvalidQueryException;
|
||||||
import org.alfresco.rest.framework.tools.ApiAssistant;
|
import org.alfresco.rest.framework.tools.ApiAssistant;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.extensions.webscripts.WebScriptException;
|
import org.springframework.extensions.webscripts.WebScriptException;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(locations = { "classpath:test-rest-context.xml" })
|
@ContextConfiguration(locations = { "classpath:test-rest-context.xml" })
|
||||||
public class ExceptionResolverTests
|
public class ExceptionResolverTests
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
ApiAssistant assistant;
|
ApiAssistant assistant;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWebscriptException()
|
public void testWebscriptException()
|
||||||
{
|
{
|
||||||
ErrorResponse response = assistant.resolveException(new WebScriptException(null));
|
ErrorResponse response = assistant.resolveException(new WebScriptException(null));
|
||||||
@@ -75,43 +76,43 @@ public class ExceptionResolverTests
|
|||||||
|
|
||||||
//04180006 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get
|
//04180006 Authentication failed for Web Script org/alfresco/api/ResourceWebScript.get
|
||||||
@Test
|
@Test
|
||||||
public void testMatchException()
|
public void testMatchException()
|
||||||
{
|
{
|
||||||
ErrorResponse response = assistant.resolveException(new ApiException(null));
|
ErrorResponse response = assistant.resolveException(new ApiException(null));
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertEquals(500, response.getStatusCode()); //default to INTERNAL_SERVER_ERROR
|
assertEquals(500, response.getStatusCode()); //default to INTERNAL_SERVER_ERROR
|
||||||
|
|
||||||
response = assistant.resolveException(new InvalidArgumentException(null));
|
response = assistant.resolveException(new InvalidArgumentException(null));
|
||||||
assertEquals(400, response.getStatusCode()); //default to STATUS_BAD_REQUEST
|
assertEquals(400, response.getStatusCode()); //default to STATUS_BAD_REQUEST
|
||||||
|
|
||||||
response = assistant.resolveException(new InvalidQueryException(null));
|
|
||||||
assertEquals(400, response.getStatusCode()); //default to STATUS_BAD_REQUEST
|
|
||||||
|
|
||||||
response = assistant.resolveException(new NotFoundException(null));
|
|
||||||
assertEquals(404, response.getStatusCode()); //default to STATUS_NOT_FOUND
|
|
||||||
|
|
||||||
response = assistant.resolveException(new EntityNotFoundException(null));
|
|
||||||
assertEquals(404, response.getStatusCode()); //default to STATUS_NOT_FOUND
|
|
||||||
|
|
||||||
response = assistant.resolveException(new RelationshipResourceNotFoundException(null, null));
|
|
||||||
assertEquals(404, response.getStatusCode()); //default to STATUS_NOT_FOUND
|
|
||||||
|
|
||||||
response = assistant.resolveException(new PermissionDeniedException(null));
|
|
||||||
assertEquals(403, response.getStatusCode()); //default to STATUS_FORBIDDEN
|
|
||||||
|
|
||||||
response = assistant.resolveException(new UnsupportedResourceOperationException(null));
|
|
||||||
assertEquals(405, response.getStatusCode()); //default to STATUS_METHOD_NOT_ALLOWED
|
|
||||||
|
|
||||||
response = assistant.resolveException(new DeletedResourceException(null));
|
|
||||||
assertEquals(405, response.getStatusCode()); //default to STATUS_METHOD_NOT_ALLOWED
|
|
||||||
|
|
||||||
response = assistant.resolveException(new ConstraintViolatedException(null));
|
|
||||||
assertEquals(409, response.getStatusCode()); //default to STATUS_CONFLICT
|
|
||||||
|
|
||||||
response = assistant.resolveException(new StaleEntityException(null));
|
|
||||||
assertEquals(409, response.getStatusCode()); //default to STATUS_CONFLICT
|
|
||||||
|
|
||||||
//Try a random exception
|
response = assistant.resolveException(new InvalidQueryException(null));
|
||||||
|
assertEquals(400, response.getStatusCode()); //default to STATUS_BAD_REQUEST
|
||||||
|
|
||||||
|
response = assistant.resolveException(new NotFoundException(null));
|
||||||
|
assertEquals(404, response.getStatusCode()); //default to STATUS_NOT_FOUND
|
||||||
|
|
||||||
|
response = assistant.resolveException(new EntityNotFoundException(null));
|
||||||
|
assertEquals(404, response.getStatusCode()); //default to STATUS_NOT_FOUND
|
||||||
|
|
||||||
|
response = assistant.resolveException(new RelationshipResourceNotFoundException(null, null));
|
||||||
|
assertEquals(404, response.getStatusCode()); //default to STATUS_NOT_FOUND
|
||||||
|
|
||||||
|
response = assistant.resolveException(new PermissionDeniedException(null));
|
||||||
|
assertEquals(403, response.getStatusCode()); //default to STATUS_FORBIDDEN
|
||||||
|
|
||||||
|
response = assistant.resolveException(new UnsupportedResourceOperationException(null));
|
||||||
|
assertEquals(405, response.getStatusCode()); //default to STATUS_METHOD_NOT_ALLOWED
|
||||||
|
|
||||||
|
response = assistant.resolveException(new DeletedResourceException(null));
|
||||||
|
assertEquals(405, response.getStatusCode()); //default to STATUS_METHOD_NOT_ALLOWED
|
||||||
|
|
||||||
|
response = assistant.resolveException(new ConstraintViolatedException(null));
|
||||||
|
assertEquals(409, response.getStatusCode()); //default to STATUS_CONFLICT
|
||||||
|
|
||||||
|
response = assistant.resolveException(new StaleEntityException(null));
|
||||||
|
assertEquals(409, response.getStatusCode()); //default to STATUS_CONFLICT
|
||||||
|
|
||||||
|
//Try a random exception
|
||||||
response = assistant.resolveException(new FormNotFoundException(null));
|
response = assistant.resolveException(new FormNotFoundException(null));
|
||||||
assertEquals(500, response.getStatusCode()); //default to INTERNAL_SERVER_ERROR
|
assertEquals(500, response.getStatusCode()); //default to INTERNAL_SERVER_ERROR
|
||||||
|
|
||||||
@@ -120,6 +121,15 @@ public class ExceptionResolverTests
|
|||||||
|
|
||||||
response = assistant.resolveException(new IntegrityException(null));
|
response = assistant.resolveException(new IntegrityException(null));
|
||||||
assertEquals(422, response.getStatusCode());
|
assertEquals(422, response.getStatusCode());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/** Check that the status code from SS is passed back to the caller. */
|
||||||
|
@Test
|
||||||
|
public void testQueryParserException()
|
||||||
|
{
|
||||||
|
ErrorResponse response = assistant.resolveException(new QueryParserException("Endpoint not found", 404));
|
||||||
|
assertNotNull(response);
|
||||||
|
assertEquals("Expected status code to be passed through from query parser.", 404, response.getStatusCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -33,10 +33,12 @@
|
|||||||
</bean>
|
</bean>
|
||||||
<bean id="webScriptExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.WebScriptExceptionResolver">
|
<bean id="webScriptExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.WebScriptExceptionResolver">
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean id="queryParserExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.QueryParserExceptionResolver" />
|
||||||
<bean id="apiAssistant" class="org.alfresco.rest.framework.tools.ApiAssistant">
|
<bean id="apiAssistant" class="org.alfresco.rest.framework.tools.ApiAssistant">
|
||||||
<property name="jsonHelper" ref="jsonHelper" />
|
<property name="jsonHelper" ref="jsonHelper" />
|
||||||
<property name="resolver" ref="simpleMappingExceptionResolver" />
|
<property name="resolver" ref="simpleMappingExceptionResolver" />
|
||||||
<property name="webScriptExceptionResolver" ref="webScriptExceptionResolver" />
|
<property name="webScriptExceptionResolver" ref="webScriptExceptionResolver" />
|
||||||
|
<property name="queryParserExceptionResolver" ref="queryParserExceptionResolver" />
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="simpleMappingExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.SimpleMappingExceptionResolver">
|
<bean id="simpleMappingExceptionResolver" class="org.alfresco.rest.framework.core.exceptions.SimpleMappingExceptionResolver">
|
||||||
<property name="exceptionMappings">
|
<property name="exceptionMappings">
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>9.20</version>
|
<version>9.37</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -245,7 +245,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.freemarker</groupId>
|
<groupId>org.freemarker</groupId>
|
||||||
<artifactId>freemarker</artifactId>
|
<artifactId>freemarker</artifactId>
|
||||||
<version>2.3.20-alfresco-patched-20200421</version>
|
<version>2.3.20-alfresco-patched-20220413</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlbeans</groupId>
|
<groupId>org.apache.xmlbeans</groupId>
|
||||||
|
@@ -34,7 +34,10 @@ import org.alfresco.repo.action.ParameterDefinitionImpl;
|
|||||||
import org.alfresco.repo.admin.SysAdminParams;
|
import org.alfresco.repo.admin.SysAdminParams;
|
||||||
import org.alfresco.repo.jscript.ScriptAction;
|
import org.alfresco.repo.jscript.ScriptAction;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
|
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||||
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
|
import org.alfresco.service.cmr.action.ParameterConstraint;
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -126,6 +129,10 @@ public class ScriptActionExecuter extends ActionExecuterAbstractBase
|
|||||||
if (nodeService.exists(actionedUponNodeRef))
|
if (nodeService.exists(actionedUponNodeRef))
|
||||||
{
|
{
|
||||||
NodeRef scriptRef = (NodeRef)action.getParameterValue(PARAM_SCRIPTREF);
|
NodeRef scriptRef = (NodeRef)action.getParameterValue(PARAM_SCRIPTREF);
|
||||||
|
if(!isValidScriptRef(action))
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("Invalid script ref path: " + scriptRef);
|
||||||
|
}
|
||||||
NodeRef spaceRef = this.serviceRegistry.getRuleService().getOwningNodeRef(action);
|
NodeRef spaceRef = this.serviceRegistry.getRuleService().getOwningNodeRef(action);
|
||||||
if (spaceRef == null)
|
if (spaceRef == null)
|
||||||
{
|
{
|
||||||
@@ -222,4 +229,19 @@ public class ScriptActionExecuter extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
return companyHomeRef;
|
return companyHomeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isValidScriptRef(Action action)
|
||||||
|
{
|
||||||
|
NodeRef scriptRef = (NodeRef) action.getParameterValue(PARAM_SCRIPTREF);
|
||||||
|
ActionService actionService = this.serviceRegistry.getActionService();
|
||||||
|
ActionDefinition actDef = actionService.getActionDefinition(action.getActionDefinitionName());
|
||||||
|
ParameterDefinition parameterDef = actDef.getParameterDefintion(PARAM_SCRIPTREF);
|
||||||
|
String paramConstraintName = parameterDef.getParameterConstraintName();
|
||||||
|
if (paramConstraintName != null)
|
||||||
|
{
|
||||||
|
ParameterConstraint paramConstraint = actionService.getParameterConstraint(paramConstraintName);
|
||||||
|
return paramConstraint.isValidValue(scriptRef.toString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,9 @@
|
|||||||
package org.alfresco.repo.search;
|
package org.alfresco.repo.search;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.apache.http.HttpStatus;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andy
|
* @author Andy
|
||||||
@@ -33,11 +36,10 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
*/
|
*/
|
||||||
public class QueryParserException extends AlfrescoRuntimeException
|
public class QueryParserException extends AlfrescoRuntimeException
|
||||||
{
|
{
|
||||||
|
/** Serial version UUID. */
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 4886993838297301968L;
|
private static final long serialVersionUID = 4886993838297301968L;
|
||||||
|
/** Http Status Code that should be returned by Remote API. */
|
||||||
|
private int httpStatusCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param msgId
|
* @param msgId
|
||||||
@@ -45,7 +47,6 @@ public class QueryParserException extends AlfrescoRuntimeException
|
|||||||
public QueryParserException(String msgId)
|
public QueryParserException(String msgId)
|
||||||
{
|
{
|
||||||
super(msgId);
|
super(msgId);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +56,6 @@ public class QueryParserException extends AlfrescoRuntimeException
|
|||||||
public QueryParserException(String msgId, Object[] msgParams)
|
public QueryParserException(String msgId, Object[] msgParams)
|
||||||
{
|
{
|
||||||
super(msgId, msgParams);
|
super(msgId, msgParams);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +65,6 @@ public class QueryParserException extends AlfrescoRuntimeException
|
|||||||
public QueryParserException(String msgId, Throwable cause)
|
public QueryParserException(String msgId, Throwable cause)
|
||||||
{
|
{
|
||||||
super(msgId, cause);
|
super(msgId, cause);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,7 +75,22 @@ public class QueryParserException extends AlfrescoRuntimeException
|
|||||||
public QueryParserException(String msgId, Object[] msgParams, Throwable cause)
|
public QueryParserException(String msgId, Object[] msgParams, Throwable cause)
|
||||||
{
|
{
|
||||||
super(msgId, msgParams, cause);
|
super(msgId, msgParams, cause);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for exception that allows setting an HTTP status code.
|
||||||
|
*
|
||||||
|
* @param msgId Message for the exception
|
||||||
|
* @param httpStatusCode Status code to return for exception
|
||||||
|
*/
|
||||||
|
public QueryParserException(String msgId, int httpStatusCode)
|
||||||
|
{
|
||||||
|
super(msgId);
|
||||||
|
this.httpStatusCode = httpStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHttpStatusCode()
|
||||||
|
{
|
||||||
|
return httpStatusCode;
|
||||||
|
}
|
||||||
}
|
}
|
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.search.impl.querymodel.impl.db;
|
package org.alfresco.repo.search.impl.querymodel.impl.db;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -74,6 +74,10 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
Set<String> selectorGroup;
|
Set<String> selectorGroup;
|
||||||
|
|
||||||
|
private int limit = 0;
|
||||||
|
|
||||||
|
private int offset = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param source Source
|
* @param source Source
|
||||||
* @param constraint Constraint
|
* @param constraint Constraint
|
||||||
@@ -133,6 +137,22 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
|||||||
this.sinceTxId = sinceTxId;
|
this.sinceTxId = sinceTxId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(int limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffset(int offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
public List<DBQueryBuilderJoinCommand> getJoins()
|
public List<DBQueryBuilderJoinCommand> getJoins()
|
||||||
{
|
{
|
||||||
HashMap<QName, DBQueryBuilderJoinCommand> singleJoins = new HashMap<QName, DBQueryBuilderJoinCommand>();
|
HashMap<QName, DBQueryBuilderJoinCommand> singleJoins = new HashMap<QName, DBQueryBuilderJoinCommand>();
|
||||||
|
@@ -76,8 +76,10 @@ import org.alfresco.service.namespace.QName;
|
|||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.ibatis.executor.result.DefaultResultContext;
|
||||||
import org.apache.ibatis.session.ResultContext;
|
import org.apache.ibatis.session.ResultContext;
|
||||||
import org.apache.ibatis.session.ResultHandler;
|
import org.apache.ibatis.session.ResultHandler;
|
||||||
|
import org.apache.ibatis.session.RowBounds;
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +91,11 @@ public class DBQueryEngine implements QueryEngine
|
|||||||
protected static final Log logger = LogFactory.getLog(DBQueryEngine.class);
|
protected static final Log logger = LogFactory.getLog(DBQueryEngine.class);
|
||||||
|
|
||||||
protected static final String SELECT_BY_DYNAMIC_QUERY = "alfresco.metadata.query.select_byDynamicQuery";
|
protected static final String SELECT_BY_DYNAMIC_QUERY = "alfresco.metadata.query.select_byDynamicQuery";
|
||||||
|
|
||||||
|
private static final int DEFAULT_MIN_PAGING_BATCH_SIZE = 2500;
|
||||||
|
|
||||||
|
private static final int DEFAULT_MAX_PAGING_BATCH_SIZE = 10000;
|
||||||
|
|
||||||
protected SqlSessionTemplate template;
|
protected SqlSessionTemplate template;
|
||||||
|
|
||||||
protected QNameDAO qnameDAO;
|
protected QNameDAO qnameDAO;
|
||||||
@@ -114,6 +120,12 @@ public class DBQueryEngine implements QueryEngine
|
|||||||
|
|
||||||
private boolean maxPermissionCheckEnabled;
|
private boolean maxPermissionCheckEnabled;
|
||||||
|
|
||||||
|
private boolean usePagingQuery = false;
|
||||||
|
|
||||||
|
private int minPagingBatchSize = DEFAULT_MIN_PAGING_BATCH_SIZE;
|
||||||
|
|
||||||
|
private int maxPagingBatchSize = DEFAULT_MAX_PAGING_BATCH_SIZE;
|
||||||
|
|
||||||
protected EntityLookupCache<Long, Node, NodeRef> nodesCache;
|
protected EntityLookupCache<Long, Node, NodeRef> nodesCache;
|
||||||
|
|
||||||
private List<Pair<Long, StoreRef>> stores;
|
private List<Pair<Long, StoreRef>> stores;
|
||||||
@@ -149,7 +161,31 @@ public class DBQueryEngine implements QueryEngine
|
|||||||
{
|
{
|
||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUsePagingQuery() {
|
||||||
|
return usePagingQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsePagingQuery(boolean usePagingQuery) {
|
||||||
|
this.usePagingQuery = usePagingQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinPagingBatchSize() {
|
||||||
|
return minPagingBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinPagingBatchSize(int minPagingBatchSize) {
|
||||||
|
this.minPagingBatchSize = minPagingBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxPagingBatchSize() {
|
||||||
|
return maxPagingBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxPagingBatchSize(int maxPagingBatchSize) {
|
||||||
|
this.maxPagingBatchSize = maxPagingBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMetadataIndexCheck2(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2)
|
public void setMetadataIndexCheck2(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2)
|
||||||
{
|
{
|
||||||
this.metadataIndexCheck2 = metadataIndexCheck2;
|
this.metadataIndexCheck2 = metadataIndexCheck2;
|
||||||
@@ -331,7 +367,7 @@ public class DBQueryEngine implements QueryEngine
|
|||||||
int requiredNodes = computeRequiredNodesCount(options);
|
int requiredNodes = computeRequiredNodesCount(options);
|
||||||
|
|
||||||
logger.debug("- query sent to the database");
|
logger.debug("- query sent to the database");
|
||||||
template.select(pickQueryTemplate(options, dbQuery), dbQuery, new ResultHandler<Node>()
|
performTmdqSelect(pickQueryTemplate(options, dbQuery), dbQuery, requiredNodes, new ResultHandler<Node>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void handleResult(ResultContext<? extends Node> context)
|
public void handleResult(ResultContext<? extends Node> context)
|
||||||
@@ -399,6 +435,54 @@ public class DBQueryEngine implements QueryEngine
|
|||||||
return frs;
|
return frs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void performTmdqSelect(String statement, DBQuery dbQuery, int requiredNodes, ResultHandler<Node> handler)
|
||||||
|
{
|
||||||
|
if (usePagingQuery)
|
||||||
|
{
|
||||||
|
performTmdqSelectPaging(statement, dbQuery, requiredNodes, handler);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
performTmdqSelectStreaming(statement, dbQuery, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void performTmdqSelectStreaming(String statement, DBQuery dbQuery, ResultHandler<Node> handler)
|
||||||
|
{
|
||||||
|
template.select(statement, dbQuery, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void performTmdqSelectPaging(String statement, DBQuery dbQuery, int requiredNodes, ResultHandler<Node> handler)
|
||||||
|
{
|
||||||
|
int batchStart = 0;
|
||||||
|
int batchSize = requiredNodes * 2;
|
||||||
|
batchSize = Math.min(Math.max(batchSize, minPagingBatchSize), maxPagingBatchSize);
|
||||||
|
DefaultResultContext<Node> resultCtx = new DefaultResultContext<>();
|
||||||
|
while (!resultCtx.isStopped())
|
||||||
|
{
|
||||||
|
dbQuery.setOffset(batchStart);
|
||||||
|
dbQuery.setLimit(batchSize);
|
||||||
|
List<Node> batch = template.selectList(statement, dbQuery);
|
||||||
|
for (Node node : batch)
|
||||||
|
{
|
||||||
|
resultCtx.nextResultObject(node);
|
||||||
|
handler.handleResult(resultCtx);
|
||||||
|
if (resultCtx.isStopped())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (batch.size() < batchSize)
|
||||||
|
{
|
||||||
|
resultCtx.stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
batchStart += batchSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private DBResultSet createResultSet(QueryOptions options, List<Node> nodes, int numberFound)
|
private DBResultSet createResultSet(QueryOptions options, List<Node> nodes, int numberFound)
|
||||||
{
|
{
|
||||||
DBResultSet dbResultSet = new DBResultSet(options.getAsSearchParmeters(), nodes, nodeDAO, nodeService, tenantService, Integer.MAX_VALUE);
|
DBResultSet dbResultSet = new DBResultSet(options.getAsSearchParmeters(), nodes, nodeDAO, nodeService, tenantService, Integer.MAX_VALUE);
|
||||||
|
@@ -29,26 +29,29 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.alfresco.repo.search.QueryParserException;
|
import org.alfresco.repo.search.QueryParserException;
|
||||||
import org.apache.commons.httpclient.Header;
|
import org.apache.commons.httpclient.Header;
|
||||||
import org.apache.commons.httpclient.HttpClient;
|
import org.apache.commons.httpclient.HttpClient;
|
||||||
import org.apache.commons.httpclient.HttpException;
|
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.apache.commons.httpclient.URI;
|
import org.apache.commons.httpclient.URI;
|
||||||
import org.apache.commons.httpclient.URIException;
|
|
||||||
import org.apache.commons.httpclient.methods.PostMethod;
|
import org.apache.commons.httpclient.methods.PostMethod;
|
||||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||||
import org.apache.commons.httpclient.params.HttpMethodParams;
|
import org.apache.commons.httpclient.params.HttpMethodParams;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
import org.json.JSONTokener;
|
||||||
|
|
||||||
public abstract class AbstractSolrQueryHTTPClient
|
public abstract class AbstractSolrQueryHTTPClient
|
||||||
{
|
{
|
||||||
|
/** Logger for the class. */
|
||||||
|
private static final Log LOGGER = LogFactory.getLog(AbstractSolrQueryHTTPClient.class);
|
||||||
|
|
||||||
public static final int DEFAULT_SAVEPOST_BUFFER = 4096;
|
public static final int DEFAULT_SAVEPOST_BUFFER = 4096;
|
||||||
|
|
||||||
// Constants copied from org.apache.solr.common.params.HighlightParams (solr-solrj:1.4.1)
|
// Constants copied from org.apache.solr.common.params.HighlightParams (solr-solrj:1.4.1)
|
||||||
@@ -79,11 +82,13 @@ public abstract class AbstractSolrQueryHTTPClient
|
|||||||
public static final String HIGHLIGHT_PARAMS_SLOP = HIGHLIGHT_PARAMS_HIGHLIGHT + "." + HIGHLIGHT_PARAMS_REGEX + ".slop";
|
public static final String HIGHLIGHT_PARAMS_SLOP = HIGHLIGHT_PARAMS_HIGHLIGHT + "." + HIGHLIGHT_PARAMS_REGEX + ".slop";
|
||||||
public static final String HIGHLIGHT_PARAMS_PATTERN = HIGHLIGHT_PARAMS_HIGHLIGHT + "." + HIGHLIGHT_PARAMS_REGEX + ".pattern";
|
public static final String HIGHLIGHT_PARAMS_PATTERN = HIGHLIGHT_PARAMS_HIGHLIGHT + "." + HIGHLIGHT_PARAMS_REGEX + ".pattern";
|
||||||
public static final String HIGHLIGHT_PARAMS_MAX_RE_CHARS = HIGHLIGHT_PARAMS_HIGHLIGHT + "." + HIGHLIGHT_PARAMS_REGEX + ".maxAnalyzedChars";
|
public static final String HIGHLIGHT_PARAMS_MAX_RE_CHARS = HIGHLIGHT_PARAMS_HIGHLIGHT + "." + HIGHLIGHT_PARAMS_REGEX + ".maxAnalyzedChars";
|
||||||
|
|
||||||
|
/** List of SOLR Exceptions that should be returning HTTP 501 status code in Remote API. */
|
||||||
|
private static final List<String> STATUS_CODE_501_EXCEPTIONS = List.of("java.lang.UnsupportedOperationException");
|
||||||
|
|
||||||
protected JSONObject postQuery(HttpClient httpClient, String url, JSONObject body) throws UnsupportedEncodingException,
|
protected JSONObject postQuery(HttpClient httpClient, String url, JSONObject body) throws IOException, JSONException
|
||||||
IOException, HttpException, URIException, JSONException
|
|
||||||
{
|
{
|
||||||
PostMethod post = new PostMethod(url);
|
PostMethod post = createNewPostMethod(url);
|
||||||
if (body.toString().length() > DEFAULT_SAVEPOST_BUFFER)
|
if (body.toString().length() > DEFAULT_SAVEPOST_BUFFER)
|
||||||
{
|
{
|
||||||
post.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true);
|
post.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true);
|
||||||
@@ -103,9 +108,33 @@ public abstract class AbstractSolrQueryHTTPClient
|
|||||||
httpClient.executeMethod(post);
|
httpClient.executeMethod(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String responseBodyStr = post.getResponseBodyAsString();
|
||||||
if (post.getStatusCode() != HttpServletResponse.SC_OK)
|
if (post.getStatusCode() != HttpServletResponse.SC_OK)
|
||||||
{
|
{
|
||||||
throw new QueryParserException("Request failed " + post.getStatusCode() + " " + url.toString());
|
String trace = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
trace = new JSONObject(responseBodyStr).getJSONObject("error").getString("trace");
|
||||||
|
}
|
||||||
|
catch (JSONException jsonException)
|
||||||
|
{
|
||||||
|
LOGGER.warn("Node 'error.trace' is not present in Search Services error response: " + responseBodyStr);
|
||||||
|
LOGGER.warn("A generic error message will be provided. Check SOLR log file in order to find the root cause for this issue");
|
||||||
|
}
|
||||||
|
|
||||||
|
int httpStatusCode = post.getStatusCode();
|
||||||
|
String message = "Solr request failed with " + httpStatusCode + " " + url;
|
||||||
|
|
||||||
|
// Override the status code for certain exceptions with 501.
|
||||||
|
if (trace != null)
|
||||||
|
{
|
||||||
|
String traceException = trace.substring(0, trace.indexOf(":")).trim();
|
||||||
|
if (STATUS_CODE_501_EXCEPTIONS.contains(traceException))
|
||||||
|
{
|
||||||
|
httpStatusCode = org.apache.http.HttpStatus.SC_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new QueryParserException(message, httpStatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream(), post.getResponseCharSet()));
|
Reader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream(), post.getResponseCharSet()));
|
||||||
@@ -118,4 +147,10 @@ public abstract class AbstractSolrQueryHTTPClient
|
|||||||
post.releaseConnection();
|
post.releaseConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Helper method that can be overridden by unit tests. */
|
||||||
|
protected PostMethod createNewPostMethod(String url)
|
||||||
|
{
|
||||||
|
return new PostMethod(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@ public class Version2ServiceImpl extends VersionServiceImpl implements VersionSe
|
|||||||
private static Log logger = LogFactory.getLog(Version2ServiceImpl.class);
|
private static Log logger = LogFactory.getLog(Version2ServiceImpl.class);
|
||||||
|
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
private boolean useVersionAssocIndex = false;
|
||||||
|
|
||||||
private ExtendedTrait<VersionServiceTrait> versionServiceTrait;
|
private ExtendedTrait<VersionServiceTrait> versionServiceTrait;
|
||||||
|
|
||||||
@@ -96,7 +97,23 @@ public class Version2ServiceImpl extends VersionServiceImpl implements VersionSe
|
|||||||
{
|
{
|
||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to use child association index on versions. This helps ordering versions when sequential IDs are not
|
||||||
|
* guaranteed by the DBMS.
|
||||||
|
*
|
||||||
|
* @param useVersionAssocIndex
|
||||||
|
*/
|
||||||
|
public void setUseVersionAssocIndex(boolean useVersionAssocIndex)
|
||||||
|
{
|
||||||
|
this.useVersionAssocIndex = useVersionAssocIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUseVersionAssocIndex()
|
||||||
|
{
|
||||||
|
return useVersionAssocIndex;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise method
|
* Initialise method
|
||||||
*/
|
*/
|
||||||
@@ -506,9 +523,12 @@ public class Version2ServiceImpl extends VersionServiceImpl implements VersionSe
|
|||||||
QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS+"-"+versionNumber), // TODO - testing - note: all children (of a versioned node) will have the same version number, maybe replace with a version sequence of some sort 001-...00n
|
QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS+"-"+versionNumber), // TODO - testing - note: all children (of a versioned node) will have the same version number, maybe replace with a version sequence of some sort 001-...00n
|
||||||
sourceTypeRef,
|
sourceTypeRef,
|
||||||
nodeDetails.getProperties());
|
nodeDetails.getProperties());
|
||||||
|
if (isUseVersionAssocIndex())
|
||||||
|
{
|
||||||
|
nodeService.setChildAssociationIndex(childAssocRef, getAllVersions(versionHistoryRef).size());
|
||||||
|
}
|
||||||
versionNodeRef = childAssocRef.getChildRef();
|
versionNodeRef = childAssocRef.getChildRef();
|
||||||
|
|
||||||
// NOTE: special ML case - see also MultilingualContentServiceImpl.makeMLContainer
|
// NOTE: special ML case - see also MultilingualContentServiceImpl.makeMLContainer
|
||||||
if (sourceTypeRef.equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
|
if (sourceTypeRef.equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
|
||||||
{
|
{
|
||||||
|
@@ -322,7 +322,7 @@ public class CombinedConfig
|
|||||||
{
|
{
|
||||||
combinedTransformers.remove(indexToRemove);
|
combinedTransformers.remove(indexToRemove);
|
||||||
// this may also require the current index i to be changed so we don't skip one.
|
// this may also require the current index i to be changed so we don't skip one.
|
||||||
if (i <= indexToRemove)
|
if (i >= indexToRemove)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@@ -488,6 +488,9 @@
|
|||||||
<property name="versionComparatorClass">
|
<property name="versionComparatorClass">
|
||||||
<value>${version.store.versionComparatorClass}</value>
|
<value>${version.store.versionComparatorClass}</value>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="useVersionAssocIndex">
|
||||||
|
<value>${version.store.useVersionAssocIndex}</value>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="versionNodeService" class="org.alfresco.repo.version.Node2ServiceImpl">
|
<bean id="versionNodeService" class="org.alfresco.repo.version.Node2ServiceImpl">
|
||||||
|
@@ -180,7 +180,8 @@
|
|||||||
</choose>
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
<if test="limit != 0">limit #{offset}, #{limit}</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@@ -378,6 +378,14 @@ version.store.version2Store=workspace://version2Store
|
|||||||
# if upgrading from a version that used unordered sequences in a cluster.
|
# if upgrading from a version that used unordered sequences in a cluster.
|
||||||
version.store.versionComparatorClass=
|
version.store.versionComparatorClass=
|
||||||
|
|
||||||
|
# Optional to set the child association index when creating a new version.
|
||||||
|
# This helps ordering versions when sequential IDs are not guaranteed by the DBMS.
|
||||||
|
# Not compatible with AGS < 7.1.1
|
||||||
|
# Once enabled, it should not be disabled again or new versions will go back
|
||||||
|
# to have index -1 and you will get the wrong order in version history.
|
||||||
|
# Please, see MNT-22715 for details.
|
||||||
|
version.store.useVersionAssocIndex=false
|
||||||
|
|
||||||
# Folders for storing people
|
# Folders for storing people
|
||||||
system.system_container.childname=sys:system
|
system.system_container.childname=sys:system
|
||||||
system.people_container.childname=sys:people
|
system.people_container.childname=sys:people
|
||||||
|
@@ -105,8 +105,35 @@
|
|||||||
<ref bean="metadataQueryIndexesCheck2" />
|
<ref bean="metadataQueryIndexesCheck2" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.dbQueryEngineImpl" class="org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryEngine" >
|
<bean id="search.dbQueryEngineImpl" class="org.alfresco.util.bean.HierarchicalBeanLoader">
|
||||||
|
<property name="targetBeanName">
|
||||||
|
<value>search.dbQueryEngineImpl.#bean.dialect#</value>
|
||||||
|
</property>
|
||||||
|
<property name="targetClass">
|
||||||
|
<value>org.alfresco.repo.search.impl.querymodel.QueryEngine</value>
|
||||||
|
</property>
|
||||||
|
<property name="dialectBaseClass">
|
||||||
|
<value>org.alfresco.repo.domain.dialect.Dialect</value>
|
||||||
|
</property>
|
||||||
|
<property name="dialectClass">
|
||||||
|
<bean class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
|
||||||
|
<property name="targetBeanName" value="dialect" />
|
||||||
|
<property name="propertyPath" value="class.name" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="search.dbQueryEngineImpl.org.alfresco.repo.domain.dialect.Dialect"
|
||||||
|
parent="search.baseDbQueryEngineImpl">
|
||||||
|
<property name="usePagingQuery" value="false"/>
|
||||||
|
</bean>
|
||||||
|
<bean id="search.dbQueryEngineImpl.org.alfresco.repo.domain.dialect.MySQLInnoDBDialect"
|
||||||
|
parent="search.baseDbQueryEngineImpl">
|
||||||
|
<property name="usePagingQuery" value="true"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="search.baseDbQueryEngineImpl" class="org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryEngine" abstract="true">
|
||||||
<property name="permissionService" ref="permissionService"/>
|
<property name="permissionService" ref="permissionService"/>
|
||||||
<property name="dictionaryService" ref="dictionaryService" />
|
<property name="dictionaryService" ref="dictionaryService" />
|
||||||
<property name="namespaceService" ref="namespaceService" />
|
<property name="namespaceService" ref="namespaceService" />
|
||||||
|
@@ -117,31 +117,6 @@
|
|||||||
"imageMagickOptions"
|
"imageMagickOptions"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"transformerName": "htmlToPdfViaOdt",
|
|
||||||
"transformerPipeline" : [
|
|
||||||
{"transformerName": "libreoffice", "targetMediaType": "application/vnd.oasis.opendocument.text"},
|
|
||||||
{"transformerName": "libreoffice"}
|
|
||||||
],
|
|
||||||
"supportedSourceAndTargetList": [
|
|
||||||
{"sourceMediaType": "text/html", "targetMediaType": "application/pdf" }
|
|
||||||
],
|
|
||||||
"transformOptions": [
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"transformerName": "htmlToImageViaPdf",
|
|
||||||
"transformerPipeline" : [
|
|
||||||
{"transformerName": "htmlToPdfViaOdt", "targetMediaType": "application/pdf"},
|
|
||||||
{"transformerName": "pdfToImageViaPng"}
|
|
||||||
],
|
|
||||||
"supportedSourceAndTargetList": [
|
|
||||||
],
|
|
||||||
"transformOptions": [
|
|
||||||
"pdfRendererOptions",
|
|
||||||
"imageMagickOptions"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"transformerName": "ooXmlToImageViaText",
|
"transformerName": "ooXmlToImageViaText",
|
||||||
"transformerPipeline" : [
|
"transformerPipeline" : [
|
||||||
@@ -198,42 +173,66 @@
|
|||||||
"archiveOptions"
|
"archiveOptions"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"transformerName": "libreofficeHtmlToPdfViaOdt",
|
|
||||||
"transformerPipeline" : [
|
|
||||||
{"transformerName": "libreoffice", "targetMediaType": "application/vnd.oasis.opendocument.text"},
|
|
||||||
{"transformerName": "libreoffice"}
|
|
||||||
],
|
|
||||||
"supportedSourceAndTargetList": [
|
|
||||||
{"sourceMediaType": "text/html", "targetMediaType": "application/pdf" }
|
|
||||||
],
|
|
||||||
"transformOptions": [
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"transformerName": "libreofficeToPdf",
|
|
||||||
"transformerFailover" : [ "libreoffice", "libreofficeHtmlToPdfViaOdt" ],
|
|
||||||
"supportedSourceAndTargetList": [
|
|
||||||
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "text/tab-separated-values", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/vnd.visio2013", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/wordperfect", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/vnd.sun.xml.calc", "priority": 150, "targetMediaType": "application/pdf" },
|
|
||||||
{"sourceMediaType": "application/vnd.sun.xml.impress", "priority": 150, "targetMediaType": "application/pdf" }
|
|
||||||
],
|
|
||||||
"transformOptions": [
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"transformerName": "libreofficeToPdfBoxViaPdf",
|
"transformerName": "libreofficeToPdfBoxViaPdf",
|
||||||
"transformerPipeline" : [
|
"transformerPipeline" : [
|
||||||
{"transformerName": "libreofficeToPdf", "targetMediaType": "application/pdf"},
|
{"transformerName": "libreoffice", "targetMediaType": "application/pdf"},
|
||||||
{"transformerName": "PdfBox"}
|
{"transformerName": "PdfBox"}
|
||||||
],
|
],
|
||||||
"supportedSourceAndTargetList": [
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "text/tab-separated-values", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "text/tab-separated-values", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "text/tab-separated-values", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/tab-separated-values", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "text/tab-separated-values", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/vnd.visio2013", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.visio2013", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.visio2013", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.visio2013", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.visio2013", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/wordperfect", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/wordperfect", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/wordperfect", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/wordperfect", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/wordperfect", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.calc", "priority": 150, "targetMediaType": "text/xml"},
|
||||||
|
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress", "priority": 150, "targetMediaType": "text/csv"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress", "priority": 150, "targetMediaType": "text/html"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress", "maxSourceSizeBytes": 26214400, "priority": 150, "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress", "priority": 150, "targetMediaType": "application/xhtml+xml"},
|
||||||
|
{"sourceMediaType": "application/vnd.sun.xml.impress", "priority": 150, "targetMediaType": "text/xml"}
|
||||||
],
|
],
|
||||||
"transformOptions": [
|
"transformOptions": [
|
||||||
"pdfboxOptions"
|
"pdfboxOptions"
|
||||||
@@ -263,6 +262,32 @@
|
|||||||
"transformOptions": [
|
"transformOptions": [
|
||||||
"tikaOptions"
|
"tikaOptions"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"transformerName": "htmlToPdfViaTXT",
|
||||||
|
"transformerPipeline" : [
|
||||||
|
{"transformerName": "string", "targetMediaType": "text/plain"},
|
||||||
|
{"transformerName": "libreoffice"}
|
||||||
|
],
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "text/html", "targetMediaType": "application/pdf" }
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"transformerName": "htmlToImageViaTXT",
|
||||||
|
"transformerPipeline" : [
|
||||||
|
{"transformerName": "string", "targetMediaType": "text/plain"},
|
||||||
|
{"transformerName": "textToImageViaPdf"}
|
||||||
|
],
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "text/html", "targetMediaType": "image/png" }
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
"pdfRendererOptions",
|
||||||
|
"imageMagickOptions"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -77,7 +77,10 @@ import org.junit.runners.Suite;
|
|||||||
// From MiscContextTestSuite
|
// From MiscContextTestSuite
|
||||||
org.alfresco.repo.domain.query.CannedQueryDAOTest.class,
|
org.alfresco.repo.domain.query.CannedQueryDAOTest.class,
|
||||||
|
|
||||||
// REPO-2963 : Tests causing a cascade of failures in AllDBTestsTestSuite on PostgreSQL/MySQL
|
// ACS-1907
|
||||||
|
org.alfresco.repo.search.impl.querymodel.impl.db.ACS1907Test.class,
|
||||||
|
|
||||||
|
// REPO-2963 : Tests causing a cascade of failures in AllDBTestsTestSuite on PostgreSQL/MySQL
|
||||||
// Moved at the bottom of the suite because DbNodeServiceImplTest.testNodeCleanupRegistry() takes a long time on a clean DB.
|
// Moved at the bottom of the suite because DbNodeServiceImplTest.testNodeCleanupRegistry() takes a long time on a clean DB.
|
||||||
org.alfresco.repo.node.db.DbNodeServiceImplTest.class,
|
org.alfresco.repo.node.db.DbNodeServiceImplTest.class,
|
||||||
|
|
||||||
|
@@ -111,14 +111,15 @@ import org.junit.runners.Suite;
|
|||||||
org.alfresco.util.schemacomp.validator.SchemaVersionValidatorTest.class,
|
org.alfresco.util.schemacomp.validator.SchemaVersionValidatorTest.class,
|
||||||
org.alfresco.util.schemacomp.validator.TypeNameOnlyValidatorTest.class,
|
org.alfresco.util.schemacomp.validator.TypeNameOnlyValidatorTest.class,
|
||||||
org.alfresco.util.test.junitrules.TemporaryMockOverrideTest.class,
|
org.alfresco.util.test.junitrules.TemporaryMockOverrideTest.class,
|
||||||
|
org.alfresco.repo.search.impl.solr.AbstractSolrQueryHTTPClientTest.class,
|
||||||
|
org.alfresco.repo.search.impl.solr.SpellCheckDecisionManagerTest.class,
|
||||||
|
org.alfresco.repo.search.impl.solr.SolrStoreMappingWrapperTest.class,
|
||||||
org.alfresco.repo.search.impl.solr.SolrQueryHTTPClientTest.class,
|
org.alfresco.repo.search.impl.solr.SolrQueryHTTPClientTest.class,
|
||||||
org.alfresco.repo.search.impl.solr.SolrSQLHttpClientTest.class,
|
org.alfresco.repo.search.impl.solr.SolrSQLHttpClientTest.class,
|
||||||
org.alfresco.repo.search.impl.solr.SolrStatsResultTest.class,
|
org.alfresco.repo.search.impl.solr.SolrStatsResultTest.class,
|
||||||
org.alfresco.repo.search.impl.solr.facet.SolrFacetComparatorTest.class,
|
org.alfresco.repo.search.impl.solr.facet.SolrFacetComparatorTest.class,
|
||||||
org.alfresco.repo.search.impl.solr.facet.FacetQNameUtilsTest.class,
|
org.alfresco.repo.search.impl.solr.facet.FacetQNameUtilsTest.class,
|
||||||
org.alfresco.util.BeanExtenderUnitTest.class,
|
org.alfresco.util.BeanExtenderUnitTest.class,
|
||||||
org.alfresco.repo.search.impl.solr.SpellCheckDecisionManagerTest.class,
|
|
||||||
org.alfresco.repo.search.impl.solr.SolrStoreMappingWrapperTest.class,
|
|
||||||
org.alfresco.repo.security.authentication.CompositePasswordEncoderTest.class,
|
org.alfresco.repo.security.authentication.CompositePasswordEncoderTest.class,
|
||||||
org.alfresco.repo.security.authentication.PasswordHashingTest.class,
|
org.alfresco.repo.security.authentication.PasswordHashingTest.class,
|
||||||
org.alfresco.traitextender.TraitExtenderIntegrationTest.class,
|
org.alfresco.traitextender.TraitExtenderIntegrationTest.class,
|
||||||
|
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.action;
|
package org.alfresco.repo.action;
|
||||||
|
|
||||||
import static java.lang.Thread.sleep;
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.action.executer.ActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
|
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
|
||||||
import org.alfresco.repo.action.executer.CounterIncrementActionExecuter;
|
import org.alfresco.repo.action.executer.CounterIncrementActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.ScriptActionExecuter;
|
import org.alfresco.repo.action.executer.ScriptActionExecuter;
|
||||||
@@ -259,7 +260,7 @@ public class ActionServiceImpl2Test
|
|||||||
public void testExecuteScript() throws Exception
|
public void testExecuteScript() throws Exception
|
||||||
{
|
{
|
||||||
final NodeRef scriptToBeExecuted = addTempScript("changeFileNameTest.js",
|
final NodeRef scriptToBeExecuted = addTempScript("changeFileNameTest.js",
|
||||||
"document.properties.name = \"Changed\" + \"_\" + document.properties.name;\ndocument.save();");
|
"document.properties.name = \"Changed_\" + document.properties.name;\ndocument.save();");
|
||||||
assertNotNull("Failed to add the test script.", scriptToBeExecuted);
|
assertNotNull("Failed to add the test script.", scriptToBeExecuted);
|
||||||
|
|
||||||
// add a test file to the Site in order to change its name
|
// add a test file to the Site in order to change its name
|
||||||
@@ -310,6 +311,73 @@ public class ActionServiceImpl2Test
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Execute script not in Data Dictionary > Scripts
|
||||||
|
AuthenticationUtil.setFullyAuthenticatedUser(testSiteAndMemberInfo.siteManager);
|
||||||
|
NodeRef companyHomeRef = wellKnownNodes.getCompanyHome();
|
||||||
|
NodeRef sharedFolderRef = nodeService.getChildByName(companyHomeRef, ContentModel.ASSOC_CONTAINS,
|
||||||
|
"Shared");
|
||||||
|
final NodeRef invalidScriptRef = addTempScript("changeFileNameTest.js",
|
||||||
|
"document.properties.name = \"Invalid_Change.pdf\";\ndocument.save();",sharedFolderRef);
|
||||||
|
assertNotNull("Failed to add the test script.", scriptToBeExecuted);
|
||||||
|
transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
|
// Create the action
|
||||||
|
Action action = actionService.createAction(ScriptActionExecuter.NAME);
|
||||||
|
action.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, invalidScriptRef);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Execute the action
|
||||||
|
actionService.executeAction(action, testNode);
|
||||||
|
}
|
||||||
|
catch (Throwable th)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
assertFalse("Scripts outside of Data Dictionary Scripts folder should not be executed",
|
||||||
|
("Invalid_Change.pdf".equals(nodeService.getProperty(testNode, ContentModel.PROP_NAME))));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testActionResult() throws Exception
|
||||||
|
{
|
||||||
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Create the script node reference
|
||||||
|
NodeRef script = addTempScript("test-action-result-script.js", "\"VALUE\";");
|
||||||
|
|
||||||
|
// Create the action
|
||||||
|
Action action = actionService.createAction(ScriptActionExecuter.NAME);
|
||||||
|
action.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
|
||||||
|
|
||||||
|
// Execute the action
|
||||||
|
actionService.executeAction(action, testNode);
|
||||||
|
|
||||||
|
// Get the result
|
||||||
|
String result = (String) action.getParameterValue(ActionExecuter.PARAM_RESULT);
|
||||||
|
assertNotNull(result);
|
||||||
|
assertEquals("VALUE", result);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -369,6 +437,32 @@ public class ActionServiceImpl2Test
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NodeRef addTempScript(final String scriptFileName, final String javaScript, final NodeRef parentRef)
|
||||||
|
{
|
||||||
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
return transactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>()
|
||||||
|
{
|
||||||
|
public NodeRef execute() throws Throwable
|
||||||
|
{
|
||||||
|
|
||||||
|
// Create the script node reference
|
||||||
|
NodeRef script = nodeService.createNode(parentRef, ContentModel.ASSOC_CONTAINS,
|
||||||
|
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, scriptFileName),
|
||||||
|
ContentModel.TYPE_CONTENT).getChildRef();
|
||||||
|
|
||||||
|
nodeService.setProperty(script, ContentModel.PROP_NAME, scriptFileName);
|
||||||
|
|
||||||
|
ContentWriter contentWriter = contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
|
||||||
|
contentWriter.setMimetype(MimetypeMap.MIMETYPE_JAVASCRIPT);
|
||||||
|
contentWriter.setEncoding("UTF-8");
|
||||||
|
contentWriter.putContent(javaScript);
|
||||||
|
|
||||||
|
tempNodes.addNodeRef(script);
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private NodeRef addTempScript(final String scriptFileName, final String javaScript)
|
private NodeRef addTempScript(final String scriptFileName, final String javaScript)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||||
@@ -386,20 +480,7 @@ public class ActionServiceImpl2Test
|
|||||||
NodeRef scriptsRef = nodeService.getChildByName(dataDictionaryRef, ContentModel.ASSOC_CONTAINS,
|
NodeRef scriptsRef = nodeService.getChildByName(dataDictionaryRef, ContentModel.ASSOC_CONTAINS,
|
||||||
"Scripts");
|
"Scripts");
|
||||||
|
|
||||||
// Create the script node reference
|
return addTempScript(scriptFileName, javaScript, scriptsRef);
|
||||||
NodeRef script = nodeService.createNode(scriptsRef, ContentModel.ASSOC_CONTAINS,
|
|
||||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, scriptFileName),
|
|
||||||
ContentModel.TYPE_CONTENT).getChildRef();
|
|
||||||
|
|
||||||
nodeService.setProperty(script, ContentModel.PROP_NAME, scriptFileName);
|
|
||||||
|
|
||||||
ContentWriter contentWriter = contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
|
|
||||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_JAVASCRIPT);
|
|
||||||
contentWriter.setEncoding("UTF-8");
|
|
||||||
contentWriter.putContent(javaScript);
|
|
||||||
|
|
||||||
tempNodes.addNodeRef(script);
|
|
||||||
return script;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -805,46 +805,6 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
assertEquals(action4, savedAction2.getAction(2));
|
assertEquals(action4, savedAction2.getAction(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the action result parameter
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testActionResult()
|
|
||||||
{
|
|
||||||
// We need to run this test as Administrator. The ScriptAction has to run as a full user (instead of as System)
|
|
||||||
// so that we can setup the Person object in the ScriptNode
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Create the script node reference
|
|
||||||
NodeRef script = this.nodeService.createNode(
|
|
||||||
this.folder,
|
|
||||||
ContentModel.ASSOC_CONTAINS,
|
|
||||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
|
|
||||||
ContentModel.TYPE_CONTENT).getChildRef();
|
|
||||||
this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
|
|
||||||
ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
|
|
||||||
contentWriter.setMimetype("text/plain");
|
|
||||||
contentWriter.setEncoding("UTF-8");
|
|
||||||
contentWriter.putContent("\"VALUE\";");
|
|
||||||
|
|
||||||
// Create the action
|
|
||||||
Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
|
|
||||||
action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
|
|
||||||
|
|
||||||
// Execute the action
|
|
||||||
this.actionService.executeAction(action1, this.nodeRef);
|
|
||||||
|
|
||||||
// Get the result
|
|
||||||
String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
|
|
||||||
assertNotNull(result);
|
|
||||||
assertEquals("VALUE", result);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
AuthenticationUtil.clearCurrentSecurityContext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ===================================================================================
|
/** ===================================================================================
|
||||||
* Test asynchronous actions
|
* Test asynchronous actions
|
||||||
|
@@ -0,0 +1,260 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Repository
|
||||||
|
* %%
|
||||||
|
* 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
|
||||||
|
* 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.search.impl.querymodel.impl.db;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.cache.TransactionalCache;
|
||||||
|
import org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
import org.alfresco.repo.security.permissions.AccessControlList;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.cmr.search.*;
|
||||||
|
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||||
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
|
import org.alfresco.util.testing.category.DBTests;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Category({OwnJVMTestsCategory.class, DBTests.class})
|
||||||
|
public class ACS1907Test extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private ApplicationContext ctx;
|
||||||
|
|
||||||
|
private NodeService nodeService;
|
||||||
|
private AuthenticationComponent authenticationComponent;
|
||||||
|
private MutableAuthenticationService authenticationService;
|
||||||
|
private MutableAuthenticationDao authenticationDAO;
|
||||||
|
private SearchService pubSearchService;
|
||||||
|
private PermissionService pubPermissionService;
|
||||||
|
private TransactionService transactionService;
|
||||||
|
private RetryingTransactionHelper txnHelper;
|
||||||
|
private DBQueryEngine queryEngine;
|
||||||
|
|
||||||
|
private TransactionalCache<Serializable, AccessControlList> aclCache;
|
||||||
|
private TransactionalCache<Serializable, Object> aclEntityCache;
|
||||||
|
private TransactionalCache<Serializable, Object> permissionEntityCache;
|
||||||
|
|
||||||
|
private NodeRef rootNodeRef;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception
|
||||||
|
{
|
||||||
|
setupServices();
|
||||||
|
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
|
setupTestUsers();
|
||||||
|
setupTestContent();
|
||||||
|
dropCaches();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception
|
||||||
|
{
|
||||||
|
authenticationComponent.clearCurrentSecurityContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupServices()
|
||||||
|
{
|
||||||
|
ctx = ApplicationContextHelper.getApplicationContext();
|
||||||
|
nodeService = (NodeService) ctx.getBean("dbNodeService");
|
||||||
|
authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
|
||||||
|
authenticationService = (MutableAuthenticationService) ctx.getBean("authenticationService");
|
||||||
|
authenticationDAO = (MutableAuthenticationDao) ctx.getBean("authenticationDao");
|
||||||
|
pubSearchService = (SearchService) ctx.getBean("SearchService");
|
||||||
|
pubPermissionService = (PermissionService) ctx.getBean("PermissionService");
|
||||||
|
transactionService = (TransactionService) ctx.getBean("TransactionService");
|
||||||
|
aclCache = (TransactionalCache) ctx.getBean("aclCache");
|
||||||
|
aclEntityCache = (TransactionalCache) ctx.getBean("aclEntityCache");
|
||||||
|
permissionEntityCache = (TransactionalCache) ctx.getBean("permissionEntityCache");
|
||||||
|
SwitchableApplicationContextFactory searchContextFactory = (SwitchableApplicationContextFactory) ctx.getBean("Search");
|
||||||
|
ApplicationContext searchCtx = searchContextFactory.getApplicationContext();
|
||||||
|
queryEngine = (DBQueryEngine) searchCtx.getBean("search.dbQueryEngineImpl");
|
||||||
|
txnHelper = new RetryingTransactionHelper();
|
||||||
|
txnHelper.setTransactionService(transactionService);
|
||||||
|
txnHelper.setReadOnly(false);
|
||||||
|
txnHelper.setMaxRetries(1);
|
||||||
|
txnHelper.setMinRetryWaitMs(1);
|
||||||
|
txnHelper.setMaxRetryWaitMs(10);
|
||||||
|
txnHelper.setRetryWaitIncrementMs(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupTestUser(String userName)
|
||||||
|
{
|
||||||
|
if (!authenticationDAO.userExists(userName))
|
||||||
|
{
|
||||||
|
authenticationService.createAuthentication(userName, userName.toCharArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupTestUsers()
|
||||||
|
{
|
||||||
|
txnHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Object>() {
|
||||||
|
@Override
|
||||||
|
public Object execute() throws Throwable {
|
||||||
|
setupTestUser("userA");
|
||||||
|
setupTestUser("userB");
|
||||||
|
setupTestUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupTestContent()
|
||||||
|
{
|
||||||
|
for(int f = 0; f < 5; f++)
|
||||||
|
{
|
||||||
|
final int ff = f;
|
||||||
|
txnHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Object>() {
|
||||||
|
@Override
|
||||||
|
public Object execute() throws Throwable {
|
||||||
|
Map<QName, Serializable> testFolderProps = new HashMap<>();
|
||||||
|
testFolderProps.put(ContentModel.PROP_NAME, "folder"+ff);
|
||||||
|
NodeRef testFolder = nodeService.createNode(
|
||||||
|
rootNodeRef,
|
||||||
|
ContentModel.ASSOC_CHILDREN,
|
||||||
|
QName.createQName("https://example.com/test", "folder"+ff),
|
||||||
|
ContentModel.TYPE_FOLDER,
|
||||||
|
testFolderProps
|
||||||
|
).getChildRef();
|
||||||
|
for(int c = 0; c < 5; c++)
|
||||||
|
{
|
||||||
|
Map<QName, Serializable> testContentProps = new HashMap<>();
|
||||||
|
testContentProps.put(ContentModel.PROP_NAME, "content"+c);
|
||||||
|
NodeRef testContent = nodeService.createNode(
|
||||||
|
testFolder,
|
||||||
|
ContentModel.ASSOC_CONTAINS,
|
||||||
|
QName.createQName("https://example.com/test", "content"+c),
|
||||||
|
ContentModel.TYPE_CONTENT,
|
||||||
|
testContentProps
|
||||||
|
).getChildRef();
|
||||||
|
String user = c % 2 == 0 ? "userA" : "userB";
|
||||||
|
pubPermissionService.setPermission(testContent, user, "Read", true);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dropCaches()
|
||||||
|
{
|
||||||
|
aclCache.clear();
|
||||||
|
aclEntityCache.clear();
|
||||||
|
permissionEntityCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testACS1907()
|
||||||
|
{
|
||||||
|
txnHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Object>() {
|
||||||
|
@Override
|
||||||
|
public Object execute() throws Throwable {
|
||||||
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {
|
||||||
|
@Override
|
||||||
|
public Object doWork() throws Exception {
|
||||||
|
SearchParameters sp = new SearchParameters();
|
||||||
|
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
|
sp.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||||
|
sp.setQueryConsistency(QueryConsistency.TRANSACTIONAL);
|
||||||
|
sp.setQuery("TYPE:\"cm:content\"");
|
||||||
|
ResultSet rs = pubSearchService.query(sp);
|
||||||
|
int cnt = 0;
|
||||||
|
for (ResultSetRow row : rs)
|
||||||
|
{
|
||||||
|
assertNotNull(row.getValue(ContentModel.PROP_NAME));
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, "userA");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testPaging()
|
||||||
|
{
|
||||||
|
HashSet<NodeRef> resultPageSize2 = queryNodes(2);
|
||||||
|
HashSet<NodeRef> resultPageSize5 = queryNodes(5);
|
||||||
|
HashSet<NodeRef> resultPageSize10 = queryNodes(10);
|
||||||
|
HashSet<NodeRef> resultPageSizeAll = queryNodes(10000);
|
||||||
|
// all result sets must be equal, independent of page size used to retrieve them
|
||||||
|
assertTrue(resultPageSize2.size() >= 25);
|
||||||
|
assertTrue(resultPageSize5.size() >= 25);
|
||||||
|
assertTrue(resultPageSize10.size() >= 25);
|
||||||
|
assertTrue(resultPageSizeAll.size() >= 25);
|
||||||
|
assertTrue(resultPageSize2.containsAll(resultPageSize5));
|
||||||
|
assertTrue(resultPageSize2.containsAll(resultPageSize10));
|
||||||
|
assertTrue(resultPageSize2.containsAll(resultPageSizeAll));
|
||||||
|
assertTrue(resultPageSize5.containsAll(resultPageSize2));
|
||||||
|
assertTrue(resultPageSize5.containsAll(resultPageSize10));
|
||||||
|
assertTrue(resultPageSize5.containsAll(resultPageSizeAll));
|
||||||
|
assertTrue(resultPageSize10.containsAll(resultPageSize2));
|
||||||
|
assertTrue(resultPageSize10.containsAll(resultPageSize5));
|
||||||
|
assertTrue(resultPageSize10.containsAll(resultPageSizeAll));
|
||||||
|
assertTrue(resultPageSizeAll.containsAll(resultPageSize2));
|
||||||
|
assertTrue(resultPageSizeAll.containsAll(resultPageSize5));
|
||||||
|
assertTrue(resultPageSizeAll.containsAll(resultPageSize10));
|
||||||
|
// reset
|
||||||
|
queryEngine.setMinPagingBatchSize(2500);
|
||||||
|
queryEngine.setMaxPagingBatchSize(10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
HashSet<NodeRef> queryNodes(int pageSize)
|
||||||
|
{
|
||||||
|
queryEngine.setMinPagingBatchSize(pageSize);
|
||||||
|
queryEngine.setMaxPagingBatchSize(pageSize);
|
||||||
|
HashSet<NodeRef> result = new HashSet<>();
|
||||||
|
SearchParameters sp = new SearchParameters();
|
||||||
|
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
|
sp.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||||
|
sp.setQueryConsistency(QueryConsistency.TRANSACTIONAL);
|
||||||
|
sp.setQuery("TYPE:\"cm:content\"");
|
||||||
|
ResultSet rs = pubSearchService.query(sp);
|
||||||
|
int cnt = 0;
|
||||||
|
for (ResultSetRow row : rs)
|
||||||
|
{
|
||||||
|
result.add(row.getNodeRef());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Repository
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.search.impl.solr;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
import static org.mockito.Mockito.spy;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
import static org.mockito.MockitoAnnotations.openMocks;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
|
||||||
|
import org.alfresco.repo.search.QueryParserException;
|
||||||
|
import org.apache.commons.httpclient.Header;
|
||||||
|
import org.apache.commons.httpclient.HttpClient;
|
||||||
|
import org.apache.commons.httpclient.URI;
|
||||||
|
import org.apache.commons.httpclient.methods.PostMethod;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
/** Tests for the {@link AbstractSolrQueryHTTPClient}. */
|
||||||
|
public class AbstractSolrQueryHTTPClientTest
|
||||||
|
{
|
||||||
|
/** A URL for use in the tests. */
|
||||||
|
private static final String URL = "http://this/is/a/url";
|
||||||
|
|
||||||
|
/** The abstract class under test. */
|
||||||
|
private AbstractSolrQueryHTTPClient abstractSolrQueryHTTPClient = spy(AbstractSolrQueryHTTPClient.class);
|
||||||
|
@Mock
|
||||||
|
private HttpClient httpClient;
|
||||||
|
@Mock
|
||||||
|
private JSONObject body;
|
||||||
|
@Mock
|
||||||
|
private PostMethod postMethod;
|
||||||
|
@Mock
|
||||||
|
private Header header;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception
|
||||||
|
{
|
||||||
|
openMocks(this);
|
||||||
|
|
||||||
|
doReturn(postMethod).when(abstractSolrQueryHTTPClient).createNewPostMethod(URL);
|
||||||
|
when(postMethod.getResponseCharSet()).thenReturn("UTF-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check postQuery works as expected for the success case. */
|
||||||
|
@Test
|
||||||
|
public void testPostQuery_success() throws Exception
|
||||||
|
{
|
||||||
|
when(body.toString()).thenReturn("Example body");
|
||||||
|
when(postMethod.getStatusCode()).thenReturn(HttpServletResponse.SC_OK);
|
||||||
|
when(postMethod.getResponseBodyAsStream()).thenReturn(convertStringToInputStream("{}"));
|
||||||
|
|
||||||
|
JSONObject response = abstractSolrQueryHTTPClient.postQuery(httpClient, URL, body);
|
||||||
|
|
||||||
|
assertEquals("Unexpected JSON response received.", "{}", response.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check that the status code is usually passed through from Solr. */
|
||||||
|
@Test
|
||||||
|
public void testPostQuery_failure() throws Exception
|
||||||
|
{
|
||||||
|
String failureMessage = "{\"error\": {\"trace\": \"ExceptionClass: Stacktrace\"}}";
|
||||||
|
|
||||||
|
when(body.toString()).thenReturn("Example body");
|
||||||
|
when(postMethod.getStatusCode()).thenReturn(HttpServletResponse.SC_NOT_FOUND);
|
||||||
|
when(postMethod.getResponseBodyAsStream()).thenReturn(convertStringToInputStream(failureMessage));
|
||||||
|
when(postMethod.getResponseBodyAsString()).thenReturn(failureMessage);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
abstractSolrQueryHTTPClient.postQuery(httpClient, URL, body);
|
||||||
|
fail("Expected a QueryParserException to be thrown.");
|
||||||
|
}
|
||||||
|
catch (QueryParserException e)
|
||||||
|
{
|
||||||
|
assertEquals("Unexpected status code in exception.", e.getHttpStatusCode(), HttpServletResponse.SC_NOT_FOUND);
|
||||||
|
verify(postMethod).releaseConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check that the status code is replaced with "Not Implemented" for an unsupported query option. */
|
||||||
|
@Test
|
||||||
|
public void testPostQuery_unsupportedOperation() throws Exception
|
||||||
|
{
|
||||||
|
String failureMessage = "{\"error\": {\"trace\": \"java.lang.UnsupportedOperationException: Stacktrace\"}}";
|
||||||
|
|
||||||
|
when(body.toString()).thenReturn("Example body");
|
||||||
|
when(postMethod.getStatusCode()).thenReturn(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
|
when(postMethod.getResponseBodyAsStream()).thenReturn(convertStringToInputStream(failureMessage));
|
||||||
|
when(postMethod.getResponseBodyAsString()).thenReturn(failureMessage);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
abstractSolrQueryHTTPClient.postQuery(httpClient, URL, body);
|
||||||
|
fail("Expected a QueryParserException to be thrown.");
|
||||||
|
}
|
||||||
|
catch (QueryParserException e)
|
||||||
|
{
|
||||||
|
assertEquals("Unexpected status code in exception.", e.getHttpStatusCode(), HttpServletResponse.SC_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check that a redirect can be followed if the endpoint reports that it's moved. */
|
||||||
|
@Test
|
||||||
|
public void testPostQuery_moved() throws Exception
|
||||||
|
{
|
||||||
|
when(body.toString()).thenReturn("Example body");
|
||||||
|
// Report "moved" for the first invocation and then OK for subsequent requests.
|
||||||
|
when(postMethod.getStatusCode()).thenReturn(HttpServletResponse.SC_MOVED_PERMANENTLY).thenReturn(HttpServletResponse.SC_OK);
|
||||||
|
when(postMethod.getResponseBodyAsStream()).thenReturn(convertStringToInputStream("{}"));
|
||||||
|
when(postMethod.getResponseHeader("location")).thenReturn(header);
|
||||||
|
when(header.getValue()).thenReturn("http://new/URL");
|
||||||
|
|
||||||
|
JSONObject response = abstractSolrQueryHTTPClient.postQuery(httpClient, URL, body);
|
||||||
|
|
||||||
|
verify(postMethod).setURI(new URI("http://new/URL", true));
|
||||||
|
assertEquals("Unexpected JSON response received.", "{}", response.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create an input stream containing the given string. */
|
||||||
|
private ByteArrayInputStream convertStringToInputStream(String message)
|
||||||
|
{
|
||||||
|
return new ByteArrayInputStream(message.getBytes());
|
||||||
|
}
|
||||||
|
}
|
@@ -39,7 +39,6 @@ import java.util.Properties;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.transaction.UserTransaction;
|
import javax.transaction.UserTransaction;
|
||||||
import junit.framework.AssertionFailedError;
|
|
||||||
|
|
||||||
import org.alfresco.model.ApplicationModel;
|
import org.alfresco.model.ApplicationModel;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
@@ -94,6 +93,8 @@ import org.springframework.test.annotation.Commit;
|
|||||||
import org.springframework.test.context.transaction.TestTransaction;
|
import org.springframework.test.context.transaction.TestTransaction;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import junit.framework.AssertionFailedError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* versionService test class.
|
* versionService test class.
|
||||||
*
|
*
|
||||||
@@ -575,6 +576,86 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When IDs are out of order the comparator only fixes the order we retrieve versions. Any operation fails due to
|
||||||
|
* the head version not being the latest. (MNT-22715)
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testVersionIndex()
|
||||||
|
{
|
||||||
|
setUseVersionAssocIndex(true);
|
||||||
|
NodeRef versionableNode = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN,
|
||||||
|
QName.createQName("{test}MyVersionableNodeTestIndex"), ContentModel.TYPE_CONTENT, null).getChildRef();
|
||||||
|
nodeService.addAspect(versionableNode, ContentModel.ASPECT_VERSIONABLE, new HashMap<QName, Serializable>());
|
||||||
|
Version version1 = createVersion(versionableNode);
|
||||||
|
Version version2 = createVersion(versionableNode);
|
||||||
|
Version version3 = createVersion(versionableNode);
|
||||||
|
|
||||||
|
VersionHistory vh = versionService.getVersionHistory(versionableNode);
|
||||||
|
assertEquals("Version History does not contain 3 versions", 3, vh.getAllVersions().size());
|
||||||
|
|
||||||
|
NodeRef root = nodeService.getPrimaryParent(vh.getRootVersion().getFrozenStateNodeRef()).getParentRef();
|
||||||
|
NodeRef versionHistoryNode = dbNodeService.getChildByName(root, Version2Model.CHILD_QNAME_VERSION_HISTORIES,
|
||||||
|
versionableNode.getId());
|
||||||
|
|
||||||
|
// getChildAssocs orders by assoc_index first and then by ID. Version History relies on this.
|
||||||
|
List<ChildAssociationRef> vhChildAssocs = nodeService.getChildAssocs(versionHistoryNode);
|
||||||
|
int index = 0;
|
||||||
|
for (ChildAssociationRef vhChildAssoc : vhChildAssocs)
|
||||||
|
{
|
||||||
|
// Unset indexes are -1
|
||||||
|
assertFalse("Index is not set", vhChildAssoc.getNthSibling() < 0);
|
||||||
|
assertTrue("Index is not increasing as expected", vhChildAssoc.getNthSibling() > index);
|
||||||
|
index = vhChildAssoc.getNthSibling();
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals("1st version is not 1st assoc", version1.getFrozenStateNodeRef().getId(),
|
||||||
|
vhChildAssocs.get(0).getChildRef().getId());
|
||||||
|
assertEquals("2nd version is not 2nd assoc", version2.getFrozenStateNodeRef().getId(),
|
||||||
|
vhChildAssocs.get(1).getChildRef().getId());
|
||||||
|
assertEquals("3rd version is not 3rd assoc", version3.getFrozenStateNodeRef().getId(),
|
||||||
|
vhChildAssocs.get(2).getChildRef().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test version assoc index use disabled
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testVersionIndexDisabled()
|
||||||
|
{
|
||||||
|
setUseVersionAssocIndex(false);
|
||||||
|
NodeRef versionableNode = nodeService
|
||||||
|
.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN,
|
||||||
|
QName.createQName("{test}MyVersionableNodeTestWithoutIndex"), ContentModel.TYPE_CONTENT, null)
|
||||||
|
.getChildRef();
|
||||||
|
nodeService.addAspect(versionableNode, ContentModel.ASPECT_VERSIONABLE, new HashMap<QName, Serializable>());
|
||||||
|
Version version1 = createVersion(versionableNode);
|
||||||
|
Version version2 = createVersion(versionableNode);
|
||||||
|
Version version3 = createVersion(versionableNode);
|
||||||
|
|
||||||
|
VersionHistory vh = versionService.getVersionHistory(versionableNode);
|
||||||
|
assertEquals("Version History does not contain 3 versions", 3, vh.getAllVersions().size());
|
||||||
|
|
||||||
|
NodeRef root = nodeService.getPrimaryParent(vh.getRootVersion().getFrozenStateNodeRef()).getParentRef();
|
||||||
|
NodeRef versionHistoryNode = dbNodeService.getChildByName(root, Version2Model.CHILD_QNAME_VERSION_HISTORIES,
|
||||||
|
versionableNode.getId());
|
||||||
|
|
||||||
|
// getChildAssocs orders by assoc_index first and then by ID. Version History relies on this.
|
||||||
|
List<ChildAssociationRef> vhChildAssocs = nodeService.getChildAssocs(versionHistoryNode);
|
||||||
|
for (ChildAssociationRef vhChildAssoc : vhChildAssocs)
|
||||||
|
{
|
||||||
|
// Unset indexes are -1
|
||||||
|
assertTrue("Index is not set", vhChildAssoc.getNthSibling() < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals("1st version is not 1st assoc", version1.getFrozenStateNodeRef().getId(),
|
||||||
|
vhChildAssocs.get(0).getChildRef().getId());
|
||||||
|
assertEquals("2nd version is not 2nd assoc", version2.getFrozenStateNodeRef().getId(),
|
||||||
|
vhChildAssocs.get(1).getChildRef().getId());
|
||||||
|
assertEquals("3rd version is not 3rd assoc", version3.getFrozenStateNodeRef().getId(),
|
||||||
|
vhChildAssocs.get(2).getChildRef().getId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the versionService to be one that has is db ids out of order
|
* Sets the versionService to be one that has is db ids out of order
|
||||||
* so would normally have versions displayed in the wrong order.
|
* so would normally have versions displayed in the wrong order.
|
||||||
@@ -612,6 +693,25 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
|||||||
setVersionService(versionService);
|
setVersionService(versionService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the versionService to use the version assoc Index
|
||||||
|
* @param useVersionAssocIndex
|
||||||
|
*/
|
||||||
|
private void setUseVersionAssocIndex(boolean useVersionAssocIndex)
|
||||||
|
{
|
||||||
|
Version2ServiceImpl versionService = new Version2ServiceImpl();
|
||||||
|
versionService.setNodeService(nodeService);
|
||||||
|
versionService.setDbNodeService(dbNodeService); // mtAwareNodeService
|
||||||
|
versionService.setSearcher(versionSearchService);
|
||||||
|
versionService.setDictionaryService(dictionaryService);
|
||||||
|
versionService.setPolicyComponent(policyComponent);
|
||||||
|
versionService.setPolicyBehaviourFilter(policyBehaviourFilter);
|
||||||
|
versionService.setPermissionService(permissionService);
|
||||||
|
versionService.setUseVersionAssocIndex(useVersionAssocIndex);
|
||||||
|
versionService.initialise();
|
||||||
|
setVersionService(versionService);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds another version to the version history then checks that getVersionHistory is returning
|
* Adds another version to the version history then checks that getVersionHistory is returning
|
||||||
* the correct data.
|
* the correct data.
|
||||||
|
Reference in New Issue
Block a user