Merge 7.0.0-A3 changes into new projects (#3)

* Cherry pick (merge) changes from original projects in 7.0.0-A3)

Bump spring-surf-core-configservice from 8.5 to 8.6 (#144)

(cherry picked from commit 43e2592b264a6876da779d694f9a54f944c674c8)
Bump dependency.spring.version from 5.2.7.RELEASE to 5.2.8.RELEASE (#143)

(cherry picked from commit 9310346f19d6f4fb10317b6acbfb03df0bdefbd7)
Bump spring-surf-core-configservice from 8.6 to 8.7 (#145)

(cherry picked from commit 7ad131f31cd73b5ec103d279831fbc1fa8241496)
Bump spring-surf-core-configservice from 8.7 to 8.8 (#147)

(cherry picked from commit fcb5bd88e8331cfabf5a9a40e3c00e2aa013265a)
Bump mockito-core from 3.4.4 to 3.4.6 (#149)

(cherry picked from commit 1febbc71c8a52bb71620d218a15c2d7ff40350bb)
[SEARCH-2354] (#298)

Added support for DAYOFWEEK and DAYOFYEAR sql date functions

(cherry picked from commit 48bf24654945626eb8b26ff2ac0144bd92fe3302)
Bump jackson-annotations from 2.11.1 to 2.11.2 (#300)

(cherry picked from commit cde846f16f25e111b191eb8db4b46a967f40ff8e)
SEARCH-2273: Add detailed message when ignoring nodes in SOLR without… (#1111)

* SEARCH-2273: Add detailed message when ignoring nodes in SOLR without type or with types not registered in Dictionary Service.

* SEARCH-2273: Using non-registered type name.

* SEARCH-2273: Creating node without type using DB Service.

* SEARCH-2273: Check the right exception is produced when using a non registered TYPE.

* SEARCH-2273: Simplified case identification for exception message.

* SEARCH-2273: Remove unused library.

(cherry picked from commit f4bdc8c888dab01a1180715441c1669ac20e564d)
Bump dependency.spring.version from 5.2.6.RELEASE to 5.2.8.RELEASE (#1116)

(cherry picked from commit b7fc60bb60f483745f0461b9709b52e47d21e453)
Bump dependency.webscripts.version from 8.5 to 8.6 (#1117)

(cherry picked from commit 137013790b7852e549f7316c60b5305dff5f68f8)
SEARCH-800: Get values in DBResultSetRow in the same way they are rec… (#1114)

* SEARCH-800: Get values in DBResultSetRow in the same way they are recovered in SolrJSONResultSetRow.
This will provide the same behaviour when using getValue() method from Search ResultSet.

* SEARCH-800: Testing that using TRANSACTIONAL query consistency allows getting values using "getValue" method.

(cherry picked from commit 695113f4c40e34dcd8663d28e0ee56c956930a5e)
MNT-21317 Move on Update Folder Rule triggers unexpectedly for MOVED content. (#1115)

* MNT-21317_fix folder rule trigger

* MNT-21317_folder rule test case added

* Update .travis.yml

* Update OnPropertyUpdateRuleTrigger.java

* MNT-21317 updated test

(cherry picked from commit 33ca87046019416875fd23b72293e84b912f4cd9)
Bump aspectjrt from 1.9.5 to 1.9.6 (#1124)

(cherry picked from commit 330bb0820d2ce9608612eba9fed5acd76786853a)
Bump groovy-all from 2.4.19 to 2.4.20 (#1125)

(cherry picked from commit 4ab253bb21348f23a4df7e79ded43c16a9347e7c)
Bump dependency.webscripts.version from 8.6 to 8.7 (#1127)

(cherry picked from commit ac270757a7ff4bcd477375008902cf53bc220838)
Bump mariadb-java-client from 2.6.1 to 2.6.2 (#1128)

(cherry picked from commit 1f633aef1020aaeb31a71e0e4fed883f5a677f0f)
Bump gytheio-messaging-camel from 0.11.3 to 0.11.6 (#1095)

Bumps gytheio-messaging-camel from 0.11.3 to 0.11.6.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

(cherry picked from commit 16179db5fc4524c339097f1f3a9a6409dd895b11)
Bump dependency.webscripts.version from 8.7 to 8.8 (#1133)

(cherry picked from commit d363862d653e85e9366367817a82353580b2c6ce)
Bump dependency.transform.model.version from 1.0.2.10 to 1.0.2.11 (#1143)

(cherry picked from commit beaccd28608d2c70ef9eaf640d47a2e86a59ced4)
ATS-811: Updated T-engines to 2.3.3 (#1145)

(cherry picked from commit cbe6d78767741cb2b5f38d17cf4556dbda7c5311)
MNT-21614: LDAP sync communication error leads to group members deletion (#1149)

* Catch reported exceptions to filter ldap sync aborts

(cherry picked from commit 7e8cbd044e9ec2d31e05d072c0d47aa2d22ef771)
Bump commons-net from 3.6 to 3.7 (#1153)

(cherry picked from commit 3b5503bbf1c231a844536c54c639ad41a9c1b6aa)
ATS-817: Updated T-engines to 2.3.4 (#1151)

(cherry picked from commit b7f9ae0b71b599e27a59787ec3fe584ab64f1330)
[REPO-5239] - Added filter by displayName to /groups endpoint (#706)

* [REPO-5239] - Added filter by displayName to /groups endpoint

* [REPO-5239] - minor fix, brackets style

* [REPO-5239] Refactoring

* [REPO-5239] Fix to avoid the usage of displayName filter implemented in authorityService.getAuthoritiesInfo

(cherry picked from commit a01b80448ef48c5bb68978159b0ea134382ee653)

* Include branch in build

* More changes as a result of merging to alfresco-enterprise-repo. Dependencies now defined in community

* ACS-222: tests jobs using AIMS fail (#1464)

* Added a 3 minutes sleep after the curl request is succeeded preventing tests from starting immediately

Reimplemented from commit a6abc8a2c952d8c8d894bdeb50efe42f695d13cf on acs-packaging master. Now takes a second
optional parameter for the extra wait, so no all uses have to wait. Only AIMS.

* Merge commit to do with base-tomcat:8.5.51
This commit is contained in:
Alan Davis
2020-08-11 12:37:46 +01:00
committed by GitHub
parent 4dd068a98a
commit c7fbb97f76
25 changed files with 720 additions and 144 deletions

View File

@@ -25,7 +25,7 @@ branches:
only: only:
- master - master
- /release\/.*/ - /release\/.*/
- feature/REPO-5266_dup_tas_code - merge_to_7_0_0_A3
env: env:
global: global:
@@ -83,14 +83,14 @@ jobs:
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.2 - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4
script: travis_wait 20 mvn test -B -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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ script: travis_wait 20 mvn test -B -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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
- name: "Repository - AppContext04TestSuite" - name: "Repository - AppContext04TestSuite"
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.2 - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4
script: travis_wait 20 mvn test -B -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 test -B -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"
@@ -109,7 +109,7 @@ jobs:
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.2 - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4
script: travis_wait 20 mvn test -B -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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ script: travis_wait 20 mvn test -B -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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
- name: "Repository - AppContextExtraTestSuite" - name: "Repository - AppContextExtraTestSuite"
@@ -122,32 +122,32 @@ jobs:
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.2 - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4
script: travis_wait 20 mvn test -B -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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ script: travis_wait 20 mvn test -B -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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
- name: "Repository - MySQL tests" - name: "Repository - MySQL tests"
if: commit_message !~ /\[skip_db\]/ if: commit_message !~ /\[skip db\]/
install: install:
- 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.23 --transaction-isolation='READ-COMMITTED'
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
script: travis_wait 20 mvn test -B -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 test -B -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 tests" - name: "Repository - PostgreSQL 10 tests"
if: commit_message !~ /\[skip_db\]/ if: commit_message !~ /\[skip db\]/
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
script: travis_wait 20 mvn test -B -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 test -B -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 tests" - name: "Repository - PostgreSQL 11 tests"
if: commit_message !~ /\[skip_db\]/ if: commit_message !~ /\[skip db\]/
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
script: travis_wait 20 mvn test -B -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 test -B -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 - MariaDB tests" - name: "Repository - MariaDB tests"
if: commit_message !~ /\[skip_db\]/ if: commit_message !~ /\[skip db\]/
install: install:
- 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.15.8 - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
@@ -185,7 +185,7 @@ jobs:
- name: "REST API TAS tests part1" - name: "REST API TAS tests part1"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"
@@ -194,7 +194,7 @@ jobs:
- name: "REST API TAS tests part2" - name: "REST API TAS tests part2"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"
@@ -203,7 +203,7 @@ jobs:
- name: "REST API TAS tests part3" - name: "REST API TAS tests part3"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"
@@ -212,7 +212,7 @@ jobs:
- name: "CMIS TAS tests" - name: "CMIS TAS tests"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"
@@ -221,7 +221,7 @@ jobs:
- name: "Email TAS tests" - name: "Email TAS tests"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"
@@ -230,7 +230,7 @@ jobs:
- name: "WebDAV TAS tests" - name: "WebDAV TAS tests"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"
@@ -239,7 +239,7 @@ jobs:
- name: "Integration TAS tests" - name: "Integration TAS tests"
jdk: openjdk11 jdk: openjdk11
if: commit_message ~ /\[tas\]/ if: commit_message =~ /\[tas\]/
install: install:
- ${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"

View File

@@ -159,8 +159,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.11.1</version> <version>${dependency.jackson.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>

View File

@@ -187,7 +187,11 @@ public interface QueryConstants
public static final String FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX = "_unit_of_time_hour"; public static final String FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX = "_unit_of_time_hour";
public static final String FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX = "_unit_of_time_day"; public static final String FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX = "_unit_of_time_day_of_month";
public static final String FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX = "_unit_of_time_day_of_week";
public static final String FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX = "_unit_of_time_day_of_year";
public static final String FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX = "_unit_of_time_month"; public static final String FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX = "_unit_of_time_month";

View File

@@ -404,6 +404,16 @@ public class QueryParserUtils implements QueryConstants
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX.length()); propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX.length());
ending = FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX; ending = FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX;
} }
else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX))
{
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX.length());
ending = FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX;
}
else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX))
{
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX.length());
ending = FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX;
}
else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX)) else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX))
{ {
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length()); propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length());

View File

@@ -552,6 +552,34 @@ public class AlfrescoFunctionEvaluationContext implements FunctionEvaluationCont
return propertyField; return propertyField;
} }
} }
else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX))
{
QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX.length()));
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField);
if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATE) &&
!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME))
{
throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_OF_WEEK_SUFFIX+" only supported on date and datetime properties");
}
else
{
return propertyField;
}
}
else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX))
{
QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX.length()));
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField);
if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATE) &&
!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME))
{
throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_OF_YEAR_SUFFIX+" only supported on date and datetime properties");
}
else
{
return propertyField;
}
}
else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX)) else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX))
{ {
QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length())); QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length()));

View File

@@ -1,6 +1,6 @@
# Fetch image based on Tomcat 8.5.43 and Java 11 # Fetch image based on Tomcat 8.5 and Java 11
# 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:8.5.43-java-11-openjdk-centos-7 FROM alfresco/alfresco-base-tomcat:8.5.51-java-11-openjdk-centos-7
# Set default docker_context. Will / Can be overriden with maven. # Set default docker_context. Will / Can be overriden with maven.
ARG resource_path=target ARG resource_path=target

View File

@@ -1,8 +0,0 @@
# Branch specific configuration file for localisation scripts
# here is no localization needed in the alfresco-community-repo-packaging project for now
MESSAGE_SEARCH_PATH=""
EXCLUDED_FILES=""

View File

@@ -1,4 +1,4 @@
TRANSFORMERS_TAG=2.3.1 TRANSFORMERS_TAG=2.3.4
SOLR6_TAG=1.4.2 SOLR6_TAG=1.4.2
POSTGRES_TAG=11.7 POSTGRES_TAG=11.7
ACTIVEMQ_TAG=5.15.8 ACTIVEMQ_TAG=5.15.8

View File

@@ -29,20 +29,16 @@ services:
-Dshare.host=localhost -Dshare.host=localhost
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos -Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\" -Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/ -DlocalTransform.core-aio.url=http://transform-core-aio:8090/
-Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/ -Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/
-Djodconverter.url=http://transform-core-aio:8090/ -Djodconverter.url=http://transform-core-aio:8090/
-Dimg.url=http://transform-core-aio:8090/ -Dimg.url=http://transform-core-aio:8090/
-Dtika.url=http://transform-core-aio:8090/ -Dtika.url=http://transform-core-aio:8090/
-Dtransform.misc.url=http://transform-core-aio:8090/ -Dtransform.misc.url=http://transform-core-aio:8090/
-Dimap.server.port=1143 -Dimap.server.port=1143
-Dftp.port=1221 -Dftp.port=1221
-Dcors.enabled=true -Dcors.enabled=true
-Dcors.allowed.origins=http://localhost:4200,http://localhost:8080 -Dcors.allowed.origins=http://localhost:4200,http://localhost:8080
-Dmetadata-keystore.password=mp6yc0UD9e -Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata -Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=mp6yc0UD9e -Dmetadata-keystore.metadata.password=mp6yc0UD9e

View File

@@ -29,15 +29,12 @@ services:
-Dshare.host=localhost -Dshare.host=localhost
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos -Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\" -Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
-Dlocal.transform.service.enabled=false -Dlocal.transform.service.enabled=false
-Dlegacy.transform.service.enabled=false -Dlegacy.transform.service.enabled=false
-Dimap.server.port=1143 -Dimap.server.port=1143
-Dftp.port=1221 -Dftp.port=1221
-Dcors.enabled=true -Dcors.enabled=true
-Dcors.allowed.origins=http://localhost:4200,http://localhost:8080 -Dcors.allowed.origins=http://localhost:4200,http://localhost:8080
-Dmetadata-keystore.password=mp6yc0UD9e -Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata -Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=mp6yc0UD9e -Dmetadata-keystore.metadata.password=mp6yc0UD9e

View File

@@ -20,15 +20,5 @@
<properties> <properties>
<!-- TAS tests require an old version --> <!-- TAS tests require an old version -->
<dependency.org-json.version>20170516</dependency.org-json.version> <dependency.org-json.version>20170516</dependency.org-json.version>
<!-- Try the same versions of everything else to fix the tests - Some modules use diff versions. Better but test still fail. -->
<!-- <dependency.commons-dbcp.version>1.4</dependency.commons-dbcp.version>-->
<!-- <dependency.guava.version>23.0</dependency.guava.version>-->
<!-- <dependency.commons-io.version>2.5</dependency.commons-io.version>-->
<!-- <dependency.gson.version>2.8.5</dependency.gson.version>-->
<!-- <dependency.httpclient.version>4.5.12</dependency.httpclient.version>-->
<!-- <dependency.xercesImpl.version>2.12.0</dependency.xercesImpl.version>-->
<!-- <dependency.postgresql.version>9.4.1211.jre7</dependency.postgresql.version>-->
<!-- <dependency.mysql.version>5.1.18</dependency.mysql.version>-->
</properties> </properties>
</project> </project>

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export ALFRESCO_URL=$1 export ALFRESCO_URL=$1
export EXTRA_WAIT_INTERVAL=$2
if [ -z "$ALFRESCO_URL" ] if [ -z "$ALFRESCO_URL" ]
then then
@@ -24,6 +25,13 @@ if (("$COUNTER" < "$TIMEOUT")) ; then
t1=$(date +%s) t1=$(date +%s)
delta=$((($t1 - $t0)/60)) delta=$((($t1 - $t0)/60))
echo "Alfresco Started in $delta minutes" echo "Alfresco Started in $delta minutes"
if [ -n "$EXTRA_WAIT_INTERVAL" ]
then
echo "Waiting an extra $EXTRA_WAIT_INTERVAL for all the containers to initialise..."
sleep $EXTRA_WAIT_INTERVAL
echo "Waited $EXTRA_WAIT_INTERVAL seconds"
fi
else else
echo "Waited $COUNTER seconds" echo "Waited $COUNTER seconds"
echo "Alfresco Could not start in time." echo "Alfresco Could not start in time."

24
pom.xml
View File

@@ -44,40 +44,44 @@
<dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version> <dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
<dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version> <dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
<dependency.activiti.version>5.23.0</dependency.activiti.version> <dependency.activiti.version>5.23.0</dependency.activiti.version>
<dependency.transform.model.version>1.0.2.10</dependency.transform.model.version> <dependency.transform.model.version>1.0.2.11</dependency.transform.model.version>
<dependency.spring.version>5.2.7.RELEASE</dependency.spring.version> <dependency.spring.version>5.2.8.RELEASE</dependency.spring.version>
<dependency.antlr.version>3.5.2</dependency.antlr.version> <dependency.antlr.version>3.5.2</dependency.antlr.version>
<dependency.fabric8.version>4.4.0</dependency.fabric8.version> <dependency.fabric8.version>4.4.0</dependency.fabric8.version>
<dependency.jackson.version>2.11.1</dependency.jackson.version> <dependency.jackson.version>2.11.2</dependency.jackson.version>
<dependency.jackson-databind.version>2.10.1</dependency.jackson-databind.version> <dependency.jackson-databind.version>2.10.1</dependency.jackson-databind.version>
<dependency.cxf.version>3.3.7</dependency.cxf.version> <dependency.cxf.version>3.3.7</dependency.cxf.version>
<dependency.opencmis.version>1.0.0</dependency.opencmis.version> <dependency.opencmis.version>1.0.0</dependency.opencmis.version>
<dependency.pdfbox.version>2.0.20</dependency.pdfbox.version> <dependency.pdfbox.version>2.0.20</dependency.pdfbox.version>
<dependency.webscripts.version>8.5</dependency.webscripts.version> <dependency.webscripts.version>8.8</dependency.webscripts.version>
<dependency.bouncycastle.version>1.66</dependency.bouncycastle.version> <dependency.bouncycastle.version>1.66</dependency.bouncycastle.version>
<dependency.mockito-core.version>3.4.4</dependency.mockito-core.version> <dependency.mockito-core.version>3.4.6</dependency.mockito-core.version>
<dependency.org-json.version>20090211</dependency.org-json.version> <dependency.org-json.version>20090211</dependency.org-json.version>
<dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version> <dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version>
<dependency.guava.version>28.2-jre</dependency.guava.version> <dependency.guava.version>28.2-jre</dependency.guava.version>
<dependency.commons-io.version>2.7</dependency.commons-io.version> <dependency.commons-io.version>2.7</dependency.commons-io.version>
<dependency.gson.version>2.8.5</dependency.gson.version> <dependency.gson.version>2.8.5</dependency.gson.version>
<dependency.httpclient.version>4.5.12</dependency.httpclient.version> <dependency.httpclient.version>4.5.12</dependency.httpclient.version>
<dependency.httpcore.version>4.4.13</dependency.httpcore.version>
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
<dependency.xercesImpl.version>2.12.0-alfresco-patched-20191004</dependency.xercesImpl.version> <dependency.xercesImpl.version>2.12.0-alfresco-patched-20191004</dependency.xercesImpl.version>
<dependency.maven-jar-plugin.version>3.2.0</dependency.maven-jar-plugin.version> <dependency.maven-jar-plugin.version>3.2.0</dependency.maven-jar-plugin.version>
<dependency.slf4j.version>1.7.30</dependency.slf4j.version> <dependency.slf4j.version>1.7.30</dependency.slf4j.version>
<dependency.gytheio.version>0.11.6</dependency.gytheio.version>
<dependency.jaxb.version>2.3.3</dependency.jaxb.version>
<alfresco.googledrive.version>3.2.0</alfresco.googledrive.version> <alfresco.googledrive.version>3.2.0</alfresco.googledrive.version>
<alfresco.aos-module.version>1.3.1</alfresco.aos-module.version> <alfresco.aos-module.version>1.3.1</alfresco.aos-module.version>
<dependency.postgresql.version>42.2.14</dependency.postgresql.version> <dependency.postgresql.version>42.2.14</dependency.postgresql.version>
<dependency.mysql.version>8.0.21</dependency.mysql.version> <dependency.mysql.version>8.0.21</dependency.mysql.version>
<dependency.mariadb.version>2.6.1</dependency.mariadb.version> <dependency.mariadb.version>2.6.2</dependency.mariadb.version>
<dependency.tas-utility.version>3.0.21</dependency.tas-utility.version> <dependency.tas-utility.version>3.0.21</dependency.tas-utility.version>
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version> <dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
<dependency.javax.json.version>1.1.4</dependency.javax.json.version> <dependency.javax.json.version>1.1.4</dependency.javax.json.version>
<dependency.tas-restapi.version>1.46</dependency.tas-restapi.version> <dependency.tas-restapi.version>1.47</dependency.tas-restapi.version>
<dependency.tas-cmis.version>1.13</dependency.tas-cmis.version> <dependency.tas-cmis.version>1.13</dependency.tas-cmis.version>
<dependency.tas-email.version>1.8</dependency.tas-email.version> <dependency.tas-email.version>1.8</dependency.tas-email.version>
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version> <dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
@@ -264,12 +268,12 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId> <artifactId>httpcore</artifactId>
<version>4.4.13</version> <version>${dependency.httpcore.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-httpclient</groupId> <groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId> <artifactId>commons-httpclient</artifactId>
<version>3.1-HTTPCLIENT-1265</version> <version>${dependency.commons-httpclient.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
@@ -315,7 +319,7 @@
<dependency> <dependency>
<groupId>com.sun.xml.bind</groupId> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId> <artifactId>jaxb-impl</artifactId>
<version>2.3.3</version> <version>${dependency.jaxb.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>

View File

@@ -35,7 +35,6 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@@ -74,6 +73,7 @@ import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.AlfrescoCollator; import org.alfresco.util.AlfrescoCollator;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
import org.apache.commons.lang3.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.surf.util.I18NUtil;
/** /**
@@ -84,7 +84,9 @@ import org.springframework.extensions.surf.util.I18NUtil;
public class GroupsImpl implements Groups public class GroupsImpl implements Groups
{ {
private static final int MAX_ZONES = 1; private static final int MAX_ZONES = 1;
private static final int MAX_DISPLAY_NAMES = 1;
private static final String DISPLAY_NAME = "displayName"; private static final String DISPLAY_NAME = "displayName";
private static final String ZONE = "zone";
private static final String AUTHORITY_NAME = "authorityName"; private static final String AUTHORITY_NAME = "authorityName";
private static final String ERR_MSG_MODIFY_FIXED_AUTHORITY = "Trying to modify a fixed authority"; private static final String ERR_MSG_MODIFY_FIXED_AUTHORITY = "Trying to modify a fixed authority";
@@ -181,39 +183,20 @@ public class GroupsImpl implements Groups
public CollectionWithPagingInfo<Group> getGroups(final Parameters parameters) public CollectionWithPagingInfo<Group> getGroups(final Parameters parameters)
{ {
final List<String> includeParam = parameters.getInclude();
Paging paging = parameters.getPaging(); Paging paging = parameters.getPaging();
// Retrieve sort column. This is limited for now to sort column due to // Retrieve sort column. This is limited for now to sort column due to
// v0 api implementation. Should be improved in the future. // v0 api implementation. Should be improved in the future.
Pair<String, Boolean> sortProp = getGroupsSortProp(parameters); Pair<String, Boolean> sortProp = getGroupsSortProp(parameters);
// Parse where clause properties. // Parse where clause properties.
Query q = parameters.getQuery(); GroupsFilter groupsFilters = getGroupsFilterFromQueryParameters(parameters.getQuery());
Boolean isRootParam = null;
String zoneFilter = null;
if (q != null)
{
GroupsQueryWalker propertyWalker = new GroupsQueryWalker();
QueryHelper.walk(q, propertyWalker);
isRootParam = propertyWalker.getIsRoot();
List<String> zonesParam = propertyWalker.getZones();
if (zonesParam != null)
{
validateZonesParam(zonesParam);
zoneFilter = zonesParam.get(0);
}
}
final AuthorityType authorityType = AuthorityType.GROUP; final AuthorityType authorityType = AuthorityType.GROUP;
final Set<String> rootAuthorities = getAllRootAuthorities(authorityType); final Set<String> rootAuthorities = getAllRootAuthorities(authorityType);
PagingResults<AuthorityInfo> pagingResult; PagingResults<AuthorityInfo> pagingResult;
try try
{ {
pagingResult = getAuthoritiesInfo(authorityType, isRootParam, zoneFilter, rootAuthorities, sortProp, paging); pagingResult = getAuthoritiesInfo(authorityType, groupsFilters, rootAuthorities, sortProp, paging);
} }
catch (UnknownAuthorityException e) catch (UnknownAuthorityException e)
{ {
@@ -221,9 +204,15 @@ public class GroupsImpl implements Groups
pagingResult = new EmptyPagingResults<>(); pagingResult = new EmptyPagingResults<>();
} }
// Create response. List<Group> groups = createGroupsResponse(pagingResult.getPage(), parameters.getInclude(), rootAuthorities);
final List<AuthorityInfo> page = pagingResult.getPage();
int totalItems = pagingResult.getTotalResultCount().getFirst(); int totalItems = pagingResult.getTotalResultCount().getFirst();
return CollectionWithPagingInfo.asPaged(paging, groups, pagingResult.hasMoreItems(), totalItems);
}
private List<Group> createGroupsResponse(final List<AuthorityInfo> page, final List<String> includeParam, final Set<String> rootAuthorities)
{
List<Group> groups = new AbstractList<Group>() List<Group> groups = new AbstractList<Group>()
{ {
@Override @Override
@@ -239,27 +228,58 @@ public class GroupsImpl implements Groups
return page.size(); return page.size();
} }
}; };
return groups;
return CollectionWithPagingInfo.asPaged(paging, groups, pagingResult.hasMoreItems(), totalItems);
} }
private void validateZonesParam(List<String> zonesParam) private GroupsFilter getGroupsFilterFromQueryParameters(Query queryParameters)
{ {
if (zonesParam.size() > MAX_ZONES) GroupsFilter.GroupsFilterBuilder groupsFilterBuilder = GroupsFilter.builder();
if (queryParameters != null)
{ {
throw new IllegalArgumentException("A maximum of " + MAX_ZONES + " zones may be specified."); GroupsQueryWalker propertyWalker = new GroupsQueryWalker();
QueryHelper.walk(queryParameters, propertyWalker);
groupsFilterBuilder
.withIsRoot(
propertyWalker.getIsRoot())
.withZoneFilter(
getStringFilterFromList(propertyWalker.getZones(), ZONE, MAX_ZONES))
.withDisplayNameFilter(
getStringFilterFromList(propertyWalker.getDisplayNames(), DISPLAY_NAME, MAX_DISPLAY_NAMES));
} }
else if (zonesParam.isEmpty()) return groupsFilterBuilder.build();
}
private String getStringFilterFromList(List<String> listParam, String paramName, int maxItems)
{
String filter = null;
if (listParam != null)
{ {
throw new IllegalArgumentException("Zones filter list cannot be empty."); validateListParam(listParam, paramName, maxItems);
filter = listParam.get(0);
} }
// Validate each zone name return filter;
zonesParam.forEach(zone -> { }
if (zone.isEmpty())
{ private void validateListParam(List<String> listParam, String paramName, int maxItems)
throw new IllegalArgumentException("Zone name cannot be empty (i.e. '')"); {
} if (listParam.size() > maxItems)
}); {
throw new IllegalArgumentException("A maximum of " + maxItems + " " + paramName + "s may be specified.");
}
else if (listParam.isEmpty())
{
throw new IllegalArgumentException(StringUtils.capitalize(paramName) + "s filter list cannot be empty.");
}
listParam
.stream()
.filter(String::isEmpty)
.findAny()
.ifPresent(displayName -> {
throw new IllegalArgumentException(StringUtils.capitalize(paramName) + " cannot be empty (i.e. '')");
});
} }
@Override @Override
@@ -290,7 +310,7 @@ public class GroupsImpl implements Groups
List<String> zonesParam = propertyWalker.getZones(); List<String> zonesParam = propertyWalker.getZones();
if (zonesParam != null) if (zonesParam != null)
{ {
validateZonesParam(zonesParam); validateListParam(zonesParam, ZONE, MAX_ZONES);
zoneFilter = zonesParam.get(0); zoneFilter = zonesParam.get(0);
} }
} }
@@ -334,22 +354,26 @@ public class GroupsImpl implements Groups
return CollectionWithPagingInfo.asPaged(paging, groups, pagingResult.hasMoreItems(), totalItems); return CollectionWithPagingInfo.asPaged(paging, groups, pagingResult.hasMoreItems(), totalItems);
} }
private PagingResults<AuthorityInfo> getAuthoritiesInfo(AuthorityType authorityType, Boolean isRootParam, String zoneFilter, Set<String> rootAuthorities, Pair<String, Boolean> sortProp, private PagingResults<AuthorityInfo> getAuthoritiesInfo(AuthorityType authorityType, GroupsFilter groupsFilter, Set<String> rootAuthorities,
Paging paging) Pair<String, Boolean> sortProp, Paging paging)
{ {
Boolean isRootParam = groupsFilter.getIsRoot();
String zoneFilter = groupsFilter.getZoneFilter();
String displayNameFilter = groupsFilter.getDisplayNameFilter();
PagingResults<AuthorityInfo> pagingResult; PagingResults<AuthorityInfo> pagingResult;
if (isRootParam != null) if (isRootParam != null || displayNameFilter != null)
{ {
List<AuthorityInfo> groupList; List<AuthorityInfo> groupList;
if (isRootParam) if (isRootParam != null && isRootParam)
{ {
// Limit the post processing work by using the already loaded // Limit the post processing work by using the already loaded
// list of root authorities. // list of root authorities.
List<AuthorityInfo> authorities = rootAuthorities.stream(). List<AuthorityInfo> authorities = rootAuthorities.stream().
map(this::getAuthorityInfo). map(this::getAuthorityInfo).
filter(auth -> zonePredicate(auth.getAuthorityName(), zoneFilter)). filter(auth -> zonePredicate(auth.getAuthorityName(), zoneFilter)).
filter(auth -> displayNamePredicate(auth.getAuthorityDisplayName(), displayNameFilter)).
collect(Collectors.toList()); collect(Collectors.toList());
groupList = new ArrayList<>(rootAuthorities.size()); groupList = new ArrayList<>(rootAuthorities.size());
groupList.addAll(authorities); groupList.addAll(authorities);
@@ -376,14 +400,11 @@ public class GroupsImpl implements Groups
groupList = nonPagingResult.getPage(); groupList = nonPagingResult.getPage();
if (groupList != null) if (groupList != null)
{ {
for (Iterator<AuthorityInfo> i = groupList.iterator(); i.hasNext();) groupList = groupList
{ .stream()
AuthorityInfo authorityInfo = i.next(); .filter(auth -> isRootPredicate(isRootParam, rootAuthorities, auth.getAuthorityName()))
if (!isRootParam.equals(isRootAuthority(rootAuthorities, authorityInfo.getAuthorityName()))) .filter(auth -> displayNamePredicate(auth.getAuthorityDisplayName(), displayNameFilter))
{ .collect(Collectors.toList());
i.remove();
}
}
} }
} }
@@ -463,6 +484,25 @@ public class GroupsImpl implements Groups
return true; return true;
} }
/**
* Checks to see if the named group authority should be included in results
* when filtered by displayName.
* <p>
* If the requiredDisplayName parameter is null, then the filter will not be applied (returns true.)
* <p>
* @param groupDisplayName
* @param requiredDisplayName
* @return true if result should be included.
*/
private boolean displayNamePredicate(String groupDisplayName, String requiredDisplayName)
{
if (requiredDisplayName != null)
{
return groupDisplayName != null && groupDisplayName.equalsIgnoreCase(requiredDisplayName);
}
return true;
}
private Set<String> getAllRootAuthorities(AuthorityType authorityType) private Set<String> getAllRootAuthorities(AuthorityType authorityType)
{ {
Set<String> authorities; Set<String> authorities;
@@ -1026,6 +1066,7 @@ public class GroupsImpl implements Groups
private static class GroupsQueryWalker extends MapBasedQueryWalker private static class GroupsQueryWalker extends MapBasedQueryWalker
{ {
private List<String> zones; private List<String> zones;
private List<String> displayNames;
public GroupsQueryWalker() public GroupsQueryWalker()
{ {
@@ -1045,6 +1086,10 @@ public class GroupsImpl implements Groups
{ {
zones = Arrays.asList(propertyValues); zones = Arrays.asList(propertyValues);
} }
if (propertyName.equalsIgnoreCase(DISPLAY_NAME))
{
displayNames = Arrays.asList(propertyValues);
}
} }
/** /**
@@ -1066,5 +1111,81 @@ public class GroupsImpl implements Groups
{ {
return getProperty(PARAM_IS_ROOT, WhereClauseParser.EQUALS, Boolean.class); return getProperty(PARAM_IS_ROOT, WhereClauseParser.EQUALS, Boolean.class);
} }
/**
* The list of displayName specified in the where clause.
*
* @return The displayNames list if specified, or null if not.
*/
public List<String> getDisplayNames()
{
return displayNames;
}
} }
} }
class GroupsFilter
{
private Boolean isRoot;
private String zoneFilter;
private String displayNameFilter;
private GroupsFilter()
{
}
public static GroupsFilterBuilder builder()
{
return new GroupsFilterBuilder();
}
public Boolean getIsRoot()
{
return isRoot;
}
public String getZoneFilter()
{
return zoneFilter;
}
public String getDisplayNameFilter()
{
return displayNameFilter;
}
public static class GroupsFilterBuilder
{
private Boolean isRoot;
private String zoneFilter;
private String displayNameFilter;
public GroupsFilterBuilder withIsRoot(Boolean isRoot)
{
this.isRoot = isRoot;
return this;
}
public GroupsFilterBuilder withZoneFilter(String zoneFilter)
{
this.zoneFilter = zoneFilter;
return this;
}
public GroupsFilterBuilder withDisplayNameFilter(String displayNameFilter)
{
this.displayNameFilter = displayNameFilter;
return this;
}
public GroupsFilter build()
{
GroupsFilter groupsFilter = new GroupsFilter();
groupsFilter.isRoot = this.isRoot;
groupsFilter.zoneFilter = this.zoneFilter;
groupsFilter.displayNameFilter = this.displayNameFilter;
return groupsFilter;
}
}
}

View File

@@ -115,6 +115,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
testGetGroupsByIsRoot(true); testGetGroupsByIsRoot(true);
testGetGroupsByIsRoot(false); testGetGroupsByIsRoot(false);
testGetGroupsWithZoneFilter(); testGetGroupsWithZoneFilter();
testGetGroupsWithDisplayNameFilter();
} }
finally finally
{ {
@@ -1856,4 +1857,193 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
return subGroup; return subGroup;
} }
private void testGetGroupsWithDisplayNameFilter() throws Exception
{
shouldFilterGroupByDisplayName();
shouldFilterGroupByDisplayNameWhenNameNotExist();
shouldFilterGroupByDisplayNameAndZone();
shouldFilterGroupByDisplayNameWhenGroupIsRoot();
shouldFilterGroupByDisplayNameWhenIsRootIsFalse();
shouldFilterGroupByDisplayNameAndZoneWhenGroupIsRoot();
shouldReturnBadRequestErrorWhenTooManyDisplayNames();
shouldReturnBadRequestErrorWhenDisplayNameIsEmpty();
shouldNotAllowWildcards();
}
private void shouldFilterGroupByDisplayName() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where", "(displayName in ('A Group'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertEquals(1, groups.size());
assertEquals("A Group", groups.get(0).getDisplayName());
otherParams.put("where", "(displayName in ('a group'))");
response = getGroups(paging, otherParams);
response.getList();
assertEquals(1, groups.size());
assertEquals("A Group", groups.get(0).getDisplayName());
}
private void shouldFilterGroupByDisplayNameWhenNameNotExist() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where", "(displayName in ('AGroupName'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertTrue(groups.isEmpty());
}
private void shouldFilterGroupByDisplayNameAndZone() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
addOrderBy(otherParams, org.alfresco.rest.api.Groups.PARAM_DISPLAY_NAME, true);
otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_ZONES);
otherParams.put("where", "(zones in ('APITEST.MYZONE') AND displayName in ('A Group'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertEquals(1, groups.size());
assertTrue(groups.get(0).getZones().contains("APITEST.MYZONE"));
assertEquals("A Group", groups.get(0).getDisplayName());
}
private void shouldFilterGroupByDisplayNameWhenGroupIsRoot() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where", "(isRoot=true AND displayName in ('Root Group'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertEquals(1, groups.size());
assertEquals("Root Group", groups.get(0).getDisplayName());
}
private void shouldFilterGroupByDisplayNameWhenIsRootIsFalse() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where", "(isRoot=False AND displayName in ('A Group'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertEquals(1, groups.size());
assertEquals("A Group", groups.get(0).getDisplayName());
}
private void shouldFilterGroupByDisplayNameAndZoneWhenGroupIsRoot() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_ZONES);
otherParams.put("where", "(isRoot=true AND zones in ('APITEST.MYZONE') AND displayName in ('Root Group'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertEquals(1, groups.size());
assertTrue(groups.get(0).getZones().contains("APP.DEFAULT"));
assertEquals("Root Group", groups.get(0).getDisplayName());
}
private void shouldReturnBadRequestErrorWhenTooManyDisplayNames() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where", "(displayName in ('Group A', 'Group B'))");
getGroups(paging, otherParams, "Incorrect response", 400);
}
private void shouldReturnBadRequestErrorWhenDisplayNameIsEmpty() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where","(displayName in ())");
getGroups(paging, otherParams, "Incorrect response",400);
otherParams.put("where","(displayName in (''))");
getGroups(paging, otherParams, "Incorrect response",400);
}
private void shouldNotAllowWildcards() throws Exception
{
Paging paging = getPaging(0, Integer.MAX_VALUE);
Map<String, String> otherParams = new HashMap<>();
otherParams.put("where", "(displayName in ('*'))");
ListResponse<Group> response = getGroups(paging, otherParams);
List<Group> groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(isRoot=true AND displayName in ('*'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(displayName in ('A*'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(isRoot=true AND displayName in ('A*'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(displayName in ('*roup'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(isRoot=true AND displayName in ('*roup'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(displayName in ('Root ?ROUP'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(isRoot=true AND displayName in ('Root ?ROUP'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(displayName in ('Group'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
otherParams.put("where", "(isRoot=true AND displayName in ('Group'))");
response = getGroups(paging, otherParams);
groups = response.getList();
assertEquals(0, groups.size());
}
} }

View File

@@ -705,7 +705,7 @@
<dependency> <dependency>
<groupId>org.gytheio</groupId> <groupId>org.gytheio</groupId>
<artifactId>gytheio-messaging-camel</artifactId> <artifactId>gytheio-messaging-camel</artifactId>
<version>0.11.3</version> <version>${dependency.gytheio.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
@@ -1027,18 +1027,18 @@
<dependency> <dependency>
<groupId>org.aspectj</groupId> <groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId> <artifactId>aspectjrt</artifactId>
<version>1.9.5</version> <version>1.9.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-net</groupId> <groupId>commons-net</groupId>
<artifactId>commons-net</artifactId> <artifactId>commons-net</artifactId>
<version>3.6</version> <version>3.7</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.codehaus.groovy</groupId> <groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId> <artifactId>groovy-all</artifactId>
<version>2.4.19</version> <version>2.4.20</version>
<classifier>indy</classifier> <classifier>indy</classifier>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@@ -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.rule.ruletrigger; package org.alfresco.repo.rule.ruletrigger;
import java.io.Serializable; import java.io.Serializable;
@@ -141,7 +141,7 @@ public class OnPropertyUpdateRuleTrigger extends RuleTriggerAbstractBase
for (QName name : keys) for (QName name : keys)
{ {
// Skip rule firing on this content property for performance reasons // Skip rule firing on this content property for performance reasons
if (name.equals(ContentModel.PROP_PREFERENCE_VALUES)) if (name.equals(ContentModel.PROP_PREFERENCE_VALUES) || name.equals(ContentModel.PROP_CASCADE_CRC))
{ {
continue; continue;
} }

View File

@@ -240,6 +240,11 @@ public class DBResultSet extends AbstractResultSet
nodeRefs[n+1] = nodeRef == null ? null : tenantService.getBaseName(nodeRef); nodeRefs[n+1] = nodeRef == null ? null : tenantService.getBaseName(nodeRef);
} }
} }
} }
public NodeService getNodeService()
{
return nodeService;
}
} }

View File

@@ -25,11 +25,13 @@
*/ */
package org.alfresco.repo.search.impl.querymodel.impl.db; package org.alfresco.repo.search.impl.querymodel.impl.db;
import java.io.Serializable;
import java.util.Map; import java.util.Map;
import org.alfresco.repo.search.AbstractResultSetRow; import org.alfresco.repo.search.AbstractResultSetRow;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.namespace.QName;
/** /**
* @author Andy * @author Andy
@@ -82,6 +84,13 @@ public class DBResultSetRow extends AbstractResultSetRow
public float getScore(String selectorName) public float getScore(String selectorName)
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}
@Override
protected Map<QName, Serializable> getDirectProperties()
{
DBResultSet rs = (DBResultSet) getResultSet();
return rs.getNodeService().getProperties(rs.getNodeRef(getIndex()));
} }

View File

@@ -54,6 +54,7 @@ import javax.naming.InvalidNameException;
import javax.naming.Name; import javax.naming.Name;
import javax.naming.NamingEnumeration; import javax.naming.NamingEnumeration;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.naming.ServiceUnavailableException;
import javax.naming.directory.Attribute; import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes; import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext; import javax.naming.directory.DirContext;
@@ -882,6 +883,16 @@ public class LDAPUserRegistry implements UserRegistry, LDAPNameResolver, Initial
continue; continue;
} }
} }
catch (ServiceUnavailableException | CommunicationException e)
{
// MNT-21614: Check & fail if communication breaks due to ServiceUnavailableException or CommunicationException
if (e.getMessage() != null)
{
Object[] params = {e.getLocalizedMessage() };
throw new AlfrescoRuntimeException("synchronization.err.ldap.search", params, e);
}
continue;
}
catch (NamingException e) catch (NamingException e)
{ {
// Check if it is a timeout and fail // Check if it is a timeout and fail

View File

@@ -865,7 +865,22 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
} }
else else
{ {
throw new AlfrescoRuntimeException("Nodes with no type are ignored by SOLR"); QName typeQName = null;
TypeDefinition typeDefinition = null;
String errorMessage = "NodeId " + nodeId + " with nodeRef " + nodeRef;
typeQName = nodeDAO.getNodeType(nodeId);
if (typeQName != null)
{
errorMessage += " has type " + typeQName + ", but this type is not registered in DictionaryService.";
}
else
{
errorMessage += " has no type.";
}
throw new AlfrescoRuntimeException(errorMessage + " It will be ignored by SOLR.");
} }
} }

View File

@@ -25,6 +25,7 @@
*/ */
package org.alfresco.repo.rule.ruletrigger; package org.alfresco.repo.rule.ruletrigger;
import java.util.Random;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel; import org.alfresco.model.ForumModel;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
@@ -426,7 +427,33 @@ public class RuleTriggerTest extends BaseSpringTest
// Check to see if the rule type has been triggered // Check to see if the rule type has been triggered
assertTrue(ruleType.rulesTriggered); assertTrue(ruleType.rulesTriggered);
assertEquals(3, ruleType.triggerCount); assertEquals(3, ruleType.triggerCount);
} }
@Test
public void testOnPropertyUpdateRuleTrigger()
{
NodeRef nodeRef1 = this.nodeService.createNode(this.rootNodeRef,
ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_CONTAINER).getChildRef();
ContentWriter contentWriter = this.contentService.getWriter(nodeRef1, ContentModel.PROP_CONTENT, true);
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
contentWriter.setEncoding("UTF-8");
contentWriter.putContent("some content");
Random rand=new Random();
this.nodeService.setProperty(nodeRef1, ContentModel.PROP_CASCADE_CRC, rand.nextLong());
// Terminate the transaction
TestTransaction.flagForCommit();
TestTransaction.end();
TestTransaction.start();
TestRuleType contentUpdate = createTestRuleType(ON_PROPERTY_UPDATE_TRIGGER);
this.nodeService.setProperty(nodeRef1, ContentModel.PROP_CASCADE_CRC, rand.nextLong());
assertFalse(contentUpdate.rulesTriggered);
assertEquals("trigger count not matching",0,contentUpdate.triggerCount);
}
private TestRuleType createTestRuleType(String ruleTriggerName) private TestRuleType createTestRuleType(String ruleTriggerName)
{ {

View File

@@ -994,6 +994,30 @@ public class DBQueryTest implements DictionaryListener
results.getResultSetMetaData(); results.getResultSetMetaData();
results.close(); results.close();
} }
@Test
public void testGetValueForTransactionalQuery()
{
String query = "=TYPE:\"cm:folder\" ";
queryUsingGetValue(SearchService.LANGUAGE_FTS_ALFRESCO, query);
}
public void queryUsingGetValue(String ql, String query)
{
SearchParameters sp = new SearchParameters();
sp.setLanguage(ql);
sp.setQueryConsistency(QueryConsistency.TRANSACTIONAL);
sp.setQuery(query);
sp.addStore(rootNodeRef.getStoreRef());
ResultSet results = serviceRegistry.getSearchService().query(sp);
for (int i = 0; i < results.length(); i++) {
ResultSetRow row = results.getRow(i);
assertNotNull(row.getValue(ContentModel.PROP_NODE_UUID));
}
results.getResultSetMetaData();
results.close();
}
private static class UnknownDataType implements Serializable private static class UnknownDataType implements Serializable
{ {

View File

@@ -34,10 +34,10 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import javax.naming.CompositeName; import javax.naming.CommunicationException;
import javax.naming.Name;
import javax.naming.NamingEnumeration; import javax.naming.NamingEnumeration;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.naming.ServiceUnavailableException;
import javax.naming.directory.Attribute; import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes; import javax.naming.directory.Attributes;
import javax.naming.directory.InitialDirContext; import javax.naming.directory.InitialDirContext;
@@ -144,4 +144,52 @@ public class LDAPUserRegistryTest
are.getCause().getMessage().contains(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE)); are.getCause().getMessage().contains(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE));
} }
} }
/**
* Test for MNT-21614: Check & fail if communication breaks due to javax.naming.ServiceUnavailableException
*/
@Test
public void testTimeoutDuringSyncForServiceUnavailableException() throws Exception
{
LDAPUserRegistry userRegistry = createRegistry();
when(initialDirContext.getAttributes(eq(LDAPUserRegistry.jndiName(MEMBER_ATTRIBUTE_VALUE)), any()))
.thenThrow(new ServiceUnavailableException(" test."));
try
{
userRegistry.getGroups(new Date());
fail("The process should fail with an exception");
}
catch (AlfrescoRuntimeException are)
{
assertEquals("The error message is not of the right format.",
"synchronization.err.ldap.search", are.getMsgId());
assertTrue("The error message was not caused by timeout.",
are.getCause().getMessage().contains(" test."));
}
}
/**
* Test for MNT-21614: Check & fail if communication breaks due to javax.naming.CommunicationException
*/
@Test
public void testTimeoutDuringSyncForCommunicationException() throws Exception
{
LDAPUserRegistry userRegistry = createRegistry();
when(initialDirContext.getAttributes(eq(LDAPUserRegistry.jndiName(MEMBER_ATTRIBUTE_VALUE)), any()))
.thenThrow(new CommunicationException(" test."));
try
{
userRegistry.getGroups(new Date());
fail("The process should fail with an exception");
}
catch (AlfrescoRuntimeException are)
{
assertEquals("The error message is not of the right format.",
"synchronization.err.ldap.search", are.getMsgId());
assertTrue("The error message was not caused by timeout.",
are.getCause().getMessage().contains(" test."));
}
}
} }

View File

@@ -35,6 +35,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.dictionary.DictionaryDAO; import org.alfresco.repo.dictionary.DictionaryDAO;
import org.alfresco.repo.dictionary.M2Model; import org.alfresco.repo.dictionary.M2Model;
@@ -68,6 +69,7 @@ import org.apache.commons.logging.LogFactory;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Tests tracking component * Tests tracking component
@@ -1491,4 +1493,99 @@ public class SOLRTrackingComponentTest extends BaseSpringTest
return txs; return txs;
} }
} }
@Test
public void testGetNodeMetaDataWithNoType()
{
long startTime = System.currentTimeMillis();
SOLRTest st = new SOLRTestWithNoType(txnHelper, fileFolderService, nodeDAO, qnameDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataNullPropertyValue", true, true);
List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = getTransactions(null, startTime-1000, null, null, 100);
int[] updates = new int[] {2};
int[] deletes = new int[] {0};
List<Transaction> checkedTransactions = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(getTransactionIds(checkedTransactions));
getNodes(nodeParameters, st);
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds());
try
{
getNodeMetaData(nodeMetaDataParams, null, st);
}
catch (AlfrescoRuntimeException are)
{
if (!are.getMessage().contains("It will be ignored by SOLR"))
{
throw are;
}
}
}
private static class SOLRTestWithNoType extends SOLRTest
{
private NodeRef container;
private NodeRef content;
SOLRTestWithNoType(
RetryingTransactionHelper txnHelper, FileFolderService fileFolderService,
NodeDAO nodeDAO, QNameDAO qnameDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{
super(txnHelper, fileFolderService, nodeDAO, qnameDAO, nodeService, dictionaryService,rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
}
public int getExpectedNumNodes()
{
return 2;
}
protected List<Long> buildTransactionsInternal()
{
ArrayList<Long> txs = new ArrayList<Long>(2);
txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{
PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, "ContainerWithNoType");
container = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_FOLDER,
props).getChildRef();
Long containerId = nodeDAO.getNodePair(container).getFirst();
content = nodeDAO.newNode(
containerId,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"),
null,
QName.createQName("{nonExisting}nonExisting"),
I18NUtil.getLocale(),
null,
null).getChildNode().getNodeRef();
return nodeDAO.getNodeRefStatus(container).getDbTxnId();
}
}));
setExpectedNodeStatus(container, NodeStatus.UPDATED);
setExpectedNodeStatus(content, NodeStatus.UPDATED);
return txs;
}
}
} }