mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-24 14:32:01 +00:00
Compare commits
194 Commits
repo-5439-
...
8.399
Author | SHA1 | Date | |
---|---|---|---|
|
6360842e06 | ||
|
cee63b31f6 | ||
|
a74cdea223 | ||
|
e53b61d2bf | ||
|
cad18795fd | ||
|
14e43ed825 | ||
|
2ee3b2085a | ||
|
a7935b0d08 | ||
|
557a666fd3 | ||
|
87b7d524ea | ||
|
43daee3529 | ||
|
c9638187a1 | ||
|
659e2baef8 | ||
|
fb2035e82e | ||
|
366e4b23bf | ||
|
5f6734728e | ||
|
371791a0bb | ||
|
b2d65d6ac1 | ||
|
69dca8f852 | ||
|
4d73b11d12 | ||
|
582235dacf | ||
|
fbac196c19 | ||
|
fc2cde41ad | ||
|
685c4b0844 | ||
|
06d00e5193 | ||
|
3ad33034f1 | ||
|
e6e710751e | ||
|
fe649b3302 | ||
|
fb322089ab | ||
|
d6ad134d4c | ||
|
9688dab484 | ||
|
e3dca6ecbd | ||
|
8db3fc230e | ||
|
022519b5fd | ||
|
fafdfa6945 | ||
|
d50f62906d | ||
|
ff34ca3d01 | ||
|
592dde531f | ||
|
1776a43a30 | ||
|
5355592cb6 | ||
|
08bc7d4599 | ||
|
c54abf1b62 | ||
|
78aa6dc080 | ||
|
2171bcc192 | ||
|
f6166297d3 | ||
|
b270ec1f8d | ||
|
d2b87f31c4 | ||
|
0211392ff6 | ||
|
cc3c518940 | ||
|
465a1cec4d | ||
|
9858324d92 | ||
|
727847b17e | ||
|
2979082767 | ||
|
a84a68cb9a | ||
|
5cdade38a8 | ||
|
072faf603e | ||
|
438dfa9d12 | ||
|
72be8daf01 | ||
|
ba9ae7071a | ||
|
48ec102598 | ||
|
e8e2ded02a | ||
|
503b50738a | ||
|
8e90612619 | ||
|
134ca108e9 | ||
|
af5c5133f6 | ||
|
a903d9ec44 | ||
|
2b1f63e07f | ||
|
1c1b956ad1 | ||
|
14ca5bb726 | ||
|
3d0099d742 | ||
|
fd491d83fe | ||
|
6ef30c46e9 | ||
|
2b9ecf1ece | ||
|
930b312cd1 | ||
|
64122bf31b | ||
|
10efd50add | ||
|
3879e28590 | ||
|
471492c8e0 | ||
|
ae26d9c1c4 | ||
|
c2733b9da7 | ||
|
65a93c31f5 | ||
|
58e7c41bbb | ||
|
8cfc05758d | ||
|
b1ea30fc74 | ||
|
f6021faef8 | ||
|
da3220864e | ||
|
631e2f100a | ||
|
15a68ee177 | ||
|
f9af668d8d | ||
|
358bd704df | ||
|
0543a800f7 | ||
|
b4b591b8af | ||
|
d3860738da | ||
|
d5bff09158 | ||
|
16eebe4681 | ||
|
7d99fb235b | ||
|
83a1c7bd59 | ||
|
5df53eb3bf | ||
|
bd65a45128 | ||
|
ba060da9df | ||
|
44da1cb33c | ||
|
97428142b7 | ||
|
7f36c47977 | ||
|
ba301ba19a | ||
|
2ffbb2ca23 | ||
|
b3454b762c | ||
|
1b09fea6fc | ||
|
45e31ebe82 | ||
|
401833665e | ||
|
23b5dc3aef | ||
|
c4eb95471d | ||
|
a9e54bd08c | ||
|
f9aaddd787 | ||
|
81ab6e1583 | ||
|
c7d219ee23 | ||
|
ad1079aaef | ||
|
5177e607ee | ||
|
10f0104d0d | ||
|
8ea6d79b5d | ||
|
24fcf258d3 | ||
|
de6022db01 | ||
|
3195c93a9e | ||
|
8c5ec402a5 | ||
|
e772d3b898 | ||
|
8fcaa7febb | ||
|
e9f1b9f21b | ||
|
67b7552686 | ||
|
facbef9ca9 | ||
|
a6fce739b6 | ||
|
89fddfc614 | ||
|
6a2e3b64d0 | ||
|
7479379af8 | ||
|
66db333cdd | ||
|
b41ff7ae4d | ||
|
ecba5737bc | ||
|
7a335fd0ff | ||
|
112ddd4fd7 | ||
|
6ddc4c37bc | ||
|
bc36a2f261 | ||
|
7fae74b9ff | ||
|
adf67f1939 | ||
|
310496de04 | ||
|
fad7f82a2e | ||
|
54689899f9 | ||
|
4f8ca02f7f | ||
|
8af971e704 | ||
|
54457a43ef | ||
|
fae8c0a3cd | ||
|
c537c4523e | ||
|
e1f6012dd7 | ||
|
e80256e92e | ||
|
df333e32ee | ||
|
04d699cf86 | ||
|
be8e77941d | ||
|
af51b65014 | ||
|
b4f9c8a672 | ||
|
cb3912ba36 | ||
|
a8f911e2a1 | ||
|
06e877f7e5 | ||
|
da66a843da | ||
|
4d838c6286 | ||
|
5d2c83c14b | ||
|
affccc1b4d | ||
|
8a13fda5d9 | ||
|
792a86f1ee | ||
|
9d52aa3c64 | ||
|
5e5082d9b3 | ||
|
cb973c4d87 | ||
|
653694b030 | ||
|
f786f4ffaf | ||
|
a79f782a91 | ||
|
3eab59c273 | ||
|
b9adb42c30 | ||
|
9c1bfca7ad | ||
|
a4bf93d33f | ||
|
a74db1443e | ||
|
1600704bee | ||
|
c7d5736f37 | ||
|
3891306459 | ||
|
bf73af71a3 | ||
|
57c04411ed | ||
|
7962cf0b03 | ||
|
eeb49f4b36 | ||
|
31d65ceb42 | ||
|
1b2c5d4c37 | ||
|
c0d1098db0 | ||
|
27af7d2f49 | ||
|
11cf9fa16c | ||
|
5f19aa76af | ||
|
2cffc61164 | ||
|
53c58d4b46 | ||
|
96c6ca844a | ||
|
b3e48b0072 | ||
|
e59c0d7186 |
144
.travis.yml
144
.travis.yml
@@ -33,7 +33,7 @@ stages:
|
||||
- name: test
|
||||
if: commit_message !~ /\[skip tests\]/
|
||||
- name: release
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/ OR branch =~ /fix\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/
|
||||
- name: update_downstream
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/
|
||||
- name: trigger_downstream
|
||||
@@ -44,15 +44,6 @@ install: travis_retry travis_wait 40 bash scripts/travis/build.sh
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "WhiteSource scan"
|
||||
stage: test
|
||||
# only on release branches or master and if it is not a PR
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request
|
||||
script:
|
||||
# Download the latest version of WhiteSource Unified Agent
|
||||
- curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar
|
||||
# Run WhiteSource Unified Agent
|
||||
- java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config -d ./packaging/war
|
||||
|
||||
# - name: "Source Clear Scan"
|
||||
# # only on release branches or master and if it is not a PR
|
||||
@@ -69,34 +60,34 @@ jobs:
|
||||
- name: "Repository - AppContext01TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext02TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext03TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext04TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext05TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- mkdir -p "${HOME}/tmp"
|
||||
- cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp"
|
||||
- export HOST_IP=$(hostname -I | cut -f1 -d' ')
|
||||
@@ -106,88 +97,125 @@ jobs:
|
||||
- name: "Repository - AppContext06TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContextExtraTestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MiscContextTestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - SearchTestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=SearchTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6
|
||||
|
||||
- name: "Repository - MySQL tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 10 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 11 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MariaDB tests"
|
||||
- name: "Repository - MariaDB 10.2.18 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MariaDB 10.4 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.4 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MariaDB 10.5 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.5 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MySQL 5.7.23 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
# One failing test to do with the schema reference files. ACS-1180
|
||||
# - name: "Repository - MySQL 8 tests"
|
||||
# if: commit_message !~ /\[skip db\]/
|
||||
# before_script:
|
||||
# - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:8 --transaction-isolation='READ-COMMITTED'
|
||||
# - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
# script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 10.9 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 11.7 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 12.4 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:12.4 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 13.1 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext01TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext02TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext03TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext04TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.8
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContextExtraTestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "REST API TAS tests part1"
|
||||
|
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"generalSettings": {
|
||||
"shouldScanRepo": true
|
||||
},
|
||||
"checkRunSettings": {
|
||||
"vulnerableCheckRunConclusionLevel": "failure"
|
||||
}
|
||||
}
|
@@ -1,228 +0,0 @@
|
||||
####################################################################
|
||||
# WhiteSource Unified-Agent configuration file
|
||||
####################################################################
|
||||
##########################################
|
||||
# GENERAL SCAN MODE: Files and Package Managers
|
||||
##########################################
|
||||
|
||||
checkPolicies=true
|
||||
forceCheckAllDependencies=true
|
||||
forceUpdate=true
|
||||
forceUpdate.failBuildOnPolicyViolation=true
|
||||
offline=false
|
||||
#ignoreSourceFiles=true
|
||||
#scanComment=
|
||||
#updateInventory=false
|
||||
#resolveAllDependencies=false
|
||||
#failErrorLevel=ALL
|
||||
#requireKnownSha1=false
|
||||
#generateScanReport=true
|
||||
#scanReportTimeoutMinutes=10
|
||||
#excludeDependenciesFromNodes=.*commons-io.*,.*maven-model
|
||||
|
||||
#projectPerFolder=true
|
||||
#projectPerFolderIncludes=
|
||||
#projectPerFolderExcludes=
|
||||
|
||||
#wss.connectionTimeoutMinutes=60
|
||||
# Change the below URL to your WhiteSource server.
|
||||
# Use the 'WhiteSource Server URL' which can be retrieved
|
||||
# from your 'Profile' page on the 'Server URLs' panel.
|
||||
# Then, add the '/agent' path to it.
|
||||
wss.url=https://saas.whitesourcesoftware.com/agent
|
||||
|
||||
#npm.resolveDependencies=false
|
||||
#npm.ignoreSourceFiles=false
|
||||
#npm.includeDevDependencies=true
|
||||
#npm.runPreStep=true
|
||||
#npm.ignoreNpmLsErrors=true
|
||||
#npm.ignoreScripts=true
|
||||
#npm.yarnProject=true
|
||||
#npm.accessToken=
|
||||
#npm.identifyByNameAndVersion=true
|
||||
|
||||
#bower.resolveDependencies=false
|
||||
#bower.ignoreSourceFiles=true
|
||||
#bower.runPreStep=true
|
||||
|
||||
#nuget.resolvePackagesConfigFiles=false
|
||||
#nuget.resolveCsProjFiles=false
|
||||
#nuget.resolveDependencies=false
|
||||
#nuget.restoreDependencies=true
|
||||
#nuget.ignoreSourceFiles=true
|
||||
#nuget.runPreStep=true
|
||||
#nuget.resolveNuspecFiles=false
|
||||
|
||||
#python.resolveDependencies=false
|
||||
#python.ignoreSourceFiles=false
|
||||
#python.ignorePipInstallErrors=true
|
||||
#python.installVirtualenv=true
|
||||
#python.resolveHierarchyTree=false
|
||||
#python.requirementsFileIncludes=requirements.txt
|
||||
#python.resolveSetupPyFiles=true
|
||||
#python.runPipenvPreStep=true
|
||||
#python.pipenvDevDependencies=true
|
||||
#python.IgnorePipenvInstallErrors=true
|
||||
|
||||
#maven.ignoredScopes=test provided
|
||||
maven.resolveDependencies=true
|
||||
#maven.ignoreSourceFiles=true
|
||||
#maven.aggregateModules=true
|
||||
maven.ignorePomModules=false
|
||||
#maven.runPreStep=true
|
||||
#maven.ignoreMvnTreeErrors=true
|
||||
#maven.environmentPath=
|
||||
#maven.m2RepositoryPath=
|
||||
|
||||
#gradle.ignoredScopes=
|
||||
#gradle.resolveDependencies=false
|
||||
#gradle.runAssembleCommand=false
|
||||
#gradle.runPreStep=true
|
||||
#gradle.ignoreSourceFiles=true
|
||||
#gradle.aggregateModules=true
|
||||
#gradle.preferredEnvironment=wrapper
|
||||
#gradle.localRepositoryPath=
|
||||
|
||||
#paket.resolveDependencies=false
|
||||
#paket.ignoredGroups=
|
||||
#paket.ignoreSourceFiles=false
|
||||
#paket.runPreStep=true
|
||||
#paket.exePath=
|
||||
|
||||
#go.resolveDependencies=false
|
||||
#go.collectDependenciesAtRuntime=true
|
||||
#go.dependencyManager=
|
||||
#go.ignoreSourceFiles=true
|
||||
#go.glide.ignoreTestPackages=false
|
||||
#go.gogradle.enableTaskAlias=true
|
||||
|
||||
#ruby.resolveDependencies = false
|
||||
#ruby.ignoreSourceFiles = false
|
||||
#ruby.installMissingGems = true
|
||||
#ruby.runBundleInstall = true
|
||||
#ruby.overwriteGemFile = true
|
||||
|
||||
#sbt.resolveDependencies=false
|
||||
#sbt.ignoreSourceFiles=true
|
||||
#sbt.aggregateModules=true
|
||||
#sbt.runPreStep=true
|
||||
#sbt.targetFolder=
|
||||
|
||||
#php.resolveDependencies=false
|
||||
#php.runPreStep=true
|
||||
#php.includeDevDependencies=true
|
||||
|
||||
#html.resolveDependencies=false
|
||||
|
||||
#cocoapods.resolveDependencies=false
|
||||
#cocoapods.runPreStep=true
|
||||
#cocoapods.ignoreSourceFiles=false
|
||||
|
||||
#hex.resolveDependencies=false
|
||||
#hex.runPreStep=true
|
||||
#hex.ignoreSourceFiles=false
|
||||
#hex.aggregateModules=true
|
||||
|
||||
##################################
|
||||
# Organization tokens:
|
||||
##################################
|
||||
apiKey=
|
||||
|
||||
#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option
|
||||
#userKey=
|
||||
|
||||
projectName=alfresco-community-repo
|
||||
projectVersion=
|
||||
projectToken=
|
||||
|
||||
productName=ACS Community
|
||||
productVersion=
|
||||
productToken=
|
||||
#updateType=APPEND
|
||||
#requesterEmail=user@provider.com
|
||||
|
||||
#########################################################################################
|
||||
# Includes/Excludes Glob patterns - PLEASE USE ONLY ONE EXCLUDE LINE AND ONE INCLUDE LINE
|
||||
#########################################################################################
|
||||
#includes=**/*.c **/*.cc **/*.cp **/*.cpp **/*.cxx **/*.c++ **/*.h **/*.hpp **/*.hxx
|
||||
|
||||
#includes=**/*.m **/*.mm **/*.js **/*.php
|
||||
includes=**/*.jar
|
||||
#includes=**/*.gem **/*.rb
|
||||
#includes=**/*.dll **/*.cs **/*.nupkg
|
||||
#includes=**/*.tgz **/*.deb **/*.gzip **/*.rpm **/*.tar.bz2
|
||||
#includes=**/*.zip **/*.tar.gz **/*.egg **/*.whl **/*.py
|
||||
|
||||
## Exclude file extensions or specific directories by adding **/*.<extension> or **<excluded_dir>/**
|
||||
excludes=**/*sources.jar **/*javadoc.jar
|
||||
|
||||
case.sensitive.glob=false
|
||||
followSymbolicLinks=true
|
||||
|
||||
##################################
|
||||
# Archive properties
|
||||
##################################
|
||||
#archiveExtractionDepth=2
|
||||
#archiveIncludes=**/*.war **/*.ear
|
||||
#archiveExcludes=**/*sources.jar
|
||||
|
||||
##################################
|
||||
# Proxy settings
|
||||
##################################
|
||||
#proxy.host=
|
||||
#proxy.port=
|
||||
#proxy.user=
|
||||
#proxy.pass=
|
||||
|
||||
##################################
|
||||
# SCM settings
|
||||
##################################
|
||||
#scm.type=
|
||||
#scm.user=
|
||||
#scm.pass=
|
||||
#scm.ppk=
|
||||
#scm.url=
|
||||
#scm.branch=
|
||||
#scm.tag=
|
||||
#scm.npmInstall=
|
||||
#scm.npmInstallTimeoutMinutes=
|
||||
#scm.repositoriesFile=
|
||||
|
||||
##############################################
|
||||
# SCAN MODE: Linux package manager settings
|
||||
##############################################
|
||||
#scanPackageManager=true
|
||||
|
||||
##################################
|
||||
# SCAN MODE: Docker images
|
||||
##################################
|
||||
#docker.scanImages=true
|
||||
#docker.includes=.*.*
|
||||
#docker.excludes=
|
||||
#docker.pull.enable=true
|
||||
#docker.pull.images=.*.*
|
||||
#docker.pull.maxImages=10
|
||||
#docker.pull.tags=.*.*
|
||||
#docker.pull.digest=
|
||||
#docker.delete.force=true
|
||||
#docker.login.sudo=false
|
||||
|
||||
#docker.aws.enable=true
|
||||
#docker.aws.registryIds=
|
||||
|
||||
##################################
|
||||
# SCAN MODE: Docker containers
|
||||
##################################
|
||||
#docker.scanContainers=true
|
||||
#docker.containerIncludes=.*.*
|
||||
#docker.containerExcludes=
|
||||
|
||||
################################
|
||||
# Serverless settings
|
||||
################################
|
||||
#serverless.provider=
|
||||
#serverless.scanFunctions=true
|
||||
#serverless.includes=
|
||||
#serverless.excludes=
|
||||
#serverless.region=
|
||||
#serverless.maxFunctions=10
|
14
README.md
14
README.md
@@ -34,7 +34,7 @@ Repository is a library packaged as a jar file which contains the following:
|
||||
Tests are combined into test classes split by test type or Spring application context used in the test, see classes
|
||||
in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test
|
||||
class name and a set of DB connection properties. Check the travis.yml file for docker images that should be started
|
||||
to provide a sutable test environment. For example:
|
||||
to provide a suitable test environment. For example:
|
||||
~~~
|
||||
mvn clean test -Dtest=SomeRepoTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
~~~
|
||||
@@ -114,7 +114,7 @@ want to make changes to both of them if you are changing the repository code.
|
||||
|
||||
~~~
|
||||
mkdir work
|
||||
cd works
|
||||
cd work
|
||||
git clone git@github.com:Alfresco/alfresco-community-repo.git
|
||||
git clone git@github.com:Alfresco/acs-community-packaging.git
|
||||
~~~
|
||||
@@ -131,16 +131,6 @@ cd ..
|
||||
In Intellij IDEA, create a new project using the `work` directory as the source.
|
||||
* File > New Project from Existing Sources > .../work > Maven
|
||||
|
||||
## Docker
|
||||
We generally use Docker for testing. In order to reduce the size of images we also supply a squash option that collapses
|
||||
the layers in the image. This is a long-standing experimental feature that we have fould useful. However you will need
|
||||
to enable experimental features in your Docker Engine.
|
||||
~~~
|
||||
{
|
||||
"experimental": true,
|
||||
"debug": true
|
||||
}
|
||||
~~~
|
||||
## Branches
|
||||
As multiple projects have been combined, branch names use the ACS version they are targeting.
|
||||
For example the code used to create the repository in ACS 6.2.1 is a branch called `releases/6.2.1`.
|
||||
|
30
core/pom.xml
30
core/pom.xml
@@ -7,10 +7,25 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-jta_1.1_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
@@ -79,24 +94,11 @@
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-surf-core-configservice</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.guessencoding</groupId>
|
||||
<artifactId>guessencoding</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
|
@@ -113,7 +113,7 @@ public abstract class AbstractCannedQuery<R> implements CannedQuery<R>
|
||||
final List<List<R>> finalPages = pages;
|
||||
|
||||
// Has more items beyond requested pages ? ... ie. at least one more page (with at least one result)
|
||||
final boolean hasMoreItems = (rawResults.size() > pagingDetails.getResultsRequiredForPaging());
|
||||
final boolean hasMoreItems = (rawResults.size() > pagingDetails.getResultsRequiredForPaging()) || (totalCount.getFirst() > pagingDetails.getResultsRequiredForPaging());
|
||||
|
||||
results = new CannedQueryResults<R>()
|
||||
{
|
||||
|
@@ -424,12 +424,7 @@ public abstract class AbstractAsynchronouslyRefreshedCache<T>
|
||||
@Override
|
||||
public Void call()
|
||||
{
|
||||
long threadId = Thread.currentThread().getId();
|
||||
logger.debug("Thread # " + threadId + "-> call()");
|
||||
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().lock()");
|
||||
liveLock.writeLock().lock();
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().locked [");
|
||||
liveLock.writeLock().lock();
|
||||
try
|
||||
{
|
||||
doCall();
|
||||
@@ -452,9 +447,7 @@ public abstract class AbstractAsynchronouslyRefreshedCache<T>
|
||||
}
|
||||
finally
|
||||
{
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().unlock()");
|
||||
liveLock.writeLock().unlock();
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().unlocked]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,10 @@
|
||||
*/
|
||||
package org.alfresco.util.transaction;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.transaction.HeuristicMixedException;
|
||||
import javax.transaction.HeuristicRollbackException;
|
||||
@@ -135,7 +138,9 @@ public class SpringAwareUserTransaction
|
||||
private long threadId = Long.MIN_VALUE;
|
||||
/** make sure that we clean up the thread transaction stack properly */
|
||||
private boolean finalized = false;
|
||||
|
||||
|
||||
private Collection<String> labels = emptyList();
|
||||
|
||||
/**
|
||||
* Creates a user transaction that defaults to {@link TransactionDefinition#PROPAGATION_REQUIRED}.
|
||||
*
|
||||
@@ -200,6 +205,21 @@ public class SpringAwareUserTransaction
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate one or more labels with this transaction attribute.
|
||||
* <p>This may be used for applying specific transactional behavior
|
||||
* or follow a purely descriptive nature.
|
||||
*/
|
||||
public void setLabels(Collection<String> labels) {
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getLabels()
|
||||
{
|
||||
return this.labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link UserTransaction } must rollback regardless of the error. The
|
||||
* {@link #rollback() rollback} behaviour is implemented by simulating a caught
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -127,9 +127,28 @@
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
| compile dependencies
|
||||
-->
|
||||
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces com.sun.activation:javax.activation -->
|
||||
<dependency>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>jakarta.activation</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces javax.annotation:javax.annotation-api -->
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jibx</groupId>
|
||||
<artifactId>jibx-run</artifactId>
|
||||
@@ -148,31 +167,9 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>5.0.3</version>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-jta_1.1_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces javax.annotation:javax.annotation-api -->
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces com.sun.activation:javax.activation -->
|
||||
<dependency>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>jakarta.activation</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>6.2.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- the cxf libs were updated, see dependencyManagement section -->
|
||||
<dependency>
|
||||
<groupId>org.apache.chemistry.opencmis</groupId>
|
||||
@@ -266,15 +263,6 @@
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicate classes from com.sun.xml.bind:jaxb-core-->
|
||||
<exclusion>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>txw2</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.istack</groupId>
|
||||
<artifactId>istack-commons-runtime</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.jws:jakarta.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
|
@@ -662,7 +662,6 @@ public class MimetypeMap implements MimetypeService
|
||||
boolean successReadingConfig = true;
|
||||
if (jsonConfigFileFinder != null)
|
||||
{
|
||||
// This should not be "alfresco/mimetype" which is used for the in JVM jodconverter
|
||||
successReadingConfig &= jsonConfigFileFinder.readFiles("alfresco/mimetypes", logger);
|
||||
if (mimetypeJsonConfigDir != null && !mimetypeJsonConfigDir.isBlank())
|
||||
{
|
||||
@@ -877,11 +876,6 @@ public class MimetypeMap implements MimetypeService
|
||||
*/
|
||||
private MediaType detectType(String filename, ContentReader reader)
|
||||
{
|
||||
// Metadata metadata = new Metadata();
|
||||
// if (filename != null)
|
||||
// {
|
||||
// metadata.add(Metadata.RESOURCE_NAME_KEY, filename);
|
||||
// }
|
||||
TikaInputStream inp = null;
|
||||
try
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 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
|
||||
@@ -33,8 +33,7 @@ import org.alfresco.api.AlfrescoPublicApi;
|
||||
* same action might succeed, all other things not having changed.
|
||||
* <p/>
|
||||
* An example of this would be the case where a request to create a thumbnail
|
||||
* has failed because the necessary thumbnailing software is not available e.g. because the OpenOffice.org process
|
||||
* is not currently running.
|
||||
* has failed because the necessary thumbnailing software is not available.
|
||||
*
|
||||
* @author Neil Mc Erlean
|
||||
* @since 4.0.1
|
||||
|
@@ -100,26 +100,25 @@ public abstract class BaseApplicationContextHelper
|
||||
classpath[i] = resources[i].getURL();
|
||||
}
|
||||
// Let's give our classloader 'child-first' resource loading qualities!
|
||||
ClassLoader classLoader = new URLClassLoader(classpath, Thread.currentThread().getContextClassLoader())
|
||||
{
|
||||
@Override
|
||||
public URL getResource(String name)
|
||||
{
|
||||
URL ret = findResource(name);
|
||||
return ret == null ? super.getResource(name) : ret;
|
||||
}
|
||||
return new URLClassLoader(classpath, Thread.currentThread().getContextClassLoader())
|
||||
{
|
||||
@Override
|
||||
public URL getResource(String name)
|
||||
{
|
||||
URL ret = findResource(name);
|
||||
return ret == null ? super.getResource(name) : ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enumeration<URL> getResources(String name) throws IOException
|
||||
{
|
||||
Enumeration[] tmp = new Enumeration[2];
|
||||
tmp[0] = findResources(name);
|
||||
tmp[1] = super.getResources(name);
|
||||
return new CompoundEnumeration<URL>(tmp);
|
||||
}
|
||||
};
|
||||
return classLoader;
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enumeration<URL> getResources(String name) throws IOException
|
||||
{
|
||||
Enumeration[] tmp = new Enumeration[2];
|
||||
tmp[0] = findResources(name);
|
||||
tmp[1] = super.getResources(name);
|
||||
return new CompoundEnumeration<URL>(tmp);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 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
|
||||
@@ -57,7 +57,10 @@ public abstract class ConfigScheduler<Data>
|
||||
public static class ConfigSchedulerJob implements Job
|
||||
{
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException
|
||||
// Synchronized has little effect in normal operation, but on laptops that are suspended, there can be a number
|
||||
// of Threads calling execute concurrently without it, resulting in errors in the log. Theoretically possible in
|
||||
// production but not very likely.
|
||||
public synchronized void execute(JobExecutionContext context) throws JobExecutionException
|
||||
{
|
||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||
ConfigScheduler configScheduler = (ConfigScheduler)dataMap.get(CONFIG_SCHEDULER);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -1,110 +0,0 @@
|
||||
The authoritative ImageMagick license can be found at
|
||||
http://www.imagemagick.org/script/license.php and ImageMagick notices at
|
||||
http://www.imagemagick.org/www/Notice.html.
|
||||
|
||||
Before we get to the text of the license, lets just review what the license says in simple terms:
|
||||
|
||||
It allows you to:
|
||||
|
||||
* freely download and use ImageMagick software, in whole or in part, for personal, company internal, or commercial purposes;
|
||||
* use ImageMagick software in packages or distributions that you create;
|
||||
* link against a library under a different license;
|
||||
* link code under a different license against a library under this license;
|
||||
* merge code into a work under a different license;
|
||||
* extend patent grants to any code using code under this license;
|
||||
*and extend patent protection.
|
||||
|
||||
It forbids you to:
|
||||
|
||||
* redistribute any piece of ImageMagick-originated software without proper attribution;
|
||||
* use any marks owned by ImageMagick Studio LLC in any way that might state or imply that ImageMagick Studio LLC endorses your distribution;
|
||||
* use any marks owned by ImageMagick Studio LLC in any way that might state or imply that you created the ImageMagick software in question.
|
||||
|
||||
It requires you to:
|
||||
|
||||
* include a copy of the license in any redistribution you may make that includes ImageMagick software;
|
||||
* provide clear attribution to ImageMagick Studio LLC for any distributions that include ImageMagick software.
|
||||
|
||||
It does not require you to:
|
||||
|
||||
* include the source of the ImageMagick software itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it;
|
||||
* submit changes that you make to the software back to the ImageMagick Studio LLC (though such feedback is encouraged).
|
||||
|
||||
A few other clarifications include:
|
||||
* ImageMagick is freely available without charge;
|
||||
* you may include ImageMagick on any digital media as long as you comply with the terms of the license;
|
||||
* you can give modified code away for free or sell it under the terms of the ImageMagick license or distribute the result under a different license, but you need to acknowledge the use of the ImageMagick software;
|
||||
* the license is compatible with the GPL V3.
|
||||
* when exporting the ImageMagick software, review its export classification.
|
||||
|
||||
Terms and Conditions for Use, Reproduction, and Distribution
|
||||
|
||||
The legally binding and authoritative terms and conditions for use, reproduction, and distribution of ImageMagick follow:
|
||||
|
||||
Copyright © 1999-2018 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available.
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
a. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
b. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
c. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
d. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
How to Apply the License to your Work
|
||||
|
||||
To apply the ImageMagick License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information (don't include the brackets). The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the ImageMagick License (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy
|
||||
of the License at
|
||||
|
||||
https://www.imagemagick.org/script/license.php
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
File diff suppressed because it is too large
Load Diff
@@ -45,7 +45,6 @@ commons-pool http://jakarta.apache.org/commons/
|
||||
commons-validator http://jakarta.apache.org/commons/
|
||||
ConcurrentLinkedHashMap http://code.google.com/p/concurrentlinkedhashmap/
|
||||
Fast Infoset Project http://fi.java.net/
|
||||
PDFBox http://pdfbox.apache.org/
|
||||
Google Data Java Client Library http://code.google.com/p/gdata-java-client/
|
||||
Geronimo Activation http://geronimo.apache.org/
|
||||
Geronimo Annotation http://geronimo.apache.org/
|
||||
@@ -191,10 +190,6 @@ truezip http://truezip.java.net/
|
||||
icu4j http://icu-project.org/
|
||||
|
||||
|
||||
=== Imagemagick ===
|
||||
Imagemagick http://www.imagemagick.org/script/license.php
|
||||
|
||||
|
||||
=== JSON license ===
|
||||
JSon http://www.json.org/java/
|
||||
|
||||
@@ -211,16 +206,11 @@ libwmf http://wvware.sourceforge.net/libwmf.html
|
||||
=== LGPL 2.1 ===
|
||||
Hibernate http://www.hibernate.org/
|
||||
jid3lib http://javamusictag.sourceforge.net/
|
||||
JMagick http://sourceforge.net/projects/jmagick/
|
||||
JODConverter http://jodconverter.sourceforge.net/
|
||||
PDF Renderer http://java.net/projects/pdf-renderer
|
||||
TinyMCE http://www.tinymce.com/
|
||||
|
||||
|
||||
=== LGPL 3.0 ===
|
||||
Gytheio https://github.com/Alfresco/gytheio
|
||||
Jut.jar http://www.openoffice.org/licenses/lgpl_license.html
|
||||
OpenOffice SDK http://www.openoffice.org/licenses/lgpl_license.html
|
||||
|
||||
|
||||
=== MIT License ===
|
||||
@@ -243,7 +233,6 @@ juniversalchardet http://code.google.com/p/juniversalchardet/
|
||||
=== Mozilla Public License 2.0 ===
|
||||
CCC2 http://www.webdetails.pt/ctools/ccc/
|
||||
rhino-js http://www.mozilla.org/rhino/
|
||||
LibreOffice http://www.libreoffice.org/
|
||||
|
||||
|
||||
=== Oracle Binary Code License ===
|
||||
@@ -279,7 +268,6 @@ The svn diff files with the details of the changes can be found in the following
|
||||
=== Apache 2.0 License ====
|
||||
acegi http://sourceforge.net/projects/acegisecurity/
|
||||
commons-dbcp http://jakarta.apache.org/commons/
|
||||
PDFBox http://pdfbox.apache.org/
|
||||
Greenmail http://www.icegreen.com/greenmail/
|
||||
POI http://poi.apache.org/
|
||||
quartz http://quartz-scheduler.org/
|
||||
@@ -297,12 +285,9 @@ TrueLicense http://truelicense.java.net/
|
||||
|
||||
=== LGPL 2.1 ===
|
||||
Hibernate http://www.hibernate.org/
|
||||
JODConverter http://jodconverter.sourceforge.net/
|
||||
PDF Renderer http://java.net/projects/pdf-renderer
|
||||
TinyMCE http://www.tinymce.com/
|
||||
|
||||
=== LGPL 3.0 ===
|
||||
Jut.jar http://www.openoffice.org/licenses/lgpl_license.html
|
||||
|
||||
=== Mozilla Public License 2.0 ===
|
||||
rhino-js http://www.mozilla.org/rhino/
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Fetch image based on Tomcat 8.5 and Java 11
|
||||
# Fetch image based on Tomcat 9.0, Java 11 and Centos 8
|
||||
# More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat
|
||||
FROM alfresco/alfresco-base-tomcat:8.5.51-java-11-openjdk-centos-7
|
||||
FROM alfresco/alfresco-base-tomcat:9.0.41-java-11-openjdk-centos-8
|
||||
|
||||
# Set default docker_context.
|
||||
ARG resource_path=target
|
||||
@@ -65,12 +65,12 @@ RUN sed -i -e "s_log4j.appender.File.File\=alfresco.log_log4j.appender.File.File
|
||||
|
||||
# fontconfig is required by Activiti worflow diagram generator
|
||||
# installing pinned dependencies as well
|
||||
RUN yum install -y fontconfig-2.13.0-4.3.el7 \
|
||||
dejavu-fonts-common-2.33-6.el7 \
|
||||
fontpackages-filesystem-1.44-8.el7 \
|
||||
freetype-2.8-12.el7 \
|
||||
libpng-1.5.13-7.el7_2 \
|
||||
dejavu-sans-fonts-2.33-6.el7 && \
|
||||
RUN yum install -y fontconfig-2.13.1-3.el8 \
|
||||
dejavu-fonts-common-2.35-6.el8 \
|
||||
fontpackages-filesystem-1.44-22.el8 \
|
||||
freetype-2.9.1-4.el8_3.1 \
|
||||
libpng-1.6.34-5.el8 \
|
||||
dejavu-sans-fonts-2.35-6.el8 && \
|
||||
yum clean all
|
||||
|
||||
# The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -134,17 +134,11 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
@@ -169,29 +163,17 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<images>
|
||||
<!-- Quay image -->
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<registry>${image.registry}</registry>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
<!-- DockerHub image -->
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<profiles>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.3.6
|
||||
TRANSFORMERS_TAG=2.3.8
|
||||
SOLR6_TAG=2.0.1
|
||||
POSTGRES_TAG=11.7
|
||||
ACTIVEMQ_TAG=5.15.8
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -40,11 +40,6 @@ services:
|
||||
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
|
||||
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
|
||||
-Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/
|
||||
-Djodconverter.url=http://transform-core-aio:8090/
|
||||
-Dimg.url=http://transform-core-aio:8090/
|
||||
-Dtika.url=http://transform-core-aio:8090/
|
||||
-Dtransform.misc.url=http://transform-core-aio:8090/
|
||||
-Dimap.server.port=1143
|
||||
-Dftp.port=1221
|
||||
-Dcors.enabled=true
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -39,16 +39,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>javax.mail-api</artifactId>
|
||||
<version>${dependency.javax.mail.version}</version>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>${dependency.javax.mail.version}</version>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -95,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -59,7 +59,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.json</artifactId>
|
||||
<artifactId>jakarta.json</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -0,0 +1,280 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteGroupModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class AddSiteGroupTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel publicSiteModel, moderatedSiteModel;
|
||||
private ListUserWithRoles publicSiteUsersWithRoles;
|
||||
private String addMemberJson, addMembersJson;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
publicSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite();
|
||||
publicSiteUsersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel,
|
||||
UserRole.SiteManager,
|
||||
UserRole.SiteCollaborator,
|
||||
UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
addMemberJson = "{\"role\":\"%s\",\"id\":\"%s\"}";
|
||||
addMembersJson = "{\"role\":\"%s\",\"id\":\"%s\"}, {\"role\":\"%s\",\"id\":\"%s\"}";
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that user can not be added to an inexistent site and gets status code 404")
|
||||
public void notAbleToAddGroupToAnInExistentSite() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
SiteModel inexistentSite = new SiteModel("inexistentSite");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(inexistentSite).addSiteGroup(getId(group), UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that inexistent group can not be added to site and gets status code 404")
|
||||
public void notAbleToAddInExistentGroupToSite() throws Exception
|
||||
{
|
||||
GroupModel group = new GroupModel("inExistentGroup");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(group.getGroupIdentifier(), UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY)
|
||||
.containsSummary(String.format("An authority was not found for %s", group.getGroupIdentifier()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that user can not add group that is already present and gets status code 409")
|
||||
public void notAbleToAddGroupThatIsAlreadyAPresent() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addSiteGroup(getId(group), UserRole.SiteManager);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addSiteGroup(getId(group), UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT).assertLastError().containsSummary(String.format(RestErrorModel.ALREADY_Site_MEMBER, getId(group), moderatedSiteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that several groups with different roles can be added once in a row to a site and gets status code 201")
|
||||
public void addSeveralGroupsWithDifferentRolesToASite() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
GroupModel secondGroup = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String json = String.format(addMembersJson, UserRole.SiteContributor, getId(firstGroup), UserRole.SiteCollaborator, getId(secondGroup));
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that several groups with same roles can be added once in a row to a site and gets status code 201")
|
||||
public void addSeveralGroupsWithSameRolesToASite() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
GroupModel secondGroup = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String json = String.format(addMembersJson, UserRole.SiteCollaborator, getId(firstGroup), UserRole.SiteCollaborator, getId(secondGroup));
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that several users that are already added to the site can not be added once in a row and gets status code 400")
|
||||
public void addSeveralGroupsThatAreAlreadyAddedToASite() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
GroupModel secondGroup = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String json = String.format(addMembersJson, UserRole.SiteCollaborator, getId(firstGroup), UserRole.SiteCollaborator, getId(secondGroup));
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT).assertLastError().containsSummary(String.format(RestErrorModel.ALREADY_Site_MEMBER, getId(firstGroup), publicSiteModel.getId())) ;
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add new site group membership request by providing an empty body")
|
||||
public void addSiteGroupsUsingEmptyBody() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "", "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT, "No content to map due to end-of-input"))
|
||||
.containsErrorKey(String.format(RestErrorModel.NO_CONTENT, "No content to map due to end-of-input"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check lower and upper case letters for role field")
|
||||
public void checkLowerUpperCaseLettersForRole() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
String json = String.format(addMemberJson, "SITEMANAGER", getId(group));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format("An authority was not found for GROUP_site_%s_%s", publicSiteModel.getId(), "SITEMANAGER"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
json = String.format(addMemberJson, "sitemanager", getId(group));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format("An authority was not found for GROUP_site_%s_%s", publicSiteModel.getId(), "sitemanager"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check empty value for user role")
|
||||
public void checkEmptyValueForRole() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
String json = String.format(addMemberJson, "", getId(group));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsErrorKey(String.format(RestErrorModel.NO_CONTENT, "N/A"))
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT, "N/A"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that manager is able to add site group membership and gets status code CREATED (201)")
|
||||
public void managerIsAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteCollaborator)
|
||||
.assertThat()
|
||||
.field("id").is(getId(group))
|
||||
.and()
|
||||
.field("role").is(UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site collaborator is not able to add site group membership and gets status code FORBIDDEN (403)")
|
||||
public void collaboratorIsNotAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteCollaborator);
|
||||
|
||||
restClient.assertLastError().containsSummary("The current user does not have permissions to modify the membership details of the site");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION})
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site contributor is not able to add site group membership and gets status code FORBIDDEN (403)")
|
||||
public void contributorIsNotAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteContributor);
|
||||
|
||||
restClient.assertLastError().containsSummary("The current user does not have permissions to modify the membership details of the site");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site consumer is not able to add site group membership and gets status code FORBIDDEN (403)")
|
||||
public void consumerIsNotAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteConsumer);;
|
||||
|
||||
restClient.assertLastError().containsSummary("The current user does not have permissions to modify the membership details of the site");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that admin user is able to add site group membership and gets status code CREATED (201)")
|
||||
public void adminIsAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteConsumer)
|
||||
.assertThat()
|
||||
.field("id").is(getId(group))
|
||||
.and()
|
||||
.field("role").is(UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that unauthenticated user is not able to add site group membership")
|
||||
public void unauthenticatedUserIsNotAuthorizedToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
|
||||
UserModel userModel = dataUser.createRandomTestUser();
|
||||
userModel.setPassword("user wrong password");
|
||||
dataUser.addUserToSite(userModel, publicSiteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager can add another user as manager to a public site and gets status code CREATED (201)")
|
||||
public void addManagerToPublicSite() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteManager)
|
||||
.assertThat()
|
||||
.field("id").is(getId(group))
|
||||
.and()
|
||||
.field("role").is(UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -0,0 +1,135 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
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.Test;
|
||||
|
||||
public class GetSiteGroupTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser;
|
||||
private SiteModel publicSiteModel;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private GroupModel manager, consumer;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
publicSiteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
|
||||
consumer = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(consumer, dataUser.createRandomTestUser());
|
||||
|
||||
manager = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(consumer, dataUser.createRandomTestUser());
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(manager), UserRole.SiteManager);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(consumer), UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user can get site group and gets status code OK (200)")
|
||||
public void getSiteGroupWithAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(manager))
|
||||
.and().field("id").is(getId(manager))
|
||||
.and().field("role").is(UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Failed authentication get site group call returns status code 401")
|
||||
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteGroup() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(consumer));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role doesn't get a site group of inexistent site and status code is Not Found (404)")
|
||||
public void getSiteGroupOfInexistentSite() throws Exception
|
||||
{
|
||||
SiteModel invalidSite = new SiteModel("invalidSite");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(invalidSite).getSiteGroup(getId(consumer));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, invalidSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role doesn't get non site group of inexistent site and status code is Not Found (404)")
|
||||
public void getSiteGroupForNonSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel nonGroup = dataGroup.createRandomGroup();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(nonGroup));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format("Given authority is not a member of the site"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role doesn't get not existing site group and status code is Not Found (404)")
|
||||
public void getSiteGroupForInexistentSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel inexistentGroup = new GroupModel("inexistentGroup");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(inexistentGroup));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format("An authority was not found for %s", getId(inexistentGroup)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role can get site group for empty siteId")
|
||||
public void getSiteGroupForEmptySiteId() throws Exception
|
||||
{
|
||||
SiteModel emptySite = new SiteModel("");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(emptySite).getSiteGroup(getId(consumer));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role gets site groups with Manager role and status code is OK (200)")
|
||||
public void getSiteGroupWithManagerRole() throws Exception
|
||||
{
|
||||
GroupModel anotherManager = dataGroup.createRandomGroup();
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(anotherManager), UserRole.SiteManager);
|
||||
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(anotherManager))
|
||||
.assertThat().field("id").is(getId(anotherManager))
|
||||
.and().field("role").is(UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -0,0 +1,275 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.*;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
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.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GetSiteGroupsTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSite, moderatedSite;
|
||||
private List<GroupModel> publicSiteGroups, moderatedSiteGroups;
|
||||
private DataUser.ListUserWithRoles publicSiteUsers;
|
||||
private UserModel siteCreator;
|
||||
private UserModel regularUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteCreator = dataUser.createRandomTestUser();
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
|
||||
publicSite = dataSite.usingUser(siteCreator).createPublicRandomSite();
|
||||
moderatedSite = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
|
||||
publicSiteUsers = dataUser.addUsersWithRolesToSite(publicSite,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
publicSiteGroups = addGroupToSite(publicSite,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
moderatedSiteGroups = addGroupToSite(moderatedSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("properties=role,id").getSiteGroups();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Manager role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithManagerRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(0)))
|
||||
.and().entriesListContains("role", UserRole.SiteManager.name())
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(1)))
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.name())
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(2)))
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.name())
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(3)))
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Collaborator role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithCollaboratorRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(1)))
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Contributor role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithContributorRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(3)))
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Consumer role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithConsumerRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(2)))
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(0)))
|
||||
.and().entriesListContains("role", UserRole.SiteManager.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Failed authentication get site groups call returns status code 401")
|
||||
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteGroups() throws Exception
|
||||
{
|
||||
UserModel userModel = dataUser.createRandomTestUser();
|
||||
userModel.setPassword("user wrong password");
|
||||
dataUser.addUserToSite(userModel, publicSite, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site members call returns status code 404 if siteId does not exist")
|
||||
public void checkStatusCodeForNonExistentSiteId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI()
|
||||
.usingSite("NonExistentSiteId").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.assertLastError().containsSummary(String.format("Site %s does not exist", "NonExistentSiteId"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site groups call returns status code 400 for invalid maxItems")
|
||||
public void checkStatusCodeForInvalidMaxItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withParams("maxItems=0").withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
restClient.withParams("maxItems=A").withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "A"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site groups call returns status code 400 for invalid skipCount ")
|
||||
public void checkStatusCodeForInvalidSkipCount() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withParams("skipCount=A")
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "A"));
|
||||
|
||||
restClient.withParams("skipCount=-1")
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets public site groups and status code is 200")
|
||||
public void getPublicSiteGroups() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(regularUser).withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().entriesListCountIs(4).assertThat()
|
||||
.entriesListContains("id", getId(publicSiteGroups.get(0)))
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(1)))
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(2)))
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(3)))
|
||||
.and().paginationField("count").is("4");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups and status code is 200")
|
||||
public void getModeratedSiteGroups() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(regularUser).withCoreAPI().usingSite(moderatedSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().entriesListCountIs(4).assertThat()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(0))).and()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(1))).and()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(2))).and()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(3))).and()
|
||||
.paginationField("count").is("4");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with properties parameter applied and status code is 200")
|
||||
public void getModeratedSiteGroupsUsingPropertiesParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("properties=role,id").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().entriesListCountIs(4)
|
||||
.and().entriesListDoesNotContain("person")
|
||||
.and().entriesListContains("role", UserRole.SiteManager.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(0)))
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(1)))
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(2)))
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(3)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with skipCount parameter applied")
|
||||
public void getModeratedSiteGroupsUsingSkipCountParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("skipCount=2").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().paginationField("count").is("2");
|
||||
siteGroups.assertThat().paginationField("skipCount").is("2");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with high skipCount parameter applied")
|
||||
public void getModeratedSiteGroupsUsingHighSkipCountParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("skipCount=100").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().paginationField("count").is("0");
|
||||
siteGroups.assertThat().paginationField("skipCount").is("100");
|
||||
siteGroups.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with maxItems parameter applied and check all pagination fields")
|
||||
public void getModeratedSiteGroupsUsingMaxItemsParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("maxItems=1").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().paginationField("count").is("1");
|
||||
siteGroups.assertThat().paginationField("hasMoreItems").is("true");
|
||||
siteGroups.assertThat().paginationField("maxItems").is("1");
|
||||
siteGroups.assertThat().paginationField("totalItems").is("4");
|
||||
siteGroups.assertThat().entriesListCountIs(1);
|
||||
}
|
||||
|
||||
List<GroupModel> addGroupToSite(SiteModel siteModel, UserRole ...roles) {
|
||||
List<GroupModel> groups = new ArrayList<GroupModel>();
|
||||
for (UserRole role: roles) {
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(siteModel).addSiteGroup(getId(group), role);
|
||||
groups.add(group);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -0,0 +1,197 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
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.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RemoveSiteGroupTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSiteModel, privateSiteModel;
|
||||
private UserModel adminUserModel;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
UserModel siteCreator = dataUser.createRandomTestUser();
|
||||
|
||||
publicSiteModel = dataSite.usingUser(siteCreator).createPublicRandomSite();
|
||||
privateSiteModel = dataSite.usingUser(siteCreator).createPrivateRandomSite();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
addGroupToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify manager can delete site group and gets status code 204, 'No Content'")
|
||||
public void siteManagerIsAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
|
||||
.getSiteGroups().assertThat().entriesListDoesNotContain("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.REGRESSION, description = "Verify collaborator cannot delete site group and gets status code 403, 'Forbidden'")
|
||||
public void siteCollaboratorIsNotAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI()
|
||||
.usingSite(publicSiteModel).getSiteGroups()
|
||||
.assertThat().entriesListContains("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.REGRESSION, description = "Verify contributor cannot delete site group and gets status code 403, 'Forbidden'")
|
||||
public void siteContributorIsNotAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
|
||||
.getSiteGroups().assertThat().entriesListContains("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.REGRESSION, description = "Verify consumer cannot delete site member and gets status code 403, 'Forbidden'")
|
||||
public void siteConsumerIsNotAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
|
||||
.getSiteGroups().assertThat().entriesListContains("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that unauthenticated user is not able to delete site group")
|
||||
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager can NOT delete site group for an inexistent user and gets status code 404, 'Not Found'")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void managerIsNotAbleToDeleteInexistentSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel inexistentUser = new GroupModel("inexistentUser");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(inexistentUser));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format("An authority was not found for %s", getId(inexistentUser)));
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager can NOT delete site group for a non site group and gets status code 400, 'Bad Request'")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void managerIsNotAbleToDeleteNotSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel nonMember = dataGroup.createRandomGroup();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(nonMember));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format("Given authority is not a member of the site"));
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager can NOT delete site group for an invalid site and gets status code 404, 'Not Found'")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void managerIsNotAbleToDeleteSiteMemberOfInvalidSite() throws Exception
|
||||
{
|
||||
SiteModel invalidSite = new SiteModel("invalidSite");
|
||||
GroupModel testGroupModel = dataGroup.createRandomGroup();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(invalidSite).deleteSiteGroup(getId(testGroupModel));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, "invalidSite"));
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin can delete a site group of private site and gets status code 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void adminIsAbleToDeletePrivateSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(privateSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin can not delete a site group twice and gets status code 404 for the second attempt")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@Bug(id="ACE-5447")
|
||||
public void adminIsNotAbleToRemoveSiteGroupTwice() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteContributor).get(0);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary("Given authority is not a member of the site");
|
||||
}
|
||||
|
||||
List<GroupModel> addGroupToSite(SiteModel siteModel, UserRole ...roles) {
|
||||
List<GroupModel> groups = new ArrayList<GroupModel>();
|
||||
for (UserRole role: roles) {
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(siteModel).addSiteGroup(getId(group), role);
|
||||
groups.add(group);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,187 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteMemberModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class UpdateSiteGroupTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser, siteCreator;
|
||||
private GroupModel regularGroup;
|
||||
private SiteModel publicSite;
|
||||
private DataUser.ListUserWithRoles publicSiteUsers;
|
||||
private GroupModel groupToBeUpdated;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteCreator = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteCreator).createPublicRandomSite();
|
||||
publicSiteUsers = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
regularGroup = dataGroup.createRandomGroup();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator is not able to update site group membership and gets status code FORBIDDEN (403)")
|
||||
public void collaboratorIsNotAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
restClient.assertLastError()
|
||||
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that contributor is not able to update site membership and gets status code FORBIDDEN (403)")
|
||||
public void contributorIsNotAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteContributor));
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
restClient.assertLastError()
|
||||
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that consumer is not able to update site group and gets status code FORBIDDEN (403)")
|
||||
public void consumerIsNotAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
restClient.assertLastError()
|
||||
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin is able to update site member and gets status code OK (200)")
|
||||
public void adminIsAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator)
|
||||
.assertThat().field("id").is(getId(groupToBeUpdated))
|
||||
.and().field("role").is(UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that unauthenticated user is not able to update site member")
|
||||
|
||||
public void unauthenticatedUserIsNotAuthorizedToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser);
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site group request returns status code 404 when nonexistent siteId is used")
|
||||
public void updateSiteGroupOfNonexistentSite() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
SiteModel deletedSite = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
dataSite.deleteSite(deletedSite);
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(deletedSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, deletedSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 400 when personId is not member of the site")
|
||||
public void updateNotASiteMember() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("authority is not a member of the site");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 404 when personId does not exist")
|
||||
public void updateNonexistentSiteMember() throws Exception
|
||||
{
|
||||
GroupModel nonexistentUser = new GroupModel("nonexistentUser");
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(nonexistentUser), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format("An authority was not found for %s", getId(nonexistentUser)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 404 when empty siteId is used")
|
||||
public void updateSiteMemberUsingEmptySiteId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite("").updateSiteGroup(getId(regularGroup), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 405 when empty personId is used")
|
||||
public void updateSiteMemberUsingEmptyPersonId() throws Exception
|
||||
{
|
||||
GroupModel emptyGroup = new GroupModel("");
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(emptyGroup), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format("An authority was not found for %s", getId(emptyGroup)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 400 when invalid role is used")
|
||||
public void updateSiteMemberUsingInvalidRole() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(siteCreator).withCoreAPI();
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
String json = JsonBodyGenerator.keyValueJson("role","invalidRole");
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "sites/{siteId}/group-members/{groupId}", publicSite.getId(), getId(groupToBeUpdated));
|
||||
restClient.processModel(RestSiteMemberModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("authority is not a member of the site");
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -6,6 +6,7 @@ import org.alfresco.rest.model.RestSiteMemberModel;
|
||||
import org.alfresco.rest.model.RestSiteMemberModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
@@ -20,7 +21,7 @@ import org.testng.annotations.Test;
|
||||
*/
|
||||
public class GetSiteMembersTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSite, privateSite, moderatedSite, moderatedSite2, moderatedSite3;
|
||||
private SiteModel publicSite, privateSite, moderatedSite, moderatedSite2, moderatedSite3, moderatedSite4;
|
||||
private RestSiteMemberModelsCollection siteMembers;
|
||||
private ListUserWithRoles usersWithRoles, moderatedSiteUsers;
|
||||
private UserModel regularUser, privateSiteConsumer, siteCreator;
|
||||
@@ -38,6 +39,7 @@ public class GetSiteMembersTests extends RestTest
|
||||
moderatedSite = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
moderatedSite2 = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
moderatedSite3 = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
moderatedSite4 = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
|
||||
dataUser.addUserToSite(privateSiteConsumer, privateSite, UserRole.SiteConsumer);
|
||||
dataUser.addUserToSite(privateSiteConsumer, moderatedSite3, UserRole.SiteConsumer);
|
||||
@@ -351,4 +353,32 @@ public class GetSiteMembersTests extends RestTest
|
||||
.and().entriesListContains("role", UserRole.SiteManager.toString())
|
||||
.and().entriesListContains("id", siteCreator.getUsername());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if isMemberOfGroup if user part of the group")
|
||||
public void verifyIsMemberOfGroupProps() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
dataGroup.addListOfUsersToGroup(firstGroup, user);
|
||||
|
||||
siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI()
|
||||
.usingSite(moderatedSite4).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(1);
|
||||
|
||||
restClient.withCoreAPI().usingSite(moderatedSite4).addSiteGroup("GROUP_" + firstGroup.getGroupIdentifier(), UserRole.SiteCollaborator);
|
||||
|
||||
siteMembers = restClient.withCoreAPI().usingSite(moderatedSite4).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(2);
|
||||
siteMembers.getEntryByIndex(0).assertThat().field("isMemberOfGroup").isNotNull();
|
||||
siteMembers.getEntryByIndex(1).assertThat().field("isMemberOfGroup").isNotNull();
|
||||
|
||||
siteMembers = restClient.withCoreAPI().usingSite(moderatedSite4).usingParams("where=(isMemberOfGroup=false)").getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(1);
|
||||
siteMembers.getEntries().get(0).assertThat().field("isMemberOfGroup").is(false);
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -60,12 +60,10 @@
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.soap</groupId>
|
||||
<artifactId>javax.xml.soap-api</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<groupId>jakarta.xml.soap</groupId>
|
||||
<artifactId>jakarta.xml.soap-api</artifactId>
|
||||
</dependency>
|
||||
<!-- 'provided' dependencies, not packaged in war -->
|
||||
<dependency>
|
||||
@@ -95,11 +93,6 @@
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- required by GDocs-->
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
|
@@ -239,11 +239,6 @@ log4j.logger.freemarker.runtime=
|
||||
# Metadata extraction
|
||||
log4j.logger.org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter=warn
|
||||
|
||||
# Reduces PDFont error level due to ALF-7105
|
||||
log4j.logger.org.apache.pdfbox.pdmodel.font.PDSimpleFont=fatal
|
||||
log4j.logger.org.apache.pdfbox.pdmodel.font.PDFont=fatal
|
||||
log4j.logger.org.apache.pdfbox.pdmodel.font.PDCIDFont=fatal
|
||||
|
||||
# no index support
|
||||
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexIndexer=fatal
|
||||
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexSearchService=fatal
|
||||
@@ -264,10 +259,7 @@ log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationsConsistenc
|
||||
log4j.logger.org.alfresco.heartbeat=info
|
||||
|
||||
# Transformations
|
||||
log4j.logger.org.alfresco.repo.content.transform.JodContentTransformer=info
|
||||
log4j.logger.org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker=info
|
||||
log4j.logger.org.alfresco.repo.content.transform.pdfrenderer.AlfrescoPdfRendererContentTransformerWorker=info
|
||||
log4j.logger.org.alfresco.repo.content.transform.TikaPoweredContentTransformer=info
|
||||
#log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
|
||||
|
||||
log4j.logger.org.alfresco.repo.content.transform=info
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
294
pom.xml
294
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -39,11 +39,9 @@
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
<img.exe>convert</img.exe>
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
<dependency.alfresco-mmt.version>6.0</dependency.alfresco-mmt.version>
|
||||
<dependency.alfresco-pdf-renderer.version>1.1</dependency.alfresco-pdf-renderer.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.3</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
||||
<dependency.alfresco-server-root.version>6.0.1</dependency.alfresco-server-root.version>
|
||||
@@ -51,68 +49,74 @@
|
||||
<dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
|
||||
<dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
|
||||
<dependency.activiti.version>5.23.0</dependency.activiti.version>
|
||||
<dependency.transform.model.version>1.0.2.11</dependency.transform.model.version>
|
||||
<dependency.transform.model.version>1.3.0</dependency.transform.model.version>
|
||||
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
|
||||
<dependency.acs-event-model.version>0.0.11</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.spring.version>5.2.9.RELEASE</dependency.spring.version>
|
||||
<dependency.spring.version>5.3.3</dependency.spring.version>
|
||||
<dependency.antlr.version>3.5.2</dependency.antlr.version>
|
||||
<dependency.jackson.version>2.11.3</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.11.2</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.4.1</dependency.cxf.version>
|
||||
<dependency.jackson.version>2.12.1</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>${dependency.jackson.version}</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.4.2</dependency.cxf.version>
|
||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||
<dependency.pdfbox.version>2.0.21</dependency.pdfbox.version>
|
||||
<dependency.webscripts.version>8.12</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.66</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.6.0</dependency.mockito-core.version>
|
||||
<dependency.org-json.version>20200518</dependency.org-json.version>
|
||||
<dependency.webscripts.version>8.15</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.68</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.7.7</dependency.mockito-core.version>
|
||||
<dependency.org-json.version>20201115</dependency.org-json.version>
|
||||
<dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version>
|
||||
<dependency.guava.version>28.2-jre</dependency.guava.version>
|
||||
<dependency.commons-io.version>2.8.0</dependency.commons-io.version>
|
||||
<dependency.gson.version>2.8.5</dependency.gson.version>
|
||||
<dependency.httpclient.version>4.5.13</dependency.httpclient.version>
|
||||
<dependency.httpcore.version>4.4.13</dependency.httpcore.version>
|
||||
<dependency.httpcore.version>4.4.14</dependency.httpcore.version>
|
||||
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
|
||||
<dependency.xercesImpl.version>2.12.0-alfresco-patched-20191004</dependency.xercesImpl.version>
|
||||
<dependency.xercesImpl.version>2.12.1</dependency.xercesImpl.version>
|
||||
<dependency.slf4j.version>1.7.30</dependency.slf4j.version>
|
||||
<dependency.gytheio.version>0.11.6</dependency.gytheio.version>
|
||||
<dependency.jaxb.version>2.3.3</dependency.jaxb.version>
|
||||
<dependency.gytheio.version>0.12</dependency.gytheio.version>
|
||||
<dependency.groovy.version>2.5.9</dependency.groovy.version>
|
||||
<dependency.javax.mail.version>1.6.2</dependency.javax.mail.version>
|
||||
<dependency.tika.version>1.24.1</dependency.tika.version>
|
||||
<dependency.tika.version>1.25</dependency.tika.version>
|
||||
<dependency.spring-security.version>5.4.1</dependency.spring-security.version>
|
||||
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
||||
<dependency.poi.version>4.1.2</dependency.poi.version>
|
||||
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
|
||||
<dependency.keycloak.version>11.0.0-alfresco-001</dependency.keycloak.version>
|
||||
<dependency.jboss.logging.version>3.4.1.Final</dependency.jboss.logging.version>
|
||||
<dependency.camel.version>2.24.2</dependency.camel.version>
|
||||
<dependency.activemq.version>5.16.0</dependency.activemq.version>
|
||||
<dependency.camel.version>3.7.0</dependency.camel.version>
|
||||
<dependency.activemq.version>5.16.1</dependency.activemq.version>
|
||||
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
|
||||
<dependency.awaitility.version>4.0.3</dependency.awaitility.version>
|
||||
|
||||
<alfresco.googledrive.version>3.2.0</alfresco.googledrive.version>
|
||||
<alfresco.aos-module.version>1.4.0-M1</alfresco.aos-module.version>
|
||||
<dependency.jakarta-jaxb-api.version>2.3.3</dependency.jakarta-jaxb-api.version>
|
||||
<dependency.jakarta-ws-api.version>2.3.3</dependency.jakarta-ws-api.version>
|
||||
<dependency.jakarta-soap-api.version>1.4.2</dependency.jakarta-soap-api.version>
|
||||
<dependency.jakarta-activation-api.version>1.2.2</dependency.jakarta-activation-api.version>
|
||||
<dependency.jakarta-annotation-api.version>1.3.5</dependency.jakarta-annotation-api.version>
|
||||
<dependency.jakarta-transaction-api.version>1.3.3</dependency.jakarta-transaction-api.version>
|
||||
<dependency.jakarta-jws-api.version>2.1.0</dependency.jakarta-jws-api.version>
|
||||
<dependency.jakarta-mail-api.version>1.6.5</dependency.jakarta-mail-api.version>
|
||||
<dependency.jakarta-json-api.version>1.1.6</dependency.jakarta-json-api.version>
|
||||
<dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
|
||||
|
||||
<alfresco.googledrive.version>3.2.1-A2</alfresco.googledrive.version>
|
||||
<alfresco.aos-module.version>1.4.0-A2</alfresco.aos-module.version>
|
||||
|
||||
<dependency.postgresql.version>42.2.18</dependency.postgresql.version>
|
||||
<dependency.mysql.version>8.0.22</dependency.mysql.version>
|
||||
<dependency.mariadb.version>2.7.0</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.40</dependency.tas-utility.version>
|
||||
<dependency.mysql.version>8.0.23</dependency.mysql.version>
|
||||
<dependency.mariadb.version>2.7.2</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.42</dependency.tas-utility.version>
|
||||
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
|
||||
<dependency.javax.json.version>1.1.4</dependency.javax.json.version>
|
||||
<dependency.tas-restapi.version>1.48</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.21</dependency.tas-cmis.version>
|
||||
<dependency.tas-restapi.version>1.52</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.27</dependency.tas-cmis.version>
|
||||
<dependency.tas-email.version>1.8</dependency.tas-email.version>
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
<dependency.tas-ftp.version>1.5</dependency.tas-ftp.version>
|
||||
<dependency.tas-dataprep.version>2.3</dependency.tas-dataprep.version>
|
||||
<dependency.tas-dataprep.version>2.6</dependency.tas-dataprep.version>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<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>repo-5439-M3c1</tag>
|
||||
<tag>8.399</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -128,6 +132,92 @@
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>${dependency.jakarta-jaxb-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>${dependency.jakarta-jaxb-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.ws</groupId>
|
||||
<artifactId>jakarta.xml.ws-api</artifactId>
|
||||
<version>${dependency.jakarta-ws-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.soap</groupId>
|
||||
<artifactId>jakarta.xml.soap-api</artifactId>
|
||||
<version>${dependency.jakarta-soap-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
<version>${dependency.jakarta-activation-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>jakarta.activation</artifactId>
|
||||
<version>${dependency.jakarta-activation-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${dependency.jakarta-annotation-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
<version>${dependency.jakarta-transaction-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
<version>${dependency.jakarta-jws-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<version>${dependency.jakarta-mail-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
<version>${dependency.jakarta-mail-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.json</groupId>
|
||||
<artifactId>jakarta.json-api</artifactId>
|
||||
<version>${dependency.jakarta-json-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>jakarta.json</artifactId>
|
||||
<version>${dependency.jakarta-json-api.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>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-jlan-embed</artifactId>
|
||||
@@ -142,6 +232,13 @@
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-heartbeat-data-sender</artifactId>
|
||||
<version>${dependency.alfresco-hb-data-sender.version}</version>
|
||||
<exclusions>
|
||||
<!-- Duplicates classes from jakarta.xml.bind:jakarta.xml.bind-api -->
|
||||
<exclusion>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xalan</groupId>
|
||||
@@ -159,26 +256,18 @@
|
||||
<groupId>org.alfresco.services</groupId>
|
||||
<artifactId>alfresco-messaging-repo</artifactId>
|
||||
<version>${dependency.alfresco-messaging-repo.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-broker</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<version>${dependency.alfresco-mmt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<version>${dependency.alfresco-pdf-renderer.version}</version>
|
||||
<classifier>linux</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<version>${dependency.alfresco-pdf-renderer.version}</version>
|
||||
<classifier>win64</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
@@ -261,21 +350,12 @@
|
||||
<artifactId>commons-digester</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>${dependency.jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
@@ -399,11 +479,6 @@
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
<version>${dependency.jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
@@ -474,7 +549,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.67</version>
|
||||
<version>1.68</version>
|
||||
<!-- <version>${dependency.bouncycastle.version}</version>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -514,7 +589,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
<artifactId>junrar</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>7.4.0</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
@@ -523,23 +598,11 @@
|
||||
<version>1.13.1</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${dependency.guava.version}</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.20</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>${dependency.pdfbox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-csv</artifactId>
|
||||
@@ -577,12 +640,6 @@
|
||||
<version>${dependency.rest-assured.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.json</artifactId>
|
||||
<version>${dependency.javax.json.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>restapi</artifactId>
|
||||
@@ -619,15 +676,10 @@
|
||||
<version>${dependency.tas-dataprep.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.8</version>
|
||||
<version>2.10.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided dependencies -->
|
||||
@@ -667,6 +719,70 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${dependency.gson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-activemq</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-broker</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-amqp</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<exclusions>
|
||||
<!-- conflicts with activemq geronimo-jms_1.1_spec -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jms_2.0_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-jackson</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-directvm</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-direct</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-mock</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -683,8 +799,8 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.34.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>8.399</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -16,38 +16,13 @@
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-data-model</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<!-- Duplicate classes from com.sun.activation:jakarta.activation-->
|
||||
<exclusion>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>javax.activation</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-4998 - Exclusion due to classpath conflicts between org.codehaus.woodstox:woodstox-core-asl and com.fasterxml.woodstox:woodstox-core -->
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicate classes from jakarta.annotation:jakarta.annotation-api-->
|
||||
<exclusion>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-5009 Excluded to avoid duplicated classes with javax.jws:javax.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>jakarta.xml.rpc</groupId>
|
||||
<artifactId>jakarta.xml.rpc-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
@@ -79,23 +54,12 @@
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-webscripts</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml</groupId>
|
||||
<artifactId>jaxrpc-api</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This is needed at runtime by Web Client, so not really a test dependency -->
|
||||
<dependency>
|
||||
<groupId>org.apache.chemistry.opencmis</groupId>
|
||||
<artifactId>chemistry-opencmis-test-tck</artifactId>
|
||||
<version>${dependency.opencmis.version}</version>
|
||||
<exclusions>
|
||||
<!-- Duplicate classes from com.sun.activation:jakarta.activation-->
|
||||
<exclusion>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>javax.activation</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-5009 Excluded to avoid duplicated classes with javax.jws:javax.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
@@ -141,18 +105,6 @@
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.xml.bind:jakarta.xml.bind-api -->
|
||||
<exclusion>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
@@ -195,6 +147,11 @@
|
||||
<version>2.0</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-5009 Excluded to avoid duplicated classes with javax.jws:javax.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
@@ -207,101 +164,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-mock</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<!-- Profiles to extract the alfresco-pdf-renderer -->
|
||||
<profile>
|
||||
<id>win-alfresco-pdf-renderer-test</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>windows</family>
|
||||
</os>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<classifier>win64</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<inherited>false</inherited>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>extract-alfresco-pdf-renderer-test</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${skipTests}</skip>
|
||||
<target>
|
||||
<echo message="Extracting alfresco-pdf-renderer (windows) for testing..." />
|
||||
<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
|
||||
<untar compression="gzip" src="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-win64.tgz" dest="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>linux-alfresco-pdf-renderer-test</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>linux</family>
|
||||
</os>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<classifier>linux</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<inherited>false</inherited>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>extract-alfresco-pdf-renderer-test</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${skipTests}</skip>
|
||||
<target>
|
||||
<echo message="Extracting alfresco-pdf-renderer (linux) for testing..." />
|
||||
<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
|
||||
<exec failonerror="true" executable="tar" dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer">
|
||||
<arg value="xf" />
|
||||
<arg value="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-linux.tgz" />
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@@ -335,8 +203,6 @@
|
||||
<!-- To prevent tests alfresco.log to be created in project roots and bother while synchronizing with SCM -->
|
||||
<workingDirectory>${project.build.directory}</workingDirectory>
|
||||
<systemPropertyVariables>
|
||||
<alfresco-pdf-renderer.exe>${alfresco-pdf-renderer.exe}</alfresco-pdf-renderer.exe>
|
||||
|
||||
<!-- Database related properties -->
|
||||
<db.url>${db.url}</db.url>
|
||||
<db.driver>${db.driver}</db.driver>
|
||||
@@ -344,7 +210,6 @@
|
||||
<db.username>${db.username}</db.username>
|
||||
<db.password>${db.password}</db.password>
|
||||
<dir.root>${dir.root}</dir.root>
|
||||
<img.exe>${img.exe}</img.exe>
|
||||
<!-- BDE-91 -->
|
||||
<alfresco.rmi.services.retries>30</alfresco.rmi.services.retries>
|
||||
<alfresco.rmi.services.retryInterval>2000</alfresco.rmi.services.retryInterval>
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* 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.webdav;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -82,8 +82,6 @@ public class UnlockMethod extends WebDAVMethod
|
||||
{
|
||||
if (!(strLockTokenHeader.startsWith("<") && strLockTokenHeader.endsWith(">")))
|
||||
{
|
||||
// ALF-13904: Header isn't correctly enclosed in < and > characters. Try correcting this
|
||||
// to allow for Windows 7 + OpenOffice.org bug.
|
||||
strLockTokenHeader = "<" + strLockTokenHeader + ">";
|
||||
}
|
||||
if (strLockTokenHeader.startsWith("<" + WebDAV.OPAQUE_LOCK_TOKEN) && strLockTokenHeader.endsWith(">"))
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* 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.webdav;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -31,7 +31,6 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.UnavailableException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2018 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
|
||||
@@ -23,32 +23,15 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.rendition2;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
package org.alfresco.rest.api;
|
||||
|
||||
/**
|
||||
* Repeats quick file rendition tests with local transforms and legacy transformers enabled.
|
||||
* The Transform Service does not exist for the Community edition.
|
||||
* Should be the same result as with legacy or local transforms on their own.
|
||||
*
|
||||
* @author adavis
|
||||
*/
|
||||
@Deprecated
|
||||
public class LegacyLocalRenditionTest extends AbstractRenditionTest
|
||||
import org.alfresco.rest.api.model.Aspect;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
|
||||
public interface Aspects
|
||||
{
|
||||
@BeforeClass
|
||||
public static void before()
|
||||
{
|
||||
AbstractRenditionIntegrationTest.before();
|
||||
legacyLocal();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void after()
|
||||
{
|
||||
AbstractRenditionIntegrationTest.after();
|
||||
}
|
||||
CollectionWithPagingInfo<Aspect> listAspects(Parameters params);
|
||||
Aspect getAspectById(String aspectId);
|
||||
}
|
@@ -25,15 +25,14 @@
|
||||
*/
|
||||
package org.alfresco.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.model.NodeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
|
||||
/**
|
||||
* Maps representations from TypeDefinition to NodeDefinition
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public interface NodeDefinitionMapper
|
||||
public interface ClassDefinitionMapper
|
||||
{
|
||||
NodeDefinition fromTypeDefinition(TypeDefinition typeDefinition, MessageLookup messageLookup);
|
||||
org.alfresco.rest.api.model.ClassDefinition fromDictionaryClassDefinition(org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, MessageLookup messageLookup);
|
||||
}
|
37
remote-api/src/main/java/org/alfresco/rest/api/Types.java
Normal file
37
remote-api/src/main/java/org/alfresco/rest/api/Types.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.model.Type;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
|
||||
public interface Types
|
||||
{
|
||||
CollectionWithPagingInfo<Type> listTypes(Parameters params);
|
||||
Type getType(String aspectId);
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.aspects;
|
||||
|
||||
import org.alfresco.rest.api.Aspects;
|
||||
import org.alfresco.rest.api.model.Aspect;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@EntityResource(name = "aspects", title = "Aspects")
|
||||
public class AspectEntityResource implements EntityResourceAction.ReadById<Aspect>, EntityResourceAction.Read<Aspect>, InitializingBean
|
||||
{
|
||||
|
||||
private Aspects aspects;
|
||||
|
||||
public void setAspects(Aspects aspects)
|
||||
{
|
||||
this.aspects = aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("aspects", this.aspects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Aspect> readAll(Parameters params)
|
||||
{
|
||||
return aspects.listAspects(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect readById(String id, Parameters parameters)
|
||||
{
|
||||
return aspects.getAspectById(id);
|
||||
}
|
||||
}
|
@@ -1,40 +1,30 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 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
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.content.transform.magick;
|
||||
|
||||
import org.alfresco.service.cmr.repository.CropSourceOptions;
|
||||
|
||||
/**
|
||||
* Deprecated crop options.
|
||||
*
|
||||
* @deprecated replaced by {@link CropSourceOptions}
|
||||
* @see CropSourceOptions
|
||||
*/
|
||||
public class ImageCropOptions extends CropSourceOptions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@WebApi(name="alfresco", scope= Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rest.api.aspects;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.model.AbstractClass;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.where.Query;
|
||||
import org.alfresco.rest.framework.resource.parameters.where.QueryHelper;
|
||||
import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class AbstractClassImpl<T extends AbstractClass> {
|
||||
static String PARAM_MODEL_IDS = "modelIds";
|
||||
static String PARAM_PARENT_IDS = "parentIds";
|
||||
static String PARAM_NAMESPACE_URI = "namespaceUri";
|
||||
|
||||
public CollectionWithPagingInfo<T> createPagedResult(List<T> list, Paging paging)
|
||||
{
|
||||
int skipCount = paging.getSkipCount();
|
||||
int maxItems = paging.getMaxItems();
|
||||
int totalItems = list.size();
|
||||
|
||||
Collections.sort(list);
|
||||
|
||||
if (skipCount >= totalItems)
|
||||
{
|
||||
List<T> empty = Collections.emptyList();
|
||||
return CollectionWithPagingInfo.asPaged(paging, empty, false, totalItems);
|
||||
}
|
||||
else
|
||||
{
|
||||
int end = Math.min(skipCount + maxItems, totalItems);
|
||||
boolean hasMoreItems = totalItems > end;
|
||||
list = list.subList(skipCount, end);
|
||||
return CollectionWithPagingInfo.asPaged(paging, list, hasMoreItems, totalItems);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean filterByNamespace(ModelApiFilter query, QName qName)
|
||||
{
|
||||
//System aspect/type is not allowed
|
||||
if (qName.getNamespaceURI().equals(NamespaceService.SYSTEM_MODEL_1_0_URI))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (query != null && query.getMatchedPrefix() != null)
|
||||
{
|
||||
return Pattern.matches(query.getMatchedPrefix(), qName.getNamespaceURI());
|
||||
}
|
||||
if (query != null && query.getNotMatchedPrefix() != null)
|
||||
{
|
||||
return !Pattern.matches(query.getNotMatchedPrefix(), qName.getNamespaceURI());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public ModelApiFilter getQuery(Query queryParameters)
|
||||
{
|
||||
if (queryParameters != null)
|
||||
{
|
||||
ClassQueryWalker propertyWalker = new ClassQueryWalker();
|
||||
QueryHelper.walk(queryParameters, propertyWalker);
|
||||
return new ModelApiFilter(propertyWalker.getModelIds(), propertyWalker.getParentIds(), propertyWalker.getMatchedPrefix(), propertyWalker.getNotMatchedPrefix());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void validateListParam(Set<String> listParam, String paramName)
|
||||
{
|
||||
if (listParam.isEmpty())
|
||||
{
|
||||
throw new IllegalArgumentException(StringUtils.capitalize(paramName) + "s filter list cannot be empty.");
|
||||
}
|
||||
|
||||
listParam.stream()
|
||||
.filter(String::isEmpty)
|
||||
.findAny()
|
||||
.ifPresent(qName -> {
|
||||
throw new IllegalArgumentException(StringUtils.capitalize(paramName) + " cannot be empty (i.e. '')");
|
||||
});
|
||||
}
|
||||
|
||||
public static class ClassQueryWalker extends MapBasedQueryWalker
|
||||
{
|
||||
private Set<String> modelIds = null;
|
||||
private Set<String> parentIds = null;
|
||||
private String notMatchedPrefix = null;
|
||||
private String matchedPrefix = null;
|
||||
|
||||
public ClassQueryWalker()
|
||||
{
|
||||
super(new HashSet<>(Arrays.asList(PARAM_MODEL_IDS, PARAM_PARENT_IDS)), new HashSet<>(Collections.singleton(PARAM_NAMESPACE_URI)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void in(String propertyName, boolean negated, String... propertyValues)
|
||||
{
|
||||
if (negated)
|
||||
{
|
||||
throw new InvalidArgumentException("Cannot use NOT for " + propertyName);
|
||||
}
|
||||
|
||||
if (propertyName.equalsIgnoreCase(PARAM_MODEL_IDS))
|
||||
{
|
||||
modelIds = new HashSet<>(Arrays.asList(propertyValues));
|
||||
}
|
||||
|
||||
if (propertyName.equalsIgnoreCase(PARAM_PARENT_IDS))
|
||||
{
|
||||
parentIds = new HashSet<>(Arrays.asList(propertyValues));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void matches(String property, String value, boolean negated)
|
||||
{
|
||||
if (negated && property.equals(PARAM_NAMESPACE_URI))
|
||||
{
|
||||
notMatchedPrefix = value;
|
||||
}
|
||||
else if (property.equals(PARAM_NAMESPACE_URI))
|
||||
{
|
||||
matchedPrefix = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getModelIds()
|
||||
{
|
||||
return this.modelIds;
|
||||
}
|
||||
|
||||
public Set<String> getParentIds()
|
||||
{
|
||||
return this.parentIds;
|
||||
}
|
||||
|
||||
public String getNotMatchedPrefix()
|
||||
{
|
||||
return this.notMatchedPrefix;
|
||||
}
|
||||
|
||||
public String getMatchedPrefix()
|
||||
{
|
||||
return this.matchedPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ModelApiFilter
|
||||
{
|
||||
private Set<String> modelIds;
|
||||
private Set<String> parentIds;
|
||||
private String matchedPrefix;
|
||||
private String notMatchedPrefix;
|
||||
|
||||
public ModelApiFilter(Set<String> modelIds, Set<String> parentIds, String matchedPrefix, String notMatchedPrefix)
|
||||
{
|
||||
this.modelIds = modelIds;
|
||||
this.parentIds = parentIds;
|
||||
this.matchedPrefix = matchedPrefix;
|
||||
this.notMatchedPrefix = notMatchedPrefix;
|
||||
}
|
||||
|
||||
public Set<String> getModelIds()
|
||||
{
|
||||
return modelIds;
|
||||
}
|
||||
|
||||
public String getMatchedPrefix()
|
||||
{
|
||||
return matchedPrefix;
|
||||
}
|
||||
|
||||
public String getNotMatchedPrefix()
|
||||
{
|
||||
return notMatchedPrefix;
|
||||
}
|
||||
|
||||
public Set<String> getParentIds()
|
||||
{
|
||||
return parentIds;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.Aspects;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.Aspect;
|
||||
import org.alfresco.rest.api.model.PropertyDefinition;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceException;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class AspectsImpl extends AbstractClassImpl<Aspect> implements Aspects
|
||||
{
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespacePrefixResolver namespaceService;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
public void setNamespaceService(NamespacePrefixResolver namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
public void setClassDefinitionMapper(ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "dictionaryService", dictionaryService);
|
||||
PropertyCheck.mandatory(this, "namespaceService", namespaceService);
|
||||
PropertyCheck.mandatory(this, "classDefinitionMapper", classDefinitionMapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Aspect> listAspects(Parameters params)
|
||||
{
|
||||
Paging paging = params.getPaging();
|
||||
ModelApiFilter query = getQuery(params.getQuery());
|
||||
Stream<QName> aspectList = null;
|
||||
|
||||
if (query != null && query.getModelIds() != null)
|
||||
{
|
||||
validateListParam(query.getModelIds(), PARAM_MODEL_IDS);
|
||||
aspectList = query.getModelIds().parallelStream().map(this::getModelAspects).flatMap(Collection::parallelStream);
|
||||
}
|
||||
else if (query != null && query.getParentIds() != null)
|
||||
{
|
||||
validateListParam(query.getParentIds(), PARAM_PARENT_IDS);
|
||||
aspectList = query.getParentIds().parallelStream().map(this::getChildAspects).flatMap(Collection::parallelStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
aspectList = this.dictionaryService.getAllAspects().parallelStream();
|
||||
}
|
||||
|
||||
List<Aspect> allAspects = aspectList.filter((qName) -> filterByNamespace(query, qName))
|
||||
.map((qName) -> this.convertToAspect(dictionaryService.getAspect(qName)))
|
||||
.collect(Collectors.toList());
|
||||
return createPagedResult(allAspects, paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getAspectById(String aspectId)
|
||||
{
|
||||
if (aspectId == null)
|
||||
throw new InvalidArgumentException("Invalid parameter: unknown scheme specified");
|
||||
|
||||
AspectDefinition aspectDefinition = null;
|
||||
|
||||
try
|
||||
{
|
||||
aspectDefinition = dictionaryService.getAspect(QName.createQName(aspectId, this.namespaceService));
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new EntityNotFoundException(aspectId);
|
||||
}
|
||||
|
||||
if (aspectDefinition == null)
|
||||
throw new EntityNotFoundException(aspectId);
|
||||
|
||||
return this.convertToAspect(aspectDefinition);
|
||||
}
|
||||
|
||||
public Aspect convertToAspect(AspectDefinition aspectDefinition)
|
||||
{
|
||||
List<PropertyDefinition> properties = this.classDefinitionMapper.fromDictionaryClassDefinition(aspectDefinition, dictionaryService).getProperties();
|
||||
return new Aspect(aspectDefinition, dictionaryService, properties);
|
||||
}
|
||||
|
||||
private Collection<QName> getModelAspects(String modelId)
|
||||
{
|
||||
ModelDefinition modelDefinition = null;
|
||||
|
||||
if (modelId == null)
|
||||
throw new InvalidArgumentException("modelId is null");
|
||||
|
||||
try
|
||||
{
|
||||
modelDefinition = this.dictionaryService.getModel(QName.createQName(modelId, this.namespaceService));
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
return this.dictionaryService.getAspects(modelDefinition.getName());
|
||||
}
|
||||
|
||||
private Collection<QName> getChildAspects(String aspectId)
|
||||
{
|
||||
Collection<QName> subAspects = null;
|
||||
try
|
||||
{
|
||||
QName parentAspect = QName.createQName(aspectId, this.namespaceService);
|
||||
subAspects = this.dictionaryService.getSubAspects(parentAspect, true);
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
return subAspects;
|
||||
}
|
||||
}
|
@@ -32,13 +32,8 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.rest.api.NodeDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.NodeDefinitionConstraint;
|
||||
import org.alfresco.rest.api.model.NodeDefinition;
|
||||
import org.alfresco.rest.api.model.NodeDefinitionProperty;
|
||||
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.ClassDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -47,33 +42,33 @@ import org.alfresco.service.namespace.QName;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
public class ClassDefinitionMapperImpl implements ClassDefinitionMapper
|
||||
{
|
||||
|
||||
private final List<String> EXCLUDED_NS = Arrays.asList(NamespaceService.SYSTEM_MODEL_1_0_URI);
|
||||
private static final List<QName> EXCLUDED_PROPS = Arrays.asList(ContentModel.PROP_CONTENT);
|
||||
|
||||
|
||||
@Override
|
||||
public NodeDefinition fromTypeDefinition(TypeDefinition typeDefinition,
|
||||
MessageLookup messageLookup)
|
||||
public ClassDefinition fromDictionaryClassDefinition(org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, MessageLookup messageLookup)
|
||||
{
|
||||
|
||||
if (typeDefinition == null)
|
||||
if (classDefinition == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Undefined definition for the node");
|
||||
throw new AlfrescoRuntimeException("Undefined ClassDefinition for the node");
|
||||
}
|
||||
NodeDefinition nodeDefinition = new NodeDefinition();
|
||||
nodeDefinition.setProperties(getProperties(typeDefinition.getProperties(), messageLookup));
|
||||
|
||||
return nodeDefinition;
|
||||
|
||||
ClassDefinition _classDefinition = new ClassDefinition();
|
||||
_classDefinition.setProperties(getProperties(classDefinition.getProperties(), messageLookup));
|
||||
|
||||
return _classDefinition;
|
||||
}
|
||||
|
||||
private boolean isPropertyExcluded(QName propertyName)
|
||||
private boolean isPropertyExcluded(QName propertyName)
|
||||
{
|
||||
return EXCLUDED_NS.contains(propertyName.getNamespaceURI()) || EXCLUDED_PROPS.contains(propertyName);
|
||||
}
|
||||
|
||||
private List <NodeDefinitionProperty> getProperties(Map<QName, PropertyDefinition> propertiesMap, MessageLookup messageLookup)
|
||||
private List <org.alfresco.rest.api.model.PropertyDefinition> getProperties(Map<QName, org.alfresco.service.cmr.dictionary.PropertyDefinition> propertiesMap, MessageLookup messageLookup)
|
||||
{
|
||||
return propertiesMap.values().stream()
|
||||
.filter(p -> !isPropertyExcluded(p.getName()))
|
||||
@@ -81,10 +76,10 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private NodeDefinitionProperty fromPropertyDefinitionToProperty(PropertyDefinition propertyDefinition,
|
||||
MessageLookup messageLookup)
|
||||
private org.alfresco.rest.api.model.PropertyDefinition fromPropertyDefinitionToProperty(org.alfresco.service.cmr.dictionary.PropertyDefinition propertyDefinition,
|
||||
MessageLookup messageLookup)
|
||||
{
|
||||
NodeDefinitionProperty property = new NodeDefinitionProperty();
|
||||
org.alfresco.rest.api.model.PropertyDefinition property = new org.alfresco.rest.api.model.PropertyDefinition();
|
||||
property.setId(propertyDefinition.getName().toPrefixString());
|
||||
property.setTitle(propertyDefinition.getTitle(messageLookup));
|
||||
property.setDescription(propertyDefinition.getDescription(messageLookup));
|
||||
@@ -99,8 +94,8 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
return property;
|
||||
}
|
||||
|
||||
private List<NodeDefinitionConstraint> getConstraints( Collection<ConstraintDefinition> constraintDefinitions,
|
||||
MessageLookup messageLookup)
|
||||
private List<org.alfresco.rest.api.model.ConstraintDefinition> getConstraints(Collection<org.alfresco.service.cmr.dictionary.ConstraintDefinition> constraintDefinitions,
|
||||
MessageLookup messageLookup)
|
||||
{
|
||||
|
||||
return constraintDefinitions.stream()
|
||||
@@ -109,10 +104,10 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private NodeDefinitionConstraint fromConstraintDefinitionToConstraint(ConstraintDefinition constraintDefinition,
|
||||
MessageLookup messageLookup)
|
||||
private org.alfresco.rest.api.model.ConstraintDefinition fromConstraintDefinitionToConstraint(org.alfresco.service.cmr.dictionary.ConstraintDefinition constraintDefinition,
|
||||
MessageLookup messageLookup)
|
||||
{
|
||||
NodeDefinitionConstraint constraint = new NodeDefinitionConstraint();
|
||||
org.alfresco.rest.api.model.ConstraintDefinition constraint = new org.alfresco.rest.api.model.ConstraintDefinition();
|
||||
constraint.setId(constraintDefinition.getConstraint().getShortName());
|
||||
constraint.setType(constraintDefinition.getConstraint().getType());
|
||||
constraint.setTitle(constraintDefinition.getTitle(messageLookup));
|
||||
@@ -120,5 +115,4 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
constraint.setParameters(constraintDefinition.getConstraint().getParameters());
|
||||
return constraint;
|
||||
}
|
||||
|
||||
}
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.alfresco.repo.dictionary.M2Type;
|
||||
import org.alfresco.repo.dictionary.ValueDataTypeValidator;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.rest.api.CustomModels;
|
||||
import org.alfresco.rest.api.model.AbstractClassModel;
|
||||
import org.alfresco.rest.api.model.AbstractCustomClass;
|
||||
import org.alfresco.rest.api.model.AbstractCommonDetails;
|
||||
import org.alfresco.rest.api.model.CustomAspect;
|
||||
import org.alfresco.rest.api.model.CustomModel;
|
||||
@@ -331,9 +331,9 @@ public class CustomModelsImpl implements CustomModels
|
||||
}
|
||||
}
|
||||
|
||||
private void replacePrefix(List<? extends AbstractClassModel> existingTypesOrAspects, String modelOldNamespacePrefix, String modelNewNamespacePrefix)
|
||||
private void replacePrefix(List<? extends AbstractCustomClass> existingTypesOrAspects, String modelOldNamespacePrefix, String modelNewNamespacePrefix)
|
||||
{
|
||||
for(AbstractClassModel classModel : existingTypesOrAspects)
|
||||
for(AbstractCustomClass classModel : existingTypesOrAspects)
|
||||
{
|
||||
// Type/Aspect's parent name
|
||||
String parentName = classModel.getParentName();
|
||||
@@ -460,7 +460,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
return updateTypeAspect(modelName, type, parameters);
|
||||
}
|
||||
|
||||
private <T extends AbstractClassModel> T updateTypeAspect(String modelName, T classDef, Parameters parameters)
|
||||
private <T extends AbstractCustomClass> T updateTypeAspect(String modelName, T classDef, Parameters parameters)
|
||||
{
|
||||
// Check the current user is authorised to update the custom model
|
||||
validateCurrentUser();
|
||||
@@ -476,7 +476,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
|
||||
ModelDetails existingModelDetails = new ModelDetails(getCustomModelImpl(modelName));
|
||||
|
||||
List<? extends AbstractClassModel> allClassDefs = isAspect ? existingModelDetails.getAspects() : existingModelDetails.getTypes();
|
||||
List<? extends AbstractCustomClass> allClassDefs = isAspect ? existingModelDetails.getAspects() : existingModelDetails.getTypes();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
T existingClassDef = (T) getObjectByName(allClassDefs, name);
|
||||
@@ -1186,7 +1186,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
m2Class.setParentName(parentPrefixedName);
|
||||
}
|
||||
|
||||
private void validateTypeAspectParent(AbstractClassModel typeAspect, CustomModel existingModel)
|
||||
private void validateTypeAspectParent(AbstractCustomClass typeAspect, CustomModel existingModel)
|
||||
{
|
||||
String parentPrefixedName = typeAspect.getParentName();
|
||||
if (StringUtils.isBlank(parentPrefixedName))
|
||||
@@ -1305,7 +1305,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeProperties(AbstractClassModel existingDetails, AbstractClassModel newDetails, Parameters parameters, boolean isModelActive)
|
||||
private void mergeProperties(AbstractCustomClass existingDetails, AbstractCustomClass newDetails, Parameters parameters, boolean isModelActive)
|
||||
{
|
||||
validateList(newDetails.getProperties(), "cmm.rest_api.properties_empty_null");
|
||||
|
||||
@@ -1386,7 +1386,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteProperty(AbstractClassModel existingClassModel, String propertyName)
|
||||
private void deleteProperty(AbstractCustomClass existingClassModel, String propertyName)
|
||||
{
|
||||
// Transform existing properties into a map
|
||||
Map<String, CustomModelProperty> existingProperties = transformToMap(existingClassModel.getProperties(), toNameFunction());
|
||||
@@ -1427,9 +1427,9 @@ public class CustomModelsImpl implements CustomModels
|
||||
return result;
|
||||
}
|
||||
|
||||
private void validateTypeAspectDelete(Collection<? extends AbstractClassModel> list, String classPrefixedName)
|
||||
private void validateTypeAspectDelete(Collection<? extends AbstractCustomClass> list, String classPrefixedName)
|
||||
{
|
||||
for(AbstractClassModel acm : list)
|
||||
for(AbstractCustomClass acm : list)
|
||||
{
|
||||
if(classPrefixedName.equals(acm.getParentName()))
|
||||
{
|
||||
|
@@ -79,12 +79,12 @@ import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.repo.virtual.store.VirtualStore;
|
||||
import org.alfresco.rest.antlr.WhereClauseParser;
|
||||
import org.alfresco.rest.api.Activities;
|
||||
import org.alfresco.rest.api.NodeDefinitionMapper;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.rest.api.QuickShareLinks;
|
||||
import org.alfresco.rest.api.model.AssocChild;
|
||||
import org.alfresco.rest.api.model.AssocTarget;
|
||||
import org.alfresco.rest.api.model.NodeDefinition;
|
||||
import org.alfresco.rest.api.model.ClassDefinition;
|
||||
import org.alfresco.rest.api.model.Document;
|
||||
import org.alfresco.rest.api.model.Folder;
|
||||
import org.alfresco.rest.api.model.LockInfo;
|
||||
@@ -214,7 +214,7 @@ public class NodesImpl implements Nodes
|
||||
private RetryingTransactionHelper retryingTransactionHelper;
|
||||
private LockService lockService;
|
||||
private VirtualStore smartStore; // note: remove as part of REPO-1173
|
||||
private NodeDefinitionMapper nodeDefinitionMapper;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
private enum Activity_Type
|
||||
{
|
||||
@@ -229,10 +229,13 @@ public class NodesImpl implements Nodes
|
||||
private Repository repositoryHelper;
|
||||
private ServiceRegistry sr;
|
||||
private Set<String> defaultIgnoreTypesAndAspects;
|
||||
private Set<String> defaultPersonLookupProperties;
|
||||
|
||||
// ignore types/aspects
|
||||
private Set<QName> ignoreQNames;
|
||||
|
||||
private Set<QName> personLookupProperties = new HashSet<>();
|
||||
|
||||
private ConcurrentHashMap<String,NodeRef> ddCache = new ConcurrentHashMap<>();
|
||||
|
||||
private Set<String> nonAttachContentTypes = Collections.emptySet(); // pre-configured whitelist, eg. images & pdf
|
||||
@@ -276,6 +279,14 @@ public class NodesImpl implements Nodes
|
||||
ignoreQNames.add(createQName(type));
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultPersonLookupProperties != null)
|
||||
{
|
||||
for (String property : defaultPersonLookupProperties)
|
||||
{
|
||||
personLookupProperties.add(createQName(property));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry sr)
|
||||
@@ -303,6 +314,10 @@ public class NodesImpl implements Nodes
|
||||
this.defaultIgnoreTypesAndAspects = ignoreTypesAndAspects;
|
||||
}
|
||||
|
||||
public void setPersonLookupProperties(Set<String> personLookupProperties) {
|
||||
this.defaultPersonLookupProperties = personLookupProperties;
|
||||
}
|
||||
|
||||
public void setPoster(ActivityPoster poster)
|
||||
{
|
||||
this.poster = poster;
|
||||
@@ -313,9 +328,9 @@ public class NodesImpl implements Nodes
|
||||
this.smartStore = smartStore;
|
||||
}
|
||||
|
||||
public void setNodeDefinitionMapper(NodeDefinitionMapper nodeDefinitionMapper)
|
||||
public void setClassDefinitionMapper(ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.nodeDefinitionMapper = nodeDefinitionMapper;
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
// excluded namespaces (aspects, properties, assoc types)
|
||||
@@ -338,13 +353,6 @@ public class NodesImpl implements Nodes
|
||||
ContentModel.PROP_AUTO_VERSION_PROPS,
|
||||
ContentModel.PROP_AUTO_VERSION);
|
||||
|
||||
public static final List<QName> PROPS_USERLOOKUP = Arrays.asList(
|
||||
ContentModel.PROP_CREATOR,
|
||||
ContentModel.PROP_MODIFIER,
|
||||
ContentModel.PROP_OWNER,
|
||||
ContentModel.PROP_LOCK_OWNER,
|
||||
ContentModel.PROP_WORKING_COPY_OWNER);
|
||||
|
||||
public final static Map<String,QName> PARAM_SYNONYMS_QNAME;
|
||||
static
|
||||
{
|
||||
@@ -1033,8 +1041,8 @@ public class NodesImpl implements Nodes
|
||||
|
||||
if (includeParam.contains(PARAM_INCLUDE_DEFINITION))
|
||||
{
|
||||
NodeDefinition nodeDefinition = nodeDefinitionMapper.fromTypeDefinition(getTypeDefinition(nodeRef), dictionaryService);
|
||||
node.setDefinition(nodeDefinition);
|
||||
ClassDefinition classDefinition = classDefinitionMapper.fromDictionaryClassDefinition(getTypeDefinition(nodeRef), dictionaryService);
|
||||
node.setDefinition(classDefinition);
|
||||
}
|
||||
|
||||
node.setNodeType(nodeTypeQName.toPrefixString(namespaceService));
|
||||
@@ -1222,9 +1230,9 @@ public class NodesImpl implements Nodes
|
||||
Serializable value = nodeProps.get(qName);
|
||||
if (value != null)
|
||||
{
|
||||
if (PROPS_USERLOOKUP.contains(qName))
|
||||
if (personLookupProperties.contains(qName))
|
||||
{
|
||||
value = Node.lookupUserInfo((String)value, mapUserInfo, sr.getPersonService());
|
||||
value = Node.lookupUserInfo((String) value, mapUserInfo, personService);
|
||||
}
|
||||
|
||||
// Empty (zero length) string values are considered to be
|
||||
|
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.Types;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.Type;
|
||||
import org.alfresco.rest.api.model.PropertyDefinition;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceException;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TypesImpl extends AbstractClassImpl<Type> implements Types
|
||||
{
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespacePrefixResolver namespaceService;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
public void setNamespaceService(NamespacePrefixResolver namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
public void setClassDefinitionMapper(ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "dictionaryService", dictionaryService);
|
||||
PropertyCheck.mandatory(this, "namespaceService", namespaceService);
|
||||
PropertyCheck.mandatory(this, "classDefinitionMapper", classDefinitionMapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Type> listTypes(Parameters params)
|
||||
{
|
||||
Paging paging = params.getPaging();
|
||||
ModelApiFilter query = getQuery(params.getQuery());
|
||||
Stream<QName> typeList = null;
|
||||
|
||||
if (query != null && query.getModelIds() != null)
|
||||
{
|
||||
validateListParam(query.getModelIds(), PARAM_MODEL_IDS);
|
||||
typeList = query.getModelIds().parallelStream().map(this::getModelTypes).flatMap(Collection::parallelStream);
|
||||
}
|
||||
else if (query != null && query.getParentIds() != null)
|
||||
{
|
||||
validateListParam(query.getParentIds(), PARAM_PARENT_IDS);
|
||||
typeList = query.getParentIds().parallelStream().map(this::getChildTypes).flatMap(Collection::parallelStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeList = this.dictionaryService.getAllTypes().parallelStream();
|
||||
}
|
||||
|
||||
List<Type> allTypes = typeList.filter((qName) -> filterByNamespace(query, qName))
|
||||
.map((qName) -> this.convertToType(dictionaryService.getType(qName)))
|
||||
.collect(Collectors.toList());
|
||||
return createPagedResult(allTypes, paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType(String typeId)
|
||||
{
|
||||
if (typeId == null)
|
||||
throw new InvalidArgumentException("Invalid parameter: unknown scheme specified");
|
||||
|
||||
TypeDefinition typeDefinition = null;
|
||||
|
||||
try
|
||||
{
|
||||
typeDefinition = dictionaryService.getType(QName.createQName(typeId, this.namespaceService));
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new EntityNotFoundException(typeId);
|
||||
}
|
||||
|
||||
if (typeDefinition == null)
|
||||
throw new EntityNotFoundException(typeId);
|
||||
|
||||
return this.convertToType(typeDefinition);
|
||||
}
|
||||
|
||||
public Type convertToType(TypeDefinition typeDefinition)
|
||||
{
|
||||
List<PropertyDefinition> properties = this.classDefinitionMapper.fromDictionaryClassDefinition(typeDefinition, dictionaryService).getProperties();
|
||||
return new Type(typeDefinition, dictionaryService, properties);
|
||||
}
|
||||
|
||||
private Collection<QName> getModelTypes(String modelId)
|
||||
{
|
||||
ModelDefinition modelDefinition = null;
|
||||
|
||||
if (modelId == null)
|
||||
throw new InvalidArgumentException("modelId is null");
|
||||
|
||||
try
|
||||
{
|
||||
modelDefinition = this.dictionaryService.getModel(QName.createQName(modelId, this.namespaceService));
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
return this.dictionaryService.getTypes(modelDefinition.getName());
|
||||
}
|
||||
|
||||
private Collection<QName> getChildTypes(String typeId)
|
||||
{
|
||||
Collection<QName> subTypes = null;
|
||||
try
|
||||
{
|
||||
QName parentType = QName.createQName(typeId, this.namespaceService);
|
||||
subTypes = this.dictionaryService.getSubTypes(parentType, true);
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
return subTypes;
|
||||
}
|
||||
}
|
@@ -25,15 +25,12 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.lookups;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||
import org.alfresco.rest.api.impl.NodesImpl;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.api.model.UserInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -63,10 +60,9 @@ public class PersonPropertyLookup implements PropertyLookup<String>
|
||||
return supported;
|
||||
}
|
||||
|
||||
public void setSupported(List<String> supported)
|
||||
public void setSupported(Set<String> supported)
|
||||
{
|
||||
NodesImpl.PROPS_USERLOOKUP.forEach(entry -> this.supported.add(entry.toString()));
|
||||
this.supported.addAll(supported);
|
||||
this.supported = supported;
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
|
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.NamespaceDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractClass extends ClassDefinition implements Comparable<AbstractClass>
|
||||
{
|
||||
String id;
|
||||
String title;
|
||||
String description;
|
||||
String parentId;
|
||||
Model model;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Model getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(Model model)
|
||||
{
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
<T> List<T> setList(List<T> sourceList)
|
||||
{
|
||||
if (sourceList == null)
|
||||
{
|
||||
return Collections.<T> emptyList();
|
||||
}
|
||||
return new ArrayList<>(sourceList);
|
||||
}
|
||||
|
||||
String getParentNameAsString(QName parentQName)
|
||||
{
|
||||
if (parentQName != null)
|
||||
{
|
||||
return parentQName.toPrefixString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Model getModelInfo(org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, MessageLookup messageLookup)
|
||||
{
|
||||
final ModelDefinition modelDefinition = classDefinition.getModel();
|
||||
final String prefix = classDefinition.getName().toPrefixString().split(":")[0];
|
||||
|
||||
final NamespaceDefinition namespaceDefinition = modelDefinition.getNamespaces().stream()
|
||||
.filter(definition -> definition.getPrefix().equals(prefix))
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
final String modelId = modelDefinition.getName().toPrefixString();
|
||||
final String author = modelDefinition.getAuthor();
|
||||
final String description = modelDefinition.getDescription(messageLookup);
|
||||
|
||||
return new Model(modelId, author, description, namespaceDefinition.getUri(), namespaceDefinition.getPrefix());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(AbstractClass other)
|
||||
{
|
||||
return this.id.compareTo(other.getId());
|
||||
}
|
||||
}
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.alfresco.service.namespace.QName;
|
||||
/**
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public abstract class AbstractClassModel extends AbstractCommonDetails
|
||||
public abstract class AbstractCustomClass extends AbstractCommonDetails
|
||||
{
|
||||
/* package */String parentName;
|
||||
/* package */List<CustomModelProperty> properties = Collections.emptyList();
|
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Aspect extends AbstractClass
|
||||
{
|
||||
public Aspect()
|
||||
{
|
||||
}
|
||||
|
||||
public Aspect(AspectDefinition aspectDefinition, MessageLookup messageLookup, List<PropertyDefinition> properties)
|
||||
{
|
||||
this.id = aspectDefinition.getName().toPrefixString();
|
||||
this.title = aspectDefinition.getTitle(messageLookup);
|
||||
this.description = aspectDefinition.getDescription(messageLookup);
|
||||
this.parentId = getParentNameAsString(aspectDefinition.getParentName());
|
||||
this.properties = setList(properties);
|
||||
this.model = getModelInfo(aspectDefinition, messageLookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(512);
|
||||
builder.append("Aspect [id=").append(this.id)
|
||||
.append(", title=").append(this.title)
|
||||
.append(", description=").append(this.description)
|
||||
.append(", parentId=").append(parentId)
|
||||
.append(", properties=").append(properties)
|
||||
.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -31,17 +31,17 @@ import java.util.List;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinition
|
||||
public class ClassDefinition
|
||||
{
|
||||
|
||||
List <NodeDefinitionProperty> properties;
|
||||
List <PropertyDefinition> properties;
|
||||
|
||||
public List<NodeDefinitionProperty> getProperties()
|
||||
public List<PropertyDefinition> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<NodeDefinitionProperty> properties)
|
||||
public void setProperties(List<PropertyDefinition> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinitionConstraint
|
||||
public class ConstraintDefinition
|
||||
{
|
||||
private String id;
|
||||
private String type;
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
/**
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class CustomAspect extends AbstractClassModel
|
||||
public class CustomAspect extends AbstractCustomClass
|
||||
{
|
||||
|
||||
public CustomAspect()
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
/**
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class CustomType extends AbstractClassModel
|
||||
public class CustomType extends AbstractCustomClass
|
||||
{
|
||||
|
||||
public CustomType()
|
||||
|
105
remote-api/src/main/java/org/alfresco/rest/api/model/Model.java
Normal file
105
remote-api/src/main/java/org/alfresco/rest/api/model/Model.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
public class Model implements Comparable<Model>
|
||||
{
|
||||
private String id;
|
||||
private String author;
|
||||
private String description;
|
||||
private String namespaceUri;
|
||||
private String namespacePrefix;
|
||||
|
||||
public Model()
|
||||
{
|
||||
}
|
||||
|
||||
public Model(String name, String author, String description, String namespaceUri, String namespacePrefix)
|
||||
{
|
||||
this.id = name;
|
||||
this.author = author;
|
||||
this.description = description;
|
||||
this.namespaceUri = namespaceUri;
|
||||
this.namespacePrefix = namespacePrefix;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getNamespaceUri()
|
||||
{
|
||||
return namespaceUri;
|
||||
}
|
||||
|
||||
public void setNamespaceUri(String namespaceUri)
|
||||
{
|
||||
this.namespaceUri = namespaceUri;
|
||||
}
|
||||
|
||||
public String getNamespacePrefix()
|
||||
{
|
||||
return namespacePrefix;
|
||||
}
|
||||
|
||||
public void setNamespacePrefix(String namespacePrefix)
|
||||
{
|
||||
this.namespacePrefix = namespacePrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Model model)
|
||||
{
|
||||
return this.id.compareTo(model.getId());
|
||||
}
|
||||
}
|
@@ -95,7 +95,7 @@ public class Node implements Comparable<Node>
|
||||
|
||||
protected List<String> allowableOperations;
|
||||
protected NodePermissions nodePermissions;
|
||||
protected NodeDefinition definition;
|
||||
protected ClassDefinition definition;
|
||||
|
||||
//optional SearchEntry (only ever returned from a search)
|
||||
protected SearchEntry search = null;
|
||||
@@ -470,12 +470,12 @@ public class Node implements Comparable<Node>
|
||||
this.secondaryChildren = secondaryChildren;
|
||||
}
|
||||
|
||||
public NodeDefinition getDefinition()
|
||||
public ClassDefinition getDefinition()
|
||||
{
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(NodeDefinition definition)
|
||||
public void setDefinition(ClassDefinition definition)
|
||||
{
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinitionProperty
|
||||
public class PropertyDefinition
|
||||
{
|
||||
private String id;
|
||||
private String title;
|
||||
@@ -42,7 +42,7 @@ public class NodeDefinitionProperty
|
||||
private Boolean isMandatory;
|
||||
private Boolean isMandatoryEnforced;
|
||||
private Boolean isProtected;
|
||||
private List<NodeDefinitionConstraint> constraints;
|
||||
private List<ConstraintDefinition> constraints;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
@@ -104,12 +104,12 @@ public class NodeDefinitionProperty
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public List<NodeDefinitionConstraint> getConstraints()
|
||||
public List<ConstraintDefinition> getConstraints()
|
||||
{
|
||||
return constraints;
|
||||
}
|
||||
|
||||
public void setConstraints(List<NodeDefinitionConstraint> constraints)
|
||||
public void setConstraints(List<ConstraintDefinition> constraints)
|
||||
{
|
||||
this.constraints = constraints;
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Type extends AbstractClass
|
||||
{
|
||||
public Type()
|
||||
{
|
||||
}
|
||||
|
||||
public Type(TypeDefinition typeDefinition, MessageLookup messageLookup, List<PropertyDefinition> properties)
|
||||
{
|
||||
this.id = typeDefinition.getName().toPrefixString();
|
||||
this.title = typeDefinition.getTitle(messageLookup);
|
||||
this.description = typeDefinition.getDescription(messageLookup);
|
||||
this.parentId = getParentNameAsString(typeDefinition.getParentName());
|
||||
this.properties = setList(properties);
|
||||
this.model = getModelInfo(typeDefinition, messageLookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(512);
|
||||
builder.append("Type [id=").append(this.id)
|
||||
.append(", title=").append(this.title)
|
||||
.append(", description=").append(this.description)
|
||||
.append(", parentId=").append(parentId)
|
||||
.append(", properties=").append(properties)
|
||||
.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 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
|
||||
@@ -25,6 +25,12 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.search;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.search.impl.querymodel.impl.db.DBStats;
|
||||
import org.alfresco.repo.search.impl.querymodel.impl.db.SingleTaskRestartableWatch;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.api.search.context.SearchRequestContext;
|
||||
import org.alfresco.rest.api.search.impl.ResultMapper;
|
||||
@@ -45,14 +51,14 @@ import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.extensions.webscripts.AbstractWebScript;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StopWatch.TaskInfo;
|
||||
|
||||
/**
|
||||
* An implementation of the {{baseUrl}}/{{networkId}}/public/search/versions/1/search endpoint
|
||||
@@ -62,12 +68,15 @@ import java.util.List;
|
||||
public class SearchApiWebscript extends AbstractWebScript implements RecognizedParamsExtractor, RequestReader, ResponseWriter,
|
||||
InitializingBean
|
||||
{
|
||||
protected static final Log logger = LogFactory.getLog(SearchApiWebscript.class);
|
||||
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private SearchService searchService;
|
||||
private SearchMapper searchMapper;
|
||||
private ResultMapper resultMapper;
|
||||
protected ApiAssistant assistant;
|
||||
protected ResourceWebScriptHelper helper;
|
||||
private boolean statsEnabled;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
@@ -82,7 +91,7 @@ public class SearchApiWebscript extends AbstractWebScript implements RecognizedP
|
||||
@Override
|
||||
public void execute(WebScriptRequest webScriptRequest, WebScriptResponse webScriptResponse) throws IOException
|
||||
{
|
||||
|
||||
StopWatch apiStopWatch = new StopWatch();
|
||||
try {
|
||||
//Turn JSON into a Java object respresentation
|
||||
SearchQuery searchQuery = extractJsonContent(webScriptRequest, assistant.getJsonHelper(), SearchQuery.class);
|
||||
@@ -97,12 +106,43 @@ public class SearchApiWebscript extends AbstractWebScript implements RecognizedP
|
||||
SearchParameters searchParams = searchMapper.toSearchParameters(params, searchQuery, searchRequestContext);
|
||||
|
||||
//Call searchService
|
||||
apiStopWatch.start("nodes");
|
||||
ResultSet results = searchService.query(searchParams);
|
||||
apiStopWatch.stop();
|
||||
|
||||
//Turn solr results into JSON
|
||||
apiStopWatch.start("props");
|
||||
CollectionWithPagingInfo<Node> resultJson = resultMapper.toCollectionWithPagingInfo(params, searchRequestContext, searchQuery, results);
|
||||
|
||||
//Post-process the request and pass in params, eg. params.getFilter()
|
||||
Object toRender = helper.processAdditionsToTheResponse(null, null, null, params, resultJson);
|
||||
apiStopWatch.stop();
|
||||
|
||||
// store execution stats in a special header if enabled
|
||||
if (statsEnabled)
|
||||
{
|
||||
// store execution time in a special header
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("api={");
|
||||
sb.append("tot=").append(apiStopWatch.getTotalTimeMillis()).append("ms,");
|
||||
addStopWatchStats(sb, apiStopWatch);
|
||||
sb.append("}; ");
|
||||
|
||||
sb.append("db={");
|
||||
addStopWatchStats(sb, DBStats.queryStopWatch());
|
||||
sb.append("}; ");
|
||||
|
||||
sb.append("query={");
|
||||
addStopWatchStats(sb, DBStats.handlerStopWatch());
|
||||
sb.append(",");
|
||||
addStopWatchStats(sb, DBStats.aclReadStopWatch());
|
||||
sb.append(",");
|
||||
addStopWatchStats(sb, DBStats.aclOwnerStopWatch());
|
||||
sb.append("}");
|
||||
|
||||
webScriptResponse.addHeader("X-Response-Stats", sb.toString());
|
||||
}
|
||||
|
||||
//Write response
|
||||
setResponse(webScriptResponse, DEFAULT_SUCCESS);
|
||||
@@ -113,6 +153,44 @@ public class SearchApiWebscript extends AbstractWebScript implements RecognizedP
|
||||
}
|
||||
}
|
||||
|
||||
private void addStopWatchStats(StringBuilder sb, StopWatch watch)
|
||||
{
|
||||
boolean first = true;
|
||||
|
||||
for (TaskInfo task : watch.getTaskInfo())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
sb.append(task.getTaskName())
|
||||
.append("=")
|
||||
.append(task.getTimeMillis())
|
||||
.append("ms");
|
||||
|
||||
int pc = Math.round(100 * task.getTimeNanos() / watch.getTotalTimeNanos());
|
||||
sb.append("(")
|
||||
.append(pc).append("%")
|
||||
.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
private void addStopWatchStats(StringBuilder sb, SingleTaskRestartableWatch watch)
|
||||
{
|
||||
long decimillis = (watch.getTotalTimeMicros()+5)/100;
|
||||
double millis = decimillis/10.0;
|
||||
|
||||
sb.append(watch.getName())
|
||||
.append("=")
|
||||
.append(millis)
|
||||
.append("ms");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Params object, parameters come from the SearchQuery json not the request
|
||||
* @param webScriptRequest
|
||||
@@ -165,4 +243,10 @@ public class SearchApiWebscript extends AbstractWebScript implements RecognizedP
|
||||
{
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
// receiving as a string because of known issue: https://jira.spring.io/browse/SPR-9989
|
||||
public void setStatsEnabled(String enabled) {
|
||||
this.statsEnabled = Boolean.valueOf(enabled);
|
||||
logger.info("API stats header: " + (this.statsEnabled ? "enabled" : "disabled"));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.types;
|
||||
|
||||
import org.alfresco.rest.api.Types;
|
||||
import org.alfresco.rest.api.model.Type;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@EntityResource(name = "types", title = "types")
|
||||
public class TypeEntityResource implements EntityResourceAction.ReadById<Type>, EntityResourceAction.Read<Type>, InitializingBean
|
||||
{
|
||||
|
||||
private Types types;
|
||||
|
||||
public void setTypes(Types types)
|
||||
{
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("types", this.types);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Type> readAll(Parameters params)
|
||||
{
|
||||
return types.listTypes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type readById(String id, Parameters parameters)
|
||||
{
|
||||
return types.getType(id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
@WebApi(name="alfresco", scope= Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rest.api.types;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -20,7 +20,6 @@ admin-console.close=Close
|
||||
admin-console.password.show=Show Password
|
||||
admin-console.password.hide=Hide Password
|
||||
admin-console.unavailable=Information is currently unavailable
|
||||
admin-console.not.installed=Not Installed
|
||||
|
||||
admin-console.requesterror=We couldn't complete your request. Try again.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Zav\u0159\u00edt
|
||||
admin-console.password.show=Zobrazit heslo
|
||||
admin-console.password.hide=Skr\u00fdt heslo
|
||||
admin-console.unavailable=Informace nejsou moment\u00e1ln\u011b k\u00a0dispozici
|
||||
admin-console.not.installed=Nen\u00ed nainstalov\u00e1no
|
||||
|
||||
admin-console.requesterror=V\u00e1\u0161 po\u017eadavek nebylo mo\u017en\u00e9 dokon\u010dit. Zkuste to znovu.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Luk
|
||||
admin-console.password.show=Vis adgangskode
|
||||
admin-console.password.hide=Skjul adgangskode
|
||||
admin-console.unavailable=Oplysningerne er i \u00f8jeblikket ikke tilg\u00e6ngelige
|
||||
admin-console.not.installed=Ikke installeret
|
||||
|
||||
admin-console.requesterror=Vi kunne ikke fuldf\u00f8re anmodningen. Pr\u00f8v igen.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Schlie\u00dfen
|
||||
admin-console.password.show=Passwort anzeigen
|
||||
admin-console.password.hide=Passwort ausblenden
|
||||
admin-console.unavailable=Information ist derzeit nicht verf\u00fcgbar
|
||||
admin-console.not.installed=Nicht installiert
|
||||
|
||||
admin-console.requesterror=Die Anfrage konnte nicht durchgef\u00fchrt werden.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Cerrar
|
||||
admin-console.password.show=Mostrar contrase\u00f1a
|
||||
admin-console.password.hide=Ocultar contrase\u00f1a
|
||||
admin-console.unavailable=La informaci\u00f3n no est\u00e1 disponible en este momento
|
||||
admin-console.not.installed=No instalado
|
||||
|
||||
admin-console.requesterror=No se ha podido realizar la solicitud.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Sulje
|
||||
admin-console.password.show=N\u00e4yt\u00e4 salasana
|
||||
admin-console.password.hide=Piilota salasana
|
||||
admin-console.unavailable=Tiedot eiv\u00e4t ole juuri nyt saatavilla
|
||||
admin-console.not.installed=Ei asennettu
|
||||
|
||||
admin-console.requesterror=Pyynn\u00f6n suorittaminen ei onnistu. Yrit\u00e4 uudelleen.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Fermer
|
||||
admin-console.password.show=Afficher le mot de passe
|
||||
admin-console.password.hide=Masquer le mot de passe
|
||||
admin-console.unavailable=Informations actuellement indisponibles
|
||||
admin-console.not.installed=Pas install\u00e9
|
||||
|
||||
admin-console.requesterror=Echec de la requ\u00eate.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Chiudi
|
||||
admin-console.password.show=Mostra password
|
||||
admin-console.password.hide=Nascondi password
|
||||
admin-console.unavailable=Le informazioni non sono al momento disponibili
|
||||
admin-console.not.installed=Non installato
|
||||
|
||||
admin-console.requesterror=Impossibile completare la richiesta.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=\u9589\u3058\u308b
|
||||
admin-console.password.show=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8868\u793a\u3059\u308b
|
||||
admin-console.password.hide=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b
|
||||
admin-console.unavailable=\u73fe\u5728\u3001\u60c5\u5831\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093
|
||||
admin-console.not.installed=\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093
|
||||
|
||||
admin-console.requesterror=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5b8c\u4e86\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Lukk
|
||||
admin-console.password.show=Vis passord
|
||||
admin-console.password.hide=Skjul passord
|
||||
admin-console.unavailable=Informasjon er for tiden ikke tilgjengelig
|
||||
admin-console.not.installed=Ikke installert
|
||||
|
||||
admin-console.requesterror=Vi kunne ikke fullf\u00f8re foresp\u00f8rselen.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Sluiten
|
||||
admin-console.password.show=Wachtwoord weergeven
|
||||
admin-console.password.hide=Wachtwoord verbergen
|
||||
admin-console.unavailable=Informatie is momenteel niet beschikbaar
|
||||
admin-console.not.installed=Niet ge\u00efnstalleerd
|
||||
|
||||
admin-console.requesterror=Kan de aanvraag niet uitvoeren.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Zamknij
|
||||
admin-console.password.show=Poka\u017c has\u0142o
|
||||
admin-console.password.hide=Ukryj has\u0142o
|
||||
admin-console.unavailable=Informacja nie jest aktualnie dost\u0119pna
|
||||
admin-console.not.installed=Niezainstalowane
|
||||
|
||||
admin-console.requesterror=Nie mo\u017cna wykona\u0107 Twojego zapytania. Spr\u00f3buj ponownie.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Fechar
|
||||
admin-console.password.show=Mostrar senha
|
||||
admin-console.password.hide=Ocultar senha
|
||||
admin-console.unavailable=Informa\u00e7\u00e3o indispon\u00edvel no momento
|
||||
admin-console.not.installed=N\u00e3o instalado
|
||||
|
||||
admin-console.requesterror=N\u00e3o conseguimos concluir a solicita\u00e7\u00e3o.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=\u0417\u0430\u043a\u0440\u044b\u0442\u044c
|
||||
admin-console.password.show=\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c
|
||||
admin-console.password.hide=\u0421\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c
|
||||
admin-console.unavailable=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430
|
||||
admin-console.not.installed=\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e
|
||||
|
||||
admin-console.requesterror=\u041d\u0430\u043c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=\u5173\u95ed
|
||||
admin-console.password.show=\u663e\u793a\u5bc6\u7801
|
||||
admin-console.password.hide=\u9690\u85cf\u5bc6\u7801
|
||||
admin-console.unavailable=\u4fe1\u606f\u5f53\u524d\u4e0d\u53ef\u7528
|
||||
admin-console.not.installed=\u672a\u5b89\u88c5
|
||||
|
||||
admin-console.requesterror=\u6211\u4eec\u65e0\u6cd5\u5b8c\u6210\u8bf7\u6c42\u3002
|
||||
|
||||
|
@@ -6,7 +6,7 @@ framework.exception.InvalidProperty=Ominaisuutta {0}, jonka arvo on {1}, ei tuet
|
||||
framework.exception.InvalidQuery=Vastaanotettiin virheellinen WHERE-kysely. {0}
|
||||
framework.exception.InvalidSelect=Vastaanotettiin virheellinen {1}-kysely. {0}
|
||||
framework.exception.NotFound={0}: ei l\u00f6ydy
|
||||
framework.exception.EntityNotFound=Entiteetti\u00e4, jonka tunnus on {0}, ei l\u00f6ydy.
|
||||
framework.exception.EntityNotFound=Entiteetti\u00e4, jonka tunnus on {0}, ei l\u00f6ydy
|
||||
framework.exception.RelationshipNotFound=Suhderesurssia ei l\u00f6ydy entiteetille, jonka tunnus on {0} ja suhdetunnus {1}
|
||||
framework.exception.PermissionDenied=K\u00e4ytt\u00f6 estettiin
|
||||
framework.exception.StaleEntity=Yritys p\u00e4ivitt\u00e4\u00e4 vanhentunut entiteetti
|
||||
|
@@ -23,4 +23,7 @@
|
||||
# See issue REPO-2575 for details.
|
||||
alfresco.restApi.basicAuthScheme=false
|
||||
# REPO-4388 allow CORS headers in transaction response
|
||||
webscripts.transaction.preserveHeadersPattern=Access-Control-.*
|
||||
webscripts.transaction.preserveHeadersPattern=Access-Control-.*
|
||||
|
||||
# REPO-5371 enable stats header in API response (only search atm)
|
||||
webscripts.stats.enabled=false
|
@@ -518,7 +518,19 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="nodeDefinitionMapper" class="org.alfresco.rest.api.impl.NodeDefinitionMapperImpl"/>
|
||||
<bean id="nodes.personLookupProperties" class="org.springframework.beans.factory.config.SetFactoryBean">
|
||||
<property name="sourceSet">
|
||||
<set>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}creator</value>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}modifier</value>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}owner</value>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}lockOwner</value>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}workingCopyOwner</value>
|
||||
</set>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="classDefinitionMapper" class="org.alfresco.rest.api.impl.ClassDefinitionMapperImpl"/>
|
||||
|
||||
<bean id="nodes" class="org.alfresco.rest.api.impl.NodesImpl" init-method="init">
|
||||
<property name="serviceRegistry" ref="ServiceRegistry"/>
|
||||
@@ -527,9 +539,10 @@
|
||||
<property name="behaviourFilter" ref="policyBehaviourFilter"/>
|
||||
<property name="ignoreTypes" ref="nodes.ignoreTypes"/>
|
||||
<property name="nonAttachContentTypes" ref="nodes.nonAttachContentTypes"/>
|
||||
<property name="personLookupProperties" ref="nodes.personLookupProperties"/>
|
||||
<property name="poster" ref="activitiesPoster" />
|
||||
<property name="smartStore" ref="smartStore"/>
|
||||
<property name="nodeDefinitionMapper" ref="nodeDefinitionMapper" />
|
||||
<property name="classDefinitionMapper" ref="classDefinitionMapper" />
|
||||
</bean>
|
||||
|
||||
<bean id="Nodes" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
@@ -768,7 +781,7 @@
|
||||
<bean id="siteSurfConfig" class="org.alfresco.rest.api.impl.SiteSurfConfig">
|
||||
<property name="configPath" value="alfresco/bootstrap/site"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="Sites" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>org.alfresco.rest.api.Sites</value>
|
||||
@@ -835,14 +848,15 @@
|
||||
<bean id="publicapi.personPropertyLookup" class="org.alfresco.rest.api.lookups.PersonPropertyLookup">
|
||||
<property name="serviceRegistry" ref="ServiceRegistry"/>
|
||||
<property name="supported">
|
||||
<list>
|
||||
<value>cm:creator</value>
|
||||
<value>cm:modifier</value>
|
||||
<value>cm:owner</value>
|
||||
<value>creator</value>
|
||||
<value>modifier</value>
|
||||
<value>owner</value>
|
||||
</list>
|
||||
<bean parent="nodes.personLookupProperties" class="org.springframework.beans.factory.config.SetFactoryBean">
|
||||
<property name="sourceSet">
|
||||
<set merge="true">
|
||||
<value>creator</value>
|
||||
<value>modifier</value>
|
||||
<value>owner</value>
|
||||
</set>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
@@ -1010,6 +1024,7 @@
|
||||
<property name="helper" ref="webscriptHelper" />
|
||||
<property name="resultMapper" ref="searchapiResultMapper" />
|
||||
<property name="searchMapper" ref="searchapiSearchMapper" />
|
||||
<property name="statsEnabled" value="${webscripts.stats.enabled}" />
|
||||
</bean>
|
||||
|
||||
<bean id="webscript.org.alfresco.api.SearchSQLApiWebscript.post"
|
||||
@@ -1066,6 +1081,7 @@
|
||||
<property name="authorityService" ref="AuthorityService" />
|
||||
<property name="tenantAdminService" ref="tenantAdminService"/>
|
||||
<property name="networksService" ref="networksService"/>
|
||||
<property name="cmisCreateDocRequestRenditionsSet" value="${cmis.create.doc.request.renditions.set}" />
|
||||
</bean>
|
||||
|
||||
<bean id="cmisDispatcherRegistry" class="org.alfresco.opencmis.CMISDispatcherRegistryImpl">
|
||||
@@ -1476,4 +1492,52 @@
|
||||
<bean class="org.alfresco.rest.api.groups.SiteGroupsRelation">
|
||||
<property name="sites" ref="Sites" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.aspects.AspectEntityResource">
|
||||
<property name="aspects" ref="Aspects" />
|
||||
</bean>
|
||||
|
||||
<bean id="aspects" class="org.alfresco.rest.api.impl.AspectsImpl">
|
||||
<property name="dictionaryService" ref="DictionaryService" />
|
||||
<property name="namespaceService" ref="namespaceService"/>
|
||||
<property name="classDefinitionMapper" ref="classDefinitionMapper" />
|
||||
</bean>
|
||||
|
||||
<bean id="Aspects" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>org.alfresco.rest.api.Aspects</value>
|
||||
</property>
|
||||
<property name="target">
|
||||
<ref bean="aspects" />
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<idref bean="legacyExceptionInterceptor" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.types.TypeEntityResource">
|
||||
<property name="types" ref="Types" />
|
||||
</bean>
|
||||
|
||||
<bean id="types" class="org.alfresco.rest.api.impl.TypesImpl">
|
||||
<property name="dictionaryService" ref="DictionaryService" />
|
||||
<property name="namespaceService" ref="namespaceService"/>
|
||||
<property name="classDefinitionMapper" ref="classDefinitionMapper" />
|
||||
</bean>
|
||||
|
||||
<bean id="Types" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>org.alfresco.rest.api.Types</value>
|
||||
</property>
|
||||
<property name="target">
|
||||
<ref bean="types" />
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<idref bean="legacyExceptionInterceptor" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
|
@@ -7,7 +7,7 @@ communitysummary.system-information.cpus=CPU'er
|
||||
|
||||
communitysummary.system-information.java-home=Java Home
|
||||
communitysummary.system-information.java-version=Java-version
|
||||
communitysummary.system-information.java-vm-vendor=Java VM-udbyder
|
||||
communitysummary.system-information.java-vm-vendor=Java VM-leverand\u00f8r
|
||||
communitysummary.system-information.operating-system=Operativsystem
|
||||
communitysummary.system-information.version=Version
|
||||
communitysummary.system-information.architecture=Arkitektur
|
||||
|
@@ -1,30 +1,32 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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 Remote API
|
||||
* %%
|
||||
* 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.web.scripts.preference;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
@@ -204,7 +206,7 @@ public class PreferenceServiceTest extends BaseWebScriptTest
|
||||
{
|
||||
assertEquals("value", jsonObject.get("stringValue"));
|
||||
assertEquals(10, jsonObject.get("numberValue"));
|
||||
assertEquals(3.142, jsonObject.get("numberValue2"));
|
||||
assertEquals(BigDecimal.valueOf(3.142), jsonObject.get("numberValue2"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -243,7 +243,7 @@ public class QuickShareRestApiTest extends BaseWebScriptTest
|
||||
// get content thumbnail for node (authenticated)
|
||||
rsp = sendRequest(new GetRequest(AUTH_CONTENT_THUMBNAIL_URL.replace("{node_ref_3}", testNodeRef_3).replace("{thumbnailname}", "doclib")), expectedStatusOK, USER_ONE);
|
||||
String type = rsp.getContentType();
|
||||
assertEquals(TEST_MIMETYPE_PNG, type);
|
||||
assertEquals(TEST_MIMETYPE_PNG + ";charset=UTF-8", type);
|
||||
|
||||
// As user two ...
|
||||
|
||||
@@ -279,7 +279,7 @@ public class QuickShareRestApiTest extends BaseWebScriptTest
|
||||
// get content thumbnail for share (note: can be unauthenticated)
|
||||
rsp = sendRequest(new GetRequest(SHARE_CONTENT_THUMBNAIL_URL.replace("{shared_id}", sharedId).replace("{thumbnailname}", "doclib")), expectedStatusOK, USER_TWO);
|
||||
type = rsp.getContentType();
|
||||
assertEquals(TEST_MIMETYPE_PNG, type);
|
||||
assertEquals(TEST_MIMETYPE_PNG + ";charset=UTF-8", type);
|
||||
|
||||
// As user one ...
|
||||
|
||||
|
@@ -23,77 +23,77 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.web.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
/**
|
||||
* Tests for the HttpRangeProcessor class.
|
||||
*
|
||||
* @author Ray Gauss II
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class HttpRangeProcessorTest
|
||||
{
|
||||
private HttpRangeProcessor httpRangeProcessor;
|
||||
private @Mock ContentReader reader;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
httpRangeProcessor = new HttpRangeProcessor(null);
|
||||
when(reader.getMimetype()).thenReturn("image/jpeg");
|
||||
when(reader.getSize()).thenReturn(19133L);
|
||||
when(reader.getContentInputStream()).thenReturn(this.getClass().getResourceAsStream("/test.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidRange() throws IOException
|
||||
{
|
||||
testRange("700-800", HttpServletResponse.SC_PARTIAL_CONTENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartOnlyRange() throws IOException
|
||||
{
|
||||
testRange("19000-", HttpServletResponse.SC_PARTIAL_CONTENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNegativeRange() throws IOException
|
||||
{
|
||||
testRange("800-700", HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeyondLengthRange() throws IOException
|
||||
{
|
||||
testRange("20000-", HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
|
||||
}
|
||||
|
||||
protected void testRange(String range, int expectedStatus) throws IOException
|
||||
{
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
boolean result = httpRangeProcessor.processRange(response, reader, range, null, null, null, null);
|
||||
|
||||
assertTrue(result);
|
||||
assertEquals(expectedStatus, response.getStatus());
|
||||
reader.getContentInputStream().close();
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.repo.web.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
/**
|
||||
* Tests for the HttpRangeProcessor class.
|
||||
*
|
||||
* @author Ray Gauss II
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class HttpRangeProcessorTest
|
||||
{
|
||||
private HttpRangeProcessor httpRangeProcessor;
|
||||
private @Mock ContentReader reader;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
httpRangeProcessor = new HttpRangeProcessor(null);
|
||||
when(reader.getMimetype()).thenReturn("image/jpeg");
|
||||
when(reader.getSize()).thenReturn(19133L);
|
||||
when(reader.getContentInputStream()).thenReturn(this.getClass().getResourceAsStream("/test.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidRange() throws IOException
|
||||
{
|
||||
testRange("700-800", HttpServletResponse.SC_PARTIAL_CONTENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartOnlyRange() throws IOException
|
||||
{
|
||||
testRange("19000-", HttpServletResponse.SC_PARTIAL_CONTENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNegativeRange() throws IOException
|
||||
{
|
||||
testRange("800-700", HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeyondLengthRange() throws IOException
|
||||
{
|
||||
testRange("20000-", HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
|
||||
}
|
||||
|
||||
protected void testRange(String range, int expectedStatus) throws IOException
|
||||
{
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
boolean result = httpRangeProcessor.processRange(response, reader, range, null, null, null, null);
|
||||
|
||||
assertTrue(result);
|
||||
assertEquals(expectedStatus, response.getStatus());
|
||||
reader.getContentInputStream().close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,307 +1,307 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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.webdav;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.audit.model.AuditModelRegistryImpl;
|
||||
import org.alfresco.repo.node.archive.NodeArchiveService;
|
||||
import org.alfresco.repo.nodelocator.CompanyHomeNodeLocator;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.testing.category.LuceneTests;
|
||||
import org.apache.chemistry.opencmis.commons.spi.Holder;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
/**
|
||||
* Tests {@link GetMethod} in real environment, using {@link Mock} HTTP request and {@link Mock} HTTP response
|
||||
*
|
||||
* @author Dmitry Velichkevich
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@Category(LuceneTests.class)
|
||||
public class GetMethodRegressionTest extends TestCase
|
||||
{
|
||||
private static final int DOCUMENTS_AMOUNT_FOR_GET_METHOD_TEST = 25;
|
||||
|
||||
|
||||
private static final String HTTP_METHOD_GET = "GET";
|
||||
|
||||
private static final String TEST_ENCODING = "UTF-8";
|
||||
|
||||
private static final String TEST_MIMETYPE = "text/plain";
|
||||
|
||||
private static final String TEST_WEBDAV_URL_PREFIX = "/";
|
||||
|
||||
private static final String AUDIT_REGISTRY_BEAN_NAME = "Audit";
|
||||
|
||||
private static final String PROP_AUDIT_ALFRESCO_ACCESS_ENABLED = "audit.alfresco-access.enabled";
|
||||
|
||||
private static final String ROOT_TEST_FOLDER_NAME = "TestFolder-" + System.currentTimeMillis();
|
||||
|
||||
private static final String TEST_DOCUMENT_NAME_PATTERN = "TestDocument-%d-%d.pdf";
|
||||
|
||||
private static final String TEXT_DOCUMENT_CONTENT_PATTERN = "Text content for '%s' document";
|
||||
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private WebDAVHelper davHelper;
|
||||
|
||||
private AuditService auditService;
|
||||
|
||||
private FileFolderService fileFolderService;
|
||||
|
||||
private AuditModelRegistryImpl auditRegistry;
|
||||
|
||||
private TransactionService transactionService;
|
||||
|
||||
|
||||
private UserTransaction transaction;
|
||||
|
||||
private GetMethod testingMethod;
|
||||
|
||||
private NodeRef companyHomeNodeRef;
|
||||
|
||||
private NodeRef rootTestFolder;
|
||||
|
||||
private MockHttpServletResponse mockResponse;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
applicationContext = ApplicationContextHelper.getApplicationContext();
|
||||
ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||
davHelper = (WebDAVHelper) applicationContext.getBean(WebDAVHelper.BEAN_NAME);
|
||||
auditRegistry = (AuditModelRegistryImpl) applicationContext.getBean(AUDIT_REGISTRY_BEAN_NAME);
|
||||
|
||||
auditService = registry.getAuditService();
|
||||
fileFolderService = registry.getFileFolderService();
|
||||
transactionService = registry.getTransactionService();
|
||||
|
||||
testingMethod = new GetMethod();
|
||||
mockResponse = new MockHttpServletResponse();
|
||||
|
||||
restartTransaction(TransactionActionEnum.ACTION_NONE);
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
companyHomeNodeRef = registry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null);
|
||||
rootTestFolder = fileFolderService.create(companyHomeNodeRef, ROOT_TEST_FOLDER_NAME, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
if ((null != transaction) && (Status.STATUS_ROLLEDBACK != transaction.getStatus()) && (Status.STATUS_COMMITTED != transaction.getStatus()))
|
||||
{
|
||||
transaction.rollback();
|
||||
}
|
||||
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for <a href="https://issues.alfresco.com/jira/browse/MNT-10820">MNT-10820</a>
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAuditRecordsAdditionAsbsence() throws Exception
|
||||
{
|
||||
String url = new StringBuilder(TEST_WEBDAV_URL_PREFIX).append(ROOT_TEST_FOLDER_NAME).toString();
|
||||
MockHttpServletRequest mockRequest = new MockHttpServletRequest(HTTP_METHOD_GET, url);
|
||||
testingMethod.setDetails(mockRequest, mockResponse, davHelper, companyHomeNodeRef);
|
||||
|
||||
boolean auditEnabled = auditService.isAuditEnabled();
|
||||
|
||||
if (!auditEnabled)
|
||||
{
|
||||
auditService.setAuditEnabled(true);
|
||||
}
|
||||
|
||||
boolean alfrescoAccessEnabled = Boolean.valueOf(auditRegistry.getProperty(PROP_AUDIT_ALFRESCO_ACCESS_ENABLED));
|
||||
|
||||
if (!alfrescoAccessEnabled)
|
||||
{
|
||||
setAuditRegistryProperty(PROP_AUDIT_ALFRESCO_ACCESS_ENABLED, Boolean.TRUE.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
createTestContent(rootTestFolder, DOCUMENTS_AMOUNT_FOR_GET_METHOD_TEST);
|
||||
|
||||
restartTransaction(TransactionActionEnum.ACTION_COMMIT);
|
||||
|
||||
Long expectedLastTime = getLastAuditRecordTime();
|
||||
|
||||
testingMethod.executeImpl();
|
||||
assertEquals(HttpURLConnection.HTTP_OK, mockResponse.getStatus());
|
||||
|
||||
String contentAsString = mockResponse.getContentAsString();
|
||||
assertNotNull("WebDAV 'GET' method response is empty!", contentAsString);
|
||||
assertTrue(contentAsString.contains(ROOT_TEST_FOLDER_NAME));
|
||||
|
||||
restartTransaction(TransactionActionEnum.ACTION_COMMIT);
|
||||
|
||||
Long actualLastTime = getLastAuditRecordTime();
|
||||
|
||||
if (null == expectedLastTime)
|
||||
{
|
||||
assertNull("Audit entry table is not empty after 'GetMethod.executeImpl()' invocation. But it is expected to be empty!", actualLastTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertEquals(expectedLastTime, actualLastTime);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!alfrescoAccessEnabled)
|
||||
{
|
||||
setAuditRegistryProperty(PROP_AUDIT_ALFRESCO_ACCESS_ENABLED, Boolean.FALSE.toString());
|
||||
}
|
||||
|
||||
if (!auditEnabled)
|
||||
{
|
||||
auditService.setAuditEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setAuditRegistryProperty(String propertyName, String value)
|
||||
{
|
||||
assertTrue(("'" + propertyName + "' is not updatable!"), auditRegistry.isUpdateable(propertyName));
|
||||
|
||||
auditRegistry.stop();
|
||||
auditRegistry.setProperty(propertyName, value);
|
||||
auditRegistry.start();
|
||||
}
|
||||
|
||||
private void createTestContent(NodeRef parentNode, int documentsAmount)
|
||||
{
|
||||
for (int i = 0; i < documentsAmount; i++)
|
||||
{
|
||||
String testDocumentName = String.format(TEST_DOCUMENT_NAME_PATTERN, i, System.currentTimeMillis());
|
||||
FileInfo testDocument = fileFolderService.create(parentNode, testDocumentName, ContentModel.TYPE_CONTENT);
|
||||
ContentWriter writer = fileFolderService.getWriter(testDocument.getNodeRef());
|
||||
writer.putContent(String.format(TEXT_DOCUMENT_CONTENT_PATTERN, testDocumentName));
|
||||
writer.setMimetype(TEST_MIMETYPE);
|
||||
writer.setEncoding(TEST_ENCODING);
|
||||
}
|
||||
}
|
||||
|
||||
private enum TransactionActionEnum
|
||||
{
|
||||
ACTION_NONE,
|
||||
|
||||
ACTION_COMMIT,
|
||||
|
||||
ACTION_ROLLBACK
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits or rolls back or does nothing with the current transaction and begins a new {@link UserTransaction}
|
||||
*
|
||||
* @param transactionAction - one of the {@link TransactionActionEnum} values which specifies action to be done for the current transaction
|
||||
* @throws Exception
|
||||
*/
|
||||
private void restartTransaction(TransactionActionEnum transactionAction) throws Exception
|
||||
{
|
||||
if ((null != transaction) && (Status.STATUS_ROLLEDBACK != transaction.getStatus()) && (Status.STATUS_COMMITTED != transaction.getStatus()))
|
||||
{
|
||||
if (TransactionActionEnum.ACTION_COMMIT == transactionAction)
|
||||
{
|
||||
transaction.commit();
|
||||
}
|
||||
else if (TransactionActionEnum.ACTION_ROLLBACK == transactionAction)
|
||||
{
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
|
||||
transaction = transactionService.getUserTransaction();
|
||||
transaction.begin();
|
||||
}
|
||||
|
||||
private Long getLastAuditRecordTime()
|
||||
{
|
||||
final Holder<Long> lastTime = new Holder<Long>();
|
||||
|
||||
AuditQueryParameters parameters = new AuditQueryParameters();
|
||||
parameters.setForward(false);
|
||||
|
||||
auditService.auditQuery(new AuditQueryCallback()
|
||||
{
|
||||
@Override
|
||||
public boolean valuesRequired()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleAuditEntry(Long entryId, String applicationName, String user, long time, Map<String, Serializable> values)
|
||||
{
|
||||
lastTime.setValue(time);
|
||||
return false;
|
||||
}
|
||||
}, parameters, 1);
|
||||
|
||||
return lastTime.getValue();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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.webdav;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.audit.model.AuditModelRegistryImpl;
|
||||
import org.alfresco.repo.node.archive.NodeArchiveService;
|
||||
import org.alfresco.repo.nodelocator.CompanyHomeNodeLocator;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.testing.category.LuceneTests;
|
||||
import org.apache.chemistry.opencmis.commons.spi.Holder;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
/**
|
||||
* Tests {@link GetMethod} in real environment, using {@link Mock} HTTP request and {@link Mock} HTTP response
|
||||
*
|
||||
* @author Dmitry Velichkevich
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@Category(LuceneTests.class)
|
||||
public class GetMethodRegressionTest extends TestCase
|
||||
{
|
||||
private static final int DOCUMENTS_AMOUNT_FOR_GET_METHOD_TEST = 25;
|
||||
|
||||
|
||||
private static final String HTTP_METHOD_GET = "GET";
|
||||
|
||||
private static final String TEST_ENCODING = "UTF-8";
|
||||
|
||||
private static final String TEST_MIMETYPE = "text/plain";
|
||||
|
||||
private static final String TEST_WEBDAV_URL_PREFIX = "/";
|
||||
|
||||
private static final String AUDIT_REGISTRY_BEAN_NAME = "Audit";
|
||||
|
||||
private static final String PROP_AUDIT_ALFRESCO_ACCESS_ENABLED = "audit.alfresco-access.enabled";
|
||||
|
||||
private static final String ROOT_TEST_FOLDER_NAME = "TestFolder-" + System.currentTimeMillis();
|
||||
|
||||
private static final String TEST_DOCUMENT_NAME_PATTERN = "TestDocument-%d-%d.pdf";
|
||||
|
||||
private static final String TEXT_DOCUMENT_CONTENT_PATTERN = "Text content for '%s' document";
|
||||
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private WebDAVHelper davHelper;
|
||||
|
||||
private AuditService auditService;
|
||||
|
||||
private FileFolderService fileFolderService;
|
||||
|
||||
private AuditModelRegistryImpl auditRegistry;
|
||||
|
||||
private TransactionService transactionService;
|
||||
|
||||
|
||||
private UserTransaction transaction;
|
||||
|
||||
private GetMethod testingMethod;
|
||||
|
||||
private NodeRef companyHomeNodeRef;
|
||||
|
||||
private NodeRef rootTestFolder;
|
||||
|
||||
private MockHttpServletResponse mockResponse;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
applicationContext = ApplicationContextHelper.getApplicationContext();
|
||||
ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||
davHelper = (WebDAVHelper) applicationContext.getBean(WebDAVHelper.BEAN_NAME);
|
||||
auditRegistry = (AuditModelRegistryImpl) applicationContext.getBean(AUDIT_REGISTRY_BEAN_NAME);
|
||||
|
||||
auditService = registry.getAuditService();
|
||||
fileFolderService = registry.getFileFolderService();
|
||||
transactionService = registry.getTransactionService();
|
||||
|
||||
testingMethod = new GetMethod();
|
||||
mockResponse = new MockHttpServletResponse();
|
||||
|
||||
restartTransaction(TransactionActionEnum.ACTION_NONE);
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
companyHomeNodeRef = registry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null);
|
||||
rootTestFolder = fileFolderService.create(companyHomeNodeRef, ROOT_TEST_FOLDER_NAME, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
if ((null != transaction) && (Status.STATUS_ROLLEDBACK != transaction.getStatus()) && (Status.STATUS_COMMITTED != transaction.getStatus()))
|
||||
{
|
||||
transaction.rollback();
|
||||
}
|
||||
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for <a href="https://issues.alfresco.com/jira/browse/MNT-10820">MNT-10820</a>
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAuditRecordsAdditionAsbsence() throws Exception
|
||||
{
|
||||
String url = new StringBuilder(TEST_WEBDAV_URL_PREFIX).append(ROOT_TEST_FOLDER_NAME).toString();
|
||||
MockHttpServletRequest mockRequest = new MockHttpServletRequest(HTTP_METHOD_GET, url);
|
||||
testingMethod.setDetails(mockRequest, mockResponse, davHelper, companyHomeNodeRef);
|
||||
|
||||
boolean auditEnabled = auditService.isAuditEnabled();
|
||||
|
||||
if (!auditEnabled)
|
||||
{
|
||||
auditService.setAuditEnabled(true);
|
||||
}
|
||||
|
||||
boolean alfrescoAccessEnabled = Boolean.valueOf(auditRegistry.getProperty(PROP_AUDIT_ALFRESCO_ACCESS_ENABLED));
|
||||
|
||||
if (!alfrescoAccessEnabled)
|
||||
{
|
||||
setAuditRegistryProperty(PROP_AUDIT_ALFRESCO_ACCESS_ENABLED, Boolean.TRUE.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
createTestContent(rootTestFolder, DOCUMENTS_AMOUNT_FOR_GET_METHOD_TEST);
|
||||
|
||||
restartTransaction(TransactionActionEnum.ACTION_COMMIT);
|
||||
|
||||
Long expectedLastTime = getLastAuditRecordTime();
|
||||
|
||||
testingMethod.executeImpl();
|
||||
assertEquals(HttpURLConnection.HTTP_OK, mockResponse.getStatus());
|
||||
|
||||
String contentAsString = mockResponse.getContentAsString();
|
||||
assertNotNull("WebDAV 'GET' method response is empty!", contentAsString);
|
||||
assertTrue(contentAsString.contains(ROOT_TEST_FOLDER_NAME));
|
||||
|
||||
restartTransaction(TransactionActionEnum.ACTION_COMMIT);
|
||||
|
||||
Long actualLastTime = getLastAuditRecordTime();
|
||||
|
||||
if (null == expectedLastTime)
|
||||
{
|
||||
assertNull("Audit entry table is not empty after 'GetMethod.executeImpl()' invocation. But it is expected to be empty!", actualLastTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertEquals(expectedLastTime, actualLastTime);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!alfrescoAccessEnabled)
|
||||
{
|
||||
setAuditRegistryProperty(PROP_AUDIT_ALFRESCO_ACCESS_ENABLED, Boolean.FALSE.toString());
|
||||
}
|
||||
|
||||
if (!auditEnabled)
|
||||
{
|
||||
auditService.setAuditEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setAuditRegistryProperty(String propertyName, String value)
|
||||
{
|
||||
assertTrue(("'" + propertyName + "' is not updatable!"), auditRegistry.isUpdateable(propertyName));
|
||||
|
||||
auditRegistry.stop();
|
||||
auditRegistry.setProperty(propertyName, value);
|
||||
auditRegistry.start();
|
||||
}
|
||||
|
||||
private void createTestContent(NodeRef parentNode, int documentsAmount)
|
||||
{
|
||||
for (int i = 0; i < documentsAmount; i++)
|
||||
{
|
||||
String testDocumentName = String.format(TEST_DOCUMENT_NAME_PATTERN, i, System.currentTimeMillis());
|
||||
FileInfo testDocument = fileFolderService.create(parentNode, testDocumentName, ContentModel.TYPE_CONTENT);
|
||||
ContentWriter writer = fileFolderService.getWriter(testDocument.getNodeRef());
|
||||
writer.putContent(String.format(TEXT_DOCUMENT_CONTENT_PATTERN, testDocumentName));
|
||||
writer.setMimetype(TEST_MIMETYPE);
|
||||
writer.setEncoding(TEST_ENCODING);
|
||||
}
|
||||
}
|
||||
|
||||
private enum TransactionActionEnum
|
||||
{
|
||||
ACTION_NONE,
|
||||
|
||||
ACTION_COMMIT,
|
||||
|
||||
ACTION_ROLLBACK
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits or rolls back or does nothing with the current transaction and begins a new {@link UserTransaction}
|
||||
*
|
||||
* @param transactionAction - one of the {@link TransactionActionEnum} values which specifies action to be done for the current transaction
|
||||
* @throws Exception
|
||||
*/
|
||||
private void restartTransaction(TransactionActionEnum transactionAction) throws Exception
|
||||
{
|
||||
if ((null != transaction) && (Status.STATUS_ROLLEDBACK != transaction.getStatus()) && (Status.STATUS_COMMITTED != transaction.getStatus()))
|
||||
{
|
||||
if (TransactionActionEnum.ACTION_COMMIT == transactionAction)
|
||||
{
|
||||
transaction.commit();
|
||||
}
|
||||
else if (TransactionActionEnum.ACTION_ROLLBACK == transactionAction)
|
||||
{
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
|
||||
transaction = transactionService.getUserTransaction();
|
||||
transaction.begin();
|
||||
}
|
||||
|
||||
private Long getLastAuditRecordTime()
|
||||
{
|
||||
final Holder<Long> lastTime = new Holder<Long>();
|
||||
|
||||
AuditQueryParameters parameters = new AuditQueryParameters();
|
||||
parameters.setForward(false);
|
||||
|
||||
auditService.auditQuery(new AuditQueryCallback()
|
||||
{
|
||||
@Override
|
||||
public boolean valuesRequired()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleAuditEntry(Long entryId, String applicationName, String user, long time, Map<String, Serializable> values)
|
||||
{
|
||||
lastTime.setValue(time);
|
||||
return false;
|
||||
}
|
||||
}, parameters, 1);
|
||||
|
||||
return lastTime.getValue();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -23,378 +23,359 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.TestWithUserUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class UnlockMethodTest
|
||||
{
|
||||
private UnlockMethod unlockMethod;
|
||||
private LockMethod lockMethod;
|
||||
private MockHttpServletRequest request;
|
||||
private MockHttpServletResponse response;
|
||||
private @Mock WebDAVHelper davHelper;
|
||||
ApplicationContext appContext;
|
||||
|
||||
/**
|
||||
* Services used by the tests
|
||||
*/
|
||||
private NodeService nodeService;
|
||||
private CheckOutCheckInService cociService;
|
||||
private ContentService contentService;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
private TransactionService transactionService;
|
||||
private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* Data used by the tests
|
||||
*/
|
||||
private StoreRef storeRef;
|
||||
private NodeRef rootNodeRef;
|
||||
private String userNodeRef;
|
||||
private NodeRef folderNodeRef;
|
||||
private NodeRef fileNodeRef;
|
||||
private NodeRef fileWorkingCopyNodeRef;
|
||||
|
||||
/**
|
||||
* Types and properties used by the tests
|
||||
*/
|
||||
private static final String CONTENT_1 = "This is some content";
|
||||
private static final String TEST_STORE_IDENTIFIER = "test_store-" + System.currentTimeMillis();
|
||||
private static final String TEST_FILE_NAME = "file";
|
||||
|
||||
/**
|
||||
* User details
|
||||
*/
|
||||
private String userName;
|
||||
private static final String PWD = "password";
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
request = new MockHttpServletRequest();
|
||||
response = new MockHttpServletResponse();
|
||||
unlockMethod = new UnlockMethod();
|
||||
unlockMethod.setDetails(request, response, davHelper, null);
|
||||
lockMethod = new LockMethod();
|
||||
lockMethod.setDetails(request, null, davHelper, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up preconditions for unlock a checked out node
|
||||
*/
|
||||
protected void setUpPreconditionForCheckedOutTest() throws Exception
|
||||
{
|
||||
appContext = ApplicationContextHelper.getApplicationContext(new String[]
|
||||
{
|
||||
"classpath:alfresco/application-context.xml", "classpath:alfresco/web-scripts-application-context.xml",
|
||||
"classpath:alfresco/remote-api-context.xml"
|
||||
});
|
||||
|
||||
// Set the services
|
||||
this.cociService = (CheckOutCheckInService) appContext.getBean("checkOutCheckInService");
|
||||
this.contentService = (ContentService) appContext.getBean("contentService");
|
||||
this.authenticationService = (MutableAuthenticationService) appContext.getBean("authenticationService");
|
||||
this.permissionService = (PermissionService) appContext.getBean("permissionService");
|
||||
this.transactionService = (TransactionService) appContext.getBean("TransactionService");
|
||||
this.nodeService = (NodeService) appContext.getBean("NodeService");
|
||||
// Authenticate as system to create initial test data set
|
||||
this.authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
RetryingTransactionCallback<Void> createTestFileCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
// Create the store and get the root node reference
|
||||
storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
|
||||
if (!nodeService.exists(storeRef))
|
||||
{
|
||||
storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
|
||||
}
|
||||
rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
|
||||
// Create and authenticate the user
|
||||
userName = "webdavUnlockTest" + GUID.generate();
|
||||
TestWithUserUtils.createUser(userName, PWD, rootNodeRef, nodeService, authenticationService);
|
||||
permissionService.setPermission(rootNodeRef, userName, PermissionService.ALL_PERMISSIONS, true);
|
||||
TestWithUserUtils.authenticateUser(userName, PWD, rootNodeRef, authenticationService);
|
||||
userNodeRef = TestWithUserUtils.getCurrentUser(authenticationService);
|
||||
|
||||
// create test file in test folder
|
||||
folderNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("test"), ContentModel.TYPE_FOLDER,
|
||||
Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, "folder")).getChildRef();
|
||||
fileNodeRef = nodeService.createNode(folderNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("test"), ContentModel.TYPE_CONTENT,
|
||||
Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, TEST_FILE_NAME)).getChildRef();
|
||||
ContentWriter contentWriter = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
|
||||
contentWriter.setMimetype("text/plain");
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.putContent(CONTENT_1);
|
||||
|
||||
// Check out test file
|
||||
fileWorkingCopyNodeRef = cociService.checkout(fileNodeRef);
|
||||
assertNotNull(fileWorkingCopyNodeRef);
|
||||
assertEquals(userNodeRef, nodeService.getProperty(fileNodeRef, ContentModel.PROP_LOCK_OWNER));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(createTestFileCallback);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseValidLockTokenHeader() throws WebDAVServerException
|
||||
{
|
||||
String lockToken = "976e2f82-40ab-4852-a867-986e9ce11f82:admin";
|
||||
String lockHeaderValue = "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">";
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
|
||||
assertEquals(lockToken, unlockMethod.getLockToken());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseInvalidLockTokenHeader()
|
||||
{
|
||||
String lockToken = "976e2f82-40ab-4852-a867-986e9ce11f82:admin";
|
||||
String lockHeaderValue = "<wrongprefix:" + lockToken + ">";
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
try
|
||||
{
|
||||
unlockMethod.parseRequestHeaders();
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_BAD_REQUEST, e.getHttpStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseMissingLockTokenHeader()
|
||||
{
|
||||
// Note: we're not adding the lock token header
|
||||
try
|
||||
{
|
||||
unlockMethod.parseRequestHeaders();
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_BAD_REQUEST, e.getHttpStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenOffice.org on Windows 7 results in a lock token header that is NOT enclosed in
|
||||
* the required < and > characters. Whilst technically an invalid header, we treat
|
||||
* this case specially for reasons of interoperability (ALF-13904)
|
||||
*
|
||||
* @throws WebDAVServerException
|
||||
*/
|
||||
@Test
|
||||
public void parseLockTokenHeaderFromOOoOnWindows7() throws WebDAVServerException
|
||||
{
|
||||
String lockToken = "976e2f82-40ab-4852-a867-986e9ce11f82:admin";
|
||||
// Note the missing enclosing < and > characters
|
||||
String lockHeaderValue = WebDAV.OPAQUE_LOCK_TOKEN + lockToken;
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
|
||||
assertEquals(lockToken, unlockMethod.getLockToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test MNT-9680: Working copies are open in read-only mode when using Webdav online edit
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void unlockWorkingCopy() throws Exception
|
||||
{
|
||||
setUpPreconditionForCheckedOutTest();
|
||||
try
|
||||
{
|
||||
String workingCopyName = nodeService.getProperty(fileWorkingCopyNodeRef, ContentModel.PROP_NAME).toString();
|
||||
String lockToken = fileWorkingCopyNodeRef.getId() + WebDAV.LOCK_TOKEN_SEPERATOR + this.userName;
|
||||
String lockHeaderValue = "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">";
|
||||
final WebDAVHelper davHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
|
||||
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
request.setRequestURI("/" + workingCopyName);
|
||||
String content = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
|
||||
+ "<d:lockinfo xmlns:d=\"DAV:\">"
|
||||
+ "<d:lockscope><d:exclusive/></d:lockscope>"
|
||||
+ "</d:lockinfo>";
|
||||
|
||||
request.setContent(content.getBytes("UTF-8"));
|
||||
|
||||
lockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
lockMethod.parseRequestHeaders();
|
||||
lockMethod.parseRequestBody();
|
||||
|
||||
RetryingTransactionCallback<Void> lockExecuteImplCallBack = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
lockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(lockExecuteImplCallBack);
|
||||
|
||||
unlockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
|
||||
RetryingTransactionCallback<Void> unlockExecuteImplCallBack = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
unlockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(unlockExecuteImplCallBack);
|
||||
|
||||
assertNull("lockType property should be deleted on unlock", nodeService.getProperty(fileWorkingCopyNodeRef, ContentModel.PROP_LOCK_TYPE));
|
||||
assertNull("lockOwner property should be deleted on unlock", nodeService.getProperty(fileWorkingCopyNodeRef, ContentModel.PROP_LOCK_OWNER));
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
// clear context for current user
|
||||
this.authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
// delete test store as system user
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
RetryingTransactionCallback<Void> deleteStoreCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
if (nodeService.exists(storeRef))
|
||||
{
|
||||
nodeService.deleteStore(storeRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(deleteStoreCallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that it is impossible to unlock a checked out node
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void unlockCheckedOutNode() throws Exception
|
||||
{
|
||||
setUpPreconditionForCheckedOutTest();
|
||||
try
|
||||
{
|
||||
String lockToken = fileNodeRef.getId() + WebDAV.LOCK_TOKEN_SEPERATOR + this.userName;
|
||||
String lockHeaderValue = "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">";
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
request.setRequestURI("/" + TEST_FILE_NAME);
|
||||
|
||||
WebDAVHelper davHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
|
||||
unlockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
unlockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (AlfrescoRuntimeException e)
|
||||
{
|
||||
if (e.getCause() instanceof WebDAVServerException)
|
||||
{
|
||||
WebDAVServerException ee = (WebDAVServerException) e.getCause();
|
||||
assertEquals(HttpServletResponse.SC_PRECONDITION_FAILED, ee.getHttpStatusCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Incorrect exception thrown.");
|
||||
}
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_PRECONDITION_FAILED, e.getHttpStatusCode());
|
||||
}
|
||||
finally
|
||||
{
|
||||
// clear context for current user
|
||||
this.authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
// delete test store as system user
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
RetryingTransactionCallback<Void> deleteStoreCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
if (nodeService.exists(storeRef))
|
||||
{
|
||||
nodeService.deleteStore(storeRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(deleteStoreCallback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.TestWithUserUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class UnlockMethodTest
|
||||
{
|
||||
private UnlockMethod unlockMethod;
|
||||
private LockMethod lockMethod;
|
||||
private MockHttpServletRequest request;
|
||||
private MockHttpServletResponse response;
|
||||
private @Mock WebDAVHelper davHelper;
|
||||
ApplicationContext appContext;
|
||||
|
||||
/**
|
||||
* Services used by the tests
|
||||
*/
|
||||
private NodeService nodeService;
|
||||
private CheckOutCheckInService cociService;
|
||||
private ContentService contentService;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
private TransactionService transactionService;
|
||||
private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* Data used by the tests
|
||||
*/
|
||||
private StoreRef storeRef;
|
||||
private NodeRef rootNodeRef;
|
||||
private String userNodeRef;
|
||||
private NodeRef folderNodeRef;
|
||||
private NodeRef fileNodeRef;
|
||||
private NodeRef fileWorkingCopyNodeRef;
|
||||
|
||||
/**
|
||||
* Types and properties used by the tests
|
||||
*/
|
||||
private static final String CONTENT_1 = "This is some content";
|
||||
private static final String TEST_STORE_IDENTIFIER = "test_store-" + System.currentTimeMillis();
|
||||
private static final String TEST_FILE_NAME = "file";
|
||||
|
||||
/**
|
||||
* User details
|
||||
*/
|
||||
private String userName;
|
||||
private static final String PWD = "password";
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
request = new MockHttpServletRequest();
|
||||
response = new MockHttpServletResponse();
|
||||
unlockMethod = new UnlockMethod();
|
||||
unlockMethod.setDetails(request, response, davHelper, null);
|
||||
lockMethod = new LockMethod();
|
||||
lockMethod.setDetails(request, null, davHelper, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up preconditions for unlock a checked out node
|
||||
*/
|
||||
protected void setUpPreconditionForCheckedOutTest() throws Exception
|
||||
{
|
||||
appContext = ApplicationContextHelper.getApplicationContext(new String[]
|
||||
{
|
||||
"classpath:alfresco/application-context.xml", "classpath:alfresco/web-scripts-application-context.xml",
|
||||
"classpath:alfresco/remote-api-context.xml"
|
||||
});
|
||||
|
||||
// Set the services
|
||||
this.cociService = (CheckOutCheckInService) appContext.getBean("checkOutCheckInService");
|
||||
this.contentService = (ContentService) appContext.getBean("contentService");
|
||||
this.authenticationService = (MutableAuthenticationService) appContext.getBean("authenticationService");
|
||||
this.permissionService = (PermissionService) appContext.getBean("permissionService");
|
||||
this.transactionService = (TransactionService) appContext.getBean("TransactionService");
|
||||
this.nodeService = (NodeService) appContext.getBean("NodeService");
|
||||
// Authenticate as system to create initial test data set
|
||||
this.authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
RetryingTransactionCallback<Void> createTestFileCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
// Create the store and get the root node reference
|
||||
storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
|
||||
if (!nodeService.exists(storeRef))
|
||||
{
|
||||
storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
|
||||
}
|
||||
rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
|
||||
// Create and authenticate the user
|
||||
userName = "webdavUnlockTest" + GUID.generate();
|
||||
TestWithUserUtils.createUser(userName, PWD, rootNodeRef, nodeService, authenticationService);
|
||||
permissionService.setPermission(rootNodeRef, userName, PermissionService.ALL_PERMISSIONS, true);
|
||||
TestWithUserUtils.authenticateUser(userName, PWD, rootNodeRef, authenticationService);
|
||||
userNodeRef = TestWithUserUtils.getCurrentUser(authenticationService);
|
||||
|
||||
// create test file in test folder
|
||||
folderNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("test"), ContentModel.TYPE_FOLDER,
|
||||
Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, "folder")).getChildRef();
|
||||
fileNodeRef = nodeService.createNode(folderNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("test"), ContentModel.TYPE_CONTENT,
|
||||
Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, TEST_FILE_NAME)).getChildRef();
|
||||
ContentWriter contentWriter = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
|
||||
contentWriter.setMimetype("text/plain");
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.putContent(CONTENT_1);
|
||||
|
||||
// Check out test file
|
||||
fileWorkingCopyNodeRef = cociService.checkout(fileNodeRef);
|
||||
assertNotNull(fileWorkingCopyNodeRef);
|
||||
assertEquals(userNodeRef, nodeService.getProperty(fileNodeRef, ContentModel.PROP_LOCK_OWNER));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(createTestFileCallback);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseValidLockTokenHeader() throws WebDAVServerException
|
||||
{
|
||||
String lockToken = "976e2f82-40ab-4852-a867-986e9ce11f82:admin";
|
||||
String lockHeaderValue = "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">";
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
|
||||
assertEquals(lockToken, unlockMethod.getLockToken());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseInvalidLockTokenHeader()
|
||||
{
|
||||
String lockToken = "976e2f82-40ab-4852-a867-986e9ce11f82:admin";
|
||||
String lockHeaderValue = "<wrongprefix:" + lockToken + ">";
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
try
|
||||
{
|
||||
unlockMethod.parseRequestHeaders();
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_BAD_REQUEST, e.getHttpStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseMissingLockTokenHeader()
|
||||
{
|
||||
// Note: we're not adding the lock token header
|
||||
try
|
||||
{
|
||||
unlockMethod.parseRequestHeaders();
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_BAD_REQUEST, e.getHttpStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test MNT-9680: Working copies are open in read-only mode when using Webdav online edit
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void unlockWorkingCopy() throws Exception
|
||||
{
|
||||
setUpPreconditionForCheckedOutTest();
|
||||
try
|
||||
{
|
||||
String workingCopyName = nodeService.getProperty(fileWorkingCopyNodeRef, ContentModel.PROP_NAME).toString();
|
||||
String lockToken = fileWorkingCopyNodeRef.getId() + WebDAV.LOCK_TOKEN_SEPERATOR + this.userName;
|
||||
String lockHeaderValue = "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">";
|
||||
final WebDAVHelper davHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
|
||||
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
request.setRequestURI("/" + workingCopyName);
|
||||
String content = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
|
||||
+ "<d:lockinfo xmlns:d=\"DAV:\">"
|
||||
+ "<d:lockscope><d:exclusive/></d:lockscope>"
|
||||
+ "</d:lockinfo>";
|
||||
|
||||
request.setContent(content.getBytes("UTF-8"));
|
||||
|
||||
lockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
lockMethod.parseRequestHeaders();
|
||||
lockMethod.parseRequestBody();
|
||||
|
||||
RetryingTransactionCallback<Void> lockExecuteImplCallBack = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
lockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(lockExecuteImplCallBack);
|
||||
|
||||
unlockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
|
||||
RetryingTransactionCallback<Void> unlockExecuteImplCallBack = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
unlockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(unlockExecuteImplCallBack);
|
||||
|
||||
assertNull("lockType property should be deleted on unlock", nodeService.getProperty(fileWorkingCopyNodeRef, ContentModel.PROP_LOCK_TYPE));
|
||||
assertNull("lockOwner property should be deleted on unlock", nodeService.getProperty(fileWorkingCopyNodeRef, ContentModel.PROP_LOCK_OWNER));
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
// clear context for current user
|
||||
this.authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
// delete test store as system user
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
RetryingTransactionCallback<Void> deleteStoreCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
if (nodeService.exists(storeRef))
|
||||
{
|
||||
nodeService.deleteStore(storeRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(deleteStoreCallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that it is impossible to unlock a checked out node
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void unlockCheckedOutNode() throws Exception
|
||||
{
|
||||
setUpPreconditionForCheckedOutTest();
|
||||
try
|
||||
{
|
||||
String lockToken = fileNodeRef.getId() + WebDAV.LOCK_TOKEN_SEPERATOR + this.userName;
|
||||
String lockHeaderValue = "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">";
|
||||
request.addHeader(WebDAV.HEADER_LOCK_TOKEN, lockHeaderValue);
|
||||
request.setRequestURI("/" + TEST_FILE_NAME);
|
||||
|
||||
WebDAVHelper davHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
|
||||
unlockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
unlockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (AlfrescoRuntimeException e)
|
||||
{
|
||||
if (e.getCause() instanceof WebDAVServerException)
|
||||
{
|
||||
WebDAVServerException ee = (WebDAVServerException) e.getCause();
|
||||
assertEquals(HttpServletResponse.SC_PRECONDITION_FAILED, ee.getHttpStatusCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Incorrect exception thrown.");
|
||||
}
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_PRECONDITION_FAILED, e.getHttpStatusCode());
|
||||
}
|
||||
finally
|
||||
{
|
||||
// clear context for current user
|
||||
this.authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
// delete test store as system user
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
RetryingTransactionCallback<Void> deleteStoreCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
if (nodeService.exists(storeRef))
|
||||
{
|
||||
nodeService.deleteStore(storeRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(deleteStoreCallback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,100 +23,100 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
||||
/**
|
||||
* Tests for the WebDAVHelper class.
|
||||
*
|
||||
* @see RenameShuffleDetectionTest
|
||||
* @author Matt Ward
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class WebDAVHelperTest
|
||||
{
|
||||
private WebDAVHelper davHelper;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
davHelper = new WebDAVHelper();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetUrlPathPrefixWhenExplicitlySet()
|
||||
{
|
||||
// Path prefix explicitly set on helper.
|
||||
davHelper.setUrlPathPrefix("/my/prefix");
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/my/prefix/folder/filename.txt");
|
||||
String prefix = davHelper.getUrlPathPrefix(request);
|
||||
assertEquals("/my/prefix/", prefix);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetUrlPathPrefixFromServletPath()
|
||||
{
|
||||
// Path prefix not explicitly set on helper.
|
||||
davHelper.setUrlPathPrefix("");
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/before/the-servlet/folder/filename.txt");
|
||||
// Servlet path will be used to determine path prefix.
|
||||
request.setServletPath("/the-servlet");
|
||||
String prefix = davHelper.getUrlPathPrefix(request);
|
||||
assertEquals("/before/the-servlet/", prefix);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetDestinationPathWhenNoServletName()
|
||||
{
|
||||
assertPathForURL("/the-tenant.com/the-site/path/to/file",
|
||||
"http://webdav.alfresco.com/the-tenant.com/the-site/path/to/file");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* THOR-1459: WebDAV: site names cannot start with 'webdav'.
|
||||
* <p>
|
||||
* <code>/webdav-test</code> begins with servlet path <code>/webdav</code>
|
||||
*/
|
||||
@Test
|
||||
public void canGetDestinationPathWhenPathElementStartsWithServletPath()
|
||||
{
|
||||
assertPathForURL("/t/webdav-test/path/to/file",
|
||||
"http://webdav.alfresco.com/t/webdav-test/path/to/file");
|
||||
|
||||
// Looks like /contextPath/servletName in URL's path prefix, but isn't
|
||||
assertPathForURL("/alfresco/webdav-test/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav-test/path/to/file");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetDestinationPathWhenPrefixedWithContextPathAndServletName()
|
||||
{
|
||||
assertPathForURL("/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav/path/to/file");
|
||||
|
||||
assertPathForURL("/alfresco/webdav/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav/alfresco/webdav/path/to/file");
|
||||
|
||||
assertPathForURL("/my/folder/alfresco/webdav/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav/my/folder/alfresco/webdav/path/to/file");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the expected path was extracted from a given URL.
|
||||
*
|
||||
* @param path The expected path.
|
||||
* @param url URL to extract the path from.
|
||||
*/
|
||||
private void assertPathForURL(String path, String url)
|
||||
{
|
||||
assertEquals(path, davHelper.getDestinationPath("/alfresco", "/webdav", url));
|
||||
}
|
||||
}
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
||||
/**
|
||||
* Tests for the WebDAVHelper class.
|
||||
*
|
||||
* @see RenameShuffleDetectionTest
|
||||
* @author Matt Ward
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class WebDAVHelperTest
|
||||
{
|
||||
private WebDAVHelper davHelper;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
davHelper = new WebDAVHelper();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetUrlPathPrefixWhenExplicitlySet()
|
||||
{
|
||||
// Path prefix explicitly set on helper.
|
||||
davHelper.setUrlPathPrefix("/my/prefix");
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/my/prefix/folder/filename.txt");
|
||||
String prefix = davHelper.getUrlPathPrefix(request);
|
||||
assertEquals("/my/prefix/", prefix);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetUrlPathPrefixFromServletPath()
|
||||
{
|
||||
// Path prefix not explicitly set on helper.
|
||||
davHelper.setUrlPathPrefix("");
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/before/the-servlet/folder/filename.txt");
|
||||
// Servlet path will be used to determine path prefix.
|
||||
request.setServletPath("/the-servlet");
|
||||
String prefix = davHelper.getUrlPathPrefix(request);
|
||||
assertEquals("/before/the-servlet/", prefix);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetDestinationPathWhenNoServletName()
|
||||
{
|
||||
assertPathForURL("/the-tenant.com/the-site/path/to/file",
|
||||
"http://webdav.alfresco.com/the-tenant.com/the-site/path/to/file");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* THOR-1459: WebDAV: site names cannot start with 'webdav'.
|
||||
* <p>
|
||||
* <code>/webdav-test</code> begins with servlet path <code>/webdav</code>
|
||||
*/
|
||||
@Test
|
||||
public void canGetDestinationPathWhenPathElementStartsWithServletPath()
|
||||
{
|
||||
assertPathForURL("/t/webdav-test/path/to/file",
|
||||
"http://webdav.alfresco.com/t/webdav-test/path/to/file");
|
||||
|
||||
// Looks like /contextPath/servletName in URL's path prefix, but isn't
|
||||
assertPathForURL("/alfresco/webdav-test/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav-test/path/to/file");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetDestinationPathWhenPrefixedWithContextPathAndServletName()
|
||||
{
|
||||
assertPathForURL("/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav/path/to/file");
|
||||
|
||||
assertPathForURL("/alfresco/webdav/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav/alfresco/webdav/path/to/file");
|
||||
|
||||
assertPathForURL("/my/folder/alfresco/webdav/path/to/file",
|
||||
"http://webdav.alfresco.com/alfresco/webdav/my/folder/alfresco/webdav/path/to/file");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the expected path was extracted from a given URL.
|
||||
*
|
||||
* @param path The expected path.
|
||||
* @param url URL to extract the path from.
|
||||
*/
|
||||
private void assertPathForURL(String path, String url)
|
||||
{
|
||||
assertEquals(path, davHelper.getDestinationPath("/alfresco", "/webdav", url));
|
||||
}
|
||||
}
|
||||
|
@@ -23,234 +23,234 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyBoolean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.alfresco.repo.lock.mem.Lifetime;
|
||||
import org.alfresco.repo.lock.mem.LockState;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class WebDAVLockServiceImplTest
|
||||
{
|
||||
private WebDAVLockServiceImpl davLockService;
|
||||
private @Mock HttpSession session;
|
||||
private @Mock List<Pair<String, NodeRef>> sessionList;
|
||||
private @Mock AuthenticationUtil authenticationUtil;
|
||||
private @Mock TransactionService transactionService;
|
||||
private @Mock RetryingTransactionHelper txHelper;
|
||||
private @Mock NodeService nodeService;
|
||||
private @Mock LockService lockService;
|
||||
private @Mock CheckOutCheckInService cociService;
|
||||
private NodeRef nodeRef1;
|
||||
private NodeRef nodeRef2;
|
||||
private LockInfoImpl lockInfo1;
|
||||
private LockState lockState1;
|
||||
private LockInfoImpl lockInfo2;
|
||||
private LockState lockState2;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
davLockService = new WebDAVLockServiceImpl();
|
||||
davLockService.setNodeService(nodeService);
|
||||
davLockService.setCheckOutCheckInService(cociService);
|
||||
davLockService.setCurrentSession(session);
|
||||
davLockService.setLockService(lockService);
|
||||
|
||||
// Train the mock LockStore to respond to get() requests for certain noderefs.
|
||||
nodeRef1 = new NodeRef("workspace://SpacesStore/f6e3f82a-cfef-445b-9fca-7986a14181cc");
|
||||
lockInfo1 = new LockInfoImplTest.LockInfoImplEx();
|
||||
lockState1 = LockState.createLock(nodeRef1, LockType.WRITE_LOCK, "user1", null, Lifetime.EPHEMERAL, null);
|
||||
Mockito.when(lockService.getLockState(nodeRef1)).thenReturn(lockState1);
|
||||
nodeRef2 = new NodeRef("workspace://SpacesStore/a6a4371c-99b9-4618-8cd2-e71d7d96aa87");
|
||||
lockInfo2 = new LockInfoImplTest.LockInfoImplEx();
|
||||
lockInfo2.setExclusiveLockToken("a-random-token");
|
||||
lockInfo2.setDepth("infinity");
|
||||
lockInfo2.setScope(WebDAV.XML_EXCLUSIVE);
|
||||
lockState2 = LockState.createLock(nodeRef2, LockType.WRITE_LOCK, "user2", new Date(999L), Lifetime.EPHEMERAL, lockInfo2.toJSON());
|
||||
Mockito.when(lockService.getLockState(nodeRef2)).thenReturn(lockState2);
|
||||
|
||||
// The mock HttpSession should return the mock session list.
|
||||
Mockito.when(session.getAttribute("_webdavLockedResources")).thenReturn(sessionList);
|
||||
|
||||
// Provide a user name for our fictional user.
|
||||
authenticationUtil = new AuthenticationUtil();
|
||||
authenticationUtil.afterPropertiesSet();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser("some_user_name");
|
||||
|
||||
Mockito.when(txHelper.doInTransaction(any(RetryingTransactionCallback.class), anyBoolean())).thenAnswer(new Answer()
|
||||
{
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable
|
||||
{
|
||||
Object[] args = invocation.getArguments();
|
||||
RetryingTransactionCallback<Void> callback = (RetryingTransactionCallback<Void>) args[0];
|
||||
callback.execute();
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
Mockito.when(transactionService.getRetryingTransactionHelper()).thenReturn(txHelper);
|
||||
davLockService.setTransactionService(transactionService);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSessionDestroyed()
|
||||
{
|
||||
List<Pair<String, NodeRef>> lockedNodes = new ArrayList<Pair<String, NodeRef>>(2);
|
||||
lockedNodes.add(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
lockedNodes.add(new Pair<String, NodeRef>("another_user_name", nodeRef2));
|
||||
Mockito.when(sessionList.size()).thenReturn(2);
|
||||
Mockito.when(sessionList.iterator()).thenReturn(lockedNodes.iterator());
|
||||
|
||||
Mockito.when(nodeService.exists(nodeRef1)).thenReturn(true);
|
||||
Mockito.when(nodeService.exists(nodeRef2)).thenReturn(true);
|
||||
|
||||
Mockito.when(lockService.getLockStatus(nodeRef1)).thenReturn(LockStatus.LOCKED);
|
||||
Mockito.when(lockService.getLockStatus(nodeRef2)).thenReturn(LockStatus.LOCKED);
|
||||
|
||||
// We're not going to do anything with nodeRef2
|
||||
NodeRef wcNodeRef2 = new NodeRef("workspace://SpacesStore/a6e3f82a-cfef-363d-9fca-3986a14180a0");
|
||||
Mockito.when(cociService.getWorkingCopy(nodeRef2)).thenReturn(wcNodeRef2);
|
||||
|
||||
davLockService.sessionDestroyed();
|
||||
|
||||
// nodeRef1 is unlocked
|
||||
Mockito.verify(lockService).unlock(nodeRef1);
|
||||
|
||||
// nodeRef2 is not unlocked
|
||||
Mockito.verify(lockService, Mockito.never()).unlock(nodeRef2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockLessThan24Hours()
|
||||
{
|
||||
lockInfo1.setTimeoutSeconds(100);
|
||||
|
||||
davLockService.lock(nodeRef1, lockInfo1);
|
||||
|
||||
Mockito.verify(lockService).lock(nodeRef1, LockType.WRITE_LOCK, 100, Lifetime.EPHEMERAL, lockInfo1.toJSON());
|
||||
// 100 seconds (in millis) should have been added to the date/time stamp.
|
||||
assertEquals(86500000, lockInfo1.getExpires().getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockGreaterThan24Hours()
|
||||
{
|
||||
int timeout25hours = WebDAV.TIMEOUT_24_HOURS + 3600;
|
||||
lockInfo1.setTimeoutSeconds(timeout25hours);
|
||||
|
||||
davLockService.lock(nodeRef1, lockInfo1);
|
||||
|
||||
Mockito.verify(lockService).lock(nodeRef1, LockType.WRITE_LOCK, WebDAV.TIMEOUT_24_HOURS, Lifetime.EPHEMERAL, lockInfo1.toJSON());
|
||||
Mockito.verify(sessionList).add(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
// Timeout should be capped at 24 hours.
|
||||
assertEquals(WebDAV.TIMEOUT_24_HOURS, lockInfo1.getRemainingTimeoutSeconds());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockForInfinityTime()
|
||||
{
|
||||
lockInfo1.setTimeoutSeconds(WebDAV.TIMEOUT_INFINITY);
|
||||
|
||||
davLockService.lock(nodeRef1, lockInfo1);
|
||||
|
||||
Mockito.verify(lockService).lock(nodeRef1, LockType.WRITE_LOCK, WebDAV.TIMEOUT_24_HOURS, Lifetime.EPHEMERAL, lockInfo1.toJSON());
|
||||
Mockito.verify(sessionList).add(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
// Timeout should be capped at 24 hours.
|
||||
assertEquals(WebDAV.TIMEOUT_24_HOURS, lockInfo1.getRemainingTimeoutSeconds());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canUnlock()
|
||||
{
|
||||
davLockService.unlock(nodeRef1);
|
||||
|
||||
// NodeRef should have been unlocked.
|
||||
Mockito.verify(lockService).unlock(nodeRef1);
|
||||
// Node should have been removed from the list in the user's session.
|
||||
Mockito.verify(sessionList).remove(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetLockInfo()
|
||||
{
|
||||
NodeRef nodeRef3 = new NodeRef("workspace://SpacesStore/a6a4371c-99b9-4618-8cd2-e71d28374859");
|
||||
Mockito.when(lockService.getLockState(nodeRef1)).thenReturn(lockState1);
|
||||
Mockito.when(lockService.getLockState(nodeRef2)).thenReturn(lockState2);
|
||||
Mockito.when(lockService.getLockState(nodeRef3)).thenReturn(null);
|
||||
|
||||
// nodeRef1
|
||||
LockInfo lockInfo = davLockService.getLockInfo(nodeRef1);
|
||||
assertEquals(null, lockInfo.getExpires());
|
||||
assertEquals("user1", lockInfo.getOwner());
|
||||
|
||||
// nodeRef2
|
||||
lockInfo = davLockService.getLockInfo(nodeRef2);
|
||||
assertEquals(new Date(999L), lockInfo.getExpires());
|
||||
assertEquals("user2", lockInfo.getOwner());
|
||||
assertEquals("a-random-token", lockInfo.getExclusiveLockToken());
|
||||
assertEquals("infinity", lockInfo.getDepth());
|
||||
assertEquals(WebDAV.XML_EXCLUSIVE, lockInfo.getScope());
|
||||
|
||||
// nodeRef3
|
||||
lockInfo = davLockService.getLockInfo(nodeRef3);
|
||||
assertEquals(null, lockInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mnt13183LockInfo()
|
||||
{
|
||||
// CIFS lock node to 1 hour
|
||||
lockService.lock(nodeRef1, LockType.WRITE_LOCK, 3600, Lifetime.EPHEMERAL, "lock_info_that_is_not_from_webdav");
|
||||
|
||||
// WebDAV get lock info
|
||||
LockInfo lockInfoNodeRef1 = davLockService.getLockInfo(nodeRef1);
|
||||
assertNull("exclusiveLockToken is null", lockInfoNodeRef1.getExclusiveLockToken());
|
||||
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
|
||||
// WebDav lock, check marker
|
||||
davLockService.lock(nodeRef2, user, 3600);
|
||||
|
||||
LockState lockState2 = lockService.getLockState(nodeRef2);
|
||||
assertNotNull("lockState is not null", lockState2);
|
||||
|
||||
String additionalInfo2 = lockState2.getAdditionalInfo();
|
||||
assertNotNull("additionalInfo is not null", additionalInfo2);
|
||||
assertTrue("Check WEBDAV_LOCK marker", additionalInfo2.startsWith(LockInfoImpl.ADDINFO_WEBDAV_MARKER));
|
||||
}
|
||||
}
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyBoolean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.alfresco.repo.lock.mem.Lifetime;
|
||||
import org.alfresco.repo.lock.mem.LockState;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class WebDAVLockServiceImplTest
|
||||
{
|
||||
private WebDAVLockServiceImpl davLockService;
|
||||
private @Mock HttpSession session;
|
||||
private @Mock List<Pair<String, NodeRef>> sessionList;
|
||||
private @Mock AuthenticationUtil authenticationUtil;
|
||||
private @Mock TransactionService transactionService;
|
||||
private @Mock RetryingTransactionHelper txHelper;
|
||||
private @Mock NodeService nodeService;
|
||||
private @Mock LockService lockService;
|
||||
private @Mock CheckOutCheckInService cociService;
|
||||
private NodeRef nodeRef1;
|
||||
private NodeRef nodeRef2;
|
||||
private LockInfoImpl lockInfo1;
|
||||
private LockState lockState1;
|
||||
private LockInfoImpl lockInfo2;
|
||||
private LockState lockState2;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
davLockService = new WebDAVLockServiceImpl();
|
||||
davLockService.setNodeService(nodeService);
|
||||
davLockService.setCheckOutCheckInService(cociService);
|
||||
davLockService.setCurrentSession(session);
|
||||
davLockService.setLockService(lockService);
|
||||
|
||||
// Train the mock LockStore to respond to get() requests for certain noderefs.
|
||||
nodeRef1 = new NodeRef("workspace://SpacesStore/f6e3f82a-cfef-445b-9fca-7986a14181cc");
|
||||
lockInfo1 = new LockInfoImplTest.LockInfoImplEx();
|
||||
lockState1 = LockState.createLock(nodeRef1, LockType.WRITE_LOCK, "user1", null, Lifetime.EPHEMERAL, null);
|
||||
Mockito.when(lockService.getLockState(nodeRef1)).thenReturn(lockState1);
|
||||
nodeRef2 = new NodeRef("workspace://SpacesStore/a6a4371c-99b9-4618-8cd2-e71d7d96aa87");
|
||||
lockInfo2 = new LockInfoImplTest.LockInfoImplEx();
|
||||
lockInfo2.setExclusiveLockToken("a-random-token");
|
||||
lockInfo2.setDepth("infinity");
|
||||
lockInfo2.setScope(WebDAV.XML_EXCLUSIVE);
|
||||
lockState2 = LockState.createLock(nodeRef2, LockType.WRITE_LOCK, "user2", new Date(999L), Lifetime.EPHEMERAL, lockInfo2.toJSON());
|
||||
Mockito.when(lockService.getLockState(nodeRef2)).thenReturn(lockState2);
|
||||
|
||||
// The mock HttpSession should return the mock session list.
|
||||
Mockito.when(session.getAttribute("_webdavLockedResources")).thenReturn(sessionList);
|
||||
|
||||
// Provide a user name for our fictional user.
|
||||
authenticationUtil = new AuthenticationUtil();
|
||||
authenticationUtil.afterPropertiesSet();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser("some_user_name");
|
||||
|
||||
Mockito.when(txHelper.doInTransaction(any(RetryingTransactionCallback.class), anyBoolean())).thenAnswer(new Answer()
|
||||
{
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable
|
||||
{
|
||||
Object[] args = invocation.getArguments();
|
||||
RetryingTransactionCallback<Void> callback = (RetryingTransactionCallback<Void>) args[0];
|
||||
callback.execute();
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
Mockito.when(transactionService.getRetryingTransactionHelper()).thenReturn(txHelper);
|
||||
davLockService.setTransactionService(transactionService);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSessionDestroyed()
|
||||
{
|
||||
List<Pair<String, NodeRef>> lockedNodes = new ArrayList<Pair<String, NodeRef>>(2);
|
||||
lockedNodes.add(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
lockedNodes.add(new Pair<String, NodeRef>("another_user_name", nodeRef2));
|
||||
Mockito.when(sessionList.size()).thenReturn(2);
|
||||
Mockito.when(sessionList.iterator()).thenReturn(lockedNodes.iterator());
|
||||
|
||||
Mockito.when(nodeService.exists(nodeRef1)).thenReturn(true);
|
||||
Mockito.when(nodeService.exists(nodeRef2)).thenReturn(true);
|
||||
|
||||
Mockito.when(lockService.getLockStatus(nodeRef1)).thenReturn(LockStatus.LOCKED);
|
||||
Mockito.when(lockService.getLockStatus(nodeRef2)).thenReturn(LockStatus.LOCKED);
|
||||
|
||||
// We're not going to do anything with nodeRef2
|
||||
NodeRef wcNodeRef2 = new NodeRef("workspace://SpacesStore/a6e3f82a-cfef-363d-9fca-3986a14180a0");
|
||||
Mockito.when(cociService.getWorkingCopy(nodeRef2)).thenReturn(wcNodeRef2);
|
||||
|
||||
davLockService.sessionDestroyed();
|
||||
|
||||
// nodeRef1 is unlocked
|
||||
Mockito.verify(lockService).unlock(nodeRef1);
|
||||
|
||||
// nodeRef2 is not unlocked
|
||||
Mockito.verify(lockService, Mockito.never()).unlock(nodeRef2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockLessThan24Hours()
|
||||
{
|
||||
lockInfo1.setTimeoutSeconds(100);
|
||||
|
||||
davLockService.lock(nodeRef1, lockInfo1);
|
||||
|
||||
Mockito.verify(lockService).lock(nodeRef1, LockType.WRITE_LOCK, 100, Lifetime.EPHEMERAL, lockInfo1.toJSON());
|
||||
// 100 seconds (in millis) should have been added to the date/time stamp.
|
||||
assertEquals(86500000, lockInfo1.getExpires().getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockGreaterThan24Hours()
|
||||
{
|
||||
int timeout25hours = WebDAV.TIMEOUT_24_HOURS + 3600;
|
||||
lockInfo1.setTimeoutSeconds(timeout25hours);
|
||||
|
||||
davLockService.lock(nodeRef1, lockInfo1);
|
||||
|
||||
Mockito.verify(lockService).lock(nodeRef1, LockType.WRITE_LOCK, WebDAV.TIMEOUT_24_HOURS, Lifetime.EPHEMERAL, lockInfo1.toJSON());
|
||||
Mockito.verify(sessionList).add(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
// Timeout should be capped at 24 hours.
|
||||
assertEquals(WebDAV.TIMEOUT_24_HOURS, lockInfo1.getRemainingTimeoutSeconds());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockForInfinityTime()
|
||||
{
|
||||
lockInfo1.setTimeoutSeconds(WebDAV.TIMEOUT_INFINITY);
|
||||
|
||||
davLockService.lock(nodeRef1, lockInfo1);
|
||||
|
||||
Mockito.verify(lockService).lock(nodeRef1, LockType.WRITE_LOCK, WebDAV.TIMEOUT_24_HOURS, Lifetime.EPHEMERAL, lockInfo1.toJSON());
|
||||
Mockito.verify(sessionList).add(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
// Timeout should be capped at 24 hours.
|
||||
assertEquals(WebDAV.TIMEOUT_24_HOURS, lockInfo1.getRemainingTimeoutSeconds());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canUnlock()
|
||||
{
|
||||
davLockService.unlock(nodeRef1);
|
||||
|
||||
// NodeRef should have been unlocked.
|
||||
Mockito.verify(lockService).unlock(nodeRef1);
|
||||
// Node should have been removed from the list in the user's session.
|
||||
Mockito.verify(sessionList).remove(new Pair<String, NodeRef>("some_user_name", nodeRef1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canGetLockInfo()
|
||||
{
|
||||
NodeRef nodeRef3 = new NodeRef("workspace://SpacesStore/a6a4371c-99b9-4618-8cd2-e71d28374859");
|
||||
Mockito.when(lockService.getLockState(nodeRef1)).thenReturn(lockState1);
|
||||
Mockito.when(lockService.getLockState(nodeRef2)).thenReturn(lockState2);
|
||||
Mockito.when(lockService.getLockState(nodeRef3)).thenReturn(null);
|
||||
|
||||
// nodeRef1
|
||||
LockInfo lockInfo = davLockService.getLockInfo(nodeRef1);
|
||||
assertEquals(null, lockInfo.getExpires());
|
||||
assertEquals("user1", lockInfo.getOwner());
|
||||
|
||||
// nodeRef2
|
||||
lockInfo = davLockService.getLockInfo(nodeRef2);
|
||||
assertEquals(new Date(999L), lockInfo.getExpires());
|
||||
assertEquals("user2", lockInfo.getOwner());
|
||||
assertEquals("a-random-token", lockInfo.getExclusiveLockToken());
|
||||
assertEquals("infinity", lockInfo.getDepth());
|
||||
assertEquals(WebDAV.XML_EXCLUSIVE, lockInfo.getScope());
|
||||
|
||||
// nodeRef3
|
||||
lockInfo = davLockService.getLockInfo(nodeRef3);
|
||||
assertEquals(null, lockInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mnt13183LockInfo()
|
||||
{
|
||||
// CIFS lock node to 1 hour
|
||||
lockService.lock(nodeRef1, LockType.WRITE_LOCK, 3600, Lifetime.EPHEMERAL, "lock_info_that_is_not_from_webdav");
|
||||
|
||||
// WebDAV get lock info
|
||||
LockInfo lockInfoNodeRef1 = davLockService.getLockInfo(nodeRef1);
|
||||
assertNull("exclusiveLockToken is null", lockInfoNodeRef1.getExclusiveLockToken());
|
||||
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
|
||||
// WebDav lock, check marker
|
||||
davLockService.lock(nodeRef2, user, 3600);
|
||||
|
||||
LockState lockState2 = lockService.getLockState(nodeRef2);
|
||||
assertNotNull("lockState is not null", lockState2);
|
||||
|
||||
String additionalInfo2 = lockState2.getAdditionalInfo();
|
||||
assertNotNull("additionalInfo is not null", additionalInfo2);
|
||||
assertTrue("Check WEBDAV_LOCK marker", additionalInfo2.startsWith(LockInfoImpl.ADDINFO_WEBDAV_MARKER));
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -363,14 +364,14 @@ public class ResultMapperTests
|
||||
assertEquals("created",statsFacet.getLabel());
|
||||
Set<Metric> statsMetrics = statsFacet.getBuckets().get(0).getMetrics();
|
||||
assertEquals(8,statsMetrics.size());
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.sumOfSquares, 2.1513045770343806E27 )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.sumOfSquares, BigDecimal.valueOf(2.1513045770343806E27) )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.min, "2011-02-15T20:16:27.080Z" )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.max, "2017-04-10T15:06:30.143Z" )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.mean, "2016-09-05T04:20:12.898Z" )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.countValues, 990 )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.missing, 290 )));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.sum, 1.458318720769983E15)));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.stddev, 5.6250677994522545E10)));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.sum, BigDecimal.valueOf(1.458318720769983E15))));
|
||||
assertTrue(statsMetrics.contains(new SimpleMetric(METRIC_TYPE.stddev, BigDecimal.valueOf(5.6250677994522545E10))));
|
||||
|
||||
statsFacet = searchContext.getFacets().get(6);
|
||||
assertEquals("numericLabel",statsFacet.getLabel());
|
||||
|
@@ -33,7 +33,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.rest.api.model.AbstractClassModel;
|
||||
import org.alfresco.rest.api.model.AbstractCustomClass;
|
||||
import org.alfresco.rest.api.model.CustomAspect;
|
||||
import org.alfresco.rest.api.model.CustomModel;
|
||||
import org.alfresco.rest.api.model.CustomModel.ModelStatus;
|
||||
@@ -158,10 +158,10 @@ public class BaseCustomModelApiTest extends AbstractBaseApiTest
|
||||
return customModel;
|
||||
}
|
||||
|
||||
protected <T extends AbstractClassModel> T createTypeAspect(Class<T> glazz, String modelName, String typeAspectName, String title, String desc,
|
||||
String parent) throws Exception
|
||||
protected <T extends AbstractCustomClass> T createTypeAspect(Class<T> glazz, String modelName, String typeAspectName, String title, String desc,
|
||||
String parent) throws Exception
|
||||
{
|
||||
AbstractClassModel classModel = null;
|
||||
AbstractCustomClass classModel = null;
|
||||
String uri = "cmm/" + modelName;
|
||||
if (glazz.equals(CustomType.class))
|
||||
{
|
||||
@@ -194,7 +194,7 @@ public class BaseCustomModelApiTest extends AbstractBaseApiTest
|
||||
assertTrue("Two models are not equal. Expected:<" + expectedModel.toString() + "> but was:<" + actualModel.toString() + ">", result);
|
||||
}
|
||||
|
||||
protected void compareCustomTypesAspects(AbstractClassModel expectedDetails, AbstractClassModel actualDetails, String... excludeFields)
|
||||
protected void compareCustomTypesAspects(AbstractCustomClass expectedDetails, AbstractCustomClass actualDetails, String... excludeFields)
|
||||
{
|
||||
List<CustomModelProperty> expectedProps = expectedDetails.getProperties();
|
||||
List<CustomModelProperty> actualProps = actualDetails.getProperties();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user