Compare commits

..

8 Commits

Author SHA1 Message Date
kcichonczyk
e36b009a51 replace flags 2023-08-31 20:52:48 +02:00
kcichonczyk
b5621bae57 replace flags 2023-08-31 20:47:02 +02:00
kcichonczyk
adcadfde8f remove -T flag 2023-08-31 20:34:29 +02:00
kcichonczyk
572874ea33 add dependency on content-services-community in docker module 2023-08-31 20:26:55 +02:00
kcichonczyk
6a3ef356c2 add flags to improve build/test time 2023-08-31 19:54:15 +02:00
kcichonczyk
e14d8111c7 add flags to improve build/test time 2023-08-31 19:50:48 +02:00
kcichonczyk
3bb713847c add flags to improve build/test time 2023-08-31 19:46:28 +02:00
kcichonczyk
d42aeb309a add flags to improve build/test time 2023-08-31 19:37:46 +02:00
79 changed files with 648 additions and 1973 deletions

View File

@@ -36,9 +36,8 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Prepare maven cache and check compilation"
@@ -56,12 +55,11 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v1.33.0
continue-on-error: true
with:
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}
@@ -78,7 +76,9 @@ jobs:
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: Alfresco/ya-pmd-scan@v2.0.5
- uses: Alfresco/ya-pmd-scan@v2.0.0
with:
fail-on-new-issues: "false"
all_unit_tests_suite:
name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test"
@@ -90,15 +90,14 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run tests"
run: |
mvn -B test -pl core,data-model -am -DfailIfNoTests=false
mvn -B test -pl "repository,mmt" -am "-Dtest=AllUnitTestsSuite,AllMmtUnitTestSuite" -DfailIfNoTests=false
mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl core,data-model -am -DfailIfNoTests=false
mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl "repository,mmt" -am "-Dtest=AllUnitTestsSuite,AllMmtUnitTestSuite" -DfailIfNoTests=false
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -128,9 +127,8 @@ jobs:
REQUIRES_INSTALLED_ARTIFACTS: true
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
@@ -141,7 +139,7 @@ jobs:
- name: "Set up the environment"
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
- name: "Run tests"
run: mvn -B test -pl remote-api -Dtest=${{ matrix.testSuite }} -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl remote-api -Dtest=${{ matrix.testSuite }} -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -162,9 +160,8 @@ jobs:
version: ['10.2.18', '10.4', '10.5']
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: Run MariaDB ${{ matrix.version }} database
@@ -172,7 +169,7 @@ jobs:
env:
MARIADB_VERSION: ${{ matrix.version }}
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -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
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -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: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -189,9 +186,8 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run MariaDB 10.6 database"
@@ -199,7 +195,7 @@ jobs:
env:
MARIADB_VERSION: 10.6
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -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
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -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: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -216,9 +212,8 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run MySQL 8 database"
@@ -226,12 +221,12 @@ jobs:
env:
MYSQL_VERSION: 8
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
repository_postgresql_13_12_tests:
name: "Repository - PostgreSQL 13.12 tests"
repository_postgresql_13_7_tests:
name: "Repository - PostgreSQL 13.7 tests"
runs-on: ubuntu-latest
needs: [prepare]
if: >
@@ -242,48 +237,21 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run PostgreSQL 13.12 database"
- name: "Run PostgreSQL 13.7 database"
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile postgres up -d
env:
POSTGRES_VERSION: 13.12
POSTGRES_VERSION: 13.7
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
repository_postgresql_14_9_tests:
name: "Repository - PostgreSQL 14.9 tests"
runs-on: ubuntu-latest
needs: [prepare]
if: >
(((github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && github.event_name != 'pull_request' &&
!contains(github.event.head_commit.message, '[skip db]')) ||
contains(github.event.head_commit.message, '[db]')) &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run PostgreSQL 14.9 database"
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile postgres up -d
env:
POSTGRES_VERSION: 14.9
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
repository_postgresql_15_4_tests:
name: "Repository - PostgreSQL 15.4 tests"
repository_postgresql_14_4_tests:
name: "Repository - PostgreSQL 14.4 tests"
runs-on: ubuntu-latest
needs: [prepare]
if: >
@@ -294,17 +262,16 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run PostgreSQL 15.4 database"
- name: "Run PostgreSQL 14.4 database"
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile postgres up -d
env:
POSTGRES_VERSION: 15.4
POSTGRES_VERSION: 14.4
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -318,15 +285,14 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run ActiveMQ"
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile activemq up -d
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=CamelRoutesTest,CamelComponentsTest -DfailIfNoTests=false
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=CamelRoutesTest,CamelComponentsTest -DfailIfNoTests=false
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -369,9 +335,8 @@ jobs:
mvn-options: '-Dencryption.ssl.keystore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.keystore -Dencryption.ssl.truststore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.truststore'
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Set transformers tag"
@@ -394,7 +359,7 @@ jobs:
fi
docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
- name: "Run tests"
run: mvn -B test -pl repository -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco ${{ matrix.mvn-options }}
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl repository -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco ${{ matrix.mvn-options }}
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -440,9 +405,8 @@ jobs:
REQUIRES_LOCAL_IMAGES: true
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
@@ -458,7 +422,7 @@ jobs:
- name: "Run tests"
id: tests
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn -B verify -f packaging/tests/${{ matrix.pom-dir }}/pom.xml -Pall-tas-tests,${{ matrix.test-profile }} -Denvironment=default -DrunBugs=false
run: mvn -B verify -Dparallel=all -DthreadCountMethods=4 -f packaging/tests/${{ matrix.pom-dir }}/pom.xml -Pall-tas-tests,${{ matrix.test-profile }} -Denvironment=default -DrunBugs=false
- name: "Print output after success"
if: ${{ always() && steps.tests.outcome == 'success' }}
run: ${TAS_SCRIPTS}/output_tests_run.sh "packaging/tests/${{ matrix.pom-dir }}"
@@ -478,15 +442,14 @@ jobs:
!contains(github.event.head_commit.message, '[force')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- name: "Run Postgres 15.4 database"
- name: "Run Postgres 14.4 database"
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile postgres up -d
- name: "Run tests"
run: mvn -B test -pl :alfresco-share-services -am -Dtest=ShareServicesTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl :alfresco-share-services -am -Dtest=ShareServicesTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -508,9 +471,8 @@ jobs:
REQUIRES_INSTALLED_ARTIFACTS: true
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
@@ -518,7 +480,7 @@ jobs:
bash ./scripts/ci/build.sh
- name: "Verify"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn --file amps/ags/pom.xml -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -PagsAllTestSuitePt${{ matrix.part }} ${{ env.LOG_WARN }}
run: mvn --file amps/ags/pom.xml -B verify -Dparallel=all -DthreadCountMethods=4 -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -PagsAllTestSuitePt${{ matrix.part }} ${{ env.LOG_WARN }}
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -540,9 +502,8 @@ jobs:
REQUIRES_INSTALLED_ARTIFACTS: true
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
@@ -550,7 +511,7 @@ jobs:
bash ./scripts/ci/build.sh
- name: "Verify"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn --file amps/ags/pom.xml -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -PagsAllTestSuitePt${{ matrix.part }} ${{ env.LOG_WARN }}
run: mvn --file amps/ags/pom.xml -B verify -Dparallel=all -DthreadCountMethods=4 -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -PagsAllTestSuitePt${{ matrix.part }} ${{ env.LOG_WARN }}
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
@@ -568,9 +529,8 @@ jobs:
REQUIRES_LOCAL_IMAGES: true
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
@@ -584,7 +544,7 @@ jobs:
mvn -B install -pl :alfresco-governance-services-automation-community-rest-api -am -Pags -Pall-tas-tests -DskipTests
- name: "Test"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -Dskip.automationtests=false -Pags -Pall-tas-tests
run: mvn -B test -Dparallel=all -DthreadCountMethods=4 -pl :alfresco-governance-services-automation-community-rest-api -Dskip.automationtests=false -Pags -Pall-tas-tests
- name: "Configure AWS credentials"
if: ${{ always() }}
uses: aws-actions/configure-aws-credentials@v1
@@ -614,9 +574,8 @@ jobs:
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |

View File

@@ -34,12 +34,11 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.33.0
with:
username: ${{ env.GIT_USERNAME }}
email: ${{ env.GIT_EMAIL }}
@@ -63,12 +62,11 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.35.2
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.33.0
with:
username: ${{ env.GIT_USERNAME }}
email: ${{ env.GIT_EMAIL }}

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<build>

View File

@@ -135,7 +135,7 @@ public class DispositionScheduleLinkedRecordsTest extends BaseRMRestTest {
* <p>
* <p/> TestRail Test C775<p/>
**/
@Test(enabled = false) // temporary disabled, see ACS-6073
@Test
@AlfrescoTest(jira = "RM-1622")
public void dispositionScheduleLinkedRecords() throws UnsupportedEncodingException {
STEP("Create record category");
@@ -202,7 +202,7 @@ public class DispositionScheduleLinkedRecordsTest extends BaseRMRestTest {
* Check the disposition steps for a record can be executed
* When the record is linked to a folder with the same disposition schedule
* */
@Test(enabled = false) // temporary disabled, see ACS-6073
@Test
@AlfrescoTest (jira = "RM-3060")
public void sameDispositionScheduleLinkedRecords() throws UnsupportedEncodingException {

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -1,3 +1,3 @@
SOLR6_TAG=2.0.8.1
POSTGRES_TAG=15.4
SOLR6_TAG=2.0.7-A5
POSTGRES_TAG=14.4
ACTIVEMQ_TAG=5.18.2-jre17-rockylinux8

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<properties>
@@ -416,7 +416,9 @@
<configuration>
<images>
<image>
<name>postgres:15.4</name>
<!-- TODO upgrade this old postgres version -->
<name>postgres:9.4.12</name>
<!--<name>postgres:13.3</name>-->
<run>
<ports>
<port>${postgresql.tests.port}:${postgresql.port}</port>

View File

@@ -61,7 +61,6 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
super.setNodeService(nodeService);
}
/**

View File

@@ -5,7 +5,7 @@
# Version label
version.major=23
version.minor=1
version.revision=1
version.revision=0
version.label=
# Edition label

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<properties>
@@ -131,6 +131,23 @@
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<!-- SHA-2432 -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-jstlel</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -74,6 +74,8 @@ public abstract class X509ServletFilterBase implements Filter
logger.debug("Initializing X509ServletFilter");
}
this.handleClientAuth();
this.enforce = checkEnforce(config.getServletContext());
if(logger.isDebugEnabled())
@@ -83,8 +85,6 @@ public abstract class X509ServletFilterBase implements Filter
if (this.enforce)
{
this.handleClientAuth();
/*
* We are enforcing so get the cert-contains string.
*/

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<dependencies>

View File

@@ -9,6 +9,6 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
</project>

View File

@@ -208,6 +208,10 @@ Hibernate http://www.hibernate.org/
jid3lib http://javamusictag.sourceforge.net/
TinyMCE http://www.tinymce.com/
=== LGPL 3.0 ===
Gytheio https://github.com/Alfresco/gytheio
=== MIT License ===
Bouncy Castle http://www.bouncycastle.org/

View File

@@ -98,4 +98,4 @@ EXPOSE 10001
# For remote debug
EXPOSE 8000
USER ${IMAGEUSERNAME}
USER ${IMAGEUSERNAME}

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -1,3 +1,3 @@
SOLR6_TAG=2.0.8.1
POSTGRES_TAG=15.4
SOLR6_TAG=2.0.7-A5
POSTGRES_TAG=14.4
ACTIVEMQ_TAG=5.18.2-jre17-rockylinux8

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<organization>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -35,7 +35,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.stream.Stream;
import io.restassured.http.ContentType;
import org.alfresco.rest.core.JsonBodyGenerator;
@@ -52,11 +51,9 @@ import org.alfresco.rest.model.RestCommentModelsCollection;
import org.alfresco.rest.model.RestNodeAssocTargetModel;
import org.alfresco.rest.model.RestNodeAssociationModel;
import org.alfresco.rest.model.RestNodeAssociationModelCollection;
import org.alfresco.rest.model.RestNodeAssociationTypeModel;
import org.alfresco.rest.model.RestNodeBodyModel;
import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
import org.alfresco.rest.model.RestNodeChildAssocModelCollection;
import org.alfresco.rest.model.RestNodeChildAssociationModel;
import org.alfresco.rest.model.RestNodeModel;
import org.alfresco.rest.model.RestNodeModelsCollection;
import org.alfresco.rest.model.RestRatingModel;
@@ -75,7 +72,6 @@ import org.alfresco.rest.model.body.RestNodeLockBodyModel;
import org.alfresco.rest.model.builder.NodesBuilder;
import org.alfresco.utility.Utility;
import org.alfresco.utility.model.RepoTestModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.testng.reporters.Files;
@@ -828,118 +824,25 @@ public class Node extends ModelRequest<Node>
}
/**
* Creates a secondary child association using POST call to: 'nodes/{nodeId}/secondary-children'.
* Create secondary children association using POST call 'nodes/{nodeId}/secondary-children
* Use a list of secondary children nodes
*
* @param secondaryChild - node, which should become a secondary child
* @return a node's parent-child association
* @return a collection of nodes
*/
public RestNodeChildAssociationModel addSecondaryChild(RepoTestModel secondaryChild)
public RestNodeChildAssocModelCollection createSecondaryChildren(String secondaryChildren)
{
return addSecondaryChild("cm:contains", secondaryChild);
}
/**
* Creates a secondary child association using POST call to: 'nodes/{nodeId}/secondary-children'.
*
* @param associationType - type of secondary parent-child relationship association
* @param secondaryChild - node, which should become a secondary child
* @return a node's parent-child association
*/
public RestNodeChildAssociationModel addSecondaryChild(String associationType, RepoTestModel secondaryChild)
{
return addSecondaryChild(new RestNodeChildAssociationModel(secondaryChild.getNodeRef(), associationType));
}
/**
* Creates a secondary child association using POST call to: 'nodes/{nodeId}/secondary-children'.
*
* @param secondaryChildAssociation - node's secondary parent-child association model
* @return a node's parent-child association
*/
public RestNodeChildAssociationModel addSecondaryChild(RestNodeChildAssociationModel secondaryChildAssociation)
{
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, secondaryChildAssociation.toJson(), "nodes/{nodeId}/secondary-children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
return restWrapper.processModel(RestNodeChildAssociationModel.class, request);
}
/**
* Creates a secondary children association using POST call to: 'nodes/{nodeId}/secondary-children'.
*
* @param secondaryChildren - nodes, which should become secondary children
* @return a collection of node's parent-child associations
*/
public RestNodeChildAssocModelCollection addSecondaryChildren(RepoTestModel... secondaryChildren)
{
return addSecondaryChildren("cm:contains", secondaryChildren);
}
/**
* Creates a secondary children association using POST call to: 'nodes/{nodeId}/secondary-children'.
*
* @param associationType - type of secondary parent-child relationship association
* @param secondaryChildren - nodes, which should become secondary children
* @return a collection of node's parent-child associations
*/
public RestNodeChildAssocModelCollection addSecondaryChildren(String associationType, RepoTestModel... secondaryChildren)
{
return addSecondaryChildren(Stream.of(secondaryChildren)
.map(child -> new RestNodeChildAssociationModel(child.getNodeRef(), associationType))
.toArray(RestNodeChildAssociationModel[]::new));
}
/**
* Creates a secondary children association using POST call to: 'nodes/{nodeId}/secondary-children'.
*
* @param secondaryChildrenAssociations - node's secondary parent-child association models
* @return a collection of node's parent-child associations
*/
public RestNodeChildAssocModelCollection addSecondaryChildren(RestNodeChildAssociationModel... secondaryChildrenAssociations)
{
String requestBody = arrayToJson(Stream.of(secondaryChildrenAssociations).toList());
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, requestBody, "nodes/{nodeId}/secondary-children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, secondaryChildren, "nodes/{nodeId}/secondary-children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
return restWrapper.processModels(RestNodeChildAssocModelCollection.class, request);
}
/**
* Removes secondary child association using DELETE call 'nodes/{nodeId}/secondary-children/{childId}'.
* Delete secondary children using DELETE call 'nodes/{nodeId}/secondary-children/{childId}
*
* @param secondaryChild - node, which should NOT be a secondary child anymore
* @return a collection of nodes
*/
public void removeSecondaryChild(RepoTestModel secondaryChild)
public void deleteSecondaryChild(RestNodeAssociationModel child)
{
removeSecondaryChild(null, secondaryChild);
}
/**
* Removes secondary child association using DELETE call 'nodes/{nodeId}/secondary-children/{childId}'.
*
* @param associationType - type of secondary parent-child relationship association
* @param secondaryChild - node, which should NOT be a secondary child anymore
*/
public void removeSecondaryChild(String associationType, RepoTestModel secondaryChild)
{
RestNodeAssociationModel associationModel = new RestNodeAssociationModel();
RestNodeAssociationTypeModel associationTypeModel = new RestNodeAssociationTypeModel();
if (associationType != null)
{
associationTypeModel.setAssocType(associationType);
}
associationModel.setAssociation(associationTypeModel);
associationModel.setId(secondaryChild.getNodeRef());
removeSecondaryChild(associationModel);
}
/**
* Removes secondary child association using DELETE call 'nodes/{nodeId}/secondary-children/{childId}'.
*
* @param secondaryChildAssociation - node's secondary parent-child association to remove
*/
public void removeSecondaryChild(RestNodeAssociationModel secondaryChildAssociation)
{
String parameters = StringUtils.isNotEmpty(secondaryChildAssociation.getAssociation().getAssocType()) ?
"assocType=" + secondaryChildAssociation.getAssociation().getAssocType() + "&" + restWrapper.getParameters() :
restWrapper.getParameters();
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/secondary-children/{childId}?{parameters}", repoModel.getNodeRef(), secondaryChildAssociation.getId(), parameters);
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/secondary-children/{childId}?{parameters}", repoModel.getNodeRef(), child.getId(), restWrapper.getParameters());
restWrapper.processEmptyModel(request);
}

View File

@@ -44,7 +44,6 @@
package org.alfresco.rest.search;
import java.util.List;
import java.util.Objects;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
@@ -53,11 +52,11 @@ import org.alfresco.utility.model.TestModel;
* @author Michael Suzuki
*
*/
public class ResponseHighlightModel extends TestModel implements IRestModel<ResponseHighlightModel>
public class ResponseHighLightModel extends TestModel implements IRestModel<ResponseHighLightModel>
{
private ResponseHighlightModel model;
private ResponseHighLightModel model;
private String field;
private List<String> snippets;
private List<Object> snippets;
public String getField()
{
@@ -67,44 +66,19 @@ public class ResponseHighlightModel extends TestModel implements IRestModel<Resp
{
this.field = field;
}
public List<String> getSnippets()
public List<Object> getSnippets()
{
return snippets;
}
public void setSnippets(List<String> snippets)
public void setSnippets(List<Object> snippets)
{
this.snippets = snippets;
}
@Override
public ResponseHighlightModel onModel()
public ResponseHighLightModel onModel()
{
return model;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
ResponseHighlightModel that = (ResponseHighlightModel) o;
return Objects.equals(model, that.model) && Objects.equals(field, that.field) && Objects.equals(snippets, that.snippets);
}
@Override
public int hashCode()
{
return Objects.hash(model, field, snippets);
}
@Override
public String toString()
{
return "ResponseHighlightModel{model=%s, field=%s, snippets=%s}".formatted(model, field, snippets);
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -23,6 +23,24 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
/*
* Copyright (C) 2017 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* 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/>.
*/
package org.alfresco.rest.search;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -37,43 +55,23 @@ import org.alfresco.utility.model.TestModel;
*/
public class RestRequestFieldsModel extends TestModel implements IRestModel<RestRequestFieldsModel>
{
public RestRequestFieldsModel(){}
public RestRequestFieldsModel(String fieldValue)
{
this.field = fieldValue;
}
@JsonProperty(value = "entry")
RestRequestFieldsModel model;
@JsonProperty(required = true)
private String field;
private String prefix;
private String postfix;
private Integer snippetCount;
private Integer fragmentSize;
private Boolean mergeContiguous;
public RestRequestFieldsModel() {
super();
}
public static RestRequestFieldsModel of(String field)
{
RestRequestFieldsModel fieldModel = new RestRequestFieldsModel();
fieldModel.setField(field);
return fieldModel;
}
public static RestRequestFieldsModel of(String field, String prefix, String postfix)
{
RestRequestFieldsModel fieldModel = new RestRequestFieldsModel();
fieldModel.setField(field);
fieldModel.setPrefix(prefix);
fieldModel.setPostfix(postfix);
return fieldModel;
}
@Override
public RestRequestFieldsModel onModel()
{
return model;
}
@JsonProperty(required = true)
private String field;
public String getField()
{
@@ -84,116 +82,8 @@ public class RestRequestFieldsModel extends TestModel implements IRestModel<Rest
{
this.field = field;
}
public String getPrefix()
{
return prefix;
}
public void setPrefix(String prefix)
{
this.prefix = prefix;
}
public String getPostfix()
{
return postfix;
}
public void setPostfix(String postfix)
{
this.postfix = postfix;
}
public Integer getSnippetCount()
{
return snippetCount;
}
public void setSnippetCount(Integer snippetCount)
{
this.snippetCount = snippetCount;
}
public Integer getFragmentSize()
{
return fragmentSize;
}
public void setFragmentSize(Integer fragmentSize)
{
this.fragmentSize = fragmentSize;
}
public Boolean getMergeContiguous()
{
return mergeContiguous;
}
public void setMergeContiguous(Boolean mergeContiguous)
{
this.mergeContiguous = mergeContiguous;
}
public static Builder builder()
{
return new Builder();
}
public static class Builder
{
private String field;
private String prefix;
private String postfix;
private Integer snippetCount;
private Integer fragmentSize;
private Boolean mergeContiguous;
public Builder field(String field)
{
this.field = field;
return this;
}
public Builder prefix(String prefix)
{
this.prefix = prefix;
return this;
}
public Builder postfix(String postfix)
{
this.postfix = postfix;
return this;
}
public Builder snippetCount(Integer snippetCount)
{
this.snippetCount = snippetCount;
return this;
}
public Builder fragmentSize(Integer fragmentSize)
{
this.fragmentSize = fragmentSize;
return this;
}
public Builder mergeContiguous(Boolean mergeContiguous)
{
this.mergeContiguous = mergeContiguous;
return this;
}
public RestRequestFieldsModel build()
{
RestRequestFieldsModel fieldModel = new RestRequestFieldsModel();
fieldModel.setField(field);
fieldModel.setPrefix(prefix);
fieldModel.setPostfix(postfix);
fieldModel.setSnippetCount(snippetCount);
fieldModel.setFragmentSize(fragmentSize);
fieldModel.setMergeContiguous(mergeContiguous);
return fieldModel;
}
}
}

View File

@@ -2,30 +2,29 @@
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.search;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -34,38 +33,62 @@ import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
/**
* Generated by 'msuzuki' on '2017-02-23 13:41' from 'Alfresco Search REST API' swagger file
* Generated by 'msuzuki' on '2017-02-23 13:41' from 'Alfresco Search REST API' swagger file
* Generated from 'Alfresco Search REST API' swagger file
* Base Path {@linkplain /alfresco/api/-default-/public/search/versions/1}
*/
public class RestRequestHighlightModel extends TestModel implements IRestModel<RestRequestHighlightModel>
{
@JsonProperty("entry")
@JsonProperty(value = "entry")
RestRequestHighlightModel model;
/** The string used to mark the start of a highlight in a fragment. */
private String prefix;
/** The string used to mark the end of a highlight in a fragment. */
private String postfix;
/** The maximum number of distinct highlight snippets to return for each highlight field. */
private int snippetCount;
/** The character length of each snippet. */
private int fragmentSize;
/** The number of characters to be considered for highlighting. Matches after this count will not be shown. */
private int maxAnalyzedChars;
/** If fragments overlap they can be merged into one larger fragment */
private boolean mergeContiguous;
/** Should phrases be identified. */
private boolean usePhraseHighlighter;
/** The fields to highlight and field specific configuration properties for each field */
private List<RestRequestFieldsModel> fields;
@Override
public RestRequestHighlightModel onModel()
{
return model;
}
/**
The string used to mark the start of a highlight in a fragment.
*/
private String prefix;
/**
The string used to mark the end of a highlight in a fragment.
*/
private String postfix;
/**
The maximum number of distinct highlight snippets to return for each highlight field.
*/
private int snippetCount;
/**
The character length of each snippet.
*/
private int fragmentSize;
/**
The number of characters to be considered for highlighting. Matches after this count will not be shown.
*/
private int maxAnalyzedChars;
/**
If fragments over lap they can be merged into one larger fragment
*/
private boolean mergeContiguous;
/**
Should phrases be identified.
*/
private boolean usePhraseHighlighter;
/**
The fields to highlight and field specific configuration properties for each field
*/
private List<RestRequestFieldsModel> fields;
public String getPrefix()
{
return this.prefix;
@@ -74,7 +97,7 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setPrefix(String prefix)
{
this.prefix = prefix;
}
}
public String getPostfix()
{
@@ -84,7 +107,7 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setPostfix(String postfix)
{
this.postfix = postfix;
}
}
public int getSnippetCount()
{
@@ -94,7 +117,7 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setSnippetCount(int snippetCount)
{
this.snippetCount = snippetCount;
}
}
public int getFragmentSize()
{
@@ -104,7 +127,7 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setFragmentSize(int fragmentSize)
{
this.fragmentSize = fragmentSize;
}
}
public int getMaxAnalyzedChars()
{
@@ -114,9 +137,9 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setMaxAnalyzedChars(int maxAnalyzedChars)
{
this.maxAnalyzedChars = maxAnalyzedChars;
}
}
public boolean isMergeContiguous()
public boolean getMergeContiguous()
{
return this.mergeContiguous;
}
@@ -124,9 +147,9 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setMergeContiguous(boolean mergeContiguous)
{
this.mergeContiguous = mergeContiguous;
}
}
public boolean isUsePhraseHighlighter()
public boolean getUsePhraseHighlighter()
{
return this.usePhraseHighlighter;
}
@@ -134,7 +157,7 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setUsePhraseHighlighter(boolean usePhraseHighlighter)
{
this.usePhraseHighlighter = usePhraseHighlighter;
}
}
public List<RestRequestFieldsModel> getFields()
{
@@ -144,91 +167,6 @@ public class RestRequestHighlightModel extends TestModel implements IRestModel<R
public void setFields(List<RestRequestFieldsModel> fields)
{
this.fields = fields;
}
public static RestRequestHighlightModelBuilder builder()
{
return new RestRequestHighlightModelBuilder();
}
public static class RestRequestHighlightModelBuilder
{
private String prefix;
private String postfix;
private int snippetCount;
private int fragmentSize;
private int maxAnalyzedChars;
private boolean mergeContiguous;
private boolean usePhraseHighlighter;
private List<RestRequestFieldsModel> fields;
public RestRequestHighlightModelBuilder prefix(String prefix)
{
this.prefix = prefix;
return this;
}
public RestRequestHighlightModelBuilder postfix(String postfix)
{
this.postfix = postfix;
return this;
}
public RestRequestHighlightModelBuilder snippetCount(int snippetCount)
{
this.snippetCount = snippetCount;
return this;
}
public RestRequestHighlightModelBuilder fragmentSize(int fragmentSize)
{
this.fragmentSize = fragmentSize;
return this;
}
public RestRequestHighlightModelBuilder maxAnalyzedChars(int maxAnalyzedChars)
{
this.maxAnalyzedChars = maxAnalyzedChars;
return this;
}
public RestRequestHighlightModelBuilder mergeContinuous(boolean mergeContiguous)
{
this.mergeContiguous = mergeContiguous;
return this;
}
public RestRequestHighlightModelBuilder usePhraseHighlighter(boolean usePhraseHighlighter)
{
this.usePhraseHighlighter = usePhraseHighlighter;
return this;
}
public RestRequestHighlightModelBuilder fields(List<String> fields)
{
this.fields = fields.stream().map(RestRequestFieldsModel::of).toList();
return this;
}
public RestRequestHighlightModelBuilder fields(RestRequestFieldsModel... fields)
{
this.fields = Arrays.stream(fields).toList();
return this;
}
public RestRequestHighlightModel build()
{
RestRequestHighlightModel highlightModel = new RestRequestHighlightModel();
highlightModel.setPrefix(prefix);
highlightModel.setPostfix(postfix);
highlightModel.setSnippetCount(snippetCount);
highlightModel.setFragmentSize(fragmentSize);
highlightModel.setMaxAnalyzedChars(maxAnalyzedChars);
highlightModel.setMergeContiguous(mergeContiguous);
highlightModel.setUsePhraseHighlighter(usePhraseHighlighter);
highlightModel.setFields(fields);
return highlightModel;
}
}
}
}

View File

@@ -60,7 +60,7 @@ public class SearchScoreModel extends TestModel implements IRestModel<SearchScor
@JsonProperty(required = true)
private float score;
private List<ResponseHighlightModel> highlight;
private List<ResponseHighLightModel> highlight;
public float getScore()
{
@@ -78,12 +78,12 @@ public class SearchScoreModel extends TestModel implements IRestModel<SearchScor
return this;
}
public List<ResponseHighlightModel> getHighlight()
public List<ResponseHighLightModel> getHighlight()
{
return highlight;
}
public void setHighlight(List<ResponseHighlightModel> highlight)
public void setHighlight(List<ResponseHighLightModel> highlight)
{
this.highlight = highlight;
}

View File

@@ -125,10 +125,11 @@ public class NodesParentChildrenTests extends RestTest
RestNodeChildAssociationModel childAssoc1 = new RestNodeChildAssociationModel(nodesBuilder.getNode("f1").getId(), "cm:contains");
RestNodeChildAssociationModel childAssoc2 = new RestNodeChildAssociationModel(nodesBuilder.getNode("f2").getId(), "cm:contains");
RestNodeChildAssociationModel childAssoc3 = new RestNodeChildAssociationModel(nodesBuilder.getNode("f3").getId(), "cm:preferenceImage");
String secondaryChildrenBody = "[" + childAssoc1.toJson() + "," + childAssoc2.toJson() + "," + childAssoc3.toJson() + "]";
STEP("3. Create secondary child associations using POST /nodes/{nodeId}/secondary-children");
RestNodeChildAssocModelCollection secondaryChildAssoc = restClient.withCoreAPI().usingNode(nodesBuilder.getNode("F1").toContentModel())
.addSecondaryChildren(childAssoc1, childAssoc2, childAssoc3);
.createSecondaryChildren(secondaryChildrenBody);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
secondaryChildAssoc.getEntryByIndex(0).assertThat().field("childId").is(childAssoc1.getChildId());
secondaryChildAssoc.getEntryByIndex(1).assertThat().field("childId").is(childAssoc2.getChildId());
@@ -141,7 +142,7 @@ public class NodesParentChildrenTests extends RestTest
secondaryChildren.assertThat().entriesListCountIs(2);
STEP("5. Check using DELETE /nodes/{nodeId}/secondary-children/{childId} that a secondary child can be deleted");
restClient.withCoreAPI().usingNode(nodesBuilder.getNode("F1").toContentModel()).removeSecondaryChild(secondaryChildren.getEntryByIndex(0));
restClient.withCoreAPI().usingNode(nodesBuilder.getNode("F1").toContentModel()).deleteSecondaryChild(secondaryChildren.getEntryByIndex(0));
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
STEP("6. Check using GET /nodes/{nodeId}/secondary-children that a secondary child association was deleted");
@@ -181,7 +182,7 @@ public class NodesParentChildrenTests extends RestTest
STEP("2. Create secondary child associations using POST /nodes/{nodeId}/secondary-children");
RestNodeChildAssociationModel childAssoc = new RestNodeChildAssociationModel(nodesBuilder.getNode("f1").getId(), "cm:contains");
restClient.withCoreAPI().usingNode(nodesBuilder.getNode("F1").toContentModel()).addSecondaryChild(childAssoc);
restClient.withCoreAPI().usingNode(nodesBuilder.getNode("F1").toContentModel()).createSecondaryChildren(childAssoc.toJson());
restClient.assertStatusCodeIs(HttpStatus.CREATED);
STEP("3. Get all parents for file 'f1' - both primary and secondary");

View File

@@ -11,7 +11,6 @@ import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
import java.util.List;
@@ -48,9 +47,8 @@ public class GetProcessesCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
description = "Verify user gets all processes started by him ordered descending by id")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.REGRESSION }, enabled = false)
@Ignore("Until ACS-6234 is done")
public void getProcessesOrderedByIdDESC()
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.REGRESSION })
public void getProcessesOrderedByIdDESC() throws Exception
{
RestProcessModelsCollection processes = restClient.authenticateUser(userWhoStartsTask).withParams("orderBy=id DESC")
.withWorkflowAPI().getProcesses();

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<developers>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<properties>

104
pom.xml
View File

@@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -25,7 +25,7 @@
<properties>
<acs.version.major>23</acs.version.major>
<acs.version.minor>1</acs.version.minor>
<acs.version.revision>1</acs.version.revision>
<acs.version.revision>0</acs.version.revision>
<acs.version.label />
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
@@ -51,37 +51,37 @@
<dependency.alfresco-server-root.version>7.0.1</dependency.alfresco-server-root.version>
<dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
<dependency.activiti.version>5.23.0</dependency.activiti.version>
<dependency.alfresco-transform-core.version>5.0.0</dependency.alfresco-transform-core.version>
<dependency.alfresco-transform-service.version>4.0.0</dependency.alfresco-transform-service.version>
<dependency.alfresco-transform-service.version>3.0.1-A2</dependency.alfresco-transform-service.version>
<dependency.alfresco-transform-core.version>4.0.1-A3</dependency.alfresco-transform-core.version>
<dependency.alfresco-greenmail.version>7.0</dependency.alfresco-greenmail.version>
<dependency.acs-event-model.version>0.0.24</dependency.acs-event-model.version>
<dependency.acs-event-model.version>0.0.23</dependency.acs-event-model.version>
<dependency.aspectj.version>1.9.20.1</dependency.aspectj.version>
<dependency.spring.version>6.0.12</dependency.spring.version>
<dependency.spring-security.version>6.1.4</dependency.spring-security.version>
<dependency.spring.version>6.0.9</dependency.spring.version>
<dependency.antlr.version>3.5.3</dependency.antlr.version>
<dependency.jackson.version>2.15.2</dependency.jackson.version>
<dependency.cxf.version>4.0.2</dependency.cxf.version>
<dependency.opencmis.version>1.0.0-jakarta-1</dependency.opencmis.version>
<dependency.webscripts.version>9.0</dependency.webscripts.version>
<dependency.webscripts.version>8.46</dependency.webscripts.version>
<dependency.bouncycastle.version>1.76</dependency.bouncycastle.version>
<dependency.mockito-core.version>5.4.0</dependency.mockito-core.version>
<dependency.assertj.version>3.24.2</dependency.assertj.version>
<dependency.org-json.version>20231013</dependency.org-json.version>
<dependency.org-json.version>20230618</dependency.org-json.version>
<dependency.commons-dbcp.version>2.9.0</dependency.commons-dbcp.version>
<dependency.commons-io.version>2.14.0</dependency.commons-io.version>
<dependency.gson.version>2.10.1</dependency.gson.version>
<dependency.commons-io.version>2.13.0</dependency.commons-io.version>
<dependency.gson.version>2.8.9</dependency.gson.version>
<dependency.guava.version>32.1.2-jre</dependency.guava.version>
<dependency.httpclient.version>4.5.14</dependency.httpclient.version>
<dependency.httpclient.version>4.5.13</dependency.httpclient.version>
<dependency.httpcore.version>4.4.16</dependency.httpcore.version>
<dependency.httpcomponents-httpclient5.version>5.2.1</dependency.httpcomponents-httpclient5.version>
<dependency.httpcomponents-httpcore5.version>5.2.3</dependency.httpcomponents-httpcore5.version>
<dependency.httpcomponents-httpcore5.version>5.2.2</dependency.httpcomponents-httpcore5.version>
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
<dependency.xercesImpl.version>2.12.2</dependency.xercesImpl.version>
<dependency.slf4j.version>2.0.9</dependency.slf4j.version>
<dependency.slf4j.version>2.0.7</dependency.slf4j.version>
<dependency.log4j.version>2.20.0</dependency.log4j.version>
<dependency.gytheio.version>0.20.0-A1</dependency.gytheio.version>
<dependency.groovy.version>3.0.19</dependency.groovy.version>
<dependency.tika.version>2.4.1</dependency.tika.version>
<dependency.spring-security.version>6.1.3</dependency.spring-security.version>
<dependency.truezip.version>7.7.10</dependency.truezip.version>
<dependency.poi.version>5.2.2</dependency.poi.version>
<dependency.poi-ooxml-lite.version>5.2.3</dependency.poi-ooxml-lite.version>
@@ -89,17 +89,19 @@
<dependency.camel.version>4.0.0</dependency.camel.version> <!-- when bumping this version, please keep track/sync with included netty.io dependencies -->
<dependency.netty.version>4.1.96.Final</dependency.netty.version> <!-- must be in sync with camels transitive dependencies, e.g.: netty-common -->
<dependency.activemq.version>5.18.2</dependency.activemq.version>
<dependency.apache-compress.version>1.24.0</dependency.apache-compress.version>
<dependency.apache-compress.version>1.23.0</dependency.apache-compress.version>
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
<dependency.awaitility.version>4.2.0</dependency.awaitility.version>
<dependency.swagger-ui.version>3.38.0</dependency.swagger-ui.version>
<dependency.swagger-parser.version>1.0.67</dependency.swagger-parser.version>
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
<dependency.maven-artifact.version>3.8.6</dependency.maven-artifact.version>
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
<dependency.pooled-jms.version>3.1.2</dependency.pooled-jms.version>
<dependency.pooled-jms.version>3.1.1</dependency.pooled-jms.version>
<dependency.jakarta-ee-jaxb-api.version>4.0.0</dependency.jakarta-ee-jaxb-api.version>
<dependency.jakarta-ee-jaxb-impl.version>4.0.3</dependency.jakarta-ee-jaxb-impl.version>
<dependency.java-ee-jaxb-api.version>2.3.3</dependency.java-ee-jaxb-api.version>
<dependency.jakarta-ws-api.version>3.0.1</dependency.jakarta-ws-api.version>
<dependency.jakarta-soap-api.version>2.0.1</dependency.jakarta-soap-api.version>
<dependency.jakarta-annotation-api.version>2.1.1</dependency.jakarta-annotation-api.version>
@@ -113,9 +115,11 @@
<dependency.jakarta-ee-json-impl.version>1.1.4</dependency.jakarta-ee-json-impl.version>
<dependency.jakarta-json-path.version>2.8.0</dependency.jakarta-json-path.version>
<dependency.json-smart.version>2.5.0</dependency.json-smart.version>
<alfresco.googledrive.version>4.0.0</alfresco.googledrive.version>
<alfresco.aos-module.version>2.0.0</alfresco.aos-module.version>
<alfresco.api-explorer.version>23.1.0</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
<dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
<alfresco.googledrive.version>3.4.2-A5</alfresco.googledrive.version>
<alfresco.aos-module.version>1.6.2-A2</alfresco.aos-module.version>
<alfresco.api-explorer.version>23.1.0-A1</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
<alfresco.maven-plugin.version>2.2.0</alfresco.maven-plugin.version>
<license-maven-plugin.version>2.0.1</license-maven-plugin.version>
@@ -125,10 +129,10 @@
<dependency.mysql-image.version>8</dependency.mysql-image.version>
<dependency.mariadb.version>2.7.4</dependency.mariadb.version>
<dependency.tas-utility.version>5.0.0</dependency.tas-utility.version>
<dependency.rest-assured.version>5.3.2</dependency.rest-assured.version>
<dependency.rest-assured.version>5.3.1</dependency.rest-assured.version>
<dependency.tas-email.version>2.0.0</dependency.tas-email.version>
<dependency.tas-webdav.version>1.21</dependency.tas-webdav.version>
<dependency.tas-ftp.version>1.19</dependency.tas-ftp.version>
<dependency.tas-webdav.version>1.20</dependency.tas-webdav.version>
<dependency.tas-ftp.version>1.18</dependency.tas-ftp.version>
<dependency.tas-dataprep.version>2.6</dependency.tas-dataprep.version>
<!-- AGS properties shared between community and enterprise -->
@@ -152,7 +156,7 @@
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
<url>https://github.com/Alfresco/alfresco-community-repo</url>
<tag>23.1.1.3</tag>
<tag>HEAD</tag>
</scm>
<distributionManagement>
@@ -215,6 +219,12 @@
<version>${dependency.jakarta-jws-api.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.sun.mail</groupId>-->
<!-- <artifactId>javax.mail</artifactId>-->
<!-- <version>${dependency.java-ee-mail.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
@@ -277,6 +287,17 @@
<version>${dependency.json-smart.version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.rpc</groupId>
<artifactId>jakarta.xml.rpc-api</artifactId>
<version>${dependency.jakarta-rpc-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.rpc</groupId>
<artifactId>jaxrpc-impl</artifactId>
<version>${dependency.jakarta-rpc-api.version}</version>
</dependency>
<!--CMIS-->
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
@@ -573,7 +594,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@@ -910,6 +931,21 @@
<version>${dependency.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>${dependency.apache.taglibs.version}</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>${dependency.apache.taglibs.version}</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-jstlel</artifactId>
<version>${dependency.apache.taglibs.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
@@ -924,7 +960,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -960,16 +996,6 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- Ensure consistent maven-release-plugin version-->
<plugin>
<artifactId>maven-release-plugin</artifactId>
@@ -981,7 +1007,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.43.4</version>
<version>0.43.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
@@ -1038,7 +1064,7 @@
<configuration>
<failOnMissing>true</failOnMissing>
<excludedScopes>provided,test</excludedScopes>
<excludedGroups>^(org\.alfresco|com\.alfresco|org\.activiti).*</excludedGroups>
<excludedGroups>^(org\.alfresco|com\.alfresco|org\.activiti|org\.gytheio).*</excludedGroups>
<failIfWarning>true</failIfWarning>
<includedLicenses>
https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/includedLicenses.txt
@@ -1137,4 +1163,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<dependencies>
@@ -18,6 +18,11 @@
</dependency>
<!-- Jakarta... -->
<dependency>
<groupId>jakarta.xml.rpc</groupId>
<artifactId>jakarta.xml.rpc-api</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.1.3</version>
<version>23.1.0.206-SNAPSHOT</version>
</parent>
<dependencies>
@@ -560,6 +560,21 @@
<artifactId>alfresco-sync-events</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.gytheio</groupId>
<artifactId>gytheio-messaging-camel</artifactId>
<version>${dependency.gytheio.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
@@ -711,7 +726,7 @@
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${dependency.aspectj.version}</version>
<version>1.9.19</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
@@ -731,6 +746,18 @@
<version>${dependency.opencmis.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-jstlel</artifactId>
</dependency>
<!-- Repo Event Model-->
<dependency>
<groupId>org.alfresco</groupId>
@@ -843,9 +870,9 @@
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<groupId>com.github.m50d</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14.0</version>
<version>1.11.1</version>
<executions>
<execution>
<!-- phase>process-sources</phase -->
@@ -862,17 +889,7 @@
<showWeaveInfo>true</showWeaveInfo>
<source>1.8</source>
<target>1.8</target>
<additionalCompilerArgs>
<arg>-parameters</arg>
</additionalCompilerArgs>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${dependency.aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>

View File

@@ -196,7 +196,7 @@ public class HierarchicalSqlSessionFactoryBean extends SqlSessionFactoryBean
* @param plugins list of plugins
*
*/
public void setPlugins(Interceptor... plugins) {
public void setPlugins(Interceptor[] plugins) {
this.plugins = plugins;
}
@@ -244,7 +244,7 @@ public class HierarchicalSqlSessionFactoryBean extends SqlSessionFactoryBean
*
* @param typeHandlers Type handler list
*/
public void setTypeHandlers(TypeHandler<?>... typeHandlers) {
public void setTypeHandlers(TypeHandler<?>[] typeHandlers) {
this.typeHandlers = typeHandlers;
}
@@ -255,7 +255,7 @@ public class HierarchicalSqlSessionFactoryBean extends SqlSessionFactoryBean
*
* @param typeAliases Type aliases list
*/
public void setTypeAliases(Class<?>... typeAliases) {
public void setTypeAliases(Class<?>[] typeAliases) {
this.typeAliases = typeAliases;
}
@@ -288,7 +288,7 @@ public class HierarchicalSqlSessionFactoryBean extends SqlSessionFactoryBean
* This property being based on Spring's resource abstraction also allows for specifying
* resource patterns here: e.g. "classpath*:sqlmap/*-mapper.xml".
*/
public void setMapperLocations(Resource... mapperLocations) {
public void setMapperLocations(Resource[] mapperLocations) {
this.mapperLocations = mapperLocations;
}

View File

@@ -1,42 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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.messaging;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoggingDeadLetterQueue
{
private static final Logger LOG = LoggerFactory.getLogger(LoggingDeadLetterQueue.class);
public void onReceive(Object message)
{
if (message != null)
{
LOG.debug("Received:\n\n{}}\n\n", message);
}
}
}

View File

@@ -1,93 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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.messaging.jackson;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serial;
import java.io.StringWriter;
import org.apache.commons.io.IOUtils;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public class ObjectMapperFactory
{
private ObjectMapperFactory()
{
//no instantiation
}
public static ObjectMapper createInstance()
{
QpidJsonBodyCleanerObjectMapper mapper = new QpidJsonBodyCleanerObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
return mapper;
}
private static class QpidJsonBodyCleanerObjectMapper extends ObjectMapper
{
@Serial
private static final long serialVersionUID = 2568701685293341501L;
private static final String DEFAULT_ENCODING = "utf8";
public <T> T readValue(InputStream inputStream, Class<T> valueType) throws IOException
{
try
{
// Try to unmarshal normally
if (inputStream.markSupported())
{
inputStream.mark(1024 * 512);
}
return super.readValue(inputStream, valueType);
}
catch (JsonParseException e)
{
if (!inputStream.markSupported())
{
// We can't reset this stream, bail out
throw e;
}
// Reset the stream
inputStream.reset();
}
// Clean the message body and try again
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, DEFAULT_ENCODING);
String content = writer.toString();
content = content.substring(content.indexOf('{'));
return readValue(content, valueType);
}
}
}

View File

@@ -1,28 +1,28 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 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.action.executer;
import java.io.Serializable;
@@ -34,10 +34,10 @@ import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.repo.jscript.ScriptAction;
import org.alfresco.service.ServiceRegistry;
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.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.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -129,10 +129,10 @@ public class ScriptActionExecuter extends ActionExecuterAbstractBase
if (nodeService.exists(actionedUponNodeRef))
{
NodeRef scriptRef = (NodeRef)action.getParameterValue(PARAM_SCRIPTREF);
if(!isValidScriptRef(action))
{
throw new IllegalStateException("Invalid script ref path: " + scriptRef);
}
if(!isValidScriptRef(action))
{
throw new IllegalStateException("Invalid script ref path: " + scriptRef);
}
NodeRef spaceRef = this.serviceRegistry.getRuleService().getOwningNodeRef(action);
if (spaceRef == null)
{
@@ -229,22 +229,19 @@ public class ScriptActionExecuter extends ActionExecuterAbstractBase
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);
if (parameterDef != null)
{
String paramConstraintName = parameterDef.getParameterConstraintName();
if (paramConstraintName != null)
{
ParameterConstraint paramConstraint = actionService.getParameterConstraint(paramConstraintName);
return paramConstraint.isValidValue(scriptRef.toString());
}
}
return true;
}
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;
}
}

View File

@@ -31,7 +31,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
import org.alfresco.repo.content.transform.TransformerDebug;
import org.alfresco.repo.rendition2.RenditionDefinition2;
import org.alfresco.repo.rendition2.RenditionDefinitionRegistry2Impl;
import org.alfresco.repo.rendition2.RenditionService2;
import org.alfresco.repo.rendition2.TransformDefinition;
@@ -412,21 +411,12 @@ public class AsynchronousExtractor extends AbstractMappingMetadataExtracter
// is used to cache the transform name that will be used.
String transformName = targetMimetype + '/' + sourceMimetype;
String renditionName = TransformDefinition.convertToRenditionName(transformName);
Map<String, String> transformOptions = new HashMap<>();
RenditionDefinition2 renditionDefinition2 = renditionDefinitionRegistry2.getRenditionDefinition(renditionName);
if (renditionDefinition2 != null)
TransformDefinition transformDefinition = (TransformDefinition) renditionDefinitionRegistry2.getRenditionDefinition(renditionName);
if (transformDefinition == null)
{
transformOptions.putAll(renditionDefinition2.getTransformOptions());
transformDefinition = new TransformDefinition(transformName, targetMimetype,
options, null, null, null, renditionDefinitionRegistry2);
}
else
{
transformOptions.putAll(options);
}
TransformDefinition transformDefinition = new TransformDefinition(transformName, targetMimetype, transformOptions, null,
null, null, renditionDefinitionRegistry2);
if (logger.isTraceEnabled())
{

View File

@@ -108,7 +108,7 @@ public class DeleteNotExistsExecutor implements StatementExecutor
// --DELETE_NOT_EXISTS primaryTable.key,secondaryTable1.key1,... batch.size.property
String[] args = sql.split("[ \\t]+(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
if (args.length >= 3 && args[1].indexOf('.') != -1)
if (args.length == 3 && (args[1].indexOf('.')) != -1)
{
String[] tableColumnArgs = args[1].split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
if (tableColumnArgs.length >= 2)
@@ -133,10 +133,6 @@ public class DeleteNotExistsExecutor implements StatementExecutor
String timeoutSecString = globalProperties.getProperty(PROPERTY_TIMEOUT_SECONDS);
timeoutSec = timeoutSecString == null ? -1 : Long.parseLong(timeoutSecString);
// Only implemented in v3. In v2 the skip is not used
String skipToIdString = (args.length == 4) ? globalProperties.getProperty(args[3]) : null;
Long skipToId = skipToIdString == null ? 0L : Long.parseLong(skipToIdString);
// Compute upper limits
Long[] tableUpperLimits = new Long[tableColumnArgs.length];
Pair<String, String>[] tableColumn = new Pair[tableColumnArgs.length];
@@ -163,7 +159,7 @@ public class DeleteNotExistsExecutor implements StatementExecutor
}
}
process(tableColumn, tableUpperLimits, optionalWhereClauses, skipToId);
process(tableColumn, tableUpperLimits, optionalWhereClauses);
}
}
}
@@ -627,10 +623,4 @@ public class DeleteNotExistsExecutor implements StatementExecutor
}
}
}
protected void process(Pair<String, String>[] tableColumn, Long[] tableUpperLimits, String[] optionalWhereClauses,
Long skipToId) throws SQLException
{
process(tableColumn, tableUpperLimits, optionalWhereClauses);
}
}

View File

@@ -108,19 +108,12 @@ public class DeleteNotExistsV3Executor extends DeleteNotExistsExecutor
@Override
protected void process(Pair<String, String>[] tableColumn, Long[] tableUpperLimits, String[] optionalWhereClauses)
throws SQLException
{
process(tableColumn, tableUpperLimits, optionalWhereClauses, 0L);
}
@Override
protected void process(Pair<String, String>[] tableColumn, Long[] tableUpperLimits, String[] optionalWhereClauses, Long skipToId)
throws SQLException
{
String primaryTableName = tableColumn[0].getFirst();
String primaryColumnName = tableColumn[0].getSecond();
String primaryWhereClause = optionalWhereClauses[0];
Long primaryId = skipToId;
Long primaryId = 0L;
deletedCount = 0L;
startTime = new Date();

View File

@@ -311,24 +311,12 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
public void onCreateChildAssociation(ChildAssociationRef childAssociationRef, boolean isNewNode)
{
getEventConsolidator(childAssociationRef).onCreateChildAssociation(childAssociationRef, isNewNode);
if (!childAssociationRef.isPrimary())
{
// if this is a secondary relationship simulate node move event to store state of previous secondary parents
ChildAssociationRef oldChildAssociationRef = childAssociationWithoutParentOf(childAssociationRef);
getEventConsolidator(childAssociationRef.getChildRef()).onMoveNode(oldChildAssociationRef, childAssociationRef);
}
}
@Override
public void beforeDeleteChildAssociation(ChildAssociationRef childAssociationRef)
{
getEventConsolidator(childAssociationRef).beforeDeleteChildAssociation(childAssociationRef);
if (!childAssociationRef.isPrimary())
{
// if this is a secondary relationship simulate node move event to store state of previous secondary parents
ChildAssociationRef newChildAssociationRef = childAssociationWithoutParentOf(childAssociationRef);
getEventConsolidator(childAssociationRef.getChildRef()).onMoveNode(childAssociationRef, newChildAssociationRef);
}
}
@Override
@@ -515,18 +503,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
return ZonedDateTime.ofInstant(commitTimeMs, ZoneOffset.UTC);
}
private static ChildAssociationRef childAssociationWithoutParentOf(ChildAssociationRef childAssociationRef)
{
return new ChildAssociationRef(
null,
null,
childAssociationRef.getQName(),
childAssociationRef.getChildRef(),
childAssociationRef.isPrimary(),
childAssociationRef.getNthSibling()
);
}
@Override
protected void onBootstrap(ApplicationEvent applicationEvent)
{

View File

@@ -65,7 +65,6 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
private QName nodeType;
private QName nodeTypeBefore;
private List<String> primaryHierarchyBefore;
private List<String> secondaryParentsBefore;
private boolean resourceBeforeAllFieldsNull = true;
public NodeEventConsolidator(NodeResourceHelper nodeResourceHelper)
@@ -145,25 +144,7 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
eventTypes.add(EventType.NODE_UPDATED);
createBuilderIfAbsent(newChildAssocRef.getChildRef());
if (newChildAssocRef.isPrimary())
{
setBeforePrimaryHierarchy(helper.getPrimaryHierarchy(oldChildAssocRef.getParentRef(), true));
}
else
{
List<String> secondaryParents = helper.getSecondaryParents(newChildAssocRef.getChildRef());
if (newChildAssocRef.getParentRef() != null)
{
// on create secondary child association event takes place - recreate secondary parents previous state
secondaryParents.remove(newChildAssocRef.getParentRef().getId());
}
else if(oldChildAssocRef.getParentRef() != null && !secondaryParents.contains(oldChildAssocRef.getParentRef().getId()))
{
// before remove secondary child association event takes place - recreate secondary parents previous state
secondaryParents.add(oldChildAssocRef.getParentRef().getId());
}
setSecondaryParentsBefore(secondaryParents);
}
setBeforePrimaryHierarchy(helper.getPrimaryHierarchy(oldChildAssocRef.getParentRef(), true));
}
@Override
@@ -193,7 +174,7 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
public void beforeDeleteNode(NodeRef nodeRef)
{
eventTypes.add(EventType.NODE_DELETED);
createBuilderIfAbsent(nodeRef);
createBuilderIfAbsent(nodeRef, false);
}
@Override
@@ -259,19 +240,6 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
}
}
private void setSecondaryParentsBefore(List<String> secondaryParents)
{
if (this.secondaryParentsBefore == null)
{
this.secondaryParentsBefore = secondaryParents;
}
}
List<String> getSecondaryParentsBefore()
{
return secondaryParentsBefore;
}
private NodeResource buildNodeResource()
{
if (resourceBuilder == null)
@@ -315,7 +283,7 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
resourceBeforeAllFieldsNull = false;
}
Map<String, Map<String, String>> localizedProps = helper.getLocalizedPropertiesBefore(changedPropsBefore, after);
Map<String, Map<String, String>> localizedProps =helper.getLocalizedPropertiesBefore(changedPropsBefore, after);
if (!localizedProps.isEmpty())
{
builder.setLocalizedProperties(localizedProps);
@@ -341,7 +309,8 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
builder.setModifiedByUser(modifier);
resourceBeforeAllFieldsNull = false;
}
modifiedAt = helper.getZonedDateTime((Date) changedPropsBefore.get(ContentModel.PROP_MODIFIED));
modifiedAt =
helper.getZonedDateTime((Date) changedPropsBefore.get(ContentModel.PROP_MODIFIED));
}
// Handle case where the content does not exist on the propertiesBefore
@@ -365,12 +334,6 @@ public class NodeEventConsolidator extends EventConsolidator<NodeRef, NodeResour
resourceBeforeAllFieldsNull = false;
}
if (secondaryParentsBefore != null)
{
builder.setSecondaryParents(secondaryParentsBefore);
resourceBeforeAllFieldsNull = false;
}
if (nodeTypeBefore != null)
{
builder.setNodeType(helper.getQNamePrefixString(nodeTypeBefore));

View File

@@ -26,7 +26,6 @@
package org.alfresco.repo.event2;
import static java.util.Optional.ofNullable;
import static java.util.function.Predicate.not;
import java.io.Serializable;
import java.time.ZoneId;
@@ -39,7 +38,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.google.common.collect.Sets;
@@ -147,23 +145,21 @@ public class NodeResourceHelper implements InitializingBean
// minor: save one lookup if creator & modifier are the same
Map<String, UserInfo> mapUserCache = new HashMap<>(2);
return NodeResource.builder()
.setId(nodeRef.getId())
.setName((String) properties.get(ContentModel.PROP_NAME))
.setNodeType(getQNamePrefixString(type))
.setIsFile(isSubClass(type, ContentModel.TYPE_CONTENT))
.setIsFolder(isSubClass(type, ContentModel.TYPE_FOLDER))
.setCreatedByUser(getUserInfo((String) properties.get(ContentModel.PROP_CREATOR), mapUserCache))
.setCreatedAt(getZonedDateTime((Date)properties.get(ContentModel.PROP_CREATED)))
.setModifiedByUser(getUserInfo((String) properties.get(ContentModel.PROP_MODIFIER), mapUserCache))
.setModifiedAt(getZonedDateTime((Date)properties.get(ContentModel.PROP_MODIFIED)))
.setContent(getContentInfo(properties))
.setPrimaryAssocQName(getPrimaryAssocQName(nodeRef))
.setPrimaryHierarchy(PathUtil.getNodeIdsInReverse(path, false))
.setProperties(mapToNodeProperties(properties))
.setLocalizedProperties(mapToNodeLocalizedProperties(properties))
.setAspectNames(getMappedAspects(nodeRef))
.setSecondaryParents(getSecondaryParents(nodeRef));
return NodeResource.builder().setId(nodeRef.getId())
.setName((String) properties.get(ContentModel.PROP_NAME))
.setNodeType(getQNamePrefixString(type))
.setIsFile(isSubClass(type, ContentModel.TYPE_CONTENT))
.setIsFolder(isSubClass(type, ContentModel.TYPE_FOLDER))
.setCreatedByUser(getUserInfo((String) properties.get(ContentModel.PROP_CREATOR), mapUserCache))
.setCreatedAt(getZonedDateTime((Date)properties.get(ContentModel.PROP_CREATED)))
.setModifiedByUser(getUserInfo((String) properties.get(ContentModel.PROP_MODIFIER), mapUserCache))
.setModifiedAt(getZonedDateTime((Date)properties.get(ContentModel.PROP_MODIFIED)))
.setContent(getContentInfo(properties))
.setPrimaryAssocQName(getPrimaryAssocQName(nodeRef))
.setPrimaryHierarchy(PathUtil.getNodeIdsInReverse(path, false))
.setProperties(mapToNodeProperties(properties))
.setLocalizedProperties(mapToNodeLocalizedProperties(properties))
.setAspectNames(getMappedAspects(nodeRef));
}
private boolean isSubClass(QName className, QName ofClassQName)
@@ -417,21 +413,6 @@ public class NodeResourceHelper implements InitializingBean
return PathUtil.getNodeIdsInReverse(path, showLeaf);
}
/**
* Gathers node's secondary parents.
*
* @param nodeRef - node reference
* @return a list of node's secondary parents.
*/
public List<String> getSecondaryParents(final NodeRef nodeRef)
{
return nodeService.getParentAssocs(nodeRef).stream()
.filter(not(ChildAssociationRef::isPrimary))
.map(ChildAssociationRef::getParentRef)
.map(NodeRef::getId)
.collect(Collectors.toList());
}
public PermissionService getPermissionService()
{
return permissionService;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -48,31 +48,19 @@ public class NodePropertyFilter extends AbstractNodeEventFilter
ContentModel.PROP_CREATOR,
ContentModel.PROP_CREATED,
ContentModel.PROP_CONTENT);
// These properties should not be excluded from the properties object
private static final Set<QName> ALLOWED_PROPERTIES = Set.of(ContentModel.PROP_CASCADE_TX,
ContentModel.PROP_CASCADE_CRC);
private final List<String> nodePropertiesBlackList;
private final List<String> nodeAspectsBlackList;
public NodePropertyFilter()
{
this.nodePropertiesBlackList = parseFilterList(FILTERED_PROPERTIES);
this.nodeAspectsBlackList = parseFilterList(FILTERED_PROPERTIES);
}
@Override
public Set<QName> getExcludedTypes()
{
Set<QName> result = new HashSet<>(EXCLUDED_TOP_LEVEL_PROPS);
nodePropertiesBlackList.forEach(nodeProperty-> result.addAll(expandTypeDef(nodeProperty)));
nodeAspectsBlackList.forEach(nodeAspect -> result.addAll(expandTypeDef(nodeAspect)));
return result;
}
@Override
public boolean isExcluded(QName qName)
{
if(qName != null && ALLOWED_PROPERTIES.contains(qName)){
return false;
}
return super.isExcluded(qName);
}
}

View File

@@ -74,6 +74,8 @@ import org.alfresco.util.transaction.TransactionSupportUtil;
import org.apache.chemistry.opencmis.commons.server.CallContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.gytheio.messaging.MessageProducer;
import org.gytheio.messaging.MessagingException;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
@@ -292,7 +294,7 @@ public abstract class AbstractEventsService extends TransactionListenerAdapter
}
/**
* Filter out event before sending them to {@link MessageProducer}
* Filter out event before sending them to {@link org.gytheio.messaging.MessageProducer}
*
* @param events the events to be filtered
*

View File

@@ -1,57 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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.events;
import java.util.Map;
import java.util.Objects;
import org.apache.camel.ProducerTemplate;
class CamelMessageProducer implements MessageProducer
{
private static final Map<String, Object> AMQP_HEADERS = Map.of("JMS_AMQP_MESSAGE_FORMAT", 0L);
private final ProducerTemplate producer;
private final String endpoint;
CamelMessageProducer(ProducerTemplate producer, String endpoint)
{
this.producer = Objects.requireNonNull(producer);
this.endpoint = Objects.requireNonNull(endpoint);
}
@Override
public void send(Object message)
{
try
{
producer.sendBodyAndHeaders(endpoint, message, AMQP_HEADERS);
}
catch (Exception e)
{
throw new MessagingException("Could not send message", e);
}
}
}

View File

@@ -30,6 +30,8 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.tenant.TenantUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.gytheio.messaging.MessageProducer;
import org.gytheio.messaging.MessagingException;
public class ExceptionEventsServiceImpl extends AbstractEventsService implements ExceptionEventsService
{

View File

@@ -1,37 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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.events;
public interface MessageProducer
{
/**
* Send the given POJO message to the default queue for the producer
*
* @param message message to send
* @throws MessagingException on failure
*/
void send(Object message) throws MessagingException;
}

View File

@@ -1,50 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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.events;
import java.io.Serial;
import java.time.LocalDate;
import java.util.concurrent.atomic.AtomicInteger;
public class MessagingException extends RuntimeException
{
@Serial
private static final long serialVersionUID = 8192266871339806688L;
private static final AtomicInteger ERROR_COUNTER = new AtomicInteger();
public MessagingException(String message, Throwable cause)
{
super(buildErrorLogNumber(message), cause);
}
private static String buildErrorLogNumber(String message)
{
final LocalDate today = LocalDate.now();
message = message == null ? "" : message;
return "%02d%02d%04d %s".formatted(today.getMonthValue(), today.getDayOfMonth(), ERROR_COUNTER.getAndIncrement(), message);
}
}

View File

@@ -156,7 +156,7 @@ public class ChainingSubsystemProxyFactory extends ProxyFactoryBean
*/
@SuppressWarnings("rawtypes")
@Override
public void setInterfaces(Class... interfaces)
public void setInterfaces(Class[] interfaces)
{
super.setInterfaces(interfaces);
// Make it possible to export the object via JMX

View File

@@ -89,7 +89,7 @@ public class SubsystemProxyFactory extends ProxyFactoryBean implements Applicati
@SuppressWarnings("unchecked")
@Override
public void setInterfaces(Class... interfaces)
public void setInterfaces(Class[] interfaces)
{
super.setInterfaces(interfaces);
// Make it possible to export the object via JMX

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -3203,16 +3203,13 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
// Invoke policy behaviour
invokeBeforeUpdateNode(parentNodeRef);
Map<QName, Serializable> propertiesBefore = nodeDAO.getNodeProperties(parentNodeId);
// Touch the node; it is cm:auditable
boolean changed = nodeDAO.setModifiedProperties(parentNodeId, modifiedDate, modifiedByToPropagate);
if (changed)
{
Map<QName, Serializable> propertiesAfter = nodeDAO.getNodeProperties(parentNodeId);
// Invoke policy behaviour
invokeOnUpdateNode(parentNodeRef);
invokeOnUpdateProperties(parentNodeRef, propertiesBefore, propertiesAfter);
}
return null;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* 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
@@ -485,7 +485,7 @@ public class SolrJSONResultSet implements SearchEngineResultSet {
Set<Metric> metrics = new HashSet<>(1);
List<GenericFacetResponse> nested = new ArrayList<>();
String field = piv.getString("field");
String value = piv.get("value") != null ? piv.get("value").toString() : null;
String value = piv.getString("value");
if (piv.has("stats"))
{
JSONObject stats = piv.getJSONObject("stats");

View File

@@ -57,7 +57,6 @@ import com.nimbusds.jose.proc.JWSVerificationKeySelector;
import com.nimbusds.jose.proc.SecurityContext;
import com.nimbusds.jose.util.ResourceRetriever;
import com.nimbusds.jwt.proc.ConfigurableJWTProcessor;
import com.nimbusds.oauth2.sdk.id.Issuer;
import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata;
import org.alfresco.repo.security.authentication.identityservice.IdentityServiceFacade.IdentityServiceFacadeException;
@@ -92,9 +91,7 @@ import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
import org.springframework.security.oauth2.core.DelegatingOAuth2TokenValidator;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.oauth2.core.OAuth2Error;
import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
import org.springframework.security.oauth2.core.OAuth2TokenValidator;
import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult;
import org.springframework.security.oauth2.core.converter.ClaimTypeConverter;
import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter;
import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm;
@@ -102,6 +99,7 @@ import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.security.oauth2.jwt.JwtClaimNames;
import org.springframework.security.oauth2.jwt.JwtClaimValidator;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.jwt.JwtIssuerValidator;
import org.springframework.security.oauth2.jwt.JwtTimestampValidator;
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
import org.springframework.web.client.RestOperations;
@@ -377,18 +375,12 @@ public class IdentityServiceFacadeFactoryBean implements FactoryBean<IdentitySer
.map(OIDCProviderMetadata::getAuthorizationEndpointURI)
.map(URI::toASCIIString)
.orElse(null);
final String issuerUri = Optional.of(metadata)
.map(OIDCProviderMetadata::getIssuer)
.map(Issuer::getValue)
.orElseGet(config::getIssuerUrl);
return ClientRegistration
.withRegistrationId("ids")
.authorizationUri(authUri)
.tokenUri(metadata.getTokenEndpointURI().toASCIIString())
.jwkSetUri(metadata.getJWKSetURI().toASCIIString())
.issuerUri(issuerUri)
.issuerUri(config.getIssuerUrl())
.authorizationGrantType(AuthorizationGrantType.PASSWORD);
}
@@ -573,34 +565,6 @@ public class IdentityServiceFacadeFactoryBean implements FactoryBean<IdentitySer
}
}
static class JwtIssuerValidator implements OAuth2TokenValidator<Jwt>
{
private final String requiredIssuer;
public JwtIssuerValidator(String issuer)
{
this.requiredIssuer = requireNonNull(issuer, "issuer cannot be null");
}
@Override
public OAuth2TokenValidatorResult validate(Jwt token)
{
requireNonNull(token, "token cannot be null");
final Object issuer = token.getClaim(JwtClaimNames.ISS);
if (issuer != null && requiredIssuer.equals(issuer.toString()))
{
return OAuth2TokenValidatorResult.success();
}
final OAuth2Error error = new OAuth2Error(
OAuth2ErrorCodes.INVALID_TOKEN,
"The iss claim is not valid. Expected `%s` but got `%s`.".formatted(requiredIssuer, issuer),
"https://tools.ietf.org/html/rfc6750#section-3.1");
return OAuth2TokenValidatorResult.failure(error);
}
}
private static boolean isDefined(String value)
{
return value != null && !value.isBlank();

View File

@@ -1,9 +1,9 @@
--DELETE_NOT_EXISTS_V3 alf_prop_root.id,alf_audit_app.disabled_paths_id,alf_audit_entry.audit_values_id,alf_prop_unique_ctx.prop1_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_root.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_root.id,alf_audit_app.disabled_paths_id,alf_audit_entry.audit_values_id,alf_prop_unique_ctx.prop1_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_value.id,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_value.id,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_string_value.id,alf_prop_value.long_value."persisted_type in (3, 5, 6)",alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_string_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_string_value.id,alf_prop_value.long_value."persisted_type in (3, 5, 6)",alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_serializable_value.id,alf_prop_value.long_value.persisted_type=4,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_serializable_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_serializable_value.id,alf_prop_value.long_value.persisted_type=4,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_double_value.id,alf_prop_value.long_value.persisted_type=2,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_double_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_double_value.id,alf_prop_value.long_value.persisted_type=2,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize

View File

@@ -1,9 +1,9 @@
--DELETE_NOT_EXISTS_V3 alf_prop_root.id,alf_audit_app.disabled_paths_id,alf_audit_entry.audit_values_id,alf_prop_unique_ctx.prop1_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_root.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_root.id,alf_audit_app.disabled_paths_id,alf_audit_entry.audit_values_id,alf_prop_unique_ctx.prop1_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_value.id,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_value.id,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_string_value.id,alf_prop_value.long_value."persisted_type in (3, 5, 6)",alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_string_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_string_value.id,alf_prop_value.long_value."persisted_type in (3, 5, 6)",alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_serializable_value.id,alf_prop_value.long_value.persisted_type=4,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_serializable_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_serializable_value.id,alf_prop_value.long_value.persisted_type=4,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize
--DELETE_NOT_EXISTS_V3 alf_prop_double_value.id,alf_prop_value.long_value.persisted_type=2,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize system.delete_not_exists.alf_prop_double_value.skipToId
--DELETE_NOT_EXISTS_V3 alf_prop_double_value.id,alf_prop_value.long_value.persisted_type=2,alf_audit_app.app_name_id,alf_audit_entry.audit_user_id,alf_prop_link.key_prop_id,alf_prop_link.value_prop_id,alf_prop_unique_ctx.value1_prop_id,alf_prop_unique_ctx.value2_prop_id,alf_prop_unique_ctx.value3_prop_id system.delete_not_exists.batchsize

View File

@@ -3,7 +3,7 @@
repository.name=Main Repository
# Schema number
version.schema=19100
version.schema=19000
# Directory configuration
@@ -1221,7 +1221,7 @@ contentPropertyRestrictions.whitelist=
repo.event2.enabled=true
# Type and aspect filters which should be excluded
# Note: System folders node types are added by default
repo.event2.filter.nodeTypes=sys:*, fm:*, cm:thumbnail, cm:failedThumbnail, cm:rating, rma:rmsite include_subtypes, usr:user
repo.event2.filter.nodeTypes=sys:*, fm:*, cm:thumbnail, cm:failedThumbnail, cm:rating, rma:rmsite include_subtypes
repo.event2.filter.nodeAspects=sys:*
repo.event2.filter.childAssocTypes=rn:rendition
# Comma separated list of users which should be excluded
@@ -1231,7 +1231,6 @@ repo.event2.filter.users=
repo.event2.topic.endpoint=amqp:topic:alfresco.repo.event2
# Specifies if messages should be enqueued in in-memory queue or sent directly to the topic
repo.event2.queue.skip=false
#repo.event2.topic.endpoint=amqp:topic:VirtualTopic.alfresco.repo.event2
# Thread pool for async enqueue of repo events
repo.event2.queue.enqueueThreadPool.priority=1
repo.event2.queue.enqueueThreadPool.coreSize=8
@@ -1255,12 +1254,6 @@ system.prop_table_cleaner.algorithm=V2
system.delete_not_exists.pauseAndRecoverBatchSize=500000
#Duration of the pause in milliseconds (default 10s)
system.delete_not_exists.pauseAndRecoverTime=10000
#Skip ids on job execution
system.delete_not_exists.alf_prop_root.skipToId=0
system.delete_not_exists.alf_prop_value.skipToId=0
system.delete_not_exists.alf_prop_string_value.skipToId=0
system.delete_not_exists.alf_prop_serializable_value.skipToId=0
system.delete_not_exists.alf_prop_double_value.skipToId=0
# --Node cleanup batch - default settings
system.node_cleanup.delete_batchSize=1000

View File

@@ -187,7 +187,7 @@
<property name="startDelay" value="${system.cronJob.startDelayMilliseconds}"/>
<property name="jobDetail">
<bean id="upgradePasswordHashJobDetail" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="org.alfresco.repo.security.authentication.UpgradePasswordHashWorker$UpgradePasswordHashJob"/>
<property name="jobClass" value="org.alfresco.repo.admin.patch.AsynchronousPatch$AsynchronousPatchJob"/>
<property name="jobDataAsMap">
<map>
<entry key="upgradePasswordHashWorker" value-ref="upgradePasswordHashWorker"/>

View File

@@ -9,9 +9,9 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="eventsDispatcher" class="org.alfresco.repo.events.CamelMessageProducer">
<constructor-arg ref="camelProducerTemplate" />
<constructor-arg value="direct:alfresco.events" />
<bean id="eventsDispatcher" class="org.gytheio.messaging.camel.CamelMessageProducer">
<property name="producer" ref="camelProducerTemplate" />
<property name="endpoint" value="direct:alfresco.events" />
</bean>
<bean id="eventsRegistry" class="org.alfresco.sync.events.EventRegistryImpl">

View File

@@ -11,7 +11,7 @@
<context:component-scan base-package="org.alfresco.messaging.camel.configuration"/>
<bean id="messagingObjectMapper" class="org.alfresco.messaging.jackson.ObjectMapperFactory"
<bean id="messagingObjectMapper" class="org.gytheio.messaging.jackson.ObjectMapperFactory"
factory-method="createInstance" />
<bean id="defaultDataFormat" class="org.apache.camel.component.jackson.JacksonDataFormat">
@@ -96,6 +96,6 @@
</bean>
<!-- In the default routes, this is where a message goes if no queue is specified -->
<bean id="deadLetterQueue" class="org.alfresco.messaging.LoggingDeadLetterQueue" />
<bean id="deadLetterQueue" class="org.gytheio.messaging.LoggingDeadLetterQueue" />
</beans>

View File

@@ -134,7 +134,6 @@ import org.junit.runners.Suite;
org.alfresco.repo.search.impl.solr.SolrQueryHTTPClientTest.class,
org.alfresco.repo.search.impl.solr.SolrSQLHttpClientTest.class,
org.alfresco.repo.search.impl.solr.SolrStatsResultTest.class,
org.alfresco.repo.search.impl.solr.SolrJSONResultTest.class,
org.alfresco.repo.search.impl.solr.SolrSQLJSONResultMetadataSetTest.class,
org.alfresco.repo.search.impl.solr.facet.SolrFacetComparatorTest.class,
org.alfresco.repo.search.impl.solr.facet.FacetQNameUtilsTest.class,

View File

@@ -158,7 +158,7 @@ public class AccessAuditorTest
{
Object[] args = invocation.getArguments();
Map<String, Serializable> auditMap = (Map<String, Serializable>)args[1];
if ("/alfresco-access/transaction".equals(args[0]) && !"updateNodeProperties".equals(auditMap.get("action")))
if ("/alfresco-access/transaction".equals(args[0]))
{
auditMapList.add(auditMap);
}

View File

@@ -86,7 +86,7 @@ public class DeleteNotExistsV3ExecutorTest
{
scriptExecutor.executeScriptUrl("scriptexec/${db.script.dialect}/delete-not-exists/test-data1.sql");
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize system.delete_not_exists.temp_tst_tbl_1.skipToId";
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize";
int line = 1;
File scriptFile = Mockito.mock(File.class);
Properties properties = Mockito.mock(Properties.class);
@@ -101,8 +101,8 @@ public class DeleteNotExistsV3ExecutorTest
{
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_READ_ONLY)).thenReturn("true");
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_TIMEOUT_SECONDS)).thenReturn("-1");
DeleteNotExistsV3Executor deleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
deleteNotExistsV3Executor.execute();
DeleteNotExistsV3Executor DeleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
DeleteNotExistsV3Executor.execute();
List<String> res = jdbcTmpl.queryForList(select, String.class);
assertEquals(7, res.size());
@@ -117,8 +117,8 @@ public class DeleteNotExistsV3ExecutorTest
{
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_READ_ONLY)).thenReturn("false");
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_TIMEOUT_SECONDS)).thenReturn("-1");
DeleteNotExistsV3Executor deleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
deleteNotExistsV3Executor.execute();
DeleteNotExistsV3Executor DeleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
DeleteNotExistsV3Executor.execute();
List<String> res = jdbcTmpl.queryForList(select, String.class);
assertEquals(5, res.size());
@@ -137,7 +137,7 @@ public class DeleteNotExistsV3ExecutorTest
{
scriptExecutor.executeScriptUrl("scriptexec/${db.script.dialect}/delete-not-exists/test-data1.sql");
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize system.delete_not_exists.temp_tst_tbl_1.skipToId";
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize";
int line = 1;
File scriptFile = Mockito.mock(File.class);
Properties properties = Mockito.mock(Properties.class);
@@ -150,8 +150,8 @@ public class DeleteNotExistsV3ExecutorTest
{
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_DELETE_BATCH_SIZE)).thenReturn("1");
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_READ_ONLY)).thenReturn("false");
DeleteNotExistsV3Executor deleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
deleteNotExistsV3Executor.execute();
DeleteNotExistsV3Executor DeleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
DeleteNotExistsV3Executor.execute();
List<String> res = jdbcTmpl.queryForList(select, String.class);
assertEquals(5, res.size());
@@ -170,7 +170,7 @@ public class DeleteNotExistsV3ExecutorTest
{
scriptExecutor.executeScriptUrl("scriptexec/${db.script.dialect}/delete-not-exists/test-data1.sql");
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize system.delete_not_exists.temp_tst_tbl_1.skipToId";
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize";
int line = 1;
File scriptFile = Mockito.mock(File.class);
Properties properties = Mockito.mock(Properties.class);
@@ -198,42 +198,4 @@ public class DeleteNotExistsV3ExecutorTest
}
}
}
@Test()
public void testSkip() throws Exception
{
scriptExecutor.executeScriptUrl("scriptexec/${db.script.dialect}/delete-not-exists/test-data1.sql");
String sql = "--DELETE_NOT_EXISTS_V3 temp_tst_tbl_1.id,temp_tst_tbl_2.tbl_2_id,temp_tst_tbl_3.tbl_3_id,temp_tst_tbl_4.tbl_4_id system.delete_not_exists.batchsize system.delete_not_exists.temp_tst_tbl_1.skipToId";
int line = 1;
File scriptFile = Mockito.mock(File.class);
Properties properties = Mockito.mock(Properties.class);
String select = "select id from temp_tst_tbl_1 order by id ASC";
try (Connection connection = dataSource.getConnection())
{
connection.setAutoCommit(true);
{
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_BATCH_SIZE)).thenReturn("2");
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_READ_ONLY)).thenReturn("false");
when(properties.getProperty(DeleteNotExistsV3Executor.PROPERTY_TIMEOUT_SECONDS)).thenReturn("-1");
when(properties.getProperty("system.delete_not_exists.temp_tst_tbl_1.skipToId")).thenReturn("6");
DeleteNotExistsV3Executor deleteNotExistsV3Executor = createDeleteNotExistsV3Executor(dialect, connection, sql, line, scriptFile, properties);
deleteNotExistsV3Executor.execute();
List<String> res = jdbcTmpl.queryForList(select, String.class);
assertEquals(7, res.size());
// We are only processing Ids after 6, so all ids < 6 must remain untouched
assertEquals("1", res.get(0));
assertEquals("2", res.get(1));
assertEquals("3", res.get(2));
assertEquals("4", res.get(3));
assertEquals("5", res.get(4));
assertEquals("10", res.get(5));
assertEquals("11", res.get(6));
}
}
}
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -28,7 +28,6 @@ package org.alfresco.repo.event2;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.event.v1.model.ChildAssociationResource;
@@ -65,11 +64,12 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(),
resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() -> nodeService.addChild(
parentNodeRef,
childNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(TEST_NAMESPACE, assocLocalName)));
retryingTransactionHelper.doInTransaction(() ->
nodeService.addChild(
parentNodeRef,
childNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(TEST_NAMESPACE, assocLocalName)));
List<ChildAssociationRef> childAssociationRefs = retryingTransactionHelper.doInTransaction(() ->
nodeService.getChildAssocs(parentNodeRef));
@@ -77,32 +77,10 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertEquals(1, childAssociationRefs.size());
assertFalse(childAssociationRefs.get(0).isPrimary());
checkNumOfEvents(4);
checkNumOfEvents(3);
// node event
final RepoEvent<EventData<NodeResource>> nodeRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_UPDATED.getType(), nodeRepoEvent.getType());
assertNotNull("Repo event ID is not available.", nodeRepoEvent.getId());
assertNotNull("Source is not available", nodeRepoEvent.getSource());
assertEquals("Repo event source is not available.",
"/" + descriptorService.getCurrentRepositoryDescriptor().getId(),
nodeRepoEvent.getSource().toString());
assertNotNull("Repo event creation time is not available.", nodeRepoEvent.getTime());
assertEquals("Invalid repo event datacontenttype", "application/json",
nodeRepoEvent.getDatacontenttype());
assertNotNull(nodeRepoEvent.getDataschema());
assertEquals(EventJSONSchema.NODE_UPDATED_V1.getSchema(), nodeRepoEvent.getDataschema());
final RepoEvent<EventData<ChildAssociationResource>> childAssocRepoEvent = getRepoEventWithoutWait(3);
final EventData<NodeResource> nodeResourceEventData = getEventData(nodeRepoEvent);
assertNotNull("Event data group ID is not available. ", nodeResourceEventData.getEventGroupId());
assertNotNull("resourceBefore property is not available", nodeResourceEventData.getResourceBefore());
final NodeResource nodeResource = getNodeResource(nodeRepoEvent);
final NodeResource nodeResourceBefore = getNodeResourceBefore(nodeRepoEvent);
assertNotSame("Secondary parents actual and earlier state should differ", nodeResource.getSecondaryParents(), nodeResourceBefore.getSecondaryParents());
// child association event
final RepoEvent<EventData<ChildAssociationResource>> childAssocRepoEvent = getFilteredEvent(EventType.CHILD_ASSOC_CREATED, 0);
assertEquals("Wrong repo event type.", EventType.CHILD_ASSOC_CREATED.getType(), childAssocRepoEvent.getType());
assertNotNull("Repo event ID is not available.", childAssocRepoEvent.getId());
assertNotNull("Source is not available", childAssocRepoEvent.getSource());
@@ -115,18 +93,16 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertNotNull(childAssocRepoEvent.getDataschema());
assertEquals(EventJSONSchema.CHILD_ASSOC_CREATED_V1.getSchema(), childAssocRepoEvent.getDataschema());
final EventData<ChildAssociationResource> childAssocResourceEventData = getEventData(childAssocRepoEvent);
assertNotNull("Event data group ID is not available. ", childAssocResourceEventData.getEventGroupId());
assertNull("resourceBefore property is not available", childAssocResourceEventData.getResourceBefore());
final EventData<ChildAssociationResource> nodeResourceEventData = getEventData(childAssocRepoEvent);
// EventData attributes
assertNotNull("Event data group ID is not available. ", nodeResourceEventData.getEventGroupId());
assertNull("resourceBefore property is not available", nodeResourceEventData.getResourceBefore());
final ChildAssociationResource childAssociationResource = getChildAssocResource(childAssocRepoEvent);
assertEquals("Wrong parent", parentNodeRef.getId(), childAssociationResource.getParent().getId());
assertEquals("Wrong child", childNodeRef.getId(), childAssociationResource.getChild().getId());
assertEquals("Wrong assoc type", "cm:contains", childAssociationResource.getAssocType());
assertEquals("Wrong assoc name", "ce:" + assocLocalName, childAssociationResource.getAssocQName());
assertEquals("Node and child association events should have same eventGroupId", nodeResourceEventData.getEventGroupId(), childAssocResourceEventData.getEventGroupId());
assertTrue("Wrong node's secondary parents", nodeResource.getSecondaryParents().contains(childAssociationResource.getParent().getId()));
}
@Test
@@ -155,7 +131,7 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertEquals(1, childAssociationRefs.size());
assertFalse(childAssociationRefs.get(0).isPrimary());
checkNumOfEvents(4);
checkNumOfEvents(3);
retryingTransactionHelper.doInTransaction(() ->
nodeService.removeChildAssociation(childAssociationRef));
@@ -165,32 +141,10 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertEquals(0, childAssociationRefs.size());
checkNumOfEvents(6);
checkNumOfEvents(4);
// node repo event
final RepoEvent<EventData<NodeResource>> nodeRepoEvent = getRepoEventWithoutWait(5);
assertEquals("Wrong repo event type.", EventType.NODE_UPDATED.getType(), nodeRepoEvent.getType());
assertNotNull("Repo event ID is not available.", nodeRepoEvent.getId());
assertNotNull("Source is not available", nodeRepoEvent.getSource());
assertEquals("Repo event source is not available.",
"/" + descriptorService.getCurrentRepositoryDescriptor().getId(),
nodeRepoEvent.getSource().toString());
assertNotNull("Repo event creation time is not available.", nodeRepoEvent.getTime());
assertEquals("Invalid repo event datacontenttype", "application/json",
nodeRepoEvent.getDatacontenttype());
assertNotNull(nodeRepoEvent.getDataschema());
assertEquals(EventJSONSchema.NODE_UPDATED_V1.getSchema(), nodeRepoEvent.getDataschema());
final RepoEvent<EventData<ChildAssociationResource>> childAssocRepoEvent = getRepoEventWithoutWait(4);
final EventData<NodeResource> nodeResourceEventData = getEventData(nodeRepoEvent);
assertNotNull("Event data group ID is not available. ", nodeResourceEventData.getEventGroupId());
assertNotNull("resourceBefore property is not available", nodeResourceEventData.getResourceBefore());
final NodeResource nodeResource = getNodeResource(nodeRepoEvent);
final NodeResource nodeResourceBefore = getNodeResourceBefore(nodeRepoEvent);
assertNotSame("Secondary parents actual and earlier state should differ", nodeResource.getSecondaryParents(), nodeResourceBefore.getSecondaryParents());
// child association repo event
final RepoEvent<EventData<ChildAssociationResource>> childAssocRepoEvent = getFilteredEvent(EventType.CHILD_ASSOC_DELETED, 0);
assertEquals("Wrong repo event type.", EventType.CHILD_ASSOC_DELETED.getType(), childAssocRepoEvent.getType());
assertNotNull("Repo event ID is not available. ", childAssocRepoEvent.getId());
assertNotNull("Source is not available", childAssocRepoEvent.getSource());
@@ -202,17 +156,15 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertNotNull(childAssocRepoEvent.getDataschema());
assertEquals(EventJSONSchema.CHILD_ASSOC_DELETED_V1.getSchema(), childAssocRepoEvent.getDataschema());
final EventData<ChildAssociationResource> childAssocResourceEventData = getEventData(childAssocRepoEvent);
assertNotNull("Event data group ID is not available. ", childAssocResourceEventData.getEventGroupId());
assertNull("resourceBefore property is not available", childAssocResourceEventData.getResourceBefore());
final EventData<ChildAssociationResource> nodeResourceEventData = getEventData(childAssocRepoEvent);
// EventData attributes
assertNotNull("Event data group ID is not available. ", nodeResourceEventData.getEventGroupId());
assertNull("resourceBefore property is not available", nodeResourceEventData.getResourceBefore());
final ChildAssociationResource childAssociationResource = getChildAssocResource(childAssocRepoEvent);
assertEquals("Wrong parent", parentNodeRef.getId(), childAssociationResource.getParent().getId());
assertEquals("Wrong child", childNodeRef.getId(), childAssociationResource.getChild().getId());
assertEquals("Wrong assoc type", "cm:contains", childAssociationResource.getAssocType());
assertEquals("Node and child association events should have same eventGroupId", nodeResourceEventData.getEventGroupId(), childAssocResourceEventData.getEventGroupId());
assertTrue("Wrong node's secondary parents", nodeResourceBefore.getSecondaryParents().contains(childAssociationResource.getParent().getId()));
}
@Test
@@ -227,10 +179,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() ->
nodeService.addChild(
@@ -253,15 +212,12 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
checkNumOfEvents(8);
// 1 node.Updated events should be created
List<RepoEvent<EventData<NodeResource>>> nodeUpdateEvent = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong association events number", 1, nodeUpdateEvent.size());
checkNumOfEvents(7);
// 3 assoc.child.Created events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_CREATED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
}
@Test
@@ -275,10 +231,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
List<NodeRef> parents = Arrays.asList(parent1NodeRef, parent2NodeRef, parent3NodeRef);
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() -> {
for (NodeRef parent : parents)
@@ -305,14 +268,10 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
checkNumOfEvents(8);
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(5);
assertEquals("Wrong repo event type.", EventType.NODE_UPDATED.getType(), resultRepoEvent.getType());
checkNumOfEvents(7);
// 3 assoc.child.Created events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_CREATED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
// All events in the transaction should have the same eventGroupId
String assocEventGroupID1 = getEventData(childAssocEvents.get(0)).getEventGroupId();
@@ -335,10 +294,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
for (NodeRef parent : parents)
{
@@ -364,15 +330,10 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
checkNumOfEvents(10);
// 3 node.Updated events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> nodeUpdateEvents = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong node update events number", 3, nodeUpdateEvents.size());
checkNumOfEvents(7);
// 3 assoc.child.Created events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_CREATED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
assertEquals(parent1NodeRef.getId(), getChildAssocResource(childAssocEvents.get(0)).getParent().getId());
assertEquals(childNodeRef.getId(), getChildAssocResource(childAssocEvents.get(0)).getChild().getId());
@@ -399,10 +360,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() -> {
for (NodeRef child : children)
@@ -420,15 +388,10 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
checkNumOfEvents(10);
// 3 node.Updated events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> nodeUpdateEvents = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong node update events number", 3, nodeUpdateEvents.size());
checkNumOfEvents(7);
// 3 assoc.child.Created events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_CREATED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
}
@Test
@@ -443,10 +406,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
for (NodeRef child : children)
{
@@ -462,15 +432,10 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
checkNumOfEvents(10);
// 3 node.Updated events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> nodeUpdateEvents = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong node update events number", 3, nodeUpdateEvents.size());
checkNumOfEvents(7);
// 3 assoc.child.Created events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_CREATED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
assertEquals(parentNodeRef.getId(), getChildAssocResource(childAssocEvents.get(0)).getParent().getId());
assertEquals(child1NodeRef.getId(), getChildAssocResource(childAssocEvents.get(0)).getChild().getId());
@@ -497,10 +462,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() ->
nodeService.addChild(parents, childNodeRef, ContentModel.ASSOC_CONTAINS,
@@ -529,19 +501,15 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
checkNumOfEvents(12);
// 2 node.Updated events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> nodeUpdateEvents = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong node update events number", 2, nodeUpdateEvents.size());
checkNumOfEvents(10);
// 3 assoc.child.Deleted events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_DELETED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
}
@Test
public void testDeleteAssociationMultipleParentOneChildrenDifferentTransactions()
public void testDeleteAssociationOneParentMultipleChildrenDifferentTransactions()
{
final NodeRef parent1NodeRef = createNode(ContentModel.TYPE_FOLDER);
final NodeRef parent2NodeRef = createNode(ContentModel.TYPE_FOLDER);
@@ -552,10 +520,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() ->
nodeService.addChild(parents, childNodeRef, ContentModel.ASSOC_CONTAINS,
@@ -582,7 +557,7 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
nodeService.removeChildAssociation(childAssociationRef));
}
checkNumOfEvents(14);
checkNumOfEvents(10);
// 3 assoc.child.Deleted events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_DELETED);
@@ -613,10 +588,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() -> {
for (NodeRef child : children)
@@ -637,15 +619,11 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
deleteNode(parentNodeRef);
checkNumOfEvents(17);
// 6 node.Updated events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> nodeUpdateEvents = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong node update events number", 6, nodeUpdateEvents.size());
checkNumOfEvents(11);
// 3 assoc.child.Deleted events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_DELETED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
}
@Test
@@ -660,10 +638,17 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(4);
IntStream.of(1, 2, 3, 4).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(3);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(4);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() ->
nodeService.addChild(parents, childNodeRef, ContentModel.ASSOC_CONTAINS,
@@ -685,15 +670,11 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
deleteNode(childNodeRef);
checkNumOfEvents(12);
// 2 node.Updated events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> nodeUpdateEvents = getFilteredEvents(EventType.NODE_UPDATED);
assertEquals("Wrong node update events number", 2, nodeUpdateEvents.size());
checkNumOfEvents(11);
// 3 assoc.child.Deleted events should be created
List<RepoEvent<EventData<ChildAssociationResource>>> childAssocEvents = getFilteredEvents(EventType.CHILD_ASSOC_DELETED);
assertEquals("Wrong association events number", 3, childAssocEvents.size());
assertEquals("Wrong association events number",3, childAssocEvents.size());
}
@Test
@@ -704,10 +685,11 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
checkNumOfEvents(2);
IntStream.of(1, 2).forEach(i -> {
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(i);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
});
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEventWithoutWait(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
resultRepoEvent = getRepoEventWithoutWait(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
retryingTransactionHelper.doInTransaction(() ->
{
@@ -726,14 +708,13 @@ public class ChildAssociationRepoEventIT extends AbstractContextAwareRepoEvent
assertEquals(1, childAssociationRefs.size());
assertFalse(childAssociationRefs.get(0).isPrimary());
checkNumOfEvents(5);
checkNumOfEvents(4);
// Check the node events occur before the child association event
List<RepoEvent<?>> repoEvents = getRepoEventsContainer().getEvents();
assertEquals(EventType.NODE_CREATED.getType(), repoEvents.get(0).getType());
assertEquals(EventType.NODE_CREATED.getType(), repoEvents.get(1).getType());
assertEquals(EventType.NODE_UPDATED.getType(), repoEvents.get(2).getType());
assertEquals(EventType.NODE_UPDATED.getType(), repoEvents.get(3).getType());
assertEquals(EventType.CHILD_ASSOC_CREATED.getType(), repoEvents.get(4).getType());
assertEquals("org.alfresco.event.node.Created", repoEvents.get(0).getType());
assertEquals("org.alfresco.event.node.Created", repoEvents.get(1).getType());
assertEquals("org.alfresco.event.node.Updated", repoEvents.get(2).getType());
assertEquals("org.alfresco.event.assoc.child.Created", repoEvents.get(3).getType());
}
}

View File

@@ -27,38 +27,24 @@ package org.alfresco.repo.event2;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.event.v1.model.EventType;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.junit.Before;
import org.junit.Test;
public class EventConsolidatorUnitTest
{
private final NodeResourceHelper nodeResourceHelper = mock(NodeResourceHelper.class);
private NodeEventConsolidator eventConsolidator;
@Before
public void setUp() throws Exception
{
eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
}
private NodeResourceHelper nodeResourceHelper = mock(NodeResourceHelper.class);
@Test
public void testGetMappedAspectsBeforeRemovedAndAddedEmpty()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
Set<String> currentAspects = new HashSet<>();
currentAspects.add("cm:geographic");
currentAspects.add("cm:auditable");
@@ -71,6 +57,7 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_AspectRemoved()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
Set<String> currentAspects = new HashSet<>();
@@ -92,6 +79,7 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_AspectAdded()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
Set<String> currentAspects = new HashSet<>();
@@ -114,6 +102,7 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_AspectAddedAndRemoved()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
Set<String> currentAspects = new HashSet<>();
@@ -136,6 +125,7 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_AspectRemovedAndAdded()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
@@ -160,6 +150,8 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_AspectAddedTwiceRemovedOnce()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
@@ -186,6 +178,8 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_AspectRemovedTwiceAddedOnce()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
@@ -212,6 +206,7 @@ public class EventConsolidatorUnitTest
@Test
public void testGetMappedAspectsBefore_FilteredAspectAdded()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASPECT_COPIEDFROM);
Set<String> currentAspects = new HashSet<>();
@@ -232,6 +227,7 @@ public class EventConsolidatorUnitTest
@Test
public void testAddAspect()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
assertEquals(1, eventConsolidator.getAspectsAdded().size());
@@ -242,6 +238,7 @@ public class EventConsolidatorUnitTest
@Test
public void testRemoveAspect()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
assertEquals(0, eventConsolidator.getAspectsAdded().size());
@@ -252,6 +249,7 @@ public class EventConsolidatorUnitTest
@Test
public void testAddAspectRemoveAspect()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
@@ -262,6 +260,7 @@ public class EventConsolidatorUnitTest
@Test
public void testRemoveAspectAddAspect()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
@@ -272,6 +271,7 @@ public class EventConsolidatorUnitTest
@Test
public void testAddAspectTwiceRemoveAspectOnce()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
@@ -284,6 +284,7 @@ public class EventConsolidatorUnitTest
@Test
public void testAddAspectOnceRemoveAspectTwice()
{
NodeEventConsolidator eventConsolidator = new NodeEventConsolidator(nodeResourceHelper);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.addAspect(ContentModel.ASSOC_CONTAINS);
eventConsolidator.removeAspect(ContentModel.ASSOC_CONTAINS);
@@ -292,83 +293,4 @@ public class EventConsolidatorUnitTest
assertEquals(1, eventConsolidator.getAspectsRemoved().size());
assertTrue(eventConsolidator.getAspectsRemoved().contains(ContentModel.ASSOC_CONTAINS));
}
@Test
public void testOnMoveNodeWithPrimaryParent()
{
ChildAssociationRef oldAssociationMock = mock(ChildAssociationRef.class);
ChildAssociationRef newAssociationMock = mock(ChildAssociationRef.class);
NodeRef parentRefMock = mock(NodeRef.class);
given(newAssociationMock.isPrimary()).willReturn(true);
given(oldAssociationMock.getParentRef()).willReturn(parentRefMock);
eventConsolidator.onMoveNode(oldAssociationMock, newAssociationMock);
then(newAssociationMock).should().getChildRef();
then(newAssociationMock).should().isPrimary();
then(newAssociationMock).shouldHaveNoMoreInteractions();
then(nodeResourceHelper).should().getPrimaryHierarchy(parentRefMock, true);
assertTrue("Node event consolidator should contain event type: UPDATED", eventConsolidator.getEventTypes().contains(EventType.NODE_UPDATED));
}
@Test
public void testOnMoveNodeAfterSecondaryParentAdded()
{
ChildAssociationRef oldAssociationMock = mock(ChildAssociationRef.class);
ChildAssociationRef newAssociationMock = mock(ChildAssociationRef.class);
NodeRef nodeRefMock = mock(NodeRef.class);
NodeRef parentRefMock = mock(NodeRef.class);
List<String> secondaryParentsMock = mock(List.class);
given(newAssociationMock.isPrimary()).willReturn(false);
given(newAssociationMock.getChildRef()).willReturn(nodeRefMock);
given(newAssociationMock.getParentRef()).willReturn(parentRefMock);
given(parentRefMock.getId()).willReturn("parent-id");
given(nodeResourceHelper.getSecondaryParents(any(NodeRef.class))).willReturn(secondaryParentsMock);
// when
eventConsolidator.onMoveNode(oldAssociationMock, newAssociationMock);
then(newAssociationMock).should().isPrimary();
then(newAssociationMock).should(times(2)).getChildRef();
then(newAssociationMock).should(times(2)).getParentRef();
then(newAssociationMock).shouldHaveNoMoreInteractions();
then(oldAssociationMock).shouldHaveNoInteractions();
then(nodeResourceHelper).should().getSecondaryParents(nodeRefMock);
then(secondaryParentsMock).should().remove("parent-id");
then(secondaryParentsMock).shouldHaveNoMoreInteractions();
assertTrue("Node event consolidator should contain event type: UPDATED", eventConsolidator.getEventTypes().contains(EventType.NODE_UPDATED));
assertEquals(secondaryParentsMock, eventConsolidator.getSecondaryParentsBefore());
}
@Test
public void testOnMoveNodeBeforeSecondaryParentRemoved()
{
ChildAssociationRef oldAssociationMock = mock(ChildAssociationRef.class);
ChildAssociationRef newAssociationMock = mock(ChildAssociationRef.class);
NodeRef nodeRefMock = mock(NodeRef.class);
NodeRef parentRefMock = mock(NodeRef.class);
List<String> secondaryParentsMock = mock(List.class);
given(newAssociationMock.isPrimary()).willReturn(false);
given(newAssociationMock.getChildRef()).willReturn(nodeRefMock);
given(oldAssociationMock.getParentRef()).willReturn(parentRefMock);
given(parentRefMock.getId()).willReturn("parent-id");
given(nodeResourceHelper.getSecondaryParents(any(NodeRef.class))).willReturn(secondaryParentsMock);
// when
eventConsolidator.onMoveNode(oldAssociationMock, newAssociationMock);
then(newAssociationMock).should().isPrimary();
then(newAssociationMock).should(times(2)).getChildRef();
then(newAssociationMock).should().getParentRef();
then(newAssociationMock).shouldHaveNoMoreInteractions();
then(oldAssociationMock).should(times(3)).getParentRef();
then(oldAssociationMock).shouldHaveNoMoreInteractions();
then(nodeResourceHelper).should().getSecondaryParents(nodeRefMock);
then(secondaryParentsMock).should().contains("parent-id");
then(secondaryParentsMock).should().add("parent-id");
then(secondaryParentsMock).shouldHaveNoMoreInteractions();
assertTrue("Node event consolidator should contain event type: NODE_UPDATED", eventConsolidator.getEventTypes().contains(EventType.NODE_UPDATED));
assertEquals(secondaryParentsMock, eventConsolidator.getSecondaryParentsBefore());
}
}

View File

@@ -119,9 +119,6 @@ public class EventFilterUnitTest
assertTrue("System properties are excluded by default.",
propertyFilter.isExcluded(ContentModel.PROP_NODE_DBID));
assertFalse("Property cascadeTx is not excluded", propertyFilter.isExcluded(ContentModel.PROP_CASCADE_TX));
assertFalse("Property cascadeCRC is not excluded", propertyFilter.isExcluded(ContentModel.PROP_CASCADE_CRC));
assertFalse(propertyFilter.isExcluded(ContentModel.PROP_TITLE));
}

View File

@@ -28,43 +28,14 @@ package org.alfresco.repo.event2;
import static org.alfresco.repo.event2.NodeResourceHelper.getLocalizedPropertiesBefore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class NodeResourceHelperUnitTest
{
@Mock
private NodeService nodeServiceMock;
@InjectMocks
private NodeResourceHelper nodeResourceHelper;
@Before
public void setUp() throws Exception
{
MockitoAnnotations.openMocks(this);
}
@Test
public void shouldExtractOnlyRelevantPropertiesForBeforeNode()
{
@@ -140,39 +111,4 @@ public class NodeResourceHelperUnitTest
return this;
}
}
@Test
public void testGetSecondaryParents()
{
NodeRef nodeRefMock = mock(NodeRef.class);
NodeRef parentRefMock = mock(NodeRef.class);
ChildAssociationRef secondaryParentMock = mock(ChildAssociationRef.class);
given(nodeServiceMock.getParentAssocs(any(NodeRef.class))).willReturn(List.of(secondaryParentMock));
given(secondaryParentMock.isPrimary()).willReturn(false);
given(secondaryParentMock.getParentRef()).willReturn(parentRefMock);
// when
List<String> secondaryParents = nodeResourceHelper.getSecondaryParents(nodeRefMock);
then(nodeServiceMock).should().getParentAssocs(nodeRefMock);
then(nodeServiceMock).shouldHaveNoMoreInteractions();
then(secondaryParentMock).should().isPrimary();
then(secondaryParentMock).should().getParentRef();
then(secondaryParentMock).shouldHaveNoMoreInteractions();
then(parentRefMock).should().getId();
then(parentRefMock).shouldHaveNoMoreInteractions();
assertNotNull(secondaryParents);
}
@Test
public void testGetNoneSecondaryParents()
{
NodeRef nodeRefMock = mock(NodeRef.class);
// when
List<String> secondaryParents = nodeResourceHelper.getSecondaryParents(nodeRefMock);
assertNotNull(secondaryParents);
assertTrue(secondaryParents.isEmpty());
}
}

View File

@@ -87,7 +87,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
});
checkNumOfEvents(2);
resultRepoEvent = getRepoEvent(2);
assertEquals("Wrong repo event type.", EventType.NODE_UPDATED.getType(),
resultRepoEvent.getType());
@@ -227,7 +227,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
});
checkNumOfEvents(2);
resultRepoEvent = getRepoEvent(2);
assertEquals("Wrong repo event type.", EventType.NODE_UPDATED.getType(), resultRepoEvent.getType());
@@ -625,7 +625,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
// Create active model
CustomModelDefinition modelDefinition =
retryingTransactionHelper.doInTransaction(() -> customModelService.createCustomModel(model, true));
retryingTransactionHelper.doInTransaction(() -> customModelService.createCustomModel(model, true));
assertNotNull(modelDefinition);
assertEquals(modelName, modelDefinition.getName().getLocalName());
@@ -635,11 +635,8 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
Collection<TypeDefinition> types = modelDefinition.getTypeDefinitions();
assertEquals(1, types.size());
// we should have only 2 events, node.Created and node.Updated
checkNumOfEvents(2);
// node.Created event should be generated for the model
RepoEvent<EventData<NodeResource>> resultRepoEvent = getFilteredEvent(EventType.NODE_CREATED, 0);
RepoEvent<EventData<NodeResource>> resultRepoEvent = getRepoEvent(1);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
NodeResource nodeResource = getNodeResource(resultRepoEvent);
assertEquals("Incorrect node type was found", "cm:dictionaryModel", nodeResource.getNodeType());
@@ -650,9 +647,9 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(nodeRef));
// node.Created event should be generated
resultRepoEvent = getRepoEvent(3);
nodeResource = getNodeResource(resultRepoEvent);
resultRepoEvent = getRepoEvent(2);
assertEquals("Wrong repo event type.", EventType.NODE_CREATED.getType(), resultRepoEvent.getType());
nodeResource = getNodeResource(resultRepoEvent);
assertEquals("cm:content node type was not found", "cm:content", nodeResource.getNodeType());
QName typeQName = QName.createQName("{" + namespacePair.getFirst()+ "}" + typeName);
@@ -664,15 +661,15 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
return null;
});
// we should have 4 events, node.Created for the model, node.Updated for the parent, node.Created for the node and node.Updated
checkNumOfEvents(4);
// we should have 3 events, node.Created for the model, node.Created for the node and node.Updated
checkNumOfEvents(3);
resultRepoEvent = getRepoEvent(4);
resultRepoEvent = getRepoEvent(3);
assertEquals("Wrong repo event type.", EventType.NODE_UPDATED.getType(), resultRepoEvent.getType());
nodeResource = getNodeResource(resultRepoEvent);
assertEquals("Incorrect node type was found", namespacePair.getSecond() + QName.NAMESPACE_PREFIX + typeName, nodeResource.getNodeType());
NodeResource resourceBefore = getNodeResourceBefore(4);
NodeResource resourceBefore = getNodeResourceBefore(3);
assertEquals("Incorrect node type was found", "cm:content", resourceBefore.getNodeType());
assertNull(resourceBefore.getId());
assertNull(resourceBefore.getContent());
@@ -791,7 +788,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
});
checkNumOfEvents(4);
NodeResource resourceBefore = getNodeResourceBefore(4);
NodeResource resource = getNodeResource(4);
@@ -811,7 +808,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
assertNull(resourceBefore.getModifiedByUser());
assertNull(resourceBefore.getCreatedAt());
assertNull(resourceBefore.getCreatedByUser());
assertNotNull(resourceBefore.getProperties());
assertNull(resourceBefore.getProperties());
assertNull(resourceBefore.getAspectNames());
assertNotNull(resourceBefore.getPrimaryHierarchy());
assertNull("Content should have been null.", resource.getContent());
@@ -821,7 +818,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
assertNotNull(resource.getModifiedByUser());
assertNotNull(resource.getAspectNames());
assertNull(resource.getContent());
assertFalse(resource.getProperties().isEmpty());
assertTrue(resource.getProperties().isEmpty());
}
@Test
@@ -1023,7 +1020,7 @@ public class UpdateRepoEventIT extends AbstractContextAwareRepoEvent
NodeResource resource = getNodeResource(1);
final Set<String> originalAspects = resource.getAspectNames();
assertNotNull(originalAspects);
retryingTransactionHelper.doInTransaction(() -> {
// Add cm:geographic aspect with default value
nodeService.addAspect(nodeRef, ContentModel.ASPECT_GEOGRAPHIC, null);

View File

@@ -1,353 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2023 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.assertTrue;
import java.util.List;
import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.LimitBy;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.util.testing.category.LuceneTests;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
/**
* The results of executing a Solr JSON query
*
* @author Tiago Salvado
*/
@RunWith(MockitoJUnitRunner.class)
@Category(LuceneTests.class)
public class SolrJSONResultTest
{
private @Mock NodeService nodeService;
private @Mock NodeDAO nodeDao;
private static final String JSON = "{\r\n"
+ " \"responseHeader\":{\r\n"
+ " \"QTime\":7,\r\n"
+ " \"status\":0\r\n"
+ " },\r\n"
+ " \"_facet_function_mappings_\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"txRemaining\":0,\r\n"
+ " \"_interval_mappings_\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"lastIndexedTx\":26,\r\n"
+ " \"_date_mappings_\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"_pivot_mappings_\":{\r\n"
+ " \"exif:pixelXDimension,exif:manufacturer\":\"int@s_@{http://www.alfresco.org/model/exif/1.0}pixelXDimension,text@s__lt@{http://www.alfresco.org/model/exif/1.0}manufacturer\"\r\n"
+ " },\r\n"
+ " \"_range_mappings_\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"_original_parameters_\":{\r\n"
+ " \"carrot.url\":\"id\",\r\n"
+ " \"spellcheck.collateExtendedResults\":\"true\",\r\n"
+ " \"df\":\"TEXT\",\r\n"
+ " \"fl\":\"DBID,score\",\r\n"
+ " \"spellcheck.maxCollations\":\"3\",\r\n"
+ " \"fq\":[\r\n"
+ " \"{!afts}AUTHORITY_FILTER_FROM_JSON\",\r\n"
+ " \"{!afts}TENANT_FILTER_FROM_JSON\"\r\n"
+ " ],\r\n"
+ " \"spellcheck.maxCollationTries\":\"5\",\r\n"
+ " \"locale\":\"en_US\",\r\n"
+ " \"hl.qparser\":\"afts\",\r\n"
+ " \"defType\":\"afts\",\r\n"
+ " \"spellcheck.maxResultsForSuggest\":\"5\",\r\n"
+ " \"rqq\":\"{!rrafts}RERANK_QUERY_FROM_CONTEXT\",\r\n"
+ " \"stats\":\"true\",\r\n"
+ " \"carrot.outputSubClusters\":\"false\",\r\n"
+ " \"wt\":\"json\",\r\n"
+ " \"stats.field\":\"{! tag=piv1 key=piv1 countDistinct=false distinctValues=false min=true max=true sum=true count=true missing=true sumOfSquares=true mean=true stddev=true}cm:content.size\",\r\n"
+ " \"facet.pivot\":\"exif:pixelXDimension,exif:manufacturer\",\r\n"
+ " \"carrot.produceSummary\":\"true\",\r\n"
+ " \"start\":\"0\",\r\n"
+ " \"rows\":\"0\",\r\n"
+ " \"spellcheck.alternativeTermCount\":\"2\",\r\n"
+ " \"spellcheck.extendedResults\":\"false\",\r\n"
+ " \"alternativeDic\":\"DEFAULT_DICTIONARY\",\r\n"
+ " \"spellcheck\":\"false\",\r\n"
+ " \"spellcheck.count\":\"5\",\r\n"
+ " \"facet\":\"true\",\r\n"
+ " \"carrot.title\":\"mltext@m___t@{http://www.alfresco.org/model/content/1.0}title\",\r\n"
+ " \"carrot.snippet\":\"content@s___t@{http://www.alfresco.org/model/content/1.0}content\",\r\n"
+ " \"spellcheck.collate\":\"true\",\r\n"
+ " \"rq\":\"{!alfrescoReRank reRankQuery=$rqq reRankDocs=500 scale=true reRankWeight=3}\"\r\n"
+ " },\r\n"
+ " \"_stats_facet_mappings_\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"stats\":{\r\n"
+ " \"stats_fields\":{\r\n"
+ " \"piv1\":{\r\n"
+ " \"sumOfSquares\":29214041999911,\r\n"
+ " \"min\":25,\r\n"
+ " \"max\":3737049,\r\n"
+ " \"mean\":81749.67403314917,\r\n"
+ " \"count\":181,\r\n"
+ " \"missing\":9,\r\n"
+ " \"sum\":14796691,\r\n"
+ " \"stddev\":394436.42871747876\r\n"
+ " }\r\n"
+ " }\r\n"
+ " },\r\n"
+ " \"processedDenies\":true,\r\n"
+ " \"response\":{\r\n"
+ " \"docs\":[\r\n"
+ " \r\n"
+ " ],\r\n"
+ " \"numFound\":190,\r\n"
+ " \"start\":0,\r\n"
+ " \"maxScore\":1\r\n"
+ " },\r\n"
+ " \"_stats_field_mappings_\":{\r\n"
+ " \"cm:content.size\":\"content@s__size@{http://www.alfresco.org/model/content/1.0}content\"\r\n"
+ " },\r\n"
+ " \"facet_counts\":{\r\n"
+ " \"facet_intervals\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"facet_pivot\":{\r\n"
+ " \"exif:pixelXDimension,exif:manufacturer\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":2,\r\n"
+ " \"pivot\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}corpor\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}hewlett\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}packard\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}pentax\"\r\n"
+ " }\r\n"
+ " ],\r\n"
+ " \"value\":1000\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"pivot\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}canon\"\r\n"
+ " }\r\n"
+ " ],\r\n"
+ " \"value\":100\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":400\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":414\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":591\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":625\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":749\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":751\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":778\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":782\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":793\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":1067\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"pivot\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}co\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}ltd\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}olympu\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}optic\"\r\n"
+ " }\r\n"
+ " ],\r\n"
+ " \"value\":1120\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":1216\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":2000\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"pivot\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}compani\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}eastman\"\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}kodak\"\r\n"
+ " }\r\n"
+ " ],\r\n"
+ " \"value\":2580\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"pivot\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}canon\"\r\n"
+ " }\r\n"
+ " ],\r\n"
+ " \"value\":3072\r\n"
+ " },\r\n"
+ " {\r\n"
+ " \"field\":\"exif:pixelXDimension\",\r\n"
+ " \"count\":1,\r\n"
+ " \"pivot\":[\r\n"
+ " {\r\n"
+ " \"field\":\"exif:manufacturer\",\r\n"
+ " \"count\":1,\r\n"
+ " \"value\":\"{en}canon\"\r\n"
+ " }\r\n"
+ " ],\r\n"
+ " \"value\":3264\r\n"
+ " }\r\n"
+ " ]\r\n"
+ " },\r\n"
+ " \"facet_queries\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"facet_fields\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"facet_heatmaps\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"facet_ranges\":{\r\n"
+ " \r\n"
+ " }\r\n"
+ " },\r\n"
+ " \"_field_mappings_\":{\r\n"
+ " \r\n"
+ " },\r\n"
+ " \"lastIndexedTxTime\":1698923805438\r\n"
+ " }";
@Test
public void testMNT23152() throws JSONException
{
JSONObject json = new JSONObject(JSON);
SearchParameters parameters = new SearchParameters();
SolrJSONResultSet s = new SolrJSONResultSet(json, parameters, nodeService, nodeDao, LimitBy.UNLIMITED, 10);
List<GenericFacetResponse> pivotsFacet = s.getPivotFacets();
assertTrue("The pivots facets shouldn't be empty", pivotsFacet != null && !pivotsFacet.isEmpty());
}
}

View File

@@ -31,20 +31,15 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Map;
import java.util.UUID;
import org.alfresco.repo.security.authentication.identityservice.IdentityServiceFacadeFactoryBean.JwtDecoderProvider;
import org.alfresco.repo.security.authentication.identityservice.IdentityServiceFacadeFactoryBean.JwtIssuerValidator;
import org.junit.Test;
import org.springframework.security.oauth2.client.registration.ClientRegistration.ProviderDetails;
import org.springframework.security.oauth2.core.OAuth2Error;
import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.security.oauth2.jwt.JwtDecoder;
public class IdentityServiceFacadeFactoryBeanTest
{
private static final String EXPECTED_ISSUER = "expected-issuer";
@Test
public void shouldCreateJwtDecoderWithoutIDSWhenPublicKeyIsProvided()
{
@@ -67,53 +62,4 @@ public class IdentityServiceFacadeFactoryBeanTest
.containsEntry(USERNAME_CLAIM, "piotrek");
}
@Test
public void shouldFailWithNotMatchingIssuerURIs()
{
final JwtIssuerValidator issuerValidator = new JwtIssuerValidator(EXPECTED_ISSUER);
final OAuth2TokenValidatorResult validationResult = issuerValidator.validate(tokenWithIssuer("different-issuer"));
assertThat(validationResult).isNotNull();
assertThat(validationResult.hasErrors()).isTrue();
assertThat(validationResult.getErrors()).hasSize(1);
final OAuth2Error error = validationResult.getErrors().iterator().next();
assertThat(error).isNotNull();
assertThat(error.getDescription()).contains(EXPECTED_ISSUER, "different-issuer");
}
@Test
public void shouldFailWithNullIssuerURI()
{
final JwtIssuerValidator issuerValidator = new JwtIssuerValidator(EXPECTED_ISSUER);
final OAuth2TokenValidatorResult validationResult = issuerValidator.validate(tokenWithIssuer(null));
assertThat(validationResult).isNotNull();
assertThat(validationResult.hasErrors()).isTrue();
assertThat(validationResult.getErrors()).hasSize(1);
final OAuth2Error error = validationResult.getErrors().iterator().next();
assertThat(error).isNotNull();
assertThat(error.getDescription()).contains(EXPECTED_ISSUER, "null");
}
@Test
public void shouldSucceedWithMatchingIssuerURI()
{
final JwtIssuerValidator issuerValidator = new JwtIssuerValidator(EXPECTED_ISSUER);
final OAuth2TokenValidatorResult validationResult = issuerValidator.validate(tokenWithIssuer(EXPECTED_ISSUER));
assertThat(validationResult).isNotNull();
assertThat(validationResult.hasErrors()).isFalse();
assertThat(validationResult.getErrors()).isEmpty();
}
private Jwt tokenWithIssuer(String issuer)
{
return Jwt.withTokenValue(UUID.randomUUID().toString())
.issuer(issuer)
.header("JUST", "FOR TESTING")
.build();
}
}

View File

@@ -9,7 +9,7 @@ services:
ports:
- "8090:8090"
postgres:
image: postgres:15.4
image: postgres:14.4
profiles: ["default", "with-transform-core-aio", "postgres", "with-mtls-transform-core-aio"]
environment:
- POSTGRES_PASSWORD=alfresco
@@ -56,4 +56,4 @@ services:
CLIENT_SSL_TRUST_STORE: "file:/tengineAIO.truststore"
CLIENT_SSL_TRUST_STORE_PASSWORD: "password"
CLIENT_SSL_TRUST_STORE_TYPE: "JCEKS"
CLIENT_SSL_TRUST_STORE_TYPE: "JCEKS"