mirror of
https://github.com/Alfresco/acs-community-packaging.git
synced 2026-09-16 18:13:21 +00:00
Compare commits
213
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad0cc65eab | ||
|
|
9e2ae4dd18 | ||
|
|
c0b21be4b1 | ||
|
|
dde66bc666 | ||
|
|
d3f8e355c8 | ||
|
|
0358e38909 | ||
|
|
26f4334d5d | ||
|
|
a31f681ca8 | ||
|
|
816442969b | ||
|
|
c0c0b7c277 | ||
|
|
5af3f0482f | ||
|
|
f167ba356d | ||
|
|
6451006595 | ||
|
|
8d9409780b | ||
|
|
ddd0470c7d | ||
|
|
67a7af857c | ||
|
|
4b6dc109f7 | ||
|
|
9d4e4ed8d1 | ||
|
|
bb6c3557fb | ||
|
|
fc2c3bb973 | ||
|
|
50d981ae59 | ||
|
|
f394b39114 | ||
|
|
87870f5909 | ||
|
|
f33dcd962a | ||
|
|
bfda5b30b2 | ||
|
|
4c7dc0045a | ||
|
|
0677f8cd4c | ||
|
|
c10f2127b6 | ||
|
|
80e7a0821f | ||
|
|
1ee249be46 | ||
|
|
c9649155a5 | ||
|
|
f30aac7aa3 | ||
|
|
6487498c31 | ||
|
|
c9fd5ea0da | ||
|
|
b29116194a | ||
|
|
4d88482eb6 | ||
|
|
f4b6186e91 | ||
|
|
ca36730ec7 | ||
|
|
7c17345ec0 | ||
|
|
d395b6ece2 | ||
|
|
daaa8cb596 | ||
|
|
2200cde0f9 | ||
|
|
6bb31ede54 | ||
|
|
dda79af24b | ||
|
|
2d3028b323 | ||
|
|
0c1bf17b5e | ||
|
|
e5a651881f | ||
|
|
994a3d0daa | ||
|
|
ce9d056e9b | ||
|
|
7ceb1a6ee6 | ||
|
|
2ce53ab670 | ||
|
|
7cf4c9fe8e | ||
|
|
7dd5d129ed | ||
|
|
577f4d980f | ||
|
|
8a92051944 | ||
|
|
350b48b489 | ||
|
|
05c95b6736 | ||
|
|
3204a27be1 | ||
|
|
7e33f191d8 | ||
|
|
417eb87342 | ||
|
|
853e6fa957 | ||
|
|
1cecc5076b | ||
|
|
d8dc7bb342 | ||
|
|
9e911a6522 | ||
|
|
b6ab0471ba | ||
|
|
8ccf987875 | ||
|
|
9a6769cf85 | ||
|
|
f50791f7d3 | ||
|
|
ae1808aa5b | ||
|
|
a792dd0f0d | ||
|
|
cdd9a7febb | ||
|
|
dbd47807c2 | ||
|
|
ec26f4c413 | ||
|
|
e24294c72a | ||
|
|
471ea4c3f0 | ||
|
|
9e067b3849 | ||
|
|
65fd3954e7 | ||
|
|
a5936e8222 | ||
|
|
29efbf17e3 | ||
|
|
d1a0b618c4 | ||
|
|
8c886189f9 | ||
|
|
b772d118f2 | ||
|
|
848ba0f423 | ||
|
|
780903b0dc | ||
|
|
6269755d41 | ||
|
|
c1eb66b4c4 | ||
|
|
349c667659 | ||
|
|
7d0d41fa8d | ||
|
|
8900c900fc | ||
|
|
6ae96d7eb9 | ||
|
|
0e178e0d7a | ||
|
|
d25b8a7456 | ||
|
|
8646af8e38 | ||
|
|
8c5df8a623 | ||
|
|
d1709e19a4 | ||
|
|
7aaf051e0f | ||
|
|
628db2571f | ||
|
|
5af9d23f00 | ||
|
|
c2234e8293 | ||
|
|
4dc4cd4bc5 | ||
|
|
cc8bb13cad | ||
|
|
e76568e1d8 | ||
|
|
ba953623b8 | ||
|
|
01b876092d | ||
|
|
0b0ae21a37 | ||
|
|
859dc09e59 | ||
|
|
7efc5d4d5b | ||
|
|
78c5f5fabf | ||
|
|
d94314cd00 | ||
|
|
7c5d37c61a | ||
|
|
397a98966f | ||
|
|
162e41b3fd | ||
|
|
8f5918ae78 | ||
|
|
3ae27589a0 | ||
|
|
5494c66485 | ||
|
|
da7f54e94a | ||
|
|
5bf6c0881e | ||
|
|
a22d2f4d2e | ||
|
|
5f45041c78 | ||
|
|
7f7dca86ba | ||
|
|
3ef8f1ca58 | ||
|
|
af12a0979d | ||
|
|
024059275f | ||
|
|
97a82edafe | ||
|
|
1e82dc0944 | ||
|
|
aaf8314fc8 | ||
|
|
4286ac5ddc | ||
|
|
abd546b7dd | ||
|
|
964b2a7e2c | ||
|
|
4b43aca430 | ||
|
|
38b6953226 | ||
|
|
419177faee | ||
|
|
98c9960085 | ||
|
|
59b0784c08 | ||
|
|
8632bc991c | ||
|
|
3a2c41b346 | ||
|
|
80e5029793 | ||
|
|
9c019c6d31 | ||
|
|
746523dbc8 | ||
|
|
56d4d86fed | ||
|
|
39d74e9133 | ||
|
|
4890949a1f | ||
|
|
5979a527bc | ||
|
|
5067e29224 | ||
|
|
e464a586d1 | ||
|
|
d1ec5c7941 | ||
|
|
e0f21011c3 | ||
|
|
ecf7f2d9be | ||
|
|
373662c8e3 | ||
|
|
d83d8c8c9a | ||
|
|
13ae6388b8 | ||
|
|
0b06aebe1a | ||
|
|
d587cc7786 | ||
|
|
62412f0243 | ||
|
|
52a6891b41 | ||
|
|
8c569fb6b2 | ||
|
|
9ed8139a9d | ||
|
|
2fab44a183 | ||
|
|
b1808b42ff | ||
|
|
78d377effe | ||
|
|
23cbca581c | ||
|
|
25c3a733e6 | ||
|
|
00a1d4fe51 | ||
|
|
04b4ac5da6 | ||
|
|
c4ba076173 | ||
|
|
dc315393d4 | ||
|
|
a988bcc58f | ||
|
|
cd3c8c81b8 | ||
|
|
4e62cc7aa6 | ||
|
|
237b8de174 | ||
|
|
889ce9c76c | ||
|
|
f5b47df591 | ||
|
|
c93466d9d6 | ||
|
|
c35d58a676 | ||
|
|
e5dd89e910 | ||
|
|
7ec28f39ad | ||
|
|
b7e3d0be8b | ||
|
|
38b0ddca4e | ||
|
|
06539e62af | ||
|
|
9ca994969a | ||
|
|
9acdc4e15b | ||
|
|
623218d6d3 | ||
|
|
a2f8c6d15d | ||
|
|
9a5b34ad0b | ||
|
|
082601aa60 | ||
|
|
0dbcb023c0 | ||
|
|
75b87f8fca | ||
|
|
85674fa3cf | ||
|
|
9aef1c6ebb | ||
|
|
17f0dc96df | ||
|
|
18af8be4f2 | ||
|
|
d1578c9728 | ||
|
|
224c48a1be | ||
|
|
9a61f9bd70 | ||
|
|
b87bc79adb | ||
|
|
fe38300a62 | ||
|
|
5760e6ff28 | ||
|
|
8b7d53180c | ||
|
|
114d0a9dab | ||
|
|
7c6dccd6cb | ||
|
|
438f632639 | ||
|
|
01fb4d9787 | ||
|
|
097d0f6cd6 | ||
|
|
f59d62e142 | ||
|
|
741945e5d0 | ||
|
|
0496a4f2ad | ||
|
|
a7a6cc1b77 | ||
|
|
1d5f934db7 | ||
|
|
dc110a62d2 | ||
|
|
56a5e6187c | ||
|
|
94fc62ccc5 | ||
|
|
b3b414b40e | ||
|
|
86e3337826 |
+8
-8
@@ -1,8 +1,8 @@
|
||||
.* eol=crlf
|
||||
*.html eol=crlf
|
||||
*.java eol=crlf
|
||||
*.txt eol=crlf
|
||||
*.css eol=crlf
|
||||
*.xml eol=crlf
|
||||
*.js eol=crlf
|
||||
*.properties eol=crlf
|
||||
# .* eol=crlf
|
||||
# *.html eol=crlf
|
||||
# *.java eol=crlf
|
||||
# *.txt eol=crlf
|
||||
# *.css eol=crlf
|
||||
# *.xml eol=crlf
|
||||
# *.js eol=crlf
|
||||
# *.properties eol=crlf
|
||||
+4
-1
@@ -35,4 +35,7 @@ alf_data/
|
||||
|
||||
helm/alfresco-content-services-community/charts/*
|
||||
helm/alfresco-content-services-community/requirements.lock
|
||||
helm/alfresco-content-services-community*.tgz
|
||||
helm/alfresco-content-services-community*.tgz
|
||||
|
||||
# Travis deployment folder
|
||||
deploy_dir
|
||||
@@ -0,0 +1,53 @@
|
||||
<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>alfresco-internal</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>alfresco-internal</id>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<name>Alfresco Internal Repository</name>
|
||||
<url>https://artifacts.alfresco.com/nexus/content/groups/internal</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>alfresco-internal</id>
|
||||
<name>Alfresco Internal Repository</name>
|
||||
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<properties>
|
||||
<!-- WhiteSource token -->
|
||||
<org.whitesource.orgToken>${env.WHITESOURCE_API_KEY}</org.whitesource.orgToken>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<servers>
|
||||
<server>
|
||||
<id>alfresco-internal</id>
|
||||
<username>${env.MAVEN_USERNAME}</username>
|
||||
<password>${env.MAVEN_PASSWORD}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>quay.io</id>
|
||||
<username>${env.QUAY_USERNAME}</username>
|
||||
<password>${env.QUAY_PASSWORD}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>docker.io</id>
|
||||
<username>${env.DOCKERHUB_USERNAME}</username>
|
||||
<password>${env.DOCKERHUB_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
+113
-55
@@ -1,90 +1,148 @@
|
||||
---
|
||||
dist: xenial
|
||||
sudo: required
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk11
|
||||
jdk: openjdk11
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
- ${HOME}/.m2/repository
|
||||
|
||||
env:
|
||||
global:
|
||||
- VERSION_EDITION=Community
|
||||
# the cache can grow constantly
|
||||
before_cache: bash scripts/travis/cleanup_cache.sh
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- /release\/.*/
|
||||
- feature/REPO-5111_repo_build
|
||||
|
||||
matrix:
|
||||
env:
|
||||
global:
|
||||
- TAS_SCRIPTS=../alfresco-community-repo/packaging/tests/scripts
|
||||
- TAS_ENVIRONMENT=./tests/environment
|
||||
# Must be in the format <alfresco-version>-<additional_versioning> ie. 6.3.0-repo-xxxx-x or 6.3.0-Ax
|
||||
- RELEASE_VERSION=7.0.0-TEST4
|
||||
- DEVELOPMENT_VERSION=7.0.0-TEST5-SNAPSHOT
|
||||
|
||||
stages:
|
||||
- name: test
|
||||
if: commit_message !~ /\[skip tests\]/
|
||||
- name: docker_latest
|
||||
if: fork = false AND type != pull_request AND branch = master
|
||||
- name: release
|
||||
if: commit_message ~= /\[release\]/ AND fork = false AND type != pull_request AND (branch =~ ^(master|develop)$ OR branch =~ /release\/.*/ OR branch = feature/REPO-5111_repo_build)
|
||||
- name: publish
|
||||
if: commit_message ~= /\[publish\]/ AND fork = false AND type != pull_request AND (branch =~ ^(master|develop)$ OR branch =~ /release\/.*/)
|
||||
|
||||
before_install: travis_retry bash scripts/travis/init.sh
|
||||
install: travis_retry travis_wait 40 bash scripts/travis/build.sh
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "WhiteSource scan"
|
||||
# only on develop and if it is not a PR
|
||||
if: fork = false AND branch = develop AND type != pull_request
|
||||
install:
|
||||
- travis_retry travis_wait 30 mvn -q install "-Dversion.edition=${VERSION_EDITION}" -f war/pom.xml
|
||||
stage: test
|
||||
# only on master or develop and if it is not a PR
|
||||
if: fork = false AND branch =~ ^(master|develop)$ AND type != pull_request
|
||||
install: travis_retry travis_wait 30 mvn -B -q install -f war/pom.xml
|
||||
script:
|
||||
# Download the latest version of WhiteSource Unified Agent
|
||||
- curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.jar
|
||||
- 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 ./war
|
||||
|
||||
- name: "REST API TAS tests part1"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 60 mvn install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 60 mvn -B install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "REST API TAS tests part2"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 60 mvn install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 60 mvn -B install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "REST API TAS tests part3"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 60 mvn install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 60 mvn -B install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "CMIS TAS tests"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 40 mvn install -q -f tests/tas-cmis/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 40 mvn -B install -f tests/tas-cmis/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "Email TAS tests"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 30 mvn install -q -f tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 30 mvn -B install -f tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "WebDAV TAS tests"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 30 mvn install -q -f tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 20 mvn -B install -f tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "Integration TAS tests"
|
||||
jdk: openjdk11
|
||||
install:
|
||||
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
|
||||
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal.yml
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 30 mvn install -q -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
- travis_wait 30 mvn -B install -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "Update Docker latest images"
|
||||
stage: docker_latest
|
||||
script: travis_retry travis_wait 30 mvn -B -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pinternal
|
||||
|
||||
- name: "Release and Copy to S3 Staging"
|
||||
stage: release
|
||||
before_script: bash scripts/travis/verify_release_tag.sh
|
||||
script: travis_wait 40 bash scripts/travis/maven_release.sh
|
||||
before_deploy:
|
||||
# Move the final artifacts to a single folder (deploy_dir) to be copied to S3
|
||||
- mkdir -p deploy_dir
|
||||
- cp distribution/target/alfresco.war deploy_dir
|
||||
- cp distribution/target/*-distribution*.zip deploy_dir
|
||||
deploy:
|
||||
- provider: s3
|
||||
access_key_id: "${AWS_STAGING_ACCESS_KEY}"
|
||||
secret_access_key: "${AWS_STAGING_SECRET_KEY}"
|
||||
bucket: "alfresco-artefacts-staging"
|
||||
region: "eu-west-1"
|
||||
skip_cleanup: true
|
||||
acl: private
|
||||
local_dir: "deploy_dir"
|
||||
upload_dir: "alfresco-content-services-community/release/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}"
|
||||
on:
|
||||
all_branches: true
|
||||
|
||||
- name: "Copy to S3 Release"
|
||||
stage: publish
|
||||
# Nothing to build/install as we are just copying from S3 buckets
|
||||
install: skip
|
||||
script: skip
|
||||
before_deploy: pip install awscli
|
||||
deploy:
|
||||
- provider: script
|
||||
script: bash scripts/travis/copy_to_release_bucket.sh
|
||||
on:
|
||||
branch: master
|
||||
|
||||
|
||||
|
||||
+24
-3
@@ -7,8 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -16,7 +15,6 @@
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-services-community</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -41,6 +39,7 @@
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${dependency.postgresql.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Alfresco Pdf Renderer -->
|
||||
<dependency>
|
||||
@@ -148,6 +147,28 @@
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- Copy ROOT.war -->
|
||||
<execution>
|
||||
<id>copy-alfresco-war</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-services-community</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<type>war</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>alfresco.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
Alfresco Community (Build: ${installer.version.name})
|
||||
===============================
|
||||
|
||||
Contains:
|
||||
- Alfresco Content Services Community: ${project.version}
|
||||
- Alfresco Share: ${alfresco.share.version}
|
||||
|
||||
For users of Alfresco Community Edition, more information on this release is available at https://community.alfresco.com/community/ecm
|
||||
Alfresco Community (Build: ${installer.version.name})
|
||||
===============================
|
||||
|
||||
Contains:
|
||||
- Alfresco Content Services Community: ${project.version}
|
||||
- Alfresco Repository: ${dependency.alfresco-community-repo.version}
|
||||
- Alfresco Share: ${alfresco.share.version}
|
||||
|
||||
For users of Alfresco Community Edition, more information on this release is available at https://community.alfresco.com/community/ecm
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
test
|
||||
+17
-70
@@ -1,81 +1,33 @@
|
||||
# Fetch image based on Tomcat 8.5.43 and Java 11
|
||||
# More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat
|
||||
FROM alfresco/alfresco-base-tomcat:8.5.43-java-11-openjdk-centos-7
|
||||
FROM alfresco/alfresco-community-repo-base:${upstream.image.tag}
|
||||
|
||||
# Set default docker_context. Will / Can be overriden with maven.
|
||||
ARG resource_path=target
|
||||
|
||||
# Set default user information
|
||||
ARG GROUPNAME=Alfresco
|
||||
ARG GROUPID=1000
|
||||
ARG USERNAME=alfresco
|
||||
ARG IMAGEUSERNAME=alfresco
|
||||
ARG USERID=33000
|
||||
|
||||
# Set default environment args
|
||||
ARG TOMCAT_DIR=/usr/local/tomcat
|
||||
|
||||
USER root
|
||||
|
||||
# Create prerequisite to store tools and properties
|
||||
RUN mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension && \
|
||||
mkdir ${TOMCAT_DIR}/alfresco-mmt
|
||||
RUN touch ${TOMCAT_DIR}/shared/classes/alfresco-global.properties
|
||||
# Copy api-explorer war
|
||||
COPY ${resource_path}/war/* ${TOMCAT_DIR}/webapps/
|
||||
|
||||
# You need to run `mvn clean install` in the root of this project to update the following dependencies
|
||||
# Copy the WAR files to the appropriate location for your application server
|
||||
# Copy the JDBC drivers for the database you are using to the lib/ directory.
|
||||
# Copy the alfresco-mmt.jar
|
||||
COPY target/war ${TOMCAT_DIR}/webapps
|
||||
COPY target/connector/* ${TOMCAT_DIR}/lib/
|
||||
COPY target/alfresco-mmt/* ${TOMCAT_DIR}/alfresco-mmt/
|
||||
|
||||
# Copy Licenses to the root of the Docker image
|
||||
RUN mkdir /licenses
|
||||
COPY target/licenses/ /licenses/
|
||||
|
||||
# Change the value of the shared.loader= property to the following:
|
||||
# shared.loader=${catalina.base}/shared/classes
|
||||
RUN sed -i "s/shared.loader=/shared.loader=\${catalina.base}\/shared\/classes/" ${TOMCAT_DIR}/conf/catalina.properties
|
||||
|
||||
RUN mkdir -p ${TOMCAT_DIR}/amps \
|
||||
${TOMCAT_DIR}/shared/classes/alfresco/extension/mimetypes \
|
||||
${TOMCAT_DIR}/shared/classes/alfresco/extension/transform/renditions \
|
||||
${TOMCAT_DIR}/shared/classes/alfresco/extension/transform/pipelines
|
||||
|
||||
#RUN echo -e '\n\
|
||||
#log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug\n\
|
||||
#' >> ${TOMCAT_DIR}/shared/classes/alfresco/extension/custom-log4j.propertiesRUN mkdir -p ${TOMCAT_DIR}/amps
|
||||
|
||||
# Copy the amps from build context to the appropriate location for your application server
|
||||
COPY target/amps ${TOMCAT_DIR}/amps
|
||||
# Copy in the share-services amp
|
||||
COPY ${resource_path}/amps/* ${TOMCAT_DIR}/amps/
|
||||
|
||||
# Install amps on alfresco.war
|
||||
RUN java -jar ${TOMCAT_DIR}/alfresco-mmt/alfresco-mmt*.jar install \
|
||||
${TOMCAT_DIR}/amps ${TOMCAT_DIR}/webapps/alfresco -directory -nobackup -force
|
||||
${TOMCAT_DIR}/amps \
|
||||
${TOMCAT_DIR}/webapps/alfresco -directory -nobackup
|
||||
|
||||
# Docker CMD from parent image starts the server
|
||||
|
||||
# Make webapps folder read-only.
|
||||
RUN chmod -R =r ${TOMCAT_DIR}/webapps && \
|
||||
# Add catalina.policy to ROOT.war and alfresco.war
|
||||
# Grant all security permissions to alfresco webapp because of numerous permissions required in order to work properly.
|
||||
# Grant only deployXmlPermission to ROOT webapp.
|
||||
sed -i -e "\$a\grant\ codeBase\ \"file:\$\{catalina.base\}\/webapps\/alfresco\/-\" \{\n\ permission\ java.security.AllPermission\;\n\};\ngrant\ codeBase\ \"file:\$\{catalina.base\}\/webapps\/ROOT\/-\" \{\n\ permission org.apache.catalina.security.DeployXmlPermission \"ROOT\";\n\};" ${TOMCAT_DIR}/conf/catalina.policy
|
||||
|
||||
# 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 && \
|
||||
yum clean all
|
||||
|
||||
# The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,
|
||||
# The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,
|
||||
# group only has restricted permissions and world has no permissions.
|
||||
RUN mkdir -p ${TOMCAT_DIR}/conf/Catalina/localhost && \
|
||||
mkdir -p ${TOMCAT_DIR}/alf_data && \
|
||||
groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${USERNAME} && \
|
||||
chgrp -R ${GROUPNAME} ${TOMCAT_DIR} && \
|
||||
chmod g+w ${TOMCAT_DIR}/logs && \
|
||||
RUN chgrp -R ${GROUPNAME} ${TOMCAT_DIR} && \
|
||||
chmod g+rx ${TOMCAT_DIR}/conf && \
|
||||
chmod -R g+r ${TOMCAT_DIR}/conf && \
|
||||
find ${TOMCAT_DIR}/webapps -type d -exec chmod 0750 {} \; && \
|
||||
@@ -84,14 +36,9 @@ RUN mkdir -p ${TOMCAT_DIR}/conf/Catalina/localhost && \
|
||||
chmod g+r ${TOMCAT_DIR}/conf/Catalina && \
|
||||
chmod g+rwx ${TOMCAT_DIR}/alf_data && \
|
||||
chmod g+rwx ${TOMCAT_DIR}/logs && \
|
||||
chmod o-w ${TOMCAT_DIR}/logs && \
|
||||
chmod g+rwx ${TOMCAT_DIR}/temp && \
|
||||
chmod g+rwx ${TOMCAT_DIR}/work && \
|
||||
chmod o-w ${TOMCAT_DIR}/work
|
||||
|
||||
sed -i -e "s_log4j.appender.File.File\=alfresco.log_log4j.appender.File.File\=${TOMCAT_DIR}/logs\/alfresco.log_" \
|
||||
${TOMCAT_DIR}/webapps/alfresco/WEB-INF/classes/log4j.properties
|
||||
|
||||
# To remote debug into this image add: EXPOSE 8000
|
||||
# Changes are also required to the docker-compose/docker-compose.yml file.
|
||||
# EXPOSE 8000
|
||||
|
||||
USER ${USERNAME}
|
||||
USER ${IMAGEUSERNAME}
|
||||
+144
-188
@@ -7,82 +7,66 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<image.name>alfresco/alfresco-content-repository-community</image.name>
|
||||
<image.registry>quay.io</image.registry>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-services-community</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>api-explorer</artifactId>
|
||||
<version>${dependency.alfresco-api-explorer.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
<version>${dependency.alfresco-server-root.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${dependency.postgresql.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<version>${dependency.alfresco-mmt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-share-services</artifactId>
|
||||
<version>${alfresco.alfresco-share-services.version}</version>
|
||||
<type>amp</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-aos-module</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>amp</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-aos-repo-binding</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-vti-bin</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.integrations</groupId>
|
||||
<artifactId>alfresco-googledrive-repo-community</artifactId>
|
||||
<version>${alfresco.googledrive.version}</version>
|
||||
<type>amp</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<!-- <dependencies>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>alfresco-mmt</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>alfresco-server-root</artifactId>-->
|
||||
<!-- <type>war</type>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco.aos-module</groupId>-->
|
||||
<!-- <artifactId>alfresco-aos-module</artifactId>-->
|
||||
<!-- <type>amp</type>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>org.alfresco.aos-module</groupId>-->
|
||||
<!-- <artifactId>alfresco-aos-repo-binding</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco.aos-module</groupId>-->
|
||||
<!-- <artifactId>alfresco-vti-bin</artifactId>-->
|
||||
<!-- <type>war</type>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco.integrations</groupId>-->
|
||||
<!-- <artifactId>alfresco-googledrive-repo-community</artifactId>-->
|
||||
<!-- <type>amp</type>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>api-explorer</artifactId>-->
|
||||
<!-- <version>${dependency.alfresco-api-explorer.version}</version>-->
|
||||
<!-- <type>war</type>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>alfresco-share-services</artifactId>-->
|
||||
<!-- <type>amp</type>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- </dependencies>-->
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-licenses</id>
|
||||
@@ -106,7 +90,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-war-files</id>
|
||||
@@ -116,14 +99,13 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-services-community</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/war/alfresco</outputDirectory>
|
||||
</artifactItem>
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>content-services-community</artifactId>-->
|
||||
<!-- <type>war</type>-->
|
||||
<!-- <overWrite>false</overWrite>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/war/alfresco</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>api-explorer</artifactId>
|
||||
@@ -131,50 +113,49 @@
|
||||
<type>war</type>
|
||||
<outputDirectory>${project.build.directory}/war/api-explorer</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
<version>${dependency.alfresco-server-root.version}</version>
|
||||
<type>war</type>
|
||||
<outputDirectory>${project.build.directory}/war/ROOT</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-vti-bin</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>war</type>
|
||||
<outputDirectory>${project.build.directory}/war/_vti_bin</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-jdbc-connectors</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${dependency.postgresql.version}</version>
|
||||
<type>jar</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/connector</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<version>${dependency.alfresco-mmt.version}</version>
|
||||
<type>jar</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/alfresco-mmt</outputDirectory>
|
||||
</artifactItem>
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>alfresco-server-root</artifactId>-->
|
||||
<!-- <version>${dependency.alfresco-server-root.version}</version>-->
|
||||
<!-- <type>war</type>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/war/ROOT</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.alfresco.aos-module</groupId>-->
|
||||
<!-- <artifactId>alfresco-vti-bin</artifactId>-->
|
||||
<!-- <type>war</type>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/war/_vti_bin</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- <execution>-->
|
||||
<!-- <id>copy-jdbc-connectors</id>-->
|
||||
<!-- <phase>process-resources</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>copy</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <artifactItems>-->
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- <version>${dependency.postgresql.version}</version>-->
|
||||
<!-- <type>jar</type>-->
|
||||
<!-- <overWrite>false</overWrite>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/connector</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.alfresco</groupId>-->
|
||||
<!-- <artifactId>alfresco-mmt</artifactId>-->
|
||||
<!-- <version>${dependency.alfresco-mmt.version}</version>-->
|
||||
<!-- <type>jar</type>-->
|
||||
<!-- <overWrite>false</overWrite>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/alfresco-mmt</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
<!-- </artifactItems>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
|
||||
<execution>
|
||||
<id>copy-amps</id>
|
||||
@@ -192,55 +173,50 @@
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/amps</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-aos-module</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>amp</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/amps</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco.integrations</groupId>
|
||||
<artifactId>alfresco-googledrive-repo-community</artifactId>
|
||||
<version>${alfresco.googledrive.version}</version>
|
||||
<type>amp</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/amps</outputDirectory>
|
||||
</artifactItem>
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.alfresco.aos-module</groupId>-->
|
||||
<!-- <artifactId>alfresco-aos-module</artifactId>-->
|
||||
<!-- <type>amp</type>-->
|
||||
<!-- <overWrite>false</overWrite>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/amps</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
<!-- <artifactItem>-->
|
||||
<!-- <groupId>org.alfresco.integrations</groupId>-->
|
||||
<!-- <artifactId>alfresco-googledrive-repo-community</artifactId>-->
|
||||
<!-- <type>amp</type>-->
|
||||
<!-- <overWrite>false</overWrite>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/amps</outputDirectory>-->
|
||||
<!-- </artifactItem>-->
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>${dependency.fabric8.version}</version>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>${image.name}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>communityDocker</id>
|
||||
<!-- builds "image:latest" locally -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>${dependency.fabric8.version}</version>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
@@ -257,59 +233,33 @@
|
||||
|
||||
<profile>
|
||||
<id>internal</id>
|
||||
<!-- publishes "image:latest" on Quay & DockerHub -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>${dependency.fabric8.version}</version>
|
||||
<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>
|
||||
</images>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-push-image</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
<goal>push</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>master</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>${dependency.fabric8.version}</version>
|
||||
<configuration>
|
||||
<images>
|
||||
<!-- DockerHub image -->
|
||||
<image>
|
||||
<name>${image.name}</name>
|
||||
<registry>${image.registry}</registry>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
</build>
|
||||
</image>
|
||||
<image>
|
||||
<name>${image.name}</name>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
@@ -331,25 +281,33 @@
|
||||
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<!-- publishes "image:release_version" on Quay & DockerHub -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>${dependency.fabric8.version}</version>
|
||||
<configuration>
|
||||
<configuration combine.self="override">
|
||||
<images>
|
||||
<!-- Quay image -->
|
||||
<image>
|
||||
<name>${image.name}:${project.version}</name>
|
||||
<registry>${image.registry}</registry>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
<!-- DockerHub image -->
|
||||
<image>
|
||||
<name>${image.name}:${project.version}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
@@ -369,6 +327,4 @@
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
ALFRESCO_TAG=latest
|
||||
TRANSFORMERS_TAG=2.1.0
|
||||
SHARE_TAG=6.2.0
|
||||
SOLR6_TAG=1.4.0
|
||||
POSTGRES_TAG=11.4
|
||||
ACTIVEMQ_TAG=5.15.8
|
||||
REGISTRY=
|
||||
LEGACY_TRANSFORM_SERVICE_ENABLED=true
|
||||
LOCAL_TRANSFORM_SERVICE_ENABLED=true
|
||||
@@ -1,132 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
# The acs-community-deployment project contains the product version of docker-compose.
|
||||
#
|
||||
# This version is for testing and development use. For testing and debug we need to have a more open version.
|
||||
# For remote debug we need the CATALINA_OPTS and to expose port 8000.
|
||||
|
||||
services:
|
||||
alfresco:
|
||||
image: ${REGISTRY}alfresco/alfresco-content-repository-community:${ALFRESCO_TAG}
|
||||
environment:
|
||||
CATALINA_OPTS : "
|
||||
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
|
||||
"
|
||||
JAVA_OPTS : "
|
||||
-Ddb.driver=org.postgresql.Driver
|
||||
-Ddb.username=alfresco
|
||||
-Ddb.password=alfresco
|
||||
-Ddb.url=jdbc:postgresql://postgres:5432/alfresco
|
||||
-Dsolr.host=solr6
|
||||
-Dsolr.port=8983
|
||||
-Dsolr.secureComms=none
|
||||
-Dsolr.base.url=/solr
|
||||
-Dindex.subsystem.name=solr6
|
||||
-Dalfresco.restApi.basicAuthScheme=true
|
||||
-Dimap.server.enabled=true
|
||||
-Dftp.enabled=true
|
||||
-Dftp.dataPortFrom=30000
|
||||
-Dftp.dataPortTo=30099
|
||||
-Dshare.host=localhost
|
||||
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
|
||||
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
|
||||
-Dlocal.transform.service.enabled=${LOCAL_TRANSFORM_SERVICE_ENABLED}
|
||||
-DlocalTransform.pdfrenderer.url=http://alfresco-pdf-renderer:8090/
|
||||
-DlocalTransform.imagemagick.url=http://imagemagick:8090/
|
||||
-DlocalTransform.libreoffice.url=http://libreoffice:8090/
|
||||
-DlocalTransform.tika.url=http://tika:8090/
|
||||
-DlocalTransform.misc.url=http://transform-misc:8090/
|
||||
|
||||
-Dlegacy.transform.service.enabled=${LEGACY_TRANSFORM_SERVICE_ENABLED}
|
||||
-Dalfresco-pdf-renderer.url=http://alfresco-pdf-renderer:8090/
|
||||
-Djodconverter.url=http://libreoffice:8090/
|
||||
-Dimg.url=http://imagemagick:8090/
|
||||
-Dtika.url=http://tika:8090/
|
||||
-Dtransform.misc.url=http://transform-misc:8090/
|
||||
|
||||
-Dimap.server.port=1143
|
||||
-Dftp.port=1221
|
||||
-Dcors.enabled=true
|
||||
-Dcors.allowed.origins=http://localhost:4200
|
||||
"
|
||||
ports:
|
||||
- 8082:8080
|
||||
- 8000:8000
|
||||
- 143:1143
|
||||
- 21:1221
|
||||
- 30000-30099:30000-30099
|
||||
|
||||
alfresco-pdf-renderer:
|
||||
image: alfresco/alfresco-pdf-renderer:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ports:
|
||||
- 8090:8090
|
||||
|
||||
imagemagick:
|
||||
image: alfresco/alfresco-imagemagick:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ports:
|
||||
- 8091:8090
|
||||
|
||||
libreoffice:
|
||||
image: alfresco/alfresco-libreoffice:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ports:
|
||||
- 8092:8090
|
||||
|
||||
tika:
|
||||
image: alfresco/alfresco-tika:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ports:
|
||||
- 8093:8090
|
||||
|
||||
transform-misc:
|
||||
image: alfresco/alfresco-transform-misc:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ports:
|
||||
- 8094:8090
|
||||
|
||||
share:
|
||||
image: alfresco/alfresco-share:${SHARE_TAG}
|
||||
environment:
|
||||
- REPO_HOST=alfresco
|
||||
- REPO_PORT=8080
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
postgres:
|
||||
image: library/postgres:${POSTGRES_TAG}
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=alfresco
|
||||
- POSTGRES_USER=alfresco
|
||||
- POSTGRES_DB=alfresco
|
||||
|
||||
solr6:
|
||||
image: alfresco/alfresco-search-services:${SOLR6_TAG}
|
||||
environment:
|
||||
#Solr needs to know how to register itself with Alfresco
|
||||
- SOLR_ALFRESCO_HOST=alfresco
|
||||
- SOLR_ALFRESCO_PORT=8080
|
||||
#Alfresco needs to know how to call solr
|
||||
- SOLR_SOLR_HOST=solr6
|
||||
- SOLR_SOLR_PORT=8983
|
||||
#Create the default alfresco and archive cores
|
||||
- SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
|
||||
#HTTP by default
|
||||
- ALFRESCO_SECURE_COMMS=none
|
||||
ports:
|
||||
- 8083:8983 #Browser port
|
||||
|
||||
activemq:
|
||||
image: alfresco/alfresco-activemq:${ACTIVEMQ_TAG}
|
||||
ports:
|
||||
- 8161:8161 # Web Console
|
||||
- 5672:5672 # AMQP
|
||||
- 61616:61616 # OpenWire
|
||||
- 61613:61613 # STOMP
|
||||
@@ -2,54 +2,21 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<name>Alfresco Content Services Community Packaging</name>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>7.0.0-TEST4</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-super-pom</artifactId>
|
||||
<version>10</version>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<relativePath>../alfresco-community-repo/pom.xml</relativePath>
|
||||
<version>8.300-TEST2</version>
|
||||
</parent>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>community</id>
|
||||
<modules>
|
||||
<module>war</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>communityDocker</id>
|
||||
<modules>
|
||||
<module>war</module>
|
||||
<module>docker-alfresco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>fullBuild</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>war</module>
|
||||
<module>distribution</module>
|
||||
<module>public-javadoc</module>
|
||||
<module>docker-alfresco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>all-tas-tests</id>
|
||||
<modules>
|
||||
<module>tests</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:Alfresco/acs-community-packaging.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:Alfresco/acs-community-packaging.git</developerConnection>
|
||||
<connection>scm:git:https://github.com/Alfresco/acs-community-packaging.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/acs-community-packaging.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/acs-community-packaging</url>
|
||||
<tag>HEAD</tag>
|
||||
<tag>7.0.0-TEST4</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -64,418 +31,151 @@
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<!-- Set to "Community Early Access" to add to the version.edition property in version.properties -->
|
||||
<dependency.alfresco-community-repo.version>8.300-TEST2</dependency.alfresco-community-repo.version>
|
||||
|
||||
<!-- Set to "Community Early Access" to add to the version.edition property in version.properties -->
|
||||
<version.edition>Community</version.edition>
|
||||
|
||||
<build-number>local</build-number>
|
||||
|
||||
<image.tag>latest</image.tag>
|
||||
|
||||
<dependency.alfresco-remote-api.version>8.92</dependency.alfresco-remote-api.version>
|
||||
<dependency.alfresco-repository.version>8.92</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-data-model.version>8.87</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-core.version>8.21</dependency.alfresco-core.version>
|
||||
<upstream.image.tag>${dependency.alfresco-community-repo.version}</upstream.image.tag>
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
<dependency.alfresco-spring-webscripts.version>8.1</dependency.alfresco-spring-webscripts.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>
|
||||
<dependency.alfresco-messaging-repo.version>1.2.15</dependency.alfresco-messaging-repo.version>
|
||||
<dependency.alfresco-api-explorer.version>6.3.0</dependency.alfresco-api-explorer.version>
|
||||
<dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
|
||||
|
||||
<dependency.spring.version>5.2.3.RELEASE</dependency.spring.version>
|
||||
<dependency.fabric8.version>4.3.1</dependency.fabric8.version>
|
||||
<dependency.jackson.version>2.10.2</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.10.1</dependency.jackson-databind.version>
|
||||
|
||||
<dependency.cxf.version>3.3.5</dependency.cxf.version>
|
||||
|
||||
<!-- Alfresco Share version -->
|
||||
<alfresco.share.version>6.2.0</alfresco.share.version>
|
||||
<alfresco.alfresco-share-services.version>6.2.0</alfresco.alfresco-share-services.version>
|
||||
|
||||
<!-- Alfresco GoogleDocs integration version -->
|
||||
<alfresco.googledrive.version>3.2.0-A1</alfresco.googledrive.version>
|
||||
|
||||
<!-- Alfresco Office Services Module -->
|
||||
<alfresco.aos-module.version>1.3.0</alfresco.aos-module.version>
|
||||
<alfresco.share.version>6.2.2</alfresco.share.version>
|
||||
<alfresco.alfresco-share-services.version>6.2.2</alfresco.alfresco-share-services.version>
|
||||
<dependency.alfresco-api-explorer.version>7.0.0-A1</dependency.alfresco-api-explorer.version>
|
||||
|
||||
<installer.version.name>${project.version}</installer.version.name>
|
||||
<alfresco.package.name>alfresco-community</alfresco.package.name>
|
||||
<alfresco.distribution.name>${alfresco.package.name}-distribution</alfresco.distribution.name>
|
||||
|
||||
<dependency.postgresql.version>42.2.9</dependency.postgresql.version>
|
||||
|
||||
<dependency.tas-utility.version>3.0.18</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.28</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.13</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>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>fullBuild</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>distribution</module>
|
||||
<module>public-javadoc</module>
|
||||
<module>docker-alfresco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>communityDocker</id>
|
||||
<modules>
|
||||
<module>docker-alfresco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>internal</id>
|
||||
<modules>
|
||||
<module>docker-alfresco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>all-tas-tests</id>
|
||||
<modules>
|
||||
<module>tests</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-core</artifactId>
|
||||
<version>${dependency.alfresco-core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-core</artifactId>
|
||||
<version>${dependency.alfresco-core.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-data-model</artifactId>
|
||||
<version>${dependency.alfresco-data-model.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-jlan-embed</artifactId>
|
||||
<version>${dependency.alfresco-jlan.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-remote-api</artifactId>
|
||||
<version>${dependency.alfresco-remote-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-remote-api</artifactId>
|
||||
<version>${dependency.alfresco-remote-api.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${dependency.alfresco-repository.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${dependency.alfresco-repository.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-trashcan-cleaner</artifactId>
|
||||
<version>${dependency.alfresco-trashcan-cleaner.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-heartbeat-data-sender</artifactId>
|
||||
<version>${dependency.alfresco-hb-data-sender.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
<version>2.7.2-alfresco</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.services</groupId>
|
||||
<artifactId>alfresco-messaging-repo</artifactId>
|
||||
<version>${dependency.alfresco-messaging-repo.version}</version>
|
||||
</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-pdf-renderer</artifactId>
|
||||
<version>${dependency.alfresco-pdf-renderer.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
<version>${dependency.alfresco-server-root.version}</version>
|
||||
<artifactId>content-services-community</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-surf-core-configservice</artifactId>
|
||||
<version>${dependency.alfresco-spring-webscripts.version}</version>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-core</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-webscripts</artifactId>
|
||||
<version>${dependency.alfresco-spring-webscripts.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-webscripts-api</artifactId>
|
||||
<version>${dependency.alfresco-spring-webscripts.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<!-- exclude c3p0 -->
|
||||
<!-- see https://issues.alfresco.com/jira/browse/REPO-3447 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1-HTTPCLIENT-1265</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
<!-- Use 2.1 version as a newer dependency for commons-validator -->
|
||||
<dependency>
|
||||
<groupId>commons-digester</groupId>
|
||||
<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>2.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient-cache</artifactId>
|
||||
<version>4.5.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
<!-- exclude spring-jcl which is brought in by spring-core -->
|
||||
<!-- see https://issues.alfresco.com/jira/browse/REPO-4774 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jcl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jms</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
<!-- exclude spring-jcl which is brought in by spring-orm -->
|
||||
<!-- see https://issues.alfresco.com/jira/browse/REPO-4774 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jcl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${dependency.jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${dependency.jackson-databind.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${dependency.jackson.version}</version>
|
||||
</dependency>
|
||||
<!-- newer dependency from camel-jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
<version>${dependency.jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
<!-- Newer cxf libs, see REPO-3131 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||
<version>${dependency.cxf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||
<version>${dependency.cxf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
<version>${dependency.cxf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
<version>${dependency.cxf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-ws-policy</artifactId>
|
||||
<version>${dependency.cxf.version}</version>
|
||||
</dependency>
|
||||
<!-- newer version, see REPO-3133 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-email</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<!-- Make sure JUnit is not packaged -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13</version>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-core</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-log-sanitizer</artifactId>
|
||||
<version>${dependency.alfresco-log-sanitizer.version}</version>
|
||||
<artifactId>alfresco-data-model</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-aos-module</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>amp</type>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-data-model</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-aos-module-distributionzip</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>zip</type>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.aos-module</groupId>
|
||||
<artifactId>alfresco-vti-bin</artifactId>
|
||||
<version>${alfresco.aos-module.version}</version>
|
||||
<type>war</type>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-remote-api</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-remote-api</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-cmis-test</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-email-test</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-integration-test</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-restapi-test</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-webdav-test</artifactId>
|
||||
<version>${dependency.alfresco-community-repo.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-content-services-share-distribution</artifactId>
|
||||
@@ -511,41 +211,6 @@
|
||||
<artifactId>alfresco-wcmqs-client-api</artifactId>
|
||||
<version>${alfresco.share.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.integrations</groupId>
|
||||
<artifactId>alfresco-googledrive-repo-community</artifactId>
|
||||
<version>${alfresco.googledrive.version}</version>
|
||||
<type>amp</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.integrations</groupId>
|
||||
<artifactId>alfresco-googledrive-share-community</artifactId>
|
||||
<version>${alfresco.googledrive.version}</version>
|
||||
<type>amp</type>
|
||||
</dependency>
|
||||
<!-- Enforce newer version -->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.64</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcmail-jdk15on</artifactId>
|
||||
<version>1.64</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
<artifactId>junrar</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.12.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "=========================== Starting Build Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set -vex
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh"
|
||||
|
||||
DEPENDENCY_VERSION="$(retrievePomProperty "dependency.alfresco-community-repo.version")"
|
||||
|
||||
# Either both the parent and the upstream dependency are the same, or else fail the build
|
||||
if [ "${DEPENDENCY_VERSION}" != "$(retrievePomParentVersion)" ]; then
|
||||
printf "Upstream dependency version (%s) is different then the project parent version!\n" "${DEPENDENCY_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prevent merging of any SNAPSHOT dependencies into the master or the release/* branches
|
||||
if [[ $(isPullRequestBuild) && "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ && "${TRAVIS_BRANCH}" =~ ^master$|^release/.+$ ]] ; then
|
||||
printf "PRs with SNAPSHOT dependencies are not allowed into master or release branches\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prevent release jobs from starting when there are SNAPSHOT upstream dependencies
|
||||
if [[ "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] ; then
|
||||
printf "Cannot release project with SNAPSHOT dependencies!\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPSTREAM_REPO="github.com/Alfresco/alfresco-community-repo.git"
|
||||
|
||||
# For release jobs, check if the upstream dependency is the latest tag on the upstream repository (on the same branch)
|
||||
# TODO UNCOMMENT THIS LINE: if isBranchBuild && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] && [ "${DEPENDENCY_VERSION}" != "$(retieveLatestTag "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}")" ] ; then
|
||||
if isBranchBuild && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] && [ "${DEPENDENCY_VERSION}" != "$(retieveLatestTag "${UPSTREAM_REPO}" "master")" ] ; then
|
||||
printf "Upstream dependency is not up to date with %s / %s\n" "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Search, checkout and build the same branch on the upstream project in case of SNAPSHOT dependencies
|
||||
# Otherwise, checkout the upstream tag and build its Docker image (use just "mvn package", without "mvn install")
|
||||
if [[ "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] ; then
|
||||
pullAndBuildSameBranchOnUpstream "${UPSTREAM_REPO}" "-PcommunityDocker"
|
||||
else
|
||||
pullUpstreamTagAndBuildDockerImage "${UPSTREAM_REPO}" "${DEPENDENCY_VERSION}" "-PcommunityDocker"
|
||||
fi
|
||||
|
||||
# Build the current project
|
||||
mvn -B -V -q install -DskipTests -Dmaven.javadoc.skip=true -PcommunityDocker \
|
||||
$([[ "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] && echo "-Dupstream.image.tag=latest")
|
||||
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing Build Script =========================="
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env bash
|
||||
set +vx
|
||||
|
||||
function isPullRequestBuild() {
|
||||
test "${TRAVIS_PULL_REQUEST}" != "false"
|
||||
}
|
||||
|
||||
function isBranchBuild() {
|
||||
test "${TRAVIS_PULL_REQUEST}" = "false"
|
||||
}
|
||||
|
||||
function cloneRepo() {
|
||||
local REPO="${1}"
|
||||
local TAG_OR_BRANCH="${2}"
|
||||
|
||||
printf "Clonning \"%s\" on %s\n" "${TAG_OR_BRANCH}" "${REPO}"
|
||||
|
||||
# clone the repository branch/tag
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null
|
||||
|
||||
rm -rf "$(basename "${REPO%.git}")"
|
||||
|
||||
git clone -b "${TAG_OR_BRANCH}" --depth=1 "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REPO}"
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
function retrievePomParentVersion() {
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null
|
||||
|
||||
sed -n '/<parent>/,/<\/parent>/p' pom.xml \
|
||||
| sed -n '/<version>/,/<\/version>/p' \
|
||||
| tr -d '\n' \
|
||||
| grep -oP '(?<=<version>).*(?=</version>)' \
|
||||
| xargs
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
function retrievePomProperty() {
|
||||
local KEY="${1}"
|
||||
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null
|
||||
|
||||
sed -n '/<properties>/,/<\/properties>/p' pom.xml \
|
||||
| sed -n "/<${KEY}>/,/<\/${KEY}>/p" \
|
||||
| tr -d '\n' \
|
||||
| grep -oP "(?<=<${KEY}>).*(?=</${KEY}>)" \
|
||||
| xargs
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
function evaluatePomProperty() {
|
||||
local KEY="${1}"
|
||||
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null
|
||||
|
||||
mvn -B -q help:evaluate -Dexpression="${KEY}" -DforceStdout
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
function remoteBranchExists() {
|
||||
local REMOTE_REPO="${1}"
|
||||
local BRANCH="${2}"
|
||||
|
||||
git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REMOTE_REPO}" "${BRANCH}" &>/dev/null
|
||||
}
|
||||
|
||||
function identifyUpstreamSourceBranch() {
|
||||
local UPSTREAM_REPO="${1}"
|
||||
|
||||
# if it's a pull request, use the source branch name (if it exists)
|
||||
if isPullRequestBuild && remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_PULL_REQUEST_BRANCH}" ; then
|
||||
echo "${TRAVIS_PULL_REQUEST_BRANCH}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# otherwise use the current branch name (or in case of PRs, the target branch name)
|
||||
if remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}" ; then
|
||||
echo "${TRAVIS_BRANCH}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if none of the previous exists, use the "master" branch
|
||||
echo "master"
|
||||
}
|
||||
|
||||
function pullUpstreamTag() {
|
||||
local UPSTREAM_REPO="${1}"
|
||||
local TAG="${2}"
|
||||
|
||||
cloneRepo "${UPSTREAM_REPO}" "${TAG}"
|
||||
}
|
||||
|
||||
function pullUpstreamTagAndBuildDockerImage() {
|
||||
local UPSTREAM_REPO="${1}"
|
||||
local TAG="${2}"
|
||||
local EXTRA_BUILD_ARGUMENTS="${3}"
|
||||
|
||||
cloneRepo "${UPSTREAM_REPO}" "${TAG}"
|
||||
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../"
|
||||
|
||||
cd "$(basename "${UPSTREAM_REPO%.git}")"
|
||||
|
||||
mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" ${EXTRA_BUILD_ARGUMENTS}
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function pullAndBuildSameBranchOnUpstream() {
|
||||
local UPSTREAM_REPO="${1}"
|
||||
local EXTRA_BUILD_ARGUMENTS="${2}"
|
||||
|
||||
local SOURCE_BRANCH="$(identifyUpstreamSourceBranch "${UPSTREAM_REPO}")"
|
||||
|
||||
cloneRepo "${UPSTREAM_REPO}" "${SOURCE_BRANCH}"
|
||||
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../"
|
||||
|
||||
cd "$(basename "${UPSTREAM_REPO%.git}")"
|
||||
|
||||
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS}
|
||||
mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function retieveLatestTag() {
|
||||
local REPO="${1}"
|
||||
local BRANCH="${2}"
|
||||
|
||||
local LOCAL_PATH="/tmp/$(basename "${REPO%.git}")"
|
||||
|
||||
git clone -q -b "${BRANCH}" "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REPO}" "${LOCAL_PATH}"
|
||||
|
||||
pushd "${LOCAL_PATH}" >/dev/null
|
||||
git describe --abbrev=0 --tags
|
||||
popd >/dev/null
|
||||
|
||||
rm -rf "${LOCAL_PATH}"
|
||||
}
|
||||
|
||||
set -vx
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ev
|
||||
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/acs-community-packaging"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-community-repo"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-community-repo-*"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-core"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-data-model"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-enterprise-remote-api"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-enterprise-repo-*"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-enterprise-repository"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-remote-api"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-repository"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/content-services"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/content-services*"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/content-services-community"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/tas/alfresco-community-repo-*-test"
|
||||
rm -rf "${HOME}/.m2/repository/org/alfresco/tas/alfresco-enterprise-repo-*-test"
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "=========================== Starting Copy to Release Bucket Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set -vex
|
||||
|
||||
#
|
||||
# Copy from S3 Release bucket to S3 eu.dl bucket
|
||||
#
|
||||
|
||||
if [ -z "${RELEASE_VERSION}" ]; then
|
||||
echo "Please provide a RELEASE_VERSION in the format <acs-version>-<additional-info> (6.3.0-EA or 6.3.0-SNAPSHOT)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SOURCE="s3://alfresco-artefacts-staging/alfresco-content-services-community/release/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}"
|
||||
DESTINATION="s3://eu.dl.alfresco.com/release/community/${RELEASE_VERSION}-build-${TRAVIS_BUILD_NUMBER}"
|
||||
|
||||
printf "\n%s\n%s\n" "${SOURCE}" "${DESTINATION}"
|
||||
|
||||
aws s3 cp --acl private \
|
||||
"${SOURCE}/alfresco.war" \
|
||||
"${DESTINATION}/alfresco.war"
|
||||
|
||||
aws s3 cp --acl private \
|
||||
"${SOURCE}/alfresco-content-services-community-distribution-${RELEASE_VERSION}.zip" \
|
||||
"${DESTINATION}/alfresco-content-services-community-distribution-${RELEASE_VERSION}.zip"
|
||||
|
||||
|
||||
set +vex
|
||||
echo "=========================== Finishing Copy to Release Bucket Script =========================="
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "=========================== Starting Init Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set -vex
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
# Maven Setup
|
||||
mkdir -p "${HOME}/.m2" && cp -f .travis.settings.xml "${HOME}/.m2/settings.xml"
|
||||
find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
|
||||
|
||||
# Docker Logins
|
||||
echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin
|
||||
echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io
|
||||
|
||||
# Enable experimental docker features (for the image squash option)
|
||||
echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
|
||||
sudo service docker restart
|
||||
|
||||
# not helpful in this script
|
||||
# export HOST_IP=$(hostname -I | cut -f1 -d' ')
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing Init Script =========================="
|
||||
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "=========================== Starting Release Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set -vex
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
|
||||
if [ -z "${RELEASE_VERSION}" ] || [ -z "${DEVELOPMENT_VERSION}" ]; then
|
||||
echo "Please provide a Release and Development version in the format <acs-version>-<additional-info> (6.3.0-EA or 6.3.0-SNAPSHOT)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use full history for release
|
||||
git checkout -B "${TRAVIS_BRANCH}"
|
||||
# Add email to link commits to user
|
||||
git config user.email "${GIT_EMAIL}"
|
||||
|
||||
mvn -B \
|
||||
-Prelease,fullBuild,all-tas-tests \
|
||||
-DreleaseVersion="${RELEASE_VERSION}" \
|
||||
-DdevelopmentVersion="${DEVELOPMENT_VERSION}" \
|
||||
"-Darguments=-Prelease,fullBuild,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \
|
||||
release:clean release:prepare release:perform \
|
||||
-DscmCommentPrefix="[maven-release-plugin][skip ci] " \
|
||||
-Dusername="${GIT_USERNAME}" \
|
||||
-Dpassword="${GIT_PASSWORD}"
|
||||
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing Release Script =========================="
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "=========================== Starting Verify Release Tag Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set -vex
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
#
|
||||
# Check that the version to be released does not already have a docker tag.
|
||||
#
|
||||
|
||||
if [ -z "${RELEASE_VERSION}" ]; then
|
||||
echo "Please provide a RELEASE_VERSION in the format <acs-version>-<additional-info> (6.3.0-EA or 6.3.0-SNAPSHOT)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git rev-parse "${RELEASE_VERSION}^{tag}" &>/dev/null ; then
|
||||
echo "The RELEASE_VERSION tag \"${RELEASE_VERSION}\" already exists in the git project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get the image name from the pom file
|
||||
ALFRESCO_DOCKER_IMAGE="$(mvn -B -q help:evaluate -f ./docker-alfresco/pom.xml -Dexpression=image.name -DforceStdout)"
|
||||
DOCKER_IMAGE_FULL_NAME="${ALFRESCO_DOCKER_IMAGE}:${RELEASE_VERSION}"
|
||||
|
||||
function docker_image_exists() {
|
||||
local IMAGE_FULL_NAME="${1}"; shift
|
||||
local WAIT_TIME="${1:-5}"
|
||||
local SEARCH_TERM='Pulling|is up to date|not found'
|
||||
|
||||
echo "Looking to see if ${IMAGE_FULL_NAME} already exists..."
|
||||
local RESULT=$( (timeout --preserve-status "${WAIT_TIME}" docker 2>&1 pull "${IMAGE_FULL_NAME}" &) | grep -v 'Pulling repository' | grep -E -o "${SEARCH_TERM}")
|
||||
|
||||
test "${RESULT}" || { echo "Timed out too soon. Try using a wait_time greater than ${WAIT_TIME}..."; return 1 ;}
|
||||
if echo "${RESULT}" | grep -vq 'not found'; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
if docker_image_exists "${DOCKER_IMAGE_FULL_NAME}" ; then
|
||||
echo "Tag ${RELEASE_VERSION} already pushed, release process will interrupt."
|
||||
exit 1
|
||||
else
|
||||
echo "The ${RELEASE_VERSION} tag was not found"
|
||||
fi
|
||||
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing Verify Release Tag Script =========================="
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.1.0
|
||||
SOLR6_TAG=1.4.0
|
||||
POSTGRES_TAG=11.4
|
||||
ACTIVEMQ_TAG=5.15.8
|
||||
TRANSFORMERS_TAG=2.3.4
|
||||
SOLR6_TAG=1.4.2
|
||||
POSTGRES_TAG=11.7
|
||||
ACTIVEMQ_TAG=5.15.8
|
||||
|
||||
@@ -10,7 +10,6 @@ services:
|
||||
image: alfresco/alfresco-content-repository-community:latest
|
||||
environment:
|
||||
CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
|
||||
# Some properties are built in Dockerfile because of cron expressions
|
||||
JAVA_OPTS :
|
||||
"
|
||||
-Ddb.driver=org.postgresql.Driver
|
||||
@@ -30,25 +29,20 @@ services:
|
||||
-Dshare.host=localhost
|
||||
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
|
||||
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
|
||||
-Dlocal.transform.service.enabled=true
|
||||
-DlocalTransform.pdfrenderer.url=http://alfresco-pdf-renderer:8090/
|
||||
-DlocalTransform.imagemagick.url=http://imagemagick:8090/
|
||||
-DlocalTransform.libreoffice.url=http://libreoffice:8090/
|
||||
-DlocalTransform.tika.url=http://tika:8090/
|
||||
-DlocalTransform.misc.url=http://transform-misc:8090/
|
||||
|
||||
-Dlegacy.transform.service.enabled=true
|
||||
-Dalfresco-pdf-renderer.url=http://alfresco-pdf-renderer:8090/
|
||||
-Djodconverter.url=http://libreoffice:8090/
|
||||
-Dimg.url=http://imagemagick:8090/
|
||||
-Dtika.url=http://tika:8090/
|
||||
-Dtransform.misc.url=http://transform-misc:8090/
|
||||
|
||||
-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
|
||||
-Dcors.allowed.origins=http://localhost:4200
|
||||
-Dcors.allowed.origins=http://localhost:4200,http://localhost:8080
|
||||
-Dmetadata-keystore.password=mp6yc0UD9e
|
||||
-Dmetadata-keystore.aliases=metadata
|
||||
-Dmetadata-keystore.metadata.password=mp6yc0UD9e
|
||||
-Dmetadata-keystore.metadata.algorithm=AES
|
||||
"
|
||||
ports:
|
||||
- 8082:8080
|
||||
@@ -88,57 +82,9 @@ services:
|
||||
- 61616:61616 # OpenWire
|
||||
- 61613:61613 # STOMP
|
||||
|
||||
alfresco-pdf-renderer:
|
||||
image: alfresco/alfresco-pdf-renderer:${TRANSFORMERS_TAG}
|
||||
transform-core-aio:
|
||||
image: alfresco/alfresco-transform-core-aio:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ACTIVEMQ_URL: "nio://activemq:61616"
|
||||
ACTIVEMQ_USER: "admin"
|
||||
ACTIVEMQ_PASSWORD: "admin"
|
||||
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
|
||||
JAVA_OPTS: " -Xms256m -Xmx512m"
|
||||
ports:
|
||||
- 8090:8090
|
||||
|
||||
imagemagick:
|
||||
image: alfresco/alfresco-imagemagick:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ACTIVEMQ_URL: "nio://activemq:61616"
|
||||
ACTIVEMQ_USER: "admin"
|
||||
ACTIVEMQ_PASSWORD: "admin"
|
||||
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
|
||||
ports:
|
||||
- 8091:8090
|
||||
|
||||
libreoffice:
|
||||
image: alfresco/alfresco-libreoffice:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ACTIVEMQ_URL: "nio://activemq:61616"
|
||||
ACTIVEMQ_USER: "admin"
|
||||
ACTIVEMQ_PASSWORD: "admin"
|
||||
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
|
||||
ports:
|
||||
- 8092:8090
|
||||
|
||||
tika:
|
||||
image: alfresco/alfresco-tika:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ACTIVEMQ_URL: "nio://activemq:61616"
|
||||
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
|
||||
ACTIVEMQ_USER: "admin"
|
||||
ACTIVEMQ_PASSWORD: "admin"
|
||||
ports:
|
||||
- 8093:8090
|
||||
|
||||
transform-misc:
|
||||
image: alfresco/alfresco-transform-misc:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ACTIVEMQ_URL: "nio://activemq:61616"
|
||||
ACTIVEMQ_USER: "admin"
|
||||
ACTIVEMQ_PASSWORD: "admin"
|
||||
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
|
||||
ports:
|
||||
- 8094:8090
|
||||
|
||||
@@ -29,14 +29,16 @@ services:
|
||||
-Dshare.host=localhost
|
||||
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
|
||||
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
|
||||
-Dlocal.transform.service.enabled=false
|
||||
-Dlegacy.transform.service.enabled=false
|
||||
|
||||
-Dimap.server.port=1143
|
||||
-Dftp.port=1221
|
||||
-Dcors.enabled=true
|
||||
-Dcors.allowed.origins=http://localhost:4200
|
||||
-Dcors.allowed.origins=http://localhost:4200,http://localhost:8080
|
||||
-Dmetadata-keystore.password=mp6yc0UD9e
|
||||
-Dmetadata-keystore.aliases=metadata
|
||||
-Dmetadata-keystore.metadata.password=mp6yc0UD9e
|
||||
-Dmetadata-keystore.metadata.algorithm=AES
|
||||
"
|
||||
ports:
|
||||
- 8082:8080
|
||||
|
||||
+6
-68
@@ -1,14 +1,12 @@
|
||||
<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>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<artifactId>content-repository-community-tests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
@@ -19,68 +17,8 @@
|
||||
<module>tas-integration</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
<version>${dependency.tas-utility.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>rest-assured</artifactId>
|
||||
<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>
|
||||
<version>${dependency.tas-restapi.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>cmis</artifactId>
|
||||
<version>${dependency.tas-cmis.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>email</artifactId>
|
||||
<version>${dependency.tas-email.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>webdav</artifactId>
|
||||
<version>${dependency.tas-webdav.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>ftp</artifactId>
|
||||
<version>${dependency.tas-ftp.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.test</groupId>
|
||||
<artifactId>dataprep</artifactId>
|
||||
<version>${dependency.tas-dataprep.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${dependency.spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<properties>
|
||||
<!-- TAS tests require an old version -->
|
||||
<dependency.org-json.version>20170516</dependency.org-json.version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export DOCKER_COMPOSE_PATH=$1
|
||||
|
||||
if [ -z "$DOCKER_COMPOSE_PATH" ]
|
||||
then
|
||||
echo "Please provide path to docker-compose.yml: \"${0##*/} /path/to/docker-compose.yml\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}"
|
||||
|
||||
# .env files are picked up from project directory correctly on docker-compose 1.23.0+
|
||||
docker-compose --file "${DOCKER_COMPOSE_PATH}" --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Docker Compose started ok"
|
||||
else
|
||||
echo "Docker Compose failed to start" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export DOCKER_COMPOSE_PATH=$1
|
||||
|
||||
if [ -z "$DOCKER_COMPOSE_PATH" ]
|
||||
then
|
||||
echo "Please provide path to docker-compose.yml: \"${0##*/} /path/to/docker-compose.yml\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Killing ACS stack in ${DOCKER_COMPOSE_PATH}"
|
||||
|
||||
cd ${DOCKER_COMPOSE_PATH}
|
||||
|
||||
docker-compose ps
|
||||
# logs for debug
|
||||
docker-compose logs --no-color -t alfresco
|
||||
docker-compose kill
|
||||
docker-compose rm -fv
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export ALFRESCO_URL=$1
|
||||
|
||||
if [ -z "$ALFRESCO_URL" ]
|
||||
then
|
||||
echo "Please provide the Alfresco URL to check, for example: \"${0##*/} http://localhost:8080/alfresco\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WAIT_INTERVAL=1
|
||||
COUNTER=0
|
||||
TIMEOUT=300
|
||||
t0=$(date +%s)
|
||||
|
||||
echo "Waiting for alfresco to start"
|
||||
until $(curl --output /dev/null --silent --head --fail ${ALFRESCO_URL}) || [ "$COUNTER" -eq "$TIMEOUT" ]; do
|
||||
printf '.'
|
||||
sleep $WAIT_INTERVAL
|
||||
COUNTER=$(($COUNTER+$WAIT_INTERVAL))
|
||||
done
|
||||
|
||||
if (("$COUNTER" < "$TIMEOUT")) ; then
|
||||
t1=$(date +%s)
|
||||
delta=$((($t1 - $t0)/60))
|
||||
echo "Alfresco Started in $delta minutes"
|
||||
else
|
||||
echo "Waited $COUNTER seconds"
|
||||
echo "Alfresco Could not start in time."
|
||||
exit 1
|
||||
fi
|
||||
@@ -4,14 +4,12 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-cmis-test</artifactId>
|
||||
<name>content-repository-community-cmis-test</name>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<artifactId>content-repository-community-tests</artifactId>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -28,6 +26,12 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-cmis-test</artifactId>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>cmis</artifactId>
|
||||
|
||||
@@ -1,645 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.data.PermissionMapping;
|
||||
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumBasicPermissions;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class AclTests extends CmisTest
|
||||
{
|
||||
UserModel testUser, inviteUser, unauthorizedUser;
|
||||
SiteModel testSite, privateSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
inviteUser = dataUser.createRandomTestUser();
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Site manager can get the acls for valid document")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS })
|
||||
public void siteManagerShouldGetDocumentAcls() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.and().assertThat().hasAcls();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Site manager can get the acls for valid folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetFolderAcls() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.and().assertThat().hasAcls();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl for valid document with AclPropagation set to REPOSITORYDETERMINED")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddAclWithRepositoryDeterminedPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
cmisApi.usingResource(testFile).addAcl(inviteUser, UserRole.SiteContributor, AclPropagation.REPOSITORYDETERMINED)
|
||||
.then().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl for valid folder with AclPropagation set to PROPAGATE")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddAclWithPropagate() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
cmisApi.usingResource(testFolder).addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.PROPAGATE)
|
||||
.then().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl for valid folder with AclPropagation set to OBJECTONLY")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddAclWithObjectOnlyPropagation() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
cmisApi.usingResource(testFolder).addAcl(inviteUser, UserRole.SiteCollaborator, AclPropagation.OBJECTONLY)
|
||||
.then().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl for valid folder with AclPropagation set to OBJECTONLY")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanApplyAclWithObjectOnlyPropagation() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
cmisApi.usingResource(testFolder).addAcl(inviteUser, UserRole.SiteCollaborator, AclPropagation.OBJECTONLY)
|
||||
.then().applyAcl(inviteUser, UserRole.SiteConsumer, UserRole.SiteCollaborator, AclPropagation.OBJECTONLY)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteConsumer)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify appply acl with invalid role that will be removed")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void applyAclWithInvalidAddedRole() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().addAcl(inviteUser, UserRole.SiteCollaborator, AclPropagation.OBJECTONLY)
|
||||
.then().applyAcl(inviteUser, UserRole.SiteConsumer, UserRole.SiteManager, AclPropagation.OBJECTONLY);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Apply Acl for valid folder with AclPropagation set to PROPAGATE")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanApplyAclWithPropagate() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.PROPAGATE)
|
||||
.when().applyAcl(inviteUser, UserRole.SiteManager, UserRole.SiteConsumer, AclPropagation.PROPAGATE)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteManager)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl for valid folder with AclPropagation set to REPOSITORYDETERMINED")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanApplyAclWithRepositoryDeterminedPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.OBJECTONLY)
|
||||
.when().applyAcl(inviteUser, UserRole.SiteManager, UserRole.SiteConsumer, AclPropagation.REPOSITORYDETERMINED)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteManager)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove Acl for valid folder with AclPropagation set to REPOSITORYDETERMINED")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRemoveAclWithRepositoryDeterminedPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.OBJECTONLY)
|
||||
.when().removeAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.REPOSITORYDETERMINED)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Remove Acl for valid folder with AclPropagation set to REPOSITORYDETERMINED")
|
||||
@Test(groups = {TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanRemoveAclWithPropagate() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteManager, AclPropagation.OBJECTONLY)
|
||||
.when().removeAcl(inviteUser, UserRole.SiteManager, AclPropagation.PROPAGATE)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteManager);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove Acl for valid folder with AclPropagation set to REPOSITORYDETERMINED")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRemoveAclWithObjectOnlyPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteContributor, AclPropagation.OBJECTONLY)
|
||||
.when().removeAcl(inviteUser, UserRole.SiteContributor, AclPropagation.OBJECTONLY)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove Acl for valid folder with AclPropagation set to REPOSITORYDETERMINED")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotRemoveInvalidAcl() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteContributor, AclPropagation.OBJECTONLY)
|
||||
.when().removeAcl(inviteUser, UserRole.SiteManager, AclPropagation.OBJECTONLY);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site manager can add acl with null AclPropagation")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddAclWithNullPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteContributor, null)
|
||||
.then().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site manager cannot get acl for pwc document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisRuntimeException.class)
|
||||
public void siteManagerCannotGetAclForPwcDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.usingPWCDocument().addAcl(inviteUser, UserRole.SiteContributor, AclPropagation.PROPAGATE)
|
||||
.then().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site manager cannot get acl for invalid object")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotGetAclForInvalidObject() throws Exception
|
||||
{
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
folder.setCmisLocation("/" + folder.getName() + "/");
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingResource(folder)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl for valid document with null AclPropagation")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanApplyAclWithNullPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.OBJECTONLY)
|
||||
.when().applyAcl(inviteUser, UserRole.SiteManager, UserRole.SiteConsumer, null)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteManager)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl for checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisRuntimeException.class)
|
||||
public void siteManagerCannotGetAclForAppliedAclForPWC() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSEXCEL);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.OBJECTONLY)
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().applyAcl(inviteUser, UserRole.SiteManager, UserRole.SiteConsumer)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteManager);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove Acl from valid folder with null AclPropagation")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRemoveAclWithNullPropagation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteContributor, AclPropagation.OBJECTONLY)
|
||||
.when().removeAcl(inviteUser, UserRole.SiteContributor)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Unauthorized user cannot remove acl")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void removeAclByUnauthorizedUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSEXCEL);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.OBJECTONLY)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteConsumer)
|
||||
.when().authenticateUser(unauthorizedUser)
|
||||
.removeAcl(inviteUser, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Unauthorized user cannot add acl")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void addAclByUnauthorizedUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSEXCEL);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.then().authenticateUser(unauthorizedUser)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer, AclPropagation.OBJECTONLY);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Unauthorized user cannot apply acl")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void applyAclByUnauthorizedUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSEXCEL);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().addAcl(inviteUser, UserRole.SiteConsumer)
|
||||
.when().authenticateUser(unauthorizedUser)
|
||||
.and().applyAcl(inviteUser, UserRole.SiteManager, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl for checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddAclForCheckedOutDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT).and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(testFile)
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl by user with collaborator role for document created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanAddAclForDocumentCreatedByHimself() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl by user with collaborator role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void collaboratorCannotAddAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.addAcl(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Get Acl by user with collaborator role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanGetAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).refreshResource()
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by user with collaborator role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void collaboratorCannotApplyAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.applyAcl(inviteUser, UserRole.SiteCollaborator, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by user with collaborator role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void collaboratorCannotRemoveAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.removeAcl(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl by user with contributor role for document created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanAddAclForDocumentCreatedByHimself() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl by user with contributor role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void contributorCannotAddAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.addAcl(inviteUser, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Get Acl by user with collaborator role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanGetAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFile).refreshResource()
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by user with contributor role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void contributorCannotApplyAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.applyAcl(inviteUser, UserRole.SiteCollaborator, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by user with contributor role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void contributorCannotRemoveAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.removeAcl(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl by user with consumer role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotAddAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.addAcl(inviteUser, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Get Acl by user with consumer role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCanGetAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).refreshResource()
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by user with consumer role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotApplyAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.applyAcl(inviteUser, UserRole.SiteCollaborator, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by user with consumer role for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotRemoveAclForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.removeAcl(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl by non invited user in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotAddAclInPrivateSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.addAcl(inviteUser, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Get Acl by non invited user in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetAclInPrivateSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).refreshResource()
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl by non invited user in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotApplyAclInPrivateSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.applyAcl(inviteUser, UserRole.SiteCollaborator, UserRole.SiteContributor)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteCollaborator)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.applyAcl(inviteUser, UserRole.SiteContributor, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove Acl by non invited user in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotRemoveAclFromPrivateSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addAcl(inviteUser, UserRole.SiteContributor)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, UserRole.SiteContributor)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.removeAcl(inviteUser, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Add Acl for valid document with PermissionMapping")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddAclWithPermissionMapping() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_UPDATE_PROPERTIES_OBJECT)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_WRITE.value())
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_DELETE_OBJECT)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_ALL.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply Acl for valid document with PermissionMapping")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanApplyAclWithPermissionMapping() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_DELETE_OBJECT)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_ALL.value())
|
||||
.then().applyAcl(inviteUser, PermissionMapping.CAN_UPDATE_PROPERTIES_OBJECT, PermissionMapping.CAN_DELETE_OBJECT)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_WRITE.value())
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, EnumBasicPermissions.CMIS_ALL.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove Acl for valid document with PermissionMapping")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRemoveAclWithPermissionMapping() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_UPDATE_PROPERTIES_OBJECT)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_WRITE.value())
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_DELETE_OBJECT)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_ALL.value())
|
||||
.then().removeAcl(inviteUser, PermissionMapping.CAN_DELETE_OBJECT)
|
||||
.and().assertThat().permissionIsNotSetForUser(inviteUser, EnumBasicPermissions.CMIS_ALL.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Remove invalid Acl(that was not set) for valid document with PermissionMapping")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class,
|
||||
expectedExceptionsMessageRegExp="No matching ACE found to remove!*")
|
||||
public void siteManagerCannotRemoveInvalidAclWithPermissionMapping() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_UPDATE_PROPERTIES_OBJECT)
|
||||
.assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_WRITE.value())
|
||||
.then().removeAcl(inviteUser, PermissionMapping.CAN_CHECKIN_DOCUMENT);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Apply invalid Acl(that was not set) for valid document with PermissionMapping")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class,
|
||||
expectedExceptionsMessageRegExp="No matching ACE found to remove!*")
|
||||
public void siteManagerCannotApplyInvalidAclWithPermissionMapping() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().addAcl(inviteUser, PermissionMapping.CAN_DELETE_OBJECT)
|
||||
.and().assertThat().permissionIsSetForUser(inviteUser, EnumBasicPermissions.CMIS_ALL.value())
|
||||
.then().applyAcl(inviteUser, PermissionMapping.CAN_UPDATE_PROPERTIES_OBJECT, PermissionMapping.CAN_CREATE_FOLDER_FOLDER);
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/28/2016.
|
||||
*/
|
||||
public class AddObjectToFolderTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FolderModel destinationFolder;
|
||||
FileModel sourceFile;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
destinationFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(destinationFolder)
|
||||
.assertThat().existsInRepo();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to add document object to folder with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldAddFileToFolder() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectIdIs(sourceFile.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to add folder object to folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisInvalidArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Object is not a document!*")
|
||||
public void siteManagerShouldNotAddFolderToFolder() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel folderToAdd = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(folderToAdd).assertThat().existsInRepo()
|
||||
.then().addDocumentToFolder(folderToAdd, true);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to add file a document object in more than one folder in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerShouldNotAddInvalidFileToFolder() throws Exception
|
||||
{
|
||||
FileModel randomFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
randomFile.setCmisLocation("/" + randomFile.getName() + "/");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.usingResource(randomFile)
|
||||
.addDocumentToFolder(destinationFolder, true);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to add folder object to folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerShouldNotAddInvalidFolderToFolder() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel randomFolder = FolderModel.getRandomFolderModel();
|
||||
randomFolder.setCmisLocation("/" + randomFolder.getName() + "/");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().addDocumentToFolder(randomFolder, true);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to add PWC document to folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldAddPWCFileToFolder() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to add document object to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanAddDocumentWithVersionsToFolderWithTrueAllVersions() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().update("first content").update("second content")
|
||||
.and().assertThat().documentHasVersion(1.2)
|
||||
.then().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentHasVersion(1.2);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to add document object to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisInvalidArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Only allVersions=true supported!*")
|
||||
public void siteManagerCannotAddDocumentToFolderWithFalseAllVersions() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().update("update content")
|
||||
.and().assertThat().documentHasVersion(1.1)
|
||||
.then().addDocumentToFolder(destinationFolder, false);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to add document object to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanAddFileToFolderCreatedByHimself() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectIdIs(sourceFile.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to add document object created by manager to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanAddFileToFolderCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.then().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to add document object to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanAddFileToFolderCreatedByHimself() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectIdIs(sourceFile.getNodeRef());
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to add document object created by manager to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanAddFileToFolderCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.then().addDocumentToFolder(destinationFolder, true)
|
||||
.and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to add document object created by manager to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCanAddFileToFolderCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.then().addDocumentToFolder(destinationFolder, true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to delete parent folder with multiple children in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotDeleteFolderTreeInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
destinationFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(privateSite)
|
||||
.createFolder(destinationFolder).assertThat().existsInRepo()
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.then().addDocumentToFolder(destinationFolder, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,217 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.enums.Action;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class AllowableActionTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile, managerFile;
|
||||
FolderModel testFolder, managerFolder;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
managerFolder = FolderModel.getRandomFolderModel();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(managerFile).assertThat().existsInRepo()
|
||||
.createFolder(managerFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify valid document has allowable action CAN_CHECK_OUT")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyValidDocumentHasAllowableActionCanCheckOut() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_CHECK_OUT)
|
||||
.then().assertThat().isAllowableActionInList(Action.CAN_APPLY_ACL, Action.CAN_DELETE_CONTENT_STREAM, Action.CAN_GET_ALL_VERSIONS);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify valid folder has allowable action CAN_GET_CHILDREN, CAN_CREATE_FOLDER")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyValidFolderHasAllowableAction() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFolder)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_CHILDREN, Action.CAN_CREATE_FOLDER);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify pwc document has allowable action CAN_CHECK_IN, CAN_CANCEL_CHECK_OUT and CAN_MOVE_OBJECT")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyPWCDocumentHasAllowable() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.assertThat().existsInRepo().and().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument()
|
||||
.assertThat().hasAllowableActions(Action.CAN_CHECK_IN, Action.CAN_MOVE_OBJECT, Action.CAN_CANCEL_CHECK_OUT)
|
||||
.and().assertThat().isAllowableActionInList(Action.CAN_CHECK_IN, Action.CAN_GET_CONTENT_STREAM, Action.CAN_CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify valid folder does not have allowable action CAN_CHECK_IN, CAN_CHECK_OUT, CAN_CANCEL_CHECK_OUT")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyFolderDoesNotHaveCanCheckInAction() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFolder)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_CHECK_IN, Action.CAN_CHECK_OUT, Action.CAN_CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify delete document has allowable actions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void verifyDeletedDocumentHasAllowableActions() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().delete()
|
||||
.and().assertThat().hasAllowableActions(Action.CAN_CHECK_IN, Action.CAN_MOVE_OBJECT, Action.CAN_CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify delete document has allowable actions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void verifyDeletedDocumentGetAllowableActions() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().delete()
|
||||
.and().assertThat().isAllowableActionInList(Action.CAN_CHECK_IN, Action.CAN_MOVE_OBJECT, Action.CAN_CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify checked out document does not have allowable action CAN_CHECK_IN, CAN_CANCEL_CHECK_OUT")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyCheckedOutDocumentHasAllowable() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.assertThat().existsInRepo().and().assertThat().documentIsCheckedOut()
|
||||
.usingResource(testFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_ALL_VERSIONS, Action.CAN_GET_CONTENT_STREAM, Action.CAN_GET_ACL, Action.CAN_GET_PROPERTIES)
|
||||
.and().assertThat().doesNotHaveAllowableActions(Action.CAN_CHECK_IN, Action.CAN_CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can get allowable and not allowable actions for content created by mananger")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorGetAllowableActionForContentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(managerFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_CONTENT_STREAM)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_CHECK_OUT, Action.CAN_CHECK_IN, Action.CAN_MOVE_OBJECT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_CONTENT_STREAM)
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_CREATE_FOLDER)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_DELETE_TREE, Action.CAN_MOVE_OBJECT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_CREATE_FOLDER);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can get allowable and not allowable actions for content created by mananger")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorGetAllowableActionForContentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(managerFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_UPDATE_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_CHECK_OUT, Action.CAN_ADD_OBJECT_TO_FOLDER)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_MOVE_OBJECT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_CONTENT_STREAM,
|
||||
Action.CAN_UPDATE_PROPERTIES, Action.CAN_CHECK_OUT, Action.CAN_ADD_OBJECT_TO_FOLDER)
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_CREATE_FOLDER, Action.CAN_UPDATE_PROPERTIES)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_DELETE_TREE, Action.CAN_MOVE_OBJECT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_CREATE_FOLDER,Action.CAN_UPDATE_PROPERTIES);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer can get allowable and not allowable actions for content created by mananger")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerGetAllowableActionForContentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(managerFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_ALL_VERSIONS, Action.CAN_ADD_OBJECT_TO_FOLDER)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_MOVE_OBJECT, Action.CAN_CHECK_OUT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_ALL_VERSIONS, Action.CAN_ADD_OBJECT_TO_FOLDER)
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_GET_DESCENDANTS)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_DELETE_TREE, Action.CAN_MOVE_OBJECT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_GET_DESCENDANTS);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer can get allowable and not allowable actions for content created by mananger")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void nonInvitedUserCanGetAllowableActionForContentCreatedByManager() throws Exception
|
||||
{
|
||||
UserModel nonInvitedUser = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(nonInvitedUser)
|
||||
.usingResource(managerFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_ALL_VERSIONS, Action.CAN_ADD_OBJECT_TO_FOLDER)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_MOVE_OBJECT, Action.CAN_CHECK_OUT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_PROPERTIES, Action.CAN_GET_ACL, Action.CAN_GET_ALL_VERSIONS, Action.CAN_ADD_OBJECT_TO_FOLDER)
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_GET_DESCENDANTS)
|
||||
.assertThat().doesNotHaveAllowableActions(Action.CAN_DELETE_OBJECT, Action.CAN_DELETE_TREE, Action.CAN_MOVE_OBJECT)
|
||||
.assertThat().isAllowableActionInList(Action.CAN_GET_FOLDER_PARENT, Action.CAN_GET_FOLDER_TREE, Action.CAN_GET_DESCENDANTS);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get allowable actions from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserOnPrivateSiteCannotGetAllowableActions() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_PROPERTIES);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get allowable actions from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserOnModeratedSiteCannotGetAllowableActions() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
cmisApi.authenticateUser(testUser).usingSite(moderatedSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile)
|
||||
.assertThat().hasAllowableActions(Action.CAN_GET_PROPERTIES);
|
||||
}
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/26/2016.
|
||||
*/
|
||||
public class AppendContentStreamTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel publicSite, privateSite;
|
||||
FileModel testFile;
|
||||
String initialContent = "initial content ";
|
||||
String textToAppend = "text to append";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to append content to a not empty file in DocumentLibrary with CMIS")
|
||||
public void siteManagerShouldAppendContentToNotEmptyFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to append content to a non existent Document in DocumentLibrary with CMIS")
|
||||
public void userShouldNotAppendContentToNonexistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile)
|
||||
.assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().delete()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().update(textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to append content to an empty file with version with CMIS")
|
||||
public void siteManagerCanAppendContentToEmptyFileWithVersion() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().setContent("")
|
||||
.assertThat().contentIs("")
|
||||
.refreshResource()
|
||||
.then().update(textToAppend)
|
||||
.and().assertThat().contentIs(textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to append content to an empty file with no version in DocumentLibrary with CMIS")
|
||||
public void siteManagerCanAppendContentToEmptyFileWithNoVersion() throws Exception
|
||||
{
|
||||
FileModel emptyFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(emptyFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs("")
|
||||
.then().update(textToAppend)
|
||||
.and().assertThat().contentIs(textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to append content with last chunk parameter set to FALSE with CMIS")
|
||||
public void siteManagerCanAppendContentWithLastChunkSetToFalse() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().update(textToAppend, false)
|
||||
.and().assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to append content to a file created by other user in DocumentLibrary with CMIS")
|
||||
public void adminShouldAppendContentToFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().authenticateUser(dataUser.getAdminUser()).update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to append content to a file created by other user in DocumentLibrary with CMIS")
|
||||
public void siteManagerShouldAppendContentToFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to append content to a file created by self in DocumentLibrary with CMIS")
|
||||
public void contributorShouldAppendContentToFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to append content to a file created by other user in DocumentLibrary with CMIS")
|
||||
public void contributorCannotAppendContentToFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).update(textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to append content to a file created by other user in DocumentLibrary with CMIS")
|
||||
public void collaboratorShouldAppendContentToFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to append content to a file created by self in DocumentLibrary with CMIS")
|
||||
public void collaboratorShouldAppendContentToFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to append content to a file with CMIS")
|
||||
public void consumerCannotAppendContentToFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).update(textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUpdateConflictException.class, expectedExceptionsMessageRegExp = "^.*Cannot perform operation since the node.*is locked.$")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to append content to a checked out file with CMIS")
|
||||
public void managerCannotAppendContentToCheckedOutFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.when().update(textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to append content to a PWC file with CMIS")
|
||||
public void managerCanAppendContentToPWCFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().update(textToAppend)
|
||||
.assertThat().contentIs(initialContent + textToAppend);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to append content to a file created in a private site with CMIS")
|
||||
public void unauthorizedUserCannotAppendContentToFileFromPrivateSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, initialContent);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(privateSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(initialContent)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).update(textToAppend);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to append content to an invalid file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = InvalidCmisObjectException.class, expectedExceptionsMessageRegExp = "^Content at.*is not a file$")
|
||||
public void userCannotAppendContentOfInvalidFile() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.update(textToAppend);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class CancelCheckOutTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
private String fileContent = "content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify cancel check out on a pwc")
|
||||
public void cancelCheckOutOnPWC() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.and().assertThat().isPrivateWorkingCopy()
|
||||
.then().cancelCheckOut()
|
||||
.and().assertThat().isNotPrivateWorkingCopy()
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsNotCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify cancel check out on a document that isn't checked out")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisRuntimeException.class)
|
||||
public void cancelCheckOutOnADocumentThatIsntCheckedOut() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.and().assertThat().isNotPrivateWorkingCopy()
|
||||
.then().cancelCheckOut();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify cancel check out on deleted document")
|
||||
public void cancelCheckOutOnDeletedDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().delete().and().assertThat().doesNotExistInRepo()
|
||||
.then().cancelCheckOut();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisRuntimeException.class)
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify cancel check out on a pwc twice")
|
||||
public void cancelCheckOutTwice() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut().assertThat().isPrivateWorkingCopy()
|
||||
.and().cancelCheckOut()
|
||||
.cancelCheckOut();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that cancel check out on document created with Versioning State CHECKED OUT deletes the document")
|
||||
public void cancelCheckOutOnDocWithVersioningStateCheckedOut() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.and().assertThat().existsInRepo().assertThat().documentIsCheckedOut()
|
||||
.then().usingPWCDocument()
|
||||
.cancelCheckOut()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator user can cancel check out on document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanCancelCheckInDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().cancelCheckOut()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator user can cancel check out on document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanCancelCheckInDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().cancelCheckOut()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that contributor user can cancel check out on document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanCancelCheckInDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().cancelCheckOut()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.0);
|
||||
}
|
||||
}
|
||||
@@ -1,329 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class CheckInTests extends CmisTest
|
||||
{
|
||||
UserModel unauthorizedUser;
|
||||
UserModel siteManager;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
private String fileContent = "content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify check in document with minor version and no content")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void checkInDocumentWithMinorVersionAndNoContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify check in document with minor version and with content")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void checkInDocumentWithMinorVersionAndWithContent() throws Exception
|
||||
{
|
||||
String newContent = "new minor content";
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.assertThat().isPrivateWorkingCopy()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.withContent(newContent)
|
||||
.checkIn()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1)
|
||||
.and().assertThat().contentIs(newContent);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify check in document with major version and no content")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void checkInDocumentWithMajorVersionAndNoContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMajorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify check in document with major version and with content")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void checkInDocumentWithMajorVersionAndWithContent() throws Exception
|
||||
{
|
||||
String newContent = "new major content";
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMajorVersion()
|
||||
.withContent(newContent)
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(2.0);
|
||||
Utility.sleep(100, 5000, () ->
|
||||
cmisApi.assertThat().contentIs(newContent));
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in document that wasn't checked out")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisVersioningException.class)
|
||||
public void checkInDocumentThatWasntCheckedOut() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.checkIn();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in comment for document with major version")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void getCheckInCommentForDocMajorVersion() throws Exception
|
||||
{
|
||||
String newContent = "new major content";
|
||||
String comment = "major version comment";
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMajorVersion()
|
||||
.withContent(newContent)
|
||||
.withComment(comment)
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(2.0)
|
||||
.and().assertThat().contentIs(newContent)
|
||||
.assertThat().hasCheckInCommentLastVersion(comment);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in comments for multiple versions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void getCheckInCommentForDocWithMultipleVersions() throws Exception
|
||||
{
|
||||
String minorComment = "minor version comment";
|
||||
String majorComment = "major version comment";
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.withContent("minor content")
|
||||
.withComment(minorComment)
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.and().assertThat().hasCheckInCommentForVersion(1.1, minorComment)
|
||||
.then().checkOut().prepareDocumentForCheckIn()
|
||||
.withMajorVersion()
|
||||
.withContent("major content")
|
||||
.withComment(majorComment)
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.and().assertThat().hasCheckInCommentForVersion(2.0, majorComment);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in document with minor version and no content")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisVersioningException.class)
|
||||
public void checkInDocumentTwice() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.checkIn()
|
||||
.prepareDocumentForCheckIn()
|
||||
.checkIn();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in document created with VersioningState checkedout")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void checkInDocumentCreatedWithVersioningStateCheckedOut() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.and().assertThat().existsInRepo().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.withContent("minor content")
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in for deleted document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void checkInDeletedDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().delete().assertThat().doesNotExistInRepo()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.withContent("minor content")
|
||||
.checkIn();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in document created with VersioningState checkedout")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void checkInDocumentWithProperties() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
properties.put(PropertyIds.NAME, testFile.getName() + "-edit");
|
||||
properties.put("cm:title", testFile.getName() + "-title");
|
||||
properties.put("cm:description", "description after checkout");
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.and().assertThat().existsInRepo().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.withContent("minor content")
|
||||
.checkIn(properties).refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "description after checkout")
|
||||
.assertThat().contentPropertyHasValue("cmis:name", testFile.getName() + "-edit")
|
||||
.assertThat().contentPropertyHasValue("cm:title", testFile.getName() + "-title");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check in document created with VersioningState checkedout")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class)
|
||||
public void checkInDocumentWithInvalidProperties() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
properties.put("cmis:fakeProp","fake-value");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.and().assertThat().existsInRepo().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.withContent("minor content")
|
||||
.checkIn(properties).refreshResource();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that contributor user can check in document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanCheckInDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator user can check in document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanCheckInDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator user can check in document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanCheckInDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.and().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.1);
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.*;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class CheckOutTests extends CmisTest
|
||||
{
|
||||
UserModel unauthorizedUser;
|
||||
UserModel siteManager;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
private String fileContent = "content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify check out valid document")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyCheckOutValidDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.then().assertThat().documentIsCheckedOut()
|
||||
.and().assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify check out inexistent document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void verifyCheckOutInexistentDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().delete().assertThat().doesNotExistInRepo()
|
||||
.then().checkOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify if PWC is created for document that is not checked out")
|
||||
@Test(groups = {TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyPWCForDocThatIsNotCheckedOut() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile).assertThat().isNotPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify error when a document is checked out twice")
|
||||
@Test(groups = {TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisVersioningException.class, expectedExceptionsMessageRegExp = "^Check out failed.*This node is already checked out.$")
|
||||
public void checkOutDocumentTwice() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().checkOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify private working copy does NOT exists for a document that was deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyPWCDoesNotExistsForDeletedDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(testFile)
|
||||
.and().checkOut()
|
||||
.then().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument()
|
||||
.delete()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(testFile)
|
||||
.assertThat().isNotPrivateWorkingCopy().and().assertThat().documentIsNotCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that contributor user can NOT check out document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = { CmisUnauthorizedException.class, CmisPermissionDeniedException.class })
|
||||
public void contributorCannotCheckOutDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.and().checkOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that consumer user can NOT check out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = { CmisUnauthorizedException.class, CmisPermissionDeniedException.class })
|
||||
public void consumerCannotCheckOutDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.and().checkOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that unauthorized user can NOT check out document from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = { CmisUnauthorizedException.class, CmisPermissionDeniedException.class })
|
||||
public void unauthorizedUserCannotCheckOutDocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.authenticateUser(unauthorizedUser)
|
||||
.and().checkOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that unauthorized user can NOT check out document from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = { CmisUnauthorizedException.class, CmisPermissionDeniedException.class })
|
||||
public void unauthorizedUserCannotCheckOutDocumentModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, fileContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(moderatedSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.authenticateUser(unauthorizedUser)
|
||||
.and().checkOut();
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.alfresco.utility.LogFactory;
|
||||
import org.alfresco.utility.data.DataContent;
|
||||
import org.alfresco.utility.data.DataSite;
|
||||
import org.alfresco.utility.data.DataUserAIS;
|
||||
import org.alfresco.utility.network.ServerHealth;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.BeforeSuite;
|
||||
|
||||
@ContextConfiguration("classpath:alfresco-cmis-context.xml")
|
||||
@Component
|
||||
@Scope(value = "prototype")
|
||||
public abstract class CmisTest extends AbstractTestNGSpringContextTests
|
||||
{
|
||||
private static Logger LOG = LogFactory.getLogger();
|
||||
|
||||
@Autowired
|
||||
protected CmisWrapper cmisApi;
|
||||
|
||||
@Autowired
|
||||
protected DataUserAIS dataUser;
|
||||
|
||||
@Autowired
|
||||
protected DataSite dataSite;
|
||||
|
||||
@Autowired
|
||||
protected DataContent dataContent;
|
||||
|
||||
@Autowired
|
||||
ServerHealth serverHealth;
|
||||
|
||||
public String documentContent = "CMIS document content";
|
||||
|
||||
@BeforeSuite(alwaysRun = true)
|
||||
public void checkServerHealth() throws Exception
|
||||
{
|
||||
super.springTestContextPrepareTestInstance();
|
||||
serverHealth.assertServerIsOnline();
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void showStartTestInfo(Method method)
|
||||
{
|
||||
LOG.info(String.format("*** STARTING Test: [%s] ***", method.getName()));
|
||||
}
|
||||
|
||||
@AfterMethod(alwaysRun = true)
|
||||
public void showEndTestInfo(Method method)
|
||||
{
|
||||
LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
|
||||
}
|
||||
|
||||
public Integer getSolrWaitTimeInSeconds()
|
||||
{
|
||||
return cmisApi.cmisProperties.envProperty().getSolrWaitTimeInSeconds();
|
||||
}
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/28/2016.
|
||||
*/
|
||||
public class CopyTests extends CmisTest
|
||||
{
|
||||
UserModel inexistentUser;
|
||||
UserModel unauthorizedUser;
|
||||
UserModel testUser;
|
||||
UserModel contributorUser;
|
||||
UserModel collaboratorUser;
|
||||
UserModel consumerUser;
|
||||
SiteModel testSite;
|
||||
FileModel sourceFile;
|
||||
FolderModel targetFolder, sourceFolder;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
contributorUser = dataUser.createRandomTestUser();
|
||||
collaboratorUser = dataUser.createRandomTestUser();
|
||||
consumerUser = dataUser.createRandomTestUser();
|
||||
inexistentUser = new UserModel("inexistent", "inexistent");
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
|
||||
dataUser.addUserToSite(consumerUser, testSite, UserRole.SiteConsumer);
|
||||
dataUser.addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
dataUser.addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to copy file to an existent location in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCopyFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().copyTo(targetFolder)
|
||||
.and().assertThat().existsInRepo().usingResource(sourceFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to copy folder to an existent location in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCopyFolder() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
sourceFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).assertThat().existsInRepo()
|
||||
.createFolder(sourceFolder).assertThat().existsInRepo()
|
||||
.then().copyTo(targetFolder)
|
||||
.and().assertThat().existsInRepo().usingResource(sourceFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to copy file to a nonexistent location in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void siteManagerCopyFileToNonexistentTarget() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(sourceFile).assertThat().existsInRepo()
|
||||
.createFolder(targetFolder).and().delete()
|
||||
.then().copyTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to copy a nonexistent file in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void siteManagerCopyNonexistentSourceFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).assertThat().existsInRepo()
|
||||
.createFile(sourceFile).delete()
|
||||
.then().copyTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non existing user is not able to copy file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUnauthorizedException.class)
|
||||
public void nonExistentUserIsNotAbleToCopyFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(inexistentUser)
|
||||
.then().copyTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non existing user is not able to copy folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUnauthorizedException.class)
|
||||
public void nonExistentUserIsNotAbleToCopyFolder() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
sourceFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).assertThat().existsInRepo()
|
||||
.createFolder(sourceFolder).assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(inexistentUser)
|
||||
.then().copyTo(targetFolder);
|
||||
}
|
||||
|
||||
// @Bug(id="ACE-5606")
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that checked out document can be copied with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void checkedOutDocumentCanBeCopied() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().checkOut()
|
||||
.and().copyTo(targetFolder).refreshResource()
|
||||
.then().assertThat().existsInRepo()
|
||||
.then().usingResource(sourceFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that whole folder structure can be copied with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void folderStructureCanBeCopied() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
FolderModel randomFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFolder(sourceFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(sourceFolder).createFolder(randomFolder)
|
||||
.then().createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().usingResource(sourceFolder)
|
||||
.copyTo(targetFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.assertThat().hasFiles(sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that version history of a copied document is not kept with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void versionHistoryIsNotKeptWhenCopyingFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().checkOut().refreshResource()
|
||||
.prepareDocumentForCheckIn()
|
||||
.withContent("First update").checkIn().refreshResource()
|
||||
.and().assertThat().documentHasVersion(1.1)
|
||||
.then().checkOut()
|
||||
.prepareDocumentForCheckIn()
|
||||
.withContent("Second update")
|
||||
.withMajorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentHasVersion(2.0)
|
||||
.then().copyTo(targetFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().documentHasVersion(1.0)
|
||||
.and().assertThat().contentIs("Second update");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify copy PWC document object")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void managerCopyPWCDocumentObject() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel pwcFile = cmisApi.authenticateUser(testUser).usingResource(sourceFile).checkOut().withCMISUtil().getPWCFileModel();
|
||||
cmisApi.usingResource(pwcFile).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(pwcFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can copy Document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void contributorCanCopyDocument() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(sourceFile).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can copy Folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void contributorCanCopyFolder() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(sourceFolder).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can copy Document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void collaboratorCanCopyDocument() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(sourceFile).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can copy Folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void collaboratorCanCopyFolder() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(sourceFolder).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot copy Document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerCannotCopyDocument() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
cmisApi.authenticateUser(consumerUser).usingResource(sourceFile).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot copy Folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerCannotCopyFolder() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
cmisApi.authenticateUser(consumerUser).usingResource(sourceFolder).copyTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot copy Document from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotCopyDocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
sourceFile = dataContent.usingUser(testUser).usingSite(privateSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(privateSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFile).copyTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot copy Folder from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotCopyFolderFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
sourceFolder = dataContent.usingUser(testUser).usingSite(privateSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(privateSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFolder).copyTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot copy Document from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotCopyDocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
sourceFile = dataContent.usingUser(testUser).usingSite(moderatedSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(moderatedSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFile).copyTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot copy Folder from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotCopyFolderFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
sourceFolder = dataContent.usingUser(testUser).usingSite(moderatedSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(testUser).usingSite(moderatedSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFolder).copyTo(targetFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/26/2016.
|
||||
*/
|
||||
public class CreateDocumentFromSourceTests extends CmisTest
|
||||
{
|
||||
SiteModel publicSite, privateSite;
|
||||
UserModel siteManager;
|
||||
FileModel sourceFile, newFile;
|
||||
String sourceContent = "source content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor,
|
||||
UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, sourceContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(sourceFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to create file from source in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS })
|
||||
public void siteManagerShouldCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(newFile, sourceFile).and()
|
||||
.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user isn't able to create file from source in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisUnauthorizedException.class)
|
||||
public void inexistentUserShouldNotCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
UserModel inexistentUser = new UserModel("inexistent", "inexistent");
|
||||
cmisApi.authenticateUser(inexistentUser).usingSite(publicSite).createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify unauthorized user isn't able to create file from source in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class,
|
||||
CmisUnauthorizedException.class })
|
||||
public void unauthorizedUserShouldNotCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingSite(publicSite).createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create document from source twice in the same location with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisContentAlreadyExistsException.class)
|
||||
public void siteManagerCannotCreateDocumentFromSourceTwice() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(newFile, sourceFile).and().assertThat()
|
||||
.existsInRepo().then().usingSite(publicSite).createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create document from source with invalid source with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void adminCannotCreateDocFromInvalidSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(publicSite).createFile(sourceFile).and().assertThat()
|
||||
.existsInRepo().then().delete().when().usingResource(sourceFile).createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create document from source with invalid characters with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisConstraintException.class)
|
||||
public void siteManagerCannotCreateDocFromSourceWithInvalidChars() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel invalidCharDoc = new FileModel("/.:?|\\`\\.txt", FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(invalidCharDoc, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create document from source at invalid location with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void adminCannotCreateDocumentAtInvalidPath() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel invalidLocation = new FolderModel("/Shared/invalidFolder");
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(invalidLocation).createFileFromSource(newFile,
|
||||
sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create file from folder source CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = InvalidCmisObjectException.class)
|
||||
public void siteManagerShouldNotCreateDocFromFolderSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel folderSource = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFolder(folderSource).then()
|
||||
.createFileFromSource(newFile, folderSource);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create document from source with invalid base type id with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisContentAlreadyExistsException.class)
|
||||
public void siteManagerCannotCreateDocFromSourceWithInvalidBaseTypeId() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(newFile, sourceFile).and().assertThat()
|
||||
.existsInRepo().then().usingSite(publicSite).createFileFromSource(newFile, sourceFile, "cmis:fakeType");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create an unnamed document from source with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteManagerCannotCreateUnnamedDocFromSource() throws Exception
|
||||
{
|
||||
newFile = new FileModel("");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(newFile, sourceFile).then()
|
||||
.usingSite(publicSite).assertThat().doesNotHaveFile(newFile);
|
||||
Utility.sleep(100, 10000, () ->
|
||||
{
|
||||
cmisApi.usingSite(publicSite).assertThat().doesNotHaveFile(newFile);
|
||||
});
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file from source added by another user with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void anotherSiteManagerShouldCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile);
|
||||
Utility.sleep(100, 10000, () ->
|
||||
{
|
||||
cmisApi.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to create file from source added by another user with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void contributorShouldCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile);
|
||||
Utility.sleep(100, 10000, () ->
|
||||
{
|
||||
cmisApi.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent);
|
||||
});
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to create file from source added by another user with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void collaboratorShouldCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile);
|
||||
Utility.sleep(100, 10000, () ->
|
||||
{
|
||||
cmisApi.refreshResource().then().assertThat().existsInRepo().and()
|
||||
.assertThat().contentIs(sourceContent);
|
||||
});
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to create file from source with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class,
|
||||
CmisUnauthorizedException.class })
|
||||
public void consumerShouldNotCreateDocumentFromSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file from source with versioning state set to Minor with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void managerCreatesDocumentFromSourceWithVersionMinor() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile, VersioningState.MINOR);
|
||||
Utility.sleep(100, 10000, () ->
|
||||
{
|
||||
cmisApi.refreshResource().then().assertThat().existsInRepo().and()
|
||||
.assertThat().contentIs(sourceContent).and()
|
||||
.assertThat().documentHasVersion(0.1).and()
|
||||
.assertThat().isNotLatestMajorVersion();
|
||||
});
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file from source with versioning state set to None with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void managerShouldCreateDocumentFromSourceWithVersionNone() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile, VersioningState.NONE);
|
||||
Utility.sleep(100, 35000, () ->
|
||||
{
|
||||
cmisApi.refreshResource().then().assertThat().existsInRepo().and()
|
||||
.assertThat().contentIs(sourceContent).and()
|
||||
.assertThat().documentHasVersion(1.0);
|
||||
});
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file from source with versioning state set to CHECKEDOUT with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void managerCreatesDocumentFromSourceWithVersionCHECKEDOUT() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile, VersioningState.CHECKEDOUT);
|
||||
Utility.sleep(100, 35000, () ->
|
||||
{
|
||||
cmisApi.refreshResource().then().assertThat().existsInRepo().and()
|
||||
.assertThat().contentIs(sourceContent).and()
|
||||
.assertThat().documentIsCheckedOut();
|
||||
});
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create document from null source with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = NullPointerException.class)
|
||||
public void adminCannotCreateDocFromNullSource() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel sourceFile = null;
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(publicSite).createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager is able to create document from a source that is checked out with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void managerShouldCreateDocFromSourceThatIsCheckedOut() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, sourceContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut().when().usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile).then().assertThat().existsInRepo().and().assertThat()
|
||||
.contentIs(sourceContent).and().assertThat().documentIsNotCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager is able to create document from a source from his private site with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void managerShouldCreateDocFromSourceFromHisPrivateSite() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, sourceContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite).createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.when().usingSite(publicSite).createFileFromSource(newFile, sourceFile).then().assertThat().existsInRepo().and()
|
||||
.assertThat().contentIs(sourceContent);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that an user is not able to create document from a source from a private site with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class,
|
||||
CmisUnauthorizedException.class })
|
||||
public void userShouldNotCreateDocFromSourceFromPrivateSite() throws Exception
|
||||
{
|
||||
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, sourceContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite).createFile(sourceFile).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(publicSite)
|
||||
.createFileFromSource(newFile, sourceFile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,313 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/26/2016.
|
||||
*/
|
||||
public class CreateDocumentTests extends CmisTest
|
||||
{
|
||||
SiteModel testSite;
|
||||
UserModel testUser;
|
||||
UserModel inexistentUser;
|
||||
FileModel testFile, adminFile;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
inexistentUser = new UserModel("inexistent", "inexistent");
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to create files in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldCreateDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user isn't able to create files in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void inexistentUserShouldNotCreateDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(inexistentUser).usingSite(testSite).createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify unauthorized user isn't able to create files in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserShouldNotCreateDocument() throws Exception
|
||||
{
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(unauthorizedUser)
|
||||
.usingSite(testSite).createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify admin user is able to create files in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminShouldCreateDocument() throws Exception
|
||||
{
|
||||
adminFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(testSite)
|
||||
.createFile(adminFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create document twice in the same location with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisContentAlreadyExistsException.class)
|
||||
public void siteManagerCannotCreateDocumentTwice() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create document ending with '.'")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotCreateDocumentEndingWithPoint() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, documentContent);
|
||||
testFile.setName(testFile.getName() + ".");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create document in invalid location with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void adminCannotCreateDocumentAtInvalidPath() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
FolderModel invalidLocation = new FolderModel("/Shared/invalidFolder");
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(invalidLocation).createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create document with invalid characters in name with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void adminCannotCreateDocumentWithInvalidCharacters() throws Exception
|
||||
{
|
||||
FileModel invalidCharDoc = new FileModel("/.:?|\\`\\.txt", FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.createFile(invalidCharDoc);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create document with invalid base type id with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotCreateDocWithInvalidObjectTypeId() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, "cmis:fakeType", VersioningState.MAJOR);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create document with cmis:folder base type id with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotCreateDocWithFolderTypeId() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, BaseTypeId.CMIS_FOLDER.value(), VersioningState.MAJOR);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is able to create document with valid symbols in name")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanCreateDocumentWithValidSymbols() throws Exception
|
||||
{
|
||||
FileModel validSymbolsDoc = new FileModel("!@#$%^&", FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(validSymbolsDoc).and().assertThat().existsInRepo();
|
||||
Assert.assertNotNull(cmisApi.withCMISUtil().getCmisObject(validSymbolsDoc.getCmisLocation()));
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that manager is not able to create document with empty name")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisInvalidArgumentException.class)
|
||||
public void siteManagerCannotCreateDocumentWithEmptyName() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(new FileModel("", FileType.TEXT_PLAIN));
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file with Major versioning state")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldCreateDocumentWithMajorVersioningState() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.MAJOR).and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentHasVersion(1.0)
|
||||
.assertThat().isLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file with Minor versioning state")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldCreateDocumentWithMinorVersioningState() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.MINOR).and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentHasVersion(0.1)
|
||||
.assertThat().isNotLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file with CHECKEDOUT versioning state")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldCreateDocumentWithCheckedOutVersioningState() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT).and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to create file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorShouldCreateDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to create file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorShouldCreateDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to create file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerShouldNotCreateDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingSite(testSite)
|
||||
.createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to create file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserShouldNotCreateDocumentInSite() throws Exception
|
||||
{
|
||||
UserModel outsider = dataUser.createRandomTestUser();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(outsider)
|
||||
.usingSite(testSite)
|
||||
.createFile(testFile);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify disabled user is not able to create file in Shared folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void disabledUserShouldNotCreateDocument() throws Exception
|
||||
{
|
||||
UserModel disabled = dataUser.createRandomTestUser();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(disabled);
|
||||
dataUser.usingAdmin().disableUser(disabled);
|
||||
cmisApi.usingShared()
|
||||
.createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to create file in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserShouldNotCreateDocumentInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingSite(privateSite)
|
||||
.createFile(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create document with no properties")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Properties must not be empty!*")
|
||||
public void siteManagerCannotCreateDocumentWithNoProperties() throws Exception
|
||||
{
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, properties, VersioningState.MAJOR);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create file with a name containing multi byte characters.")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void managerIsAbleToCreateFileWithMultiByteName() throws Exception
|
||||
{
|
||||
testFile = new FileModel(RandomData.getRandomAlphanumeric() + "\ufeff\u6768\u6728\u91d1");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that manager user is not able to create document at document location")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=InvalidCmisObjectException.class)
|
||||
public void siteManagerCannotCreateDocumentInDocumentLocation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().usingResource(testFile)
|
||||
.createFile(testFile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/26/2016
|
||||
*/
|
||||
public class CreateFolderTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FolderModel testFolder;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin user is able to create folder in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminShouldCreateFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to create folder in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldCreateFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user can't create folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void inexistentUserShouldNotCreateFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(new UserModel("random user", "random password")).usingSite(testSite).createFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify a folder with same name can't be created in the same location")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisContentAlreadyExistsException.class,
|
||||
expectedExceptionsMessageRegExp="An object with this name already exists.*")
|
||||
public void shouldNotCreateFolderWithSameName() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify a folder can't be created at invalid path")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class,
|
||||
expectedExceptionsMessageRegExp="Object not found.*")
|
||||
public void shouldNotCreateFolderAtInvalidPath() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(new SiteModel("inexitentSite")).createFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create folder with invalid base type id with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotCreateFolderWithInvalidObjectTypeId() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder, "cmis:fakeType");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create folder with cmis:document base type id with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotCreateFolderWithDocumentTypeId() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder, BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create folder with invalid characters in name")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void adminCannotCreateFolderWithInvalidCharacters() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel("/.:?|\\`\\.txt");
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.createFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType=ExecutionType.REGRESSION,
|
||||
description = "Verify that admin user is not able to create folder with empty name")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisInvalidArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Property cmis:name must be set!*")
|
||||
public void adminCannotCreateFolderWithEmptyName() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.createFolder(new FolderModel(""));
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create folder with empty properties")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Properties must not be empty!*")
|
||||
public void siteManagerCannotCreateFolderWithNoParamenters() throws Exception
|
||||
{
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFolder(testFolder, properties);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create folder with properties specific for documents")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Property 'cmis:isLatestMajorVersion' is not valid for this type or one of the secondary types!*")
|
||||
public void siteManagerCannotCreateFolderWithDocumentParamenters() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());
|
||||
properties.put(PropertyIds.NAME, testFolder.getName());
|
||||
properties.put(PropertyIds.IS_LATEST_MAJOR_VERSION, "true");
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFolder(testFolder, properties);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor is able to create folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanCreateFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator is able to create folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanCreateFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer is not able to create folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotCreateFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingSite(testSite)
|
||||
.createFolder(testFolder);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify disabled user is not able to create folder in Shared location")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void disabledUserShouldNotCreateFolder() throws Exception
|
||||
{
|
||||
UserModel disabled = dataUser.createRandomTestUser();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(disabled);
|
||||
dataUser.usingAdmin().disableUser(disabled);
|
||||
cmisApi.usingShared()
|
||||
.createFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to create folder in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserShouldNotCreateDocumentInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingSite(privateSite)
|
||||
.createFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create folder with a name containing multi byte characters.")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void managerIsAbleToCreateFolderWithMultiByteName() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomAlphanumeric() + "\ufeff\u6768\u6728\u91d1");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
}
|
||||
}
|
||||
@@ -1,590 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.DataListItemModel;
|
||||
import org.alfresco.utility.model.DataListModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class DataListsTests extends CmisTest
|
||||
{
|
||||
UserModel manager;
|
||||
SiteModel testSite;
|
||||
DataListModel dataListModel;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
manager = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(manager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(manager)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void adminCanCreateContactDataList() throws Exception
|
||||
{
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingShared()
|
||||
.createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.assertThat().objectTypeIdIs("F:dl:dataList");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void managerCanCreateContactDataList() throws Exception
|
||||
{
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.assertThat().objectTypeIdIs("F:dl:dataList")
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:contact");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void collaboratorCanCreatedIssueDataList() throws Exception
|
||||
{
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.assertThat().objectTypeIdIs("F:dl:dataList")
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void contributorCanCreateEventAgendaDataList() throws Exception
|
||||
{
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:eventAgenda");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.assertThat().objectTypeIdIs("F:dl:dataList")
|
||||
.assertThat().objectHasProperty("dl:dataListItemType", "dl:eventAgenda");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotCreateEventAgendaDataList() throws Exception
|
||||
{
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:eventAgenda");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingSite(testSite)
|
||||
.createDataList(dataListModel).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void managerCanCreateContactDataListItem() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
itemProperties.put("dl:contactLastName", "Snow");
|
||||
itemProperties.put("dl:contactEmail", "john.snow@stark.com");
|
||||
itemProperties.put("dl:contactCompany", "GOT");
|
||||
itemProperties.put("dl:contactJobTitle", "king");
|
||||
itemProperties.put("dl:contactPhoneOffice", "1234");
|
||||
itemProperties.put("dl:contactPhoneMobile", "5678");
|
||||
itemProperties.put("dl:contactNotes", "you know nothing john snow");
|
||||
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:contact")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void managerCanCreateIssueListItem() throws Exception
|
||||
{
|
||||
UserModel assignUser = dataUser.createRandomTestUser();
|
||||
FileModel attachDoc1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel attachDoc2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueID", RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueStatus", "Not Started");
|
||||
itemProperties.put("dl:issuePriority", "Low");
|
||||
itemProperties.put("dl:issueDueDate", new Date());
|
||||
itemProperties.put("dl:issueComments", "comment");
|
||||
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite).createFile(attachDoc1).createFile(attachDoc2)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo()
|
||||
.then().attachDocument(attachDoc1)
|
||||
.attachDocument(attachDoc2)
|
||||
.assertThat().objectHasRelationshipWith(attachDoc1)
|
||||
.assertThat().objectHasRelationshipWith(attachDoc2)
|
||||
.then().assignToUser(assignUser, "R:dl:issueAssignedTo")
|
||||
.assertThat().userIsAssigned(assignUser);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is able to create data list type contact")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisObjectNotFoundException.class,
|
||||
expectedExceptionsMessageRegExp="Type 'D:dl:invalidItem' is unknown!*")
|
||||
public void managerCannotCreateInvalidDataListItem() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:invalidItem");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:contact")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify collaborator user is able to add issue item type for data list created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void collaboratorCanAddIssueItem() throws Exception
|
||||
{
|
||||
UserModel assignUser = dataUser.createRandomTestUser();
|
||||
FileModel attachDoc1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel attachDoc2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueID", RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueDueDate", new Date());
|
||||
itemProperties.put("dl:issueComments", "comment");
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite).createFile(attachDoc1).createFile(attachDoc2)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo()
|
||||
.then().attachDocument(attachDoc1)
|
||||
.attachDocument(attachDoc2)
|
||||
.assertThat().objectHasRelationshipWith(attachDoc1)
|
||||
.assertThat().objectHasRelationshipWith(attachDoc2)
|
||||
.then().assignToUser(assignUser, "R:dl:issueAssignedTo")
|
||||
.assertThat().userIsAssigned(assignUser);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify contributor user is able to add issue item type for data list created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void contributorCanAddIssueItem() throws Exception
|
||||
{
|
||||
UserModel assignUser = dataUser.createRandomTestUser();
|
||||
FileModel attachDoc1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel attachDoc2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueID", RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueStatus", "Not Started");
|
||||
itemProperties.put("dl:issuePriority", "Low");
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite).createFile(attachDoc1).createFile(attachDoc2)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo()
|
||||
.then().attachDocument(attachDoc1)
|
||||
.attachDocument(attachDoc2)
|
||||
.assertThat().objectHasRelationshipWith(attachDoc1)
|
||||
.assertThat().objectHasRelationshipWith(attachDoc2)
|
||||
.then().assignToUser(assignUser, "R:dl:issueAssignedTo")
|
||||
.assertThat().userIsAssigned(assignUser);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify consumer user is able to add issue item type for data list created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotAddIssueItem() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify non invited user is able to add issue item type for data list created by manager in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotAddIssueItemInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(manager).createPrivateRandomSite();
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(privateSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is not able to create data list item with invalid status")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisConstraintException.class)
|
||||
public void managerCannotCreateTaskItemWithInvalidStatusValue() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:simpletask");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:simpletaskStatus", "invalid-status");
|
||||
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:simpletask");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is not able to create data list item with invalid status")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Property 'dl:fakePriority' is not valid for this type or one of the secondary types!*")
|
||||
public void managerCannotCreateTaskItemWithInvalidParameter() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:simpletask");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:fakePriority", "High");
|
||||
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:simpletask");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is not able to assign issue item to deleted user")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisInvalidArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Property cmis:targetId must be set!*")
|
||||
public void managerCannotAssignIssueItemToDeletedUser() throws Exception
|
||||
{
|
||||
UserModel assignUser = dataUser.createRandomTestUser();
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueID", RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueDueDate", new Date());
|
||||
itemProperties.put("dl:issueComments", "comment");
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
dataUser.usingAdmin().deleteUser(assignUser);
|
||||
cmisApi.assignToUser(assignUser, "R:dl:issueAssignedTo").assertThat().userIsAssigned(assignUser);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is not able to assign issue item twice to same user")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisRuntimeException.class)
|
||||
public void managerCannotAssignIssueItemTwice() throws Exception
|
||||
{
|
||||
UserModel assignUser = dataUser.createRandomTestUser();
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueID", RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueDueDate", new Date());
|
||||
itemProperties.put("dl:issueComments", "comment");
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
cmisApi.assignToUser(assignUser, "R:dl:issueAssignedTo").assertThat().userIsAssigned(assignUser)
|
||||
.then().assignToUser(assignUser, "R:dl:issueAssignedTo");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is able to assign issue item for 2 users")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void managerCanAssignIssueItemForTwoUsers() throws Exception
|
||||
{
|
||||
UserModel assignUser = dataUser.createRandomTestUser();
|
||||
UserModel anotherUser = dataUser.createRandomTestUser();
|
||||
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:issue");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueID", RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:issueDueDate", new Date());
|
||||
itemProperties.put("dl:issueComments", "comment");
|
||||
DataListItemModel issueItem = new DataListItemModel(itemProperties);
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:issue");
|
||||
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:issue")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(issueItem).assertThat().existsInRepo();
|
||||
cmisApi.assignToUser(assignUser, "R:dl:issueAssignedTo").assertThat().userIsAssigned(assignUser)
|
||||
.then().assignToUser(anotherUser, "R:dl:issueAssignedTo");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify manager user is able to delete contact data list with no items")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void managerCanDeleteContactDataList() throws Exception
|
||||
{
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:contact")
|
||||
.then().delete().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify manager user is not able to create contact data list items with same name twice")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisContentAlreadyExistsException.class)
|
||||
public void managerCannotCreateContactDataListWithSameNameTwice() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:contact")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.then().createDataListItem(contactItem);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify manager user is not able to create contact data list items at item location")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisInvalidArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Parent folder is not a folder!*")
|
||||
public void managerCannotCreateContactDataListItemInsideItem() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.and().assertThat().objectHasProperty("dl:dataListItemType", "dl:contact")
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().usingResource(contactItem)
|
||||
.createDataListItem(contactItem);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify manager user is not able to simple delete contact data list with items")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE}, expectedExceptions=CmisConstraintException.class,
|
||||
expectedExceptionsMessageRegExp="Could not delete folder with at least one child!*")
|
||||
public void managerCannotSimpleDeleteContactDataListWithItems() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify manager user is able to delete(delete tree) contact data list with items in it")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void managerCanDeleteTreeContactDataListWithItems() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.deleteFolderTree().assertThat().doesNotExistInRepo()
|
||||
.and().usingResource(contactItem).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator user is not able to delete(delete tree) contact data list with items in it created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void collaboratorCannotDeleteTreeContactDataListWithItems() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(dataListModel)
|
||||
.deleteFolderTree().assertThat()
|
||||
.hasFailedDeletedObject(dataListModel.getNodeRef())
|
||||
.and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor user is not able to delete(delete tree) contact data list with items in it created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void contributorCannotDeleteTreeContactDataListWithItems() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(dataListModel)
|
||||
.deleteFolderTree().assertThat()
|
||||
.hasFailedDeletedObject(dataListModel.getNodeRef())
|
||||
.and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer user is not able to delete(delete tree) contact data list with items in it created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void consumerCannotDeleteTreeContactDataListWithItems() throws Exception
|
||||
{
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(dataListModel)
|
||||
.deleteFolderTree().assertThat()
|
||||
.hasFailedDeletedObject(dataListModel.getNodeRef())
|
||||
.and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to delete(delete tree) contact data list with items in it created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.REQUIRE_SHARE})
|
||||
public void nonInvitedUserCannotDeleteTreeContactDataListWithItems() throws Exception
|
||||
{
|
||||
UserModel nonInvited = dataUser.createRandomTestUser();
|
||||
Map<String, Object> itemProperties = new HashMap<String, Object>();
|
||||
itemProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:dl:contact");
|
||||
itemProperties.put(PropertyIds.NAME, RandomData.getRandomAlphanumeric());
|
||||
itemProperties.put("dl:contactFirstName", "John");
|
||||
DataListItemModel contactItem = new DataListItemModel(itemProperties);
|
||||
|
||||
dataListModel = DataListModel.getRandomDataListModel("dl:contact");
|
||||
cmisApi.authenticateUser(manager).usingSite(testSite)
|
||||
.then().createDataList(dataListModel).and().assertThat().existsInRepo()
|
||||
.then().usingResource(dataListModel)
|
||||
.createDataListItem(contactItem).assertThat().existsInRepo()
|
||||
.then().authenticateUser(nonInvited)
|
||||
.usingResource(dataListModel)
|
||||
.deleteFolderTree().assertThat()
|
||||
.hasFailedDeletedObject(dataListModel.getNodeRef())
|
||||
.and().assertThat().existsInRepo();
|
||||
}
|
||||
}
|
||||
@@ -1,325 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/26/2016.
|
||||
*/
|
||||
public class DeleteAllVersionsTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
UserModel consumerUser;
|
||||
UserModel collaboratorUser;
|
||||
UserModel contributorUser;
|
||||
UserModel unauthorizedUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
consumerUser = dataUser.createRandomTestUser();
|
||||
collaboratorUser = dataUser.createRandomTestUser();
|
||||
contributorUser = dataUser.createRandomTestUser();
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
|
||||
dataUser.addUserToSite(consumerUser, testSite, UserRole.SiteConsumer);
|
||||
dataUser.addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
dataUser.addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete all document versions in DocumentLibrary with CMIS")
|
||||
@Test(groups = {TestGroup.SANITY, TestGroup.CMIS })
|
||||
public void siteManagerDeletesAllDocumentVersions() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().update(testFile.getName())
|
||||
.then().deleteAllVersions(true).and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete only latest document version in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerDeletesLatestDocumentVersion() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).and().update(testFile.getName())
|
||||
.then().deleteAllVersions(false).and().assertThat().documentHasVersion(1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete all versions of inexistent file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotDeleteAllVersionsOfInexistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
testFile.setCmisLocation("/fake-folder/inexistentFile.txt");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete PWC file version of a file with multiple versions with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeletePWCFileWithDeleteAllVersionsTrue() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.usingResource(testFile).update("content 1")
|
||||
.assertThat().documentHasVersion(1.1)
|
||||
.usingResource(testFile).update("content 2")
|
||||
.assertThat().documentHasVersion(1.2)
|
||||
.usingResource(testFile).checkOut()
|
||||
.assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo().and().assertThat().documentHasVersion(1.2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete PWC file version of a file with multiple versions set to false with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeletePWCFileWithDeleteAllVersionsFalse() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.then().update("content 1")
|
||||
.assertThat().documentHasVersion(1.1)
|
||||
.then().update("content 2")
|
||||
.assertThat().documentHasVersion(1.2)
|
||||
.then().checkOut().refreshResource()
|
||||
.assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().deleteAllVersions(false)
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo().and().assertThat().documentHasVersion(1.2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete file original multiple version which is checked out with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisConstraintException.class, expectedExceptionsMessageRegExp = "^Could not delete/cancel checkout on the original checked out document$")
|
||||
public void siteManagerCannotDeleteOriginalFileMultipleVersionWhenCheckedout() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.then().update("content 1")
|
||||
.assertThat().documentHasVersion(1.1)
|
||||
.then().update("content 2")
|
||||
.assertThat().documentHasVersion(1.2)
|
||||
.refreshResource().then().checkOut()
|
||||
.assertThat().documentIsCheckedOut();
|
||||
cmisApi.usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is NOT able to delete a checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotDeletePWCDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).then().update("content 1")
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.when().authenticateUser(unauthorizedUser)
|
||||
.usingResource(testFile).usingPWCDocument().deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can delete object Document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeleteDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile).usingResource(testFile).update("content 1")
|
||||
.usingResource(testFile).deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can delete object Folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeleteFolder() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder).usingResource(testFolder)
|
||||
.deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can delete object Document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanDeleteDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(contributorUser).usingSite(testSite).createFile(testFile).usingResource(testFile).update("content 1")
|
||||
.deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor cannot delete object Document created by site manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void contributorCannotDeleteDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).then().update("content 1")
|
||||
.when().authenticateUser(contributorUser).usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can delete object Folder created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanDeleteFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(contributorUser).usingSite(testSite).createFolder(testFolder).usingResource(testFolder)
|
||||
.deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor cannot delete object Folder created by site manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void contributorCannotDeleteFolderCreatedByManager() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.when().authenticateUser(contributorUser)
|
||||
.usingResource(testFolder).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can delete object Document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanDeleteDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(collaboratorUser).usingSite(testSite).createFile(testFile).usingResource(testFile).update("content 1")
|
||||
.deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator cannot delete object Document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void collaboratorCannotDeleteDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).then().update("content 1")
|
||||
.when().authenticateUser(collaboratorUser)
|
||||
.usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can delete object Folder created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanDeleteFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(collaboratorUser).usingSite(testSite).createFolder(testFolder).usingResource(testFolder)
|
||||
.deleteAllVersions(true)
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator cannot delete object Folder created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void collaboratorCannotDeleteFolderCreatedByManager() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().authenticateUser(collaboratorUser)
|
||||
.usingResource(testFolder).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot delete object Document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerCannotDeleteDocumentCreated() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).update("content 1")
|
||||
.when().authenticateUser(consumerUser)
|
||||
.usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot delete object Folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerCannotDeleteFolderCreated() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().authenticateUser(consumerUser)
|
||||
.usingResource(testFolder).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot delete Document from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotDeleteDocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(testFile).then().update("content 1")
|
||||
.when().authenticateUser(unauthorizedUser)
|
||||
.usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot delete Folder from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotDeleteFolderFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite).createFolder(testFolder);
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(testFolder).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot delete Document from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotDeleteDocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(moderatedSite).createFile(testFile).usingResource(testFile).update("content 1");
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(testFile).deleteAllVersions(true);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot delete Folder from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotDeleteFolderFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
testFolder = new FolderModel(RandomData.getRandomName("Folder"));
|
||||
cmisApi.authenticateUser(testUser).usingSite(moderatedSite).createFolder(testFolder);
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(testFolder).deleteAllVersions(true);
|
||||
}
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/27/2016.
|
||||
*/
|
||||
public class DeleteContentStreamTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel publicSite, privateSite;
|
||||
FileModel testFile;
|
||||
String content = "file content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete content of a not empty document in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerDeletesDocumentContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile)
|
||||
.deleteContent().and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to delete content of a nonexistent document in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void userCantDeleteContentFromNonexistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
testFile.setCmisLocation("/fake-folder/test.txt");
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingResource(testFile).deleteContent();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete content of a empty document in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeleteContentOfEmptyDocument() throws Exception
|
||||
{
|
||||
FileModel emptyDoc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(emptyDoc).and().assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs("")
|
||||
.then().deleteContent().and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify nonexistent user is not able to delete content of a document with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void nonexistentUserCannotDeleteDocumentContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile)
|
||||
.then().authenticateUser(UserModel.getRandomUserModel())
|
||||
.usingResource(testFile).deleteContent();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete content of a not empty document with refresh set to TRUE with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeleteDocContentWithRefreshTrue() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.HTML, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile)
|
||||
.deleteContent(true).and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete content of a not empty document with refresh set to FALSE with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeleteDocContentWithRefreshFalse() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.HTML, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile)
|
||||
.deleteContent(true).and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to delete content of a not empty document created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminDeletesContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(dataUser.getAdminUser())
|
||||
.deleteContent().and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete content of a not empty document created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerDeletesContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.deleteContent().and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to delete content of a not empty document created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorDeletesContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.deleteContent().and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to delete content of a not empty document created by self in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorDeletesContentOfFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().deleteContent()
|
||||
.and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to delete content of a not empty document created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void contributorCannotDeleteContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.deleteContent();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to delete content of a not empty document created by self in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorDeletesContentOfFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().deleteContent()
|
||||
.and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to delete content of a not empty document in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotDeleteContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.deleteContent();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUpdateConflictException.class, expectedExceptionsMessageRegExp = "^.*Cannot perform operation since the node.*is locked.$")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to delete content of a checked out file with CMIS")
|
||||
public void managerCannotDeleteContentOfCheckedOutFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.when().deleteContent();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete content of a PWC file with CMIS")
|
||||
public void managerDeletesContentOfPWCFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().deleteContent()
|
||||
.assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to delete content of a file created in a private site with CMIS")
|
||||
public void unauthorizedUserCannotDeleteContentOfFileFromPrivateSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(privateSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).deleteContent();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to delete content of invalid file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = InvalidCmisObjectException.class, expectedExceptionsMessageRegExp = "^Content at.*is not a file$")
|
||||
public void userShouldNotDeleteContentOfInvalidFile() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.deleteContent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/26/2016.
|
||||
*/
|
||||
public class DeleteTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel publicSite, privateSite;
|
||||
FolderModel testFolder;
|
||||
FileModel testFile;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete files in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldDeleteDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().delete()
|
||||
.and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete empty folders in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldDeleteEmptyFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.then().delete()
|
||||
.and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete folders with chidren with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisConstraintException.class, expectedExceptionsMessageRegExp = "^Could not delete folder with at least one child!$")
|
||||
public void siteManagerCannotDeleteFolderWithChildren() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile)
|
||||
.usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete file with multiple versions with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeleteFileWithVersions() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile)
|
||||
.then().update("content 1").assertThat().documentHasVersion(1.1)
|
||||
.then().update("content 2").assertThat().documentHasVersion(1.2)
|
||||
.then().usingResource(testFile).delete()
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete file which is checked out with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisConstraintException.class, expectedExceptionsMessageRegExp = "^Could not delete/cancel checkout on the original checked out document$")
|
||||
public void siteManagerCannotDeleteCheckedOutFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).usingResource(testFile).checkOut()
|
||||
.assertThat().documentIsCheckedOut()
|
||||
.then().delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete PWC file version with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanDeletePWCFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFile(testFile).then().checkOut()
|
||||
.assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete nonexistent file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotDeleteNonexistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
testFile.setCmisLocation("/" + testFile.getName() + "/");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.usingResource(testFile).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete nonexistent folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotDeleteNonexistentFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFolder.setCmisLocation("/" + testFolder.getName() + "/");
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete files created by another users in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldDeleteDocumentCreatedByAnotherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).delete()
|
||||
.and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to delete content created by self in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorShouldDeleteContentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.then().usingResource(testFile).delete()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(testFolder).delete()
|
||||
.and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to delete file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void contributorShouldNotDeleteFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFile).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to delete folder created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void contributorShouldNotDeleteFolderCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to delete content created by self in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorShouldDeleteContentCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.then().usingResource(testFile).delete()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(testFolder).delete()
|
||||
.and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is not able to delete file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void collaboratorShouldNotDeleteFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is not able to delete folder created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void collaboratorShouldNotDeleteFolderCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to delete file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerShouldNotDeleteFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to delete folder created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerShouldNotDeleteFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to delete files created by another users in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminShouldDeleteDocumentCreatedByAnotherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(testFile).delete()
|
||||
.and().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to delete file created inside a private site with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserShouldNotDeleteFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(privateSite)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to delete folder created inside a private site with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserShouldNotDeleteFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(privateSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to delete content created inside a private site with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotDeleteCheckedOutFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite)
|
||||
.createFile(testFile).then().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.when().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).delete();
|
||||
}
|
||||
}
|
||||
@@ -1,385 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.enums.UnfileObject;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/27/2016.
|
||||
*/
|
||||
public class DeleteTreeTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FolderModel parentTestFolder, childTestFolder;
|
||||
private String content = "content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to delete parent folder with multiple children in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerDeletesFolderTree() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify exception is thrown when deleting inexistent folder tree in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerDeletesInexistentFolderTree() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).deleteFolderTree().assertThat().doesNotExistInRepo()
|
||||
.deleteFolderTree();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user is NOT able to delete parent folder with multiple children in DocumentLibrary")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void inexistentUserCannotDeleteFolderTree() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
UserModel inexistentUser = UserModel.getRandomUserModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(inexistentUser)
|
||||
.usingResource(parentTestFolder).deleteFolderTree();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete parent folder with allVersions parameter set to true")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerDeletesFolderTreeWithAllVersionsParamTrue() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).deleteFolderTree(true, UnfileObject.DELETE, true)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Only allVersions=true is supported for delete parent folder tree, allVersions=true is not supported")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisInvalidArgumentException.class})
|
||||
public void deleteFolderTreeWithAllVersionsParamFalseNotSupported() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).deleteFolderTree(false, UnfileObject.DELETE, true)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
// @Bug(id="REPO-1108")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete parent folder with unfile parameter set to DELETESINGLEFILED, using checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteManagerDeletesFolderTreeWithDeleteSingleFieldWithCheckoutDoc() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder)
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.when().usingResource(parentTestFolder).deleteFolderTree(true, UnfileObject.DELETESINGLEFILED, true)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to delete parent folder with unfile parameter set to DELETESINGLEFILED, using add object to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerDeletesFolderTreeWithDeleteSingleFieldWithAddDocToFolder1() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder)
|
||||
.createFolder(childTestFolder)
|
||||
.usingResource(parentTestFolder)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.usingResource(testFile).addDocumentToFolder(childTestFolder, true)
|
||||
.then().usingResource(childTestFolder).deleteFolderTree(true, UnfileObject.DELETESINGLEFILED, true)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(parentTestFolder).assertThat().existsInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete parent folder with unfile parameter set to DELETESINGLEFILED, using add object to folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerDeletesFolderTreeWithDeleteSingleFieldWithAddDocToFolder2() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder)
|
||||
.createFolder(childTestFolder)
|
||||
.usingResource(parentTestFolder)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.usingResource(testFile).addDocumentToFolder(childTestFolder, true)
|
||||
.then().usingResource(childTestFolder).deleteFolderTree(true, UnfileObject.DELETE, true)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(parentTestFolder).assertThat().existsInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Unfile-ing is not supported for delete parent folder tree")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisInvalidArgumentException.class},
|
||||
expectedExceptionsMessageRegExp="Unfiling not supported!*")
|
||||
public void deleteFolderTreeWithUnfileNotSupported() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).deleteFolderTree(true, UnfileObject.UNFILE, true)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
// @Bug(id="REPO-1108")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to delete parent folder with continueOnFailure parameter set to false")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerDeletesFolderTreeWithContinueOnFailureParamFalse() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder)
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder)
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).deleteFolderTree(true, UnfileObject.DELETE, false)
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to delete parent folder with multiple children created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorDeletesOwnFolderTree() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to delete parent folder with multiple children created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCannotDeleteFolderTreeCreatedByManager() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree().and().assertThat().hasFailedDeletedObject(parentTestFolder.getNodeRef())
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().existsInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is not able to delete parent folder with multiple children created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCannotDeleteFolderTreeCreatedByManager() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree().and().assertThat().hasFailedDeletedObject(parentTestFolder.getNodeRef())
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().existsInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to delete parent folder with multiple children created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorDeletesOwnFolderTree() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to delete parent folder with multiple children created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCannotDeleteFolderTreeCreatedByManager() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree().and().assertThat().hasFailedDeletedObject(parentTestFolder.getNodeRef())
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().existsInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to delete parent folder with multiple children in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotDeleteFolderTreeInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingSite(privateSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.when().usingResource(parentTestFolder)
|
||||
.deleteFolderTree();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that only the parent folder is displayed in trash can after deleting it")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void checkTrashCanAfterDeletingParentFolder() throws Exception
|
||||
{
|
||||
parentTestFolder = FolderModel.getRandomFolderModel();
|
||||
childTestFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, content);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentTestFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentTestFolder)
|
||||
.createFolder(childTestFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo()
|
||||
.when().usingResource(parentTestFolder).refreshResource()
|
||||
.deleteFolderTree()
|
||||
.and().assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(childTestFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
dataUser.assertTrashCanHasContent(parentTestFolder);
|
||||
dataUser.assertTrashCanDoesNotHaveContent(childTestFolder, testFile);
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.client.api.OperationContext;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetAllVersionsTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel publicSite;
|
||||
FileModel testFile, managerFile;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(siteManager)
|
||||
.addUsersWithRolesToSite(publicSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(managerFile).assertThat().existsInRepo()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn().checkIn()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn()
|
||||
.withMajorVersion().checkIn();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get all versions for a valid document")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetAllVersionsForAValidDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(siteManager).usingResource(managerFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0, 1.1, 2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can not get all versions for a document that was deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void siteManagerShouldNotGetAllVersionsForADeletedDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().update("content 1").update("content 2")
|
||||
.assertThat().documentHasVersion(1.2).usingVersion().getAllDocumentVersions().assertHasVersions(1.0, 1.1, 1.2)
|
||||
.and().delete()
|
||||
.then().usingVersion().getAllDocumentVersions();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can get all versions for a document using OperationContext: OrderBy")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetAllVersionsWithOperationContextForADocument() throws Exception
|
||||
{
|
||||
OperationContext context = cmisApi.authenticateUser(siteManager).getSession().createOperationContext();
|
||||
context.setOrderBy(PropertyIds.OBJECT_ID + " DESC");
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingResource(managerFile)
|
||||
.usingVersion().getAllDocumentVersionsBy(context).assertHasVersionsInOrder(2.0, 1.1, 1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager cannot get all versions for a folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=InvalidCmisObjectException.class)
|
||||
public void siteManagerCannotGetAllVersionsForFolder() throws Exception
|
||||
{
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(folder).assertThat().existsInRepo()
|
||||
.usingVersion().getAllDocumentVersions();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can get all versions for a valid checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetAllVersionsForCheckedOutDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn().checkIn()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(testFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions("pwc", 1.1, 1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can get all versions for a valid pwc document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetAllVersionsForPWCDocument() throws Exception
|
||||
{
|
||||
OperationContext context = cmisApi.getSession().createOperationContext();
|
||||
context.setOrderBy(PropertyIds.OBJECT_ID + " DESC");
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().prepareDocumentForCheckIn().checkIn()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(testFile).usingPWCDocument()
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.1, 1.0, "pwc")
|
||||
.usingVersion().getAllDocumentVersionsBy(context).assertHasVersionsInOrder("pwc", 1.1, 1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get all versions for a document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanGetAllVersionsForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0, 1.1, 2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get all versions for a document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanGetAllVersionsForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0, 1.1, 2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer can get all versions for a document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCanGetAllVersionsForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0, 1.1, 2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user can get all versions for a document in public site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void nonInvitedUserCannotGetAllVersionsForDocumentFromPublicSite() throws Exception
|
||||
{
|
||||
UserModel nonInvitedUser = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(nonInvitedUser)
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0, 1.1, 2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user cannot get all versions for a document in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetAllVersionsForDocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite).createFile(testFile)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user cannot get all versions for a document in moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetAllVersionsForDocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderated = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(moderated).createFile(testFile)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile)
|
||||
.usingVersion().getAllDocumentVersions().assertHasVersions(1.0);
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.client.api.OperationContext;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetCheckedOutDocumentsTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile).assertThat().existsInRepo()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get checked out documents from a valid folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetCheckedOutDocumentsFromAValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get checked out documents from session")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetCheckedOutDocumentsFromSession() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).assertThat().sessionHasCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager CANNOT get checked out documents from inexistent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void siteManagerCannotGetCheckedOutDocumentsFromInexistentFolder() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
testFolder.setCmisLocation(Utility.buildPath("/", testFolder.getCmisLocation()));
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.and().usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that user is not able to get checked out documents from session created by admin in root")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void userShouldNotGetCheckedOutDocumentFromSessionCreatedByAdminInRoot() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingRoot()
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.then().authenticateUser(testUser)
|
||||
.and().assertThat().sessioDoesNotHaveCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-17357")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get checked out documents created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorShouldGetCheckedOutDocumentsFromFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get checked out documents created by himslef")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorShouldGetCheckedOutDocumentsCreatedByHimself() throws Exception
|
||||
{
|
||||
FileModel collaboratorFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFolder)
|
||||
.createFile(collaboratorFile).checkOut()
|
||||
.usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(collaboratorFile)
|
||||
.assertThat().sessionHasCheckedOutDocument(collaboratorFile);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-17357")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get checked out documents created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorShouldGetCheckedOutDocumentsFromFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get checked out documents created by himslef")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorShouldGetCheckedOutDocumentsCreatedByHimself() throws Exception
|
||||
{
|
||||
FileModel contributorFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFolder)
|
||||
.createFile(contributorFile).checkOut()
|
||||
.usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(contributorFile)
|
||||
.assertThat().sessionHasCheckedOutDocument(contributorFile);
|
||||
}
|
||||
|
||||
@Bug(id="MNT-17357")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get checked out documents created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerShouldGetCheckedOutDocumentsFromFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder)
|
||||
.assertThat().folderHasCheckedOutDocument(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get checked out documents")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserShouldNotGetCheckedOutDocuments() throws Exception
|
||||
{
|
||||
FileModel doc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFolder(folder).usingResource(folder)
|
||||
.createFile(doc).checkOut()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(folder)
|
||||
.assertThat().folderHasCheckedOutDocument(doc);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager user is able to get checked out documents from folder with operation context")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanGetCheckedOutDocumentsFromFolderWithOperationContext() throws Exception
|
||||
{
|
||||
OperationContext context = cmisApi.authenticateUser(testUser).getSession().createOperationContext();
|
||||
context.setOrderBy(PropertyIds.NAME + " DESC");
|
||||
FileModel doc1 = new FileModel("a-file.txt", FileType.TEXT_PLAIN, documentContent);
|
||||
FileModel doc2 = new FileModel("b-file.txt", FileType.TEXT_PLAIN, documentContent);
|
||||
FileModel doc3 = new FileModel("c-file.txt", FileType.TEXT_PLAIN, documentContent);
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFolder(folder).usingResource(folder)
|
||||
.createFile(doc1).checkOut()
|
||||
.createFile(doc2).checkOut()
|
||||
.createFile(doc3)
|
||||
.usingResource(folder)
|
||||
.assertThat().folderHasCheckedOutDocument(context, doc2, doc1);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is able to get checked out documents from session with operation context")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanGetCheckedOutDocumentsFromSessionWithOperationContext() throws Exception
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
OperationContext context = cmisApi.authenticateUser(user).getSession().createOperationContext();
|
||||
context.setOrderBy(PropertyIds.NAME + " DESC");
|
||||
FileModel doc1 = new FileModel("a-file.txt", FileType.TEXT_PLAIN, documentContent);
|
||||
FileModel doc2 = new FileModel("b-file.txt", FileType.TEXT_PLAIN, documentContent);
|
||||
FileModel doc3 = new FileModel("c-file.txt", FileType.TEXT_PLAIN, documentContent);
|
||||
SiteModel publicSite = dataSite.usingUser(user).createPublicRandomSite();
|
||||
cmisApi.authenticateUser(user).usingSite(publicSite)
|
||||
.createFile(doc1).checkOut()
|
||||
.createFile(doc2).checkOut()
|
||||
.createFile(doc3)
|
||||
.then().assertThat().sessionHasCheckedOutDocument(context, doc2, doc1);
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetChildrenTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FileModel secondFile;
|
||||
FolderModel testFolder;
|
||||
FolderModel subFolder;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteCollaborator, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomContent()
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
secondFile = FileModel.getRandomFileModel(FileType.MSEXCEL);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
subFolder = FolderModel.getRandomFolderModel();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY, description = "Get children from valid folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void getChildrenFromValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder)
|
||||
.then().usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.assertThat().hasFiles(testFile, secondFile)
|
||||
.assertThat().hasFolders(subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Fails to get children from folder that was previously deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS} , expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void getChildrenFromDeletedFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder)
|
||||
.then().usingResource(testFolder)
|
||||
.assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.and().usingResource(testFolder).refreshResource().and().deleteFolderTree()
|
||||
.then().usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get children for a folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorCanGetChildrenFromValidFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder)
|
||||
.then().usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.assertThat().hasFiles(testFile, secondFile)
|
||||
.assertThat().hasFolders(subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get children for a folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorCanGetChildrenFromValidFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder);
|
||||
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.assertThat().hasFiles(testFile, secondFile)
|
||||
.assertThat().hasFolders(subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get children for a folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorCanGetChildrenFromValidFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder)
|
||||
.then().usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.assertThat().hasFiles(testFile, secondFile)
|
||||
.assertThat().hasFolders(subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get children for a folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorCanGetChildrenFromValidFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder);
|
||||
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.assertThat().hasFiles(testFile, secondFile)
|
||||
.assertThat().hasFolders(subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer can get children for a folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerCanGetChildrenFromValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder);
|
||||
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder)
|
||||
.assertThat().hasFiles(testFile, secondFile)
|
||||
.assertThat().hasFolders(subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non site member cannot get children for a folder from a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberCannotGetChildrenFromValidFolderFromAPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder);
|
||||
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non site member cannot get children for a folder from a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberCannotGetChildrenFromValidFolderFromAModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(moderatedSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.createFile(testFile)
|
||||
.createFile(secondFile)
|
||||
.createFolder(subFolder);
|
||||
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingResource(testFolder).assertThat().hasChildren(testFile, secondFile, subFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/27/2016.
|
||||
*/
|
||||
public class GetContentStreamTests extends CmisTest
|
||||
{
|
||||
SiteModel publicSite, privateSite;
|
||||
UserModel siteManager;
|
||||
FileModel testFile;
|
||||
String content = "file content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get a document content in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetDocumentContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile)
|
||||
.then().assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get empty document content in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetEmptyDocumentContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile)
|
||||
.then().assertThat().existsInRepo().and().assertThat().contentIs("");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to get content from checked out document with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetContentFromCheckedOutDoc() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().checkOut()
|
||||
.and().assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to get document content with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminShouldGetContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to get content of file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get content of file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorShouldGetContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get content of file created by self in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorShouldGetContentOfFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get content of file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorShouldGetContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get content of file created by self in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorShouldGetContentOfFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to get content of file created by other user in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerShouldGetContentOfFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to get content from checked out document with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetContentOfPWCDoc() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify unauthorized is not able to get content of file created in a private site with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void unauthorizedUserShouldNotGetFileContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to get content of non existent file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisObjectNotFoundException.class)
|
||||
public void userShouldNotGetContentOfNonexistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
testFile.setCmisLocation("/" + testFile.getName() + "/");
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingResource(testFile).assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify user is not able to get content of invalid file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = InvalidCmisObjectException.class, expectedExceptionsMessageRegExp = "^Content at.*is not a file$")
|
||||
public void userShouldNotGetContentOfInvalidFile() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(content);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetDescendantsTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FileModel fileModel;
|
||||
FolderModel testFolder;
|
||||
FolderModel folderModel;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteCollaborator, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomContent()
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
fileModel = FileModel.getRandomFileModel(FileType.MSPOWERPOINT);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
folderModel = FolderModel.getRandomFolderModel();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get descendants for valid parent folder with at least 3 children and depth set to >=1")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void getDescendantsForValidParentFolderWithAtLeast3ChildrenAndDepthGreaterThan1() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder).createFile(testFile)
|
||||
.and().createFile(fileModel)
|
||||
.and().createFolder(folderModel)
|
||||
.then().usingResource(testFolder).assertThat().hasDescendants(1, folderModel, fileModel, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get descendants for valid parent folder with at least 3 children and depth set to -1")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void getDescendantsForValidParentFolderWithAtLeast3ChildrenAndDepthSetToMinus1() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder).createFile(testFile)
|
||||
.then().createFile(fileModel)
|
||||
.and().createFolder(folderModel)
|
||||
.then().usingResource(testFolder).assertThat().hasDescendants(-1, folderModel, fileModel, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager CANNOT get descendants for valid parent folder with at least 2 children and depth set to 0")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisInvalidArgumentException.class})
|
||||
public void getDescendantsForValidParentFolderWithAtLeast2ChildrenAndDepthSetTo0() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().usingResource(testFolder).createFile(testFile)
|
||||
.and().createFolder(folderModel)
|
||||
.then().usingResource(testFolder).assertThat().hasDescendants(0, folderModel, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager CANNOT get descendants for valid parent folder with at least 2 children and depth set to -2")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisInvalidArgumentException.class})
|
||||
public void getDescendantsForValidParentFolderWithAtLeast2ChildrenAndDepthSetToMinus2() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().usingResource(testFolder).createFile(testFile)
|
||||
.and().createFolder(folderModel)
|
||||
.then().usingResource(testFolder).assertThat().hasDescendants(-2, folderModel, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager CANNOT get descendants for parent folder with at least 2 children that was previously deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void getDescendantsForDeletedParentFolderWithAtLeast2Children() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().usingResource(testFolder).createFile(testFile)
|
||||
.and().createFolder(folderModel)
|
||||
.and().usingResource(testFolder).deleteFolderTree()
|
||||
.then().usingResource(testFolder)
|
||||
.assertThat().hasDescendants(1, folderModel, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get descendants for parent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorCanGetDescendantsForValidFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile)
|
||||
.usingResource(testFolder).assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get descendants for parent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorCanGetDescendantsForValidFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFolder)
|
||||
.assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get descendants for parent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorCanGetDescendantsForValidFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile)
|
||||
.usingResource(testFolder).assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get descendants for parent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorCanGetDescendantsForValidFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFolder)
|
||||
.assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer can get descendants for parent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerCanGetDescendantsForValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFolder)
|
||||
.assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non site member cannot get descendants for a folder from a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberCannotGetDescendantsAFolderFromAPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non site member cannot get descendants for a folder from a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberCannotGetDescendantsAFolderFromAModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().hasDescendants(-1, testFile);
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetExtensionTests extends CmisTest
|
||||
{
|
||||
UserModel testUser, nonInvitedUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile, managerFile;
|
||||
FolderModel managerFolder;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private String titledAspect = "P:cm:titled";
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerFile = FileModel.getRandomFileModel(FileType.XML, documentContent);
|
||||
managerFolder = FolderModel.getRandomFolderModel();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
nonInvitedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(managerFile)
|
||||
.createFolder(managerFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Site manager can get extensions from a valid folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanGetExtensionsForValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFolder)
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Site manager can get extensions from a valid file")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanGetExtensionsForValidFile() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site manager cannot get extensions from an invalid document - that was deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void siteManagerCannotGetExtensionsForInvalidDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.then().assertThat().hasAspectExtension(titledAspect)
|
||||
.and().delete()
|
||||
.then().assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site manager can get extensions from checkedout document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanGetExtensionsForCheckedOutDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).checkOut()
|
||||
.then().assertThat().hasAspectExtension(titledAspect)
|
||||
.then().usingPWCDocument()
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site collaborator can get extensions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanGetExtensions() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(managerFolder)
|
||||
.assertThat().hasAspectExtension(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site contributor can get extensions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanGetExtensions() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(managerFolder)
|
||||
.assertThat().hasAspectExtension(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Site consumer can get extensions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCanGetExtensions() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(managerFolder)
|
||||
.assertThat().hasAspectExtension(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Non invited user can get extensions in public site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void nonInvitedUserCanGetExtensionsInPublicSite() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(managerFolder)
|
||||
.assertThat().hasAspectExtension(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Non invited user cannot get extensions in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetExtensionsInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
FileModel privateDoc = FileModel.getRandomFileModel(FileType.HTML, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(privateDoc)
|
||||
.then().authenticateUser(nonInvitedUser).assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Non invited user cannot get extensions in moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetExtensionsInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
FileModel moderatedDoc = FileModel.getRandomFileModel(FileType.HTML, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(moderatedSite)
|
||||
.createFile(moderatedDoc)
|
||||
.then().authenticateUser(nonInvitedUser).assertThat().hasAspectExtension(titledAspect);
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetFolderParentTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FolderModel testFolder;
|
||||
FolderModel parentFolder;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteCollaborator, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomContent()
|
||||
{
|
||||
parentFolder = FolderModel.getRandomFolderModel();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY, description = "Verify folder parent")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyFolderParent() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder).createFolder(FolderModel.getRandomFolderModel())
|
||||
.then().assertThat().folderHasParent(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION, description = "Verify folder parent that was previously deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void verifyFolderParentThatWasDeleted() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(parentFolder).createFolder(testFolder)
|
||||
.then().assertThat().folderHasParent(parentFolder)
|
||||
.and().usingResource(parentFolder).deleteFolderTree()
|
||||
.then().usingResource(testFolder).assertThat().folderHasParent(parentFolder);
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorVerifyFolderParentCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder).createFolder(FolderModel.getRandomFolderModel())
|
||||
.then().assertThat().folderHasParent(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorVerifyFolderParentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(parentFolder).createFolder(testFolder);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFolder)
|
||||
.assertThat().folderHasParent(parentFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorVerifyFolderParentCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder).createFolder(FolderModel.getRandomFolderModel())
|
||||
.then().assertThat().folderHasParent(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorVerifyFolderParentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(parentFolder).createFolder(testFolder);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFolder)
|
||||
.assertThat().folderHasParent(parentFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer can get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerVerifyFolderParent() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(parentFolder).createFolder(testFolder);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFolder)
|
||||
.assertThat().folderHasParent(parentFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non site member for a private site is not able to get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberGetFolderParentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite).createFolder(parentFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(parentFolder).createFolder(testFolder);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().folderHasParent(parentFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non site member for a moderated site is not able to get folder parent")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberGetFolderParentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite).createFolder(parentFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(parentFolder).createFolder(testFolder);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().folderHasParent(parentFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetFolderTreeTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FolderModel testFolder;
|
||||
FolderModel folderModel1;
|
||||
FolderModel folderModel11;
|
||||
FolderModel folderModel12;
|
||||
FolderModel folderModel2;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteCollaborator, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomContent()
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
folderModel1 = FolderModel.getRandomFolderModel();
|
||||
folderModel11 = FolderModel.getRandomFolderModel();
|
||||
folderModel12 = FolderModel.getRandomFolderModel();
|
||||
folderModel2 = FolderModel.getRandomFolderModel();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get folder tree for valid parent folder with at least 2 children" +
|
||||
" folders and depth set to 1")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void getFolderTreeForValidParentFolderWithAtLeast2ChildrenFoldersAndDepthGreaterThan1() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.and().createFolder(folderModel1)
|
||||
.and().createFolder(folderModel2)
|
||||
.then().usingResource(testFolder).assertThat().hasFolderTree(1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get folder tree for valid parent folder with at least 2 children" +
|
||||
" folders and depth set to -1")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void getFolderTreeForValidParentFolderWithAtLeast2ChildrenFoldersAndDepthSetToMinus1() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.and().createFolder(folderModel1)
|
||||
.and().usingResource(folderModel1).createFolder(folderModel2)
|
||||
.then().usingResource(testFolder).assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can NOT get folder tree for valid parent folder with at least 2 children" +
|
||||
" folders and depth set to 0")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisInvalidArgumentException.class})
|
||||
public void getFolderTreeForValidParentFolderWithAtLeast2ChildrenFoldersAndDepthSetTo0() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.and().createFolder(folderModel11)
|
||||
.and().createFolder(folderModel12)
|
||||
.and().usingResource(folderModel11).createFolder(folderModel2)
|
||||
.then().usingResource(testFolder)
|
||||
.assertThat().hasFolderTree(0, folderModel11);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can NOT get folder tree for valid parent folder with at least 2 children" +
|
||||
" folders and depth set to -2")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisInvalidArgumentException.class})
|
||||
public void getFolderTreeForValidParentFolderWithAtLeast2ChildrenFoldersAndDepthSetToMinus2() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.and().createFolder(folderModel11)
|
||||
.and().createFolder(folderModel12)
|
||||
.and().usingResource(folderModel11).createFolder(folderModel2)
|
||||
.then().usingResource(testFolder)
|
||||
.assertThat().hasFolderTree(-2, folderModel11);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can NOT get folder tree for parent folder with children" +
|
||||
" that was previously deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void getFolderTreeForDeletedParentFolderWithChildren() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().usingResource(testFolder)
|
||||
.and().createFolder(folderModel11)
|
||||
.and().createFolder(folderModel12)
|
||||
.and().usingResource(folderModel11).createFolder(folderModel2)
|
||||
.and().usingResource(testFolder).deleteFolderTree()
|
||||
.then().usingResource(testFolder)
|
||||
.assertThat().hasFolderTree(1, folderModel11);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorCanGetFolderTreeForValidParentFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2)
|
||||
.usingResource(testFolder).assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorCanGetFolderTreeForValidParentFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFolder).assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorCanGetFolderTreeForValidParentFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2)
|
||||
.usingResource(testFolder).assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorCanGetFolderTreeForValidParentFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder).assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer can get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerCanGetFolderTreeForValidParentFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFolder).assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non site member of a private site cannot get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberCannotGetFolderTreeForAFolderFromAPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non site member of a moderated site cannot get folder tree for valid parent folder with at least 2 children folders")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={ CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void nonSiteMemberCannotGetFolderTreeForAFolderFromAModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite)
|
||||
.createFolder(testFolder)
|
||||
.usingResource(testFolder).createFolder(folderModel1).and().createFolder(folderModel2);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().hasFolderTree(-1, folderModel1, folderModel2);
|
||||
}
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetObjectOfLatestVersionTests extends CmisTest
|
||||
{
|
||||
UserModel testUser, nonInvitedUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile, managerFile;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerFile = FileModel.getRandomFileModel(FileType.HTML, documentContent);
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
nonInvitedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(managerFile).assertThat().existsInRepo()
|
||||
.then().checkOut()
|
||||
.and().prepareDocumentForCheckIn().withMajorVersion().checkIn()
|
||||
.then().checkOut()
|
||||
.and().prepareDocumentForCheckIn().withMinorVersion().checkIn();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get last major version for document checked in with minor version")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetLastMajorVersionForDocumentCheckedInWithMajorVersion() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get last minor version for document checked in with major version")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldGetLastMinorVersionForDocumentCheckedInWithMajorVersion() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.usingVersion().assertLatestMinorVersionIs(2.1);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to get last major version for document that was already deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void siteManagerCannotGetLastMajorVersionForInexistentDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().prepareDocumentForCheckIn().withMajorVersion().checkIn()
|
||||
.then().usingVersion().assertLatestMajorVersionIs(2.0)
|
||||
.and().delete()
|
||||
.then().usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to get last major version for document that was checked out")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanGetLastMajorVersionForCheckedOutDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().checkOut()
|
||||
.and().prepareDocumentForCheckIn().withMajorVersion().checkIn()
|
||||
.usingVersion().assertLatestMajorVersionIs(2.0)
|
||||
.checkOut()
|
||||
.then().usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to get last minor version for document created with minor VersioningState")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanGetLastMinorVersionForDocumentWithMinorVersioningState() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.MINOR).and().assertThat().existsInRepo()
|
||||
.then().usingVersion().assertLatestMinorVersionIs(0.1);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to get last major version for document created with minor VersioningState")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class,
|
||||
expectedExceptionsMessageRegExp="There is no major version!*")
|
||||
public void siteManagerCannotGetLastMajorVersionForDocumentWithMinorVersioningState() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.MINOR).and().assertThat().existsInRepo()
|
||||
.then().usingVersion().assertLatestMajorVersionIs(0.1);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to get last minor version for document created with checked out VersioningState")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanGetLastVersionForDocumentWithCheckedOutVersioningState() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT).and().assertThat().existsInRepo()
|
||||
.then().usingVersion().assertLatestMinorVersionIs(1.0)
|
||||
.usingVersion().assertLatestMajorVersionIs(1.0)
|
||||
.then().usingPWCDocument()
|
||||
.usingVersion().assertLatestMajorVersionIs(1.0)
|
||||
.usingVersion().assertLatestMinorVersionIs(1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get last versions for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanGetLastVersionsForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().assertLatestMinorVersionIs(2.1)
|
||||
.usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get last versions for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanGetLastVersionsForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().assertLatestMinorVersionIs(2.1)
|
||||
.usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to get last versions for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCanGetLastVersionsForDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().assertLatestMinorVersionIs(2.1)
|
||||
.usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is able to get last versions for document created in public site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void nonInvitedUserCanGetLastVersionsForDocumentInPublicSite() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(nonInvitedUser)
|
||||
.usingResource(managerFile)
|
||||
.usingVersion().assertLatestMinorVersionIs(2.1)
|
||||
.usingVersion().assertLatestMajorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get last versions for document from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetLastVersionsForDocumentCreatedByManagerInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.createPrivateRandomSite();
|
||||
FileModel privateDoc = FileModel.getRandomFileModel(FileType.XML, documentContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingSite(privateSite)
|
||||
.createFile(privateDoc)
|
||||
.then().checkOut()
|
||||
.and().prepareDocumentForCheckIn().withMajorVersion().checkIn()
|
||||
.authenticateUser(nonInvitedUser).usingVersion().assertLatestMinorVersionIs(2.0);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get last versions for document from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotGetLastVersionsForDocumentCreatedByManagerInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.createModeratedRandomSite();
|
||||
FileModel moderatedDoc = FileModel.getRandomFileModel(FileType.XML, documentContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingSite(moderatedSite)
|
||||
.createFile(moderatedDoc)
|
||||
.then().checkOut()
|
||||
.and().prepareDocumentForCheckIn().withMajorVersion().checkIn()
|
||||
.authenticateUser(nonInvitedUser).usingVersion().assertLatestMinorVersionIs(2.0);
|
||||
}
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetObjectTypeTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel testSite;
|
||||
FolderModel testFolder;
|
||||
FileModel testFile;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteCollaborator, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify CMIS folder type")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyCmisFolderType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.usingResource(testFolder)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify CMIS document type")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyCmisDocumentType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite)
|
||||
.usingResource(testFile)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify CMIS folder type of folder that was deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void verifyCmisFolderTypeOfDeletedFolder() throws Exception
|
||||
{
|
||||
FolderModel folderModel = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFolder(folderModel)
|
||||
.usingResource(folderModel).delete()
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify CMIS document type of file that was deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void verifyCmisDocumentTypeOfDeletedDocument() throws Exception
|
||||
{
|
||||
FileModel fileModel = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingSite(testSite).createFile(fileModel)
|
||||
.usingResource(fileModel).delete()
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Site contributor verifies CMIS document type")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorVerifiesCmisDocumentType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFile)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Site contributor verifies CMIS folder type")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorVerifiesCmisFolderType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFolder)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Site collaborator verifies CMIS document type")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorVerifiesCmisDocumentType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFile)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Site collaborator verifies CMIS folder type")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorVerifiesCmisFolderType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFolder)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Site consumer verifies CMIS document type")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerVerifiesCmisDocumentType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFile)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Site consumer verifies CMIS folder type")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerVerifiesCmisFolderType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFolder)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Non site member is not able to verify CMIS document type for a document from a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotVerifyCmisObjectTypeForADocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
FileModel privateSiteFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite).createFile(privateSiteFile);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingResource(privateSiteFile)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Non site member is not able to verify CMIS document type for a folder from a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotVerifyCmisFolderTypeForAFolderFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
FolderModel privateSiteFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite).createFolder(privateSiteFolder);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingResource(privateSiteFolder)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Non site member is not able to verify CMIS document type for a document from a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotVerifyCmisObjectTypeForADocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
FileModel moderatedSiteFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite).createFile(moderatedSiteFile);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingResource(moderatedSiteFile)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_DOCUMENT.value());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Non site member is not able to verify CMIS document type for a folder from a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotVerifyCmisObjectTypeForAFolderFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
FolderModel moderatedSiteFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite).createFolder(moderatedSiteFolder);
|
||||
|
||||
cmisApi.authenticateUser(siteManager).usingResource(moderatedSiteFolder)
|
||||
.assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 10/5/2016.
|
||||
*/
|
||||
public class GetParentsTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FolderModel testFolder, parentFolder;
|
||||
FileModel testFile;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteCollaborator, UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomContent()
|
||||
{
|
||||
parentFolder = FolderModel.getRandomFolderModel();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.MSWORD);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerGetsFileParents() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFile(testFile).and().assertThat().existsInRepo()
|
||||
.addDocumentToFolder(testFolder, true).and().assertThat().existsInRepo()
|
||||
.then().assertThat().hasParents(testFolder.getName(), parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerGetsFolderParents() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to get parents for an inexistent folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void siteManagerCannotGetInexistentFolderParents() throws Exception
|
||||
{
|
||||
FolderModel inexistentFolder = FolderModel.getRandomFolderModel();
|
||||
inexistentFolder.setCmisLocation("/" + inexistentFolder.getName() + "/");
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.and().usingResource(inexistentFolder).assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorGetsFolderParentsCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorGetsFileParentsCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFile(testFile).and().assertThat().existsInRepo()
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorGetsFolderParentsCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFolder)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorGetsFileParentsCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(testFolder).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFile)
|
||||
.assertThat().hasParents(testFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorGetsFolderParentsCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorGetsFileParentsCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFile(testFile).and().assertThat().existsInRepo()
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorGetsFolderParentsCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFolder)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorGetsFileParentsCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(testFolder).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFile)
|
||||
.assertThat().hasParents(testFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerGetsFolderParents() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFolder)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteConsumerGetsFileParents() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(testFolder).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFile)
|
||||
.assertThat().hasParents(testFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non site member for a private site is not able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberGetsFolderParentsFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non site member for a private site is not able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberGetsFileParentsFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFile)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non site member for a moderated site is not able to get folder parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberGetsFolderParentsFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non site member for a moderated site is not able to get file parents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberGetsFileParentsFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite)
|
||||
.createFolder(parentFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(parentFolder).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFile)
|
||||
.assertThat().hasParents(parentFolder.getName());
|
||||
}
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetPropertiesTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSite, UserRole.SiteManager, UserRole.SiteCollaborator,
|
||||
UserRole.SiteContributor, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void generateRandomContent()
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify secondaryObjectTypeIds property for valid document")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifySecondaryObjectTypeIdsPropertyForValidDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify secondaryObjectTypeIds property for valid folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifySecondaryObjectTypeIdsPropertyForValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property for inexistent folder (that was previously deleted)")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
public void verifySecondaryObjectTypeIdsPropertyForInexistentFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized")
|
||||
.and().usingResource(testFolder).deleteFolderTree()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property for valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void managerVerifiesSecondaryObjectTypeIdsPropertyForValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(testSite).usingResource(testFolder)
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site collaborator for valid document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorVerifiesSecondaryObjectTypeIdsPropertyForValidDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site collaborator for valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorVerifiesSecondaryObjectTypeIdsPropertyForValidFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site collaborator for valid document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorVerifiesSecondaryObjectTypeIdsPropertyForValidDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFile)
|
||||
.assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site collaborator for valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorVerifiesSecondaryObjectTypeIdsPropertyForValidFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(testFolder)
|
||||
.assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site contributor for valid document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorVerifiesSecondaryObjectTypeIdsPropertyForValidDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site contributor for valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorVerifiesSecondaryObjectTypeIdsPropertyForValidFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site contributor for valid document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorVerifiesSecondaryObjectTypeIdsPropertyForValidDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFile)
|
||||
.assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site contributor for valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorVerifiesSecondaryObjectTypeIdsPropertyForValidFolderCreatedByManager() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(testFolder)
|
||||
.assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site consumer for valid document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerVerifiesSecondaryObjectTypeIdsPropertyForValidDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFile)
|
||||
.assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify secondaryObjectTypeIds property as site consumer for valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerVerifiesSecondaryObjectTypeIdsPropertyForValidFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(testFolder)
|
||||
.assertThat().objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non site member cannot get secondaryObjectTypeIds property for a valid document from a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotGetSecondaryObjectTypeIdsForAValidDocumentFromAPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFile).assertThat()
|
||||
.objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non site member cannot get secondaryObjectTypeIds property for a valid folder from a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotGetSecondaryObjectTypeIdsForAValidFolderFromAPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder).assertThat()
|
||||
.objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non site member cannot get secondaryObjectTypeIds property for a valid document from a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotGetSecondaryObjectTypeIdsForAValidDocumentFromAModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFile).assertThat()
|
||||
.objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that non site member cannot get secondaryObjectTypeIds property for a valid folder from a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonSiteMemberCannotGetSecondaryObjectTypeIdsForAValidFolderFromAModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(moderatedSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingResource(testFolder).assertThat()
|
||||
.objectHasProperty("cmis:secondaryObjectTypeIds", "Secondary Object Type Ids",
|
||||
"secondaryObjectTypeIds", "cmis:secondaryObjectTypeIds", "P:cm:titled", "P:sys:localized");
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
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.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 10/6/2016.
|
||||
*/
|
||||
public class GetTypeChildrenTests extends CmisTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setup() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type children for a valid type id and includePropertyDefinitions set to false
|
||||
* (verify that Map<String, PropertyDefinition<?>> is empty)
|
||||
*/
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin can get type children for BaseTypeId.CMIS_DOCUMENT and includePropertyDefinitions = false")
|
||||
@Test(groups = { TestGroup.CMIS, TestGroup.SANITY })
|
||||
public void getTypeChildrenWithoutPropertyDefinitions()
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser())
|
||||
.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions()
|
||||
.hasChildren("D:srft:facetField").propertyDefinitionIsEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type children for a valid type id and includePropertyDefinitions set to true
|
||||
* (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin can get type children for valid type id and includePropertyDefinitions = true")
|
||||
@Test(groups = { TestGroup.CMIS, TestGroup.SANITY })
|
||||
public void getTypeChildrenWithPropertyDefinitions()
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingObjectType(BaseTypeId.CMIS_FOLDER.value())
|
||||
.withPropertyDefinitions()
|
||||
.hasChildren("F:pub:DeliveryChannel").propertyDefinitionIsNotEmpty();
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_FOLDER.value()).withPropertyDefinitions()
|
||||
.doesNotHaveChildren("D:srft:facetField");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get invalid type children for a valid type id and includePropertyDefinitions set to true
|
||||
* (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get invalid type children for valid type id")
|
||||
@Test(groups = { TestGroup.CMIS, TestGroup.REGRESSION })
|
||||
public void getInvalidTypeChildrenForATypeId()
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingObjectType(BaseTypeId.CMIS_FOLDER.value())
|
||||
.withPropertyDefinitions()
|
||||
.doesNotHaveChildren("F:pub:invalidDeliveryChannelv");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get valid type children for a invalid type id and includePropertyDefinitions set to true
|
||||
* (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get valid type children for invalid type id")
|
||||
@Test(groups = { TestGroup.CMIS, TestGroup.REGRESSION }, expectedExceptions = {CmisObjectNotFoundException.class},
|
||||
expectedExceptionsMessageRegExp="Type 'cmis:invalidfolder' is unknown!*")
|
||||
public void getValidTypeChildrenForInvalidTypeId()
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingObjectType("cmis:invalidfolder")
|
||||
.withPropertyDefinitions()
|
||||
.hasChildren("F:pub:DeliveryChannel").propertyDefinitionIsNotEmpty();;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleted user is not authorized to get type children for a valid type id
|
||||
* (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
* @throws DataPreparationException
|
||||
*/
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleted user is not authorized to get type children for valid type id")
|
||||
@Test(groups = { TestGroup.CMIS, TestGroup.REGRESSION }, expectedExceptions = {CmisUnauthorizedException.class})
|
||||
public void getTypeChildrenWithWithDeletedUser() throws DataPreparationException
|
||||
{
|
||||
UserModel deletedUser = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(deletedUser)
|
||||
.usingObjectType(BaseTypeId.CMIS_FOLDER.value())
|
||||
.withPropertyDefinitions()
|
||||
.hasChildren("F:pub:DeliveryChannel").propertyDefinitionIsNotEmpty();
|
||||
dataUser.deleteUser(deletedUser);
|
||||
cmisApi.disconnect()
|
||||
.usingObjectType(BaseTypeId.CMIS_FOLDER.value()).withPropertyDefinitions().doesNotHaveChildren("D:srft:facetField");
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify disabled user is not authorized to get type children for valid type id")
|
||||
@Test(groups = { TestGroup.CMIS, TestGroup.REGRESSION }, expectedExceptions = {CmisUnauthorizedException.class})
|
||||
public void getTypeChildrenWithWithDisabledUser() throws DataPreparationException
|
||||
{
|
||||
UserModel disabledUser = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(disabledUser)
|
||||
.usingObjectType(BaseTypeId.CMIS_FOLDER.value())
|
||||
.withPropertyDefinitions()
|
||||
.hasChildren("F:pub:DeliveryChannel").propertyDefinitionIsNotEmpty();
|
||||
dataUser.usingAdmin().disableUser(disabledUser);
|
||||
cmisApi.disconnect()
|
||||
.usingObjectType(BaseTypeId.CMIS_FOLDER.value()).withPropertyDefinitions().doesNotHaveChildren("D:srft:facetField");
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetTypeDefinitionTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel publicSite, privateSite, moderatedSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
|
||||
DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
moderatedSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
cmisApi.authenticateUser(testUser);
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteContributor,
|
||||
UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS })
|
||||
public void siteManagerShouldGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(publicSite).createFolder(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat()
|
||||
.typeDefinitionIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can get Type Definition for a valid document")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS })
|
||||
public void siteManagerShouldGetTypeDefinitionForValidDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(publicSite).createFile(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat()
|
||||
.typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager cannot get Type Definition for a deleted document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisObjectNotFoundException.class })
|
||||
public void siteManagerShouldGetTypeDefinitionForDeletedDocument() throws Exception
|
||||
{
|
||||
FileModel deletedFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(publicSite).createFile(deletedFile)
|
||||
.and().usingResource(deletedFile).delete()
|
||||
.then().assertThat()
|
||||
.typeDefinitionIs(deletedFile);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user that was deleted cannot get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisUnauthorizedException.class })
|
||||
public void deletedUserCannotGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
UserModel deletedUser = dataUser.createRandomTestUser();
|
||||
|
||||
dataUser.usingUser(testUser).addUserToSite(deletedUser, publicSite, UserRole.SiteManager);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(publicSite).createFolder(testFolder);
|
||||
cmisApi.authenticateUser(deletedUser).usingSite(publicSite).usingResource(testFolder)
|
||||
.then().assertThat()
|
||||
.typeDefinitionIs(testFolder);
|
||||
|
||||
dataUser.deleteUser(deletedUser);
|
||||
cmisApi.disconnect().assertThat().baseTypeIdIs(BaseTypeId.CMIS_FOLDER.value());
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user that was deleted can NOT get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteManagerGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(publicSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Contributor is able to get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(publicSite).createFolder(testFolder).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder).assertThat().typeDefinitionIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Collaborator is able to get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Consumer is NOT able to get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void siteConsumerCantGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingSite(publicSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Manager is able to get Type Definition for a valid file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteManagerGetTypeDefinitionForValidFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.PDF);
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(publicSite).createFile(testFile).and().assertThat().existsInRepo();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).assertThat().typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Contributor is able to get Type Definition for a valid file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteContributorGetTypeDefinitionForValidFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite).createFile(testFile)
|
||||
.usingResource(testFile).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Collaborator is able to get Type Definition for a valid file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteCollaboratorGetTypeDefinitionForValidFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.XML);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite).createFile(testFile)
|
||||
.usingResource(testFile).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site Consumer is NOT able to get Type Definition for a valid file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class, CmisUnauthorizedException.class })
|
||||
public void siteConsumerCantGetTypeDefinitionForValidFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.UNDEFINED);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingSite(publicSite).createFile(testFile)
|
||||
.usingResource(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user outside private site cannot get Type Definition for a valid file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class })
|
||||
public void outsideUserPrivateSiteCantGetTypeDefinitionForValidFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.XML);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(privateSite).createFile(testFile)
|
||||
.usingResource(testFile).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user outside moderated site cannot get Type Definition for a valid file")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class})
|
||||
public void outsideUserModeratedSiteGetTypeDefinitionForValidFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.XML);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(moderatedSite).createFile(testFile)
|
||||
.usingResource(testFile)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFile);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user outside private site cannot get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class })
|
||||
public void outsideUserPrivateSiteCantGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.XML);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(privateSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile)
|
||||
.usingResource(testFolder).and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFolder);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user outside moderated site cannot get Type Definition for a valid folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = { CmisPermissionDeniedException.class})
|
||||
public void outsideUserModeratedSiteGetTypeDefinitionForValidFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.XML);
|
||||
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(moderatedSite).createFolder(testFolder)
|
||||
.usingResource(testFolder).createFile(testFile)
|
||||
.usingResource(testFolder)
|
||||
.and().assertThat().existsInRepo()
|
||||
.then().assertThat().typeDefinitionIs(testFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
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.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetTypeDescendantsTests extends CmisTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setup() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type descendants for a valid type id and includePropertyDefinitions set to true
|
||||
* and depth set to -1 (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION })
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get type descendantes for valid type id and includePropertyDefinitions = true and depth = -1")
|
||||
public void adminShouldGetTypeDescendantsValidInputCase1()
|
||||
{
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withPropertyDefinitions().hasDescendantType(-1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type descendants for a valid type id and includePropertyDefinitions set to true
|
||||
* and depth set to 1 (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION })
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get type descendantes for valid type id and includePropertyDefinitions = true and depth = 1")
|
||||
public void adminShouldGetTypeDescendantsValidInputCase2()
|
||||
{
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type descendants for a valid type id and includePropertyDefinitions set to false
|
||||
* and depth set to 1 (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION })
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get type descendants for valid type id and includePropertyDefinitions = false and depth = 1")
|
||||
public void adminShouldGetTypeDescendantsValidInputCase3()
|
||||
{
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type descendantes for a valid type id and includePropertyDefinitions set to false
|
||||
* and depth set to -1 (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION })
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get type descendantes for valid type id and includePropertyDefinitions = false and depth = -1")
|
||||
public void adminShouldGetTypeDescendantsValidInputCase4()
|
||||
{
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(-1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type descendantes for an invalid type id and includePropertyDefinitions set to false
|
||||
* and depth set to -1 (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION }, expectedExceptions = {CmisObjectNotFoundException.class},
|
||||
expectedExceptionsMessageRegExp="Type 'cmis:documentfake' is unknown!*")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin cannot get type descendantes for invalid type id and includePropertyDefinitions = false and depth = -1")
|
||||
public void adminCannotGetTypeDescendantsForInvalidType()
|
||||
{
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value() +"fake")
|
||||
.withoutPropertyDefinitions().hasDescendantType(-1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type descendantes for a valid type id and includePropertyDefinitions set to false
|
||||
* and incorrect depth set to -2 (verify that Map<String, PropertyDefinition<?>> is not empty)
|
||||
*/
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION }, expectedExceptions = {CmisInvalidArgumentException.class})
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get type descendantes for valid type id and includePropertyDefinitions = false and incorrect depth = -2")
|
||||
public void adminShouldGetTypeDescendantsValidTypeWithIncorrectDepth()
|
||||
{
|
||||
cmisApi.usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(-2, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.SANITY })
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify random user can get type descendantes for valid type id and includePropertyDefinitions = false and depth = 1")
|
||||
public void userGetTypeDescendants() throws Exception
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(user).usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION }, expectedExceptions=CmisUnauthorizedException.class)
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleted user cannot get type descendantes for valid type id and includePropertyDefinitions = false and depth = 1")
|
||||
public void deletedUserCannotGetTypeDescendants() throws Exception
|
||||
{
|
||||
UserModel deletedUser = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(deletedUser).usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
dataUser.usingAdmin().deleteUser(deletedUser);
|
||||
cmisApi.disconnect().usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@Test(groups = { TestGroup.CMIS , TestGroup.REGRESSION }, expectedExceptions=CmisUnauthorizedException.class)
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify disabled user cannot get type descendantes for valid type id and includePropertyDefinitions = false and depth = 1")
|
||||
public void disabledUserCannotGetTypeDescendants() throws Exception
|
||||
{
|
||||
UserModel disabledUser = dataUser.createRandomTestUser();
|
||||
cmisApi.authenticateUser(disabledUser).usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
dataUser.usingAdmin().disableUser(disabledUser);
|
||||
cmisApi.disconnect().usingObjectType(BaseTypeId.CMIS_DOCUMENT.value())
|
||||
.withoutPropertyDefinitions().hasDescendantType(1, "D:cm:dictionaryModel", "D:trx:transferLock");
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.report.Bug.Status;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class IsLatestMajorVersionTests extends CmisTest
|
||||
{
|
||||
UserModel managerUser, nonInviteUser;
|
||||
SiteModel testSite;
|
||||
FileModel minorVersionDoc, majorVersionDoc;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
minorVersionDoc = FileModel.getRandomFileModel(FileType.XML, documentContent);
|
||||
majorVersionDoc = FileModel.getRandomFileModel(FileType.XML, documentContent);
|
||||
managerUser = dataUser.createRandomTestUser();
|
||||
nonInviteUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(managerUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(managerUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(minorVersionDoc, VersioningState.MINOR)
|
||||
.createFile(majorVersionDoc, VersioningState.MAJOR);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify is latest major version for document created with VersioningState set to major")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void verifyIsLatestMajorVersionForMajorState() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(managerUser).usingResource(majorVersionDoc)
|
||||
.and().assertThat().isLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify latest major version for folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions=InvalidCmisObjectException.class)
|
||||
public void verifyIsLatestMajorVersionOnFolders() throws Exception
|
||||
{
|
||||
FolderModel folderModel = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFolder(folderModel)
|
||||
.and().assertThat().isLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify is latest major version for document created with VersioningState set to minor")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyIsLatestMajorVersionForMinorState() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(managerUser).usingResource(minorVersionDoc)
|
||||
.and().assertThat().isNotLatestMajorVersion();
|
||||
}
|
||||
|
||||
@Bug(id = "MNT-17961", status = Status.FIXED)
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that major version doesn't change for document created with VersioningState set to none")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void verifyMajorVersionNotChangedForNoneState() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.NONE).and().assertThat().existsInRepo()
|
||||
.and().assertThat().isLatestMajorVersion()
|
||||
.and().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.and().prepareDocumentForCheckIn()
|
||||
.withMinorVersion()
|
||||
.checkIn().refreshResource()
|
||||
.and().assertThat().documentIsNotCheckedOut()
|
||||
.then().assertThat().documentHasVersion(1.0);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify is latest major version for document created with VersioningState set to checkedout")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyIsLatestMajorVersionForCheckedOutState() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile, VersioningState.CHECKEDOUT)
|
||||
.usingPWCDocument()
|
||||
.assertThat().existsInRepo()
|
||||
.and().assertThat().isNotLatestMajorVersion()
|
||||
.and().assertThat().documentIsCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify latest major version fails for document that was deleted")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void verifyIsLatestMajorVersionFailsOnDeletedDocument() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile)
|
||||
.and().assertThat().isLatestMajorVersion()
|
||||
.and().delete()
|
||||
.then().assertThat().isLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can verify is latest major version for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanVerifyIsLatestMajorVersion() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(majorVersionDoc)
|
||||
.usingResource(majorVersionDoc)
|
||||
.and().assertThat().isLatestMajorVersion()
|
||||
.then().usingResource(minorVersionDoc).assertThat().isNotLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can verify is latest major version for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanVerifyIsLatestMajorVersion() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(majorVersionDoc)
|
||||
.usingResource(majorVersionDoc)
|
||||
.and().assertThat().isLatestMajorVersion()
|
||||
.then().usingResource(minorVersionDoc).assertThat().isNotLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer can verify is latest major version for document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCanVerifyIsLatestMajorVersion() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(majorVersionDoc)
|
||||
.usingResource(majorVersionDoc)
|
||||
.and().assertThat().isLatestMajorVersion()
|
||||
.then().usingResource(minorVersionDoc).assertThat().isNotLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user can verify is latest major version for document in public site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void nonInvitedUserCanVerifyIsLatestMajorVersionInPublicSite() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(nonInviteUser).usingResource(majorVersionDoc)
|
||||
.usingResource(majorVersionDoc)
|
||||
.and().assertThat().isLatestMajorVersion()
|
||||
.then().usingResource(minorVersionDoc).assertThat().isNotLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user can verify is latest major version for document in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotVerifyIsLatestMajorVersionInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
FileModel privateDoc = FileModel.getRandomFileModel(FileType.HTML, documentContent);
|
||||
cmisApi.authenticateUser(managerUser)
|
||||
.usingSite(privateSite).createFile(privateDoc)
|
||||
.then().authenticateUser(nonInviteUser).usingResource(privateDoc)
|
||||
.and().assertThat().isLatestMajorVersion();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user can verify is latest major version for document in moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotVerifyIsLatestMajorVersionInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
FileModel moderatedDoc = FileModel.getRandomFileModel(FileType.HTML, documentContent);
|
||||
cmisApi.authenticateUser(managerUser)
|
||||
.usingSite(moderatedSite).createFile(moderatedDoc)
|
||||
.then().authenticateUser(nonInviteUser).usingResource(moderatedDoc)
|
||||
.and().assertThat().isLatestMajorVersion();
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class IsPrivateWorkingCopyTests extends CmisTest
|
||||
{
|
||||
SiteModel testSite;
|
||||
UserModel managerUser, nonInvitedUser;
|
||||
FileModel checkedOutDoc, simpleDoc;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
checkedOutDoc = FileModel.getRandomFileModel(FileType.XML, documentContent);
|
||||
simpleDoc = FileModel.getRandomFileModel(FileType.HTML, documentContent);
|
||||
managerUser = dataUser.createRandomTestUser();
|
||||
nonInvitedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(managerUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(managerUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(checkedOutDoc).and().checkOut()
|
||||
.createFile(simpleDoc);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to verify if checked out document is private working copy")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanVerifyIsPrivateWorkingCopy() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(managerUser).usingResource(checkedOutDoc)
|
||||
.assertThat().isPrivateWorkingCopy()
|
||||
.then().usingResource(simpleDoc).assertThat().isNotPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to verify if pwc document is private working copy")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanVerifyIsPrivateWorkingCopyOnPwc() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(managerUser).usingResource(checkedOutDoc)
|
||||
.usingPWCDocument()
|
||||
.assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to verify if deleted document is private working copy")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotVerifyIsPrivateWorkingCopyOnDeletedDoc() throws Exception
|
||||
{
|
||||
FileModel deletedDoc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(deletedDoc)
|
||||
.then().delete().and().assertThat().doesNotExistInRepo()
|
||||
.assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to verify if checked out document is private working copy")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanVerifyIsPrivateWorkingCopy() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(checkedOutDoc)
|
||||
.assertThat().isPrivateWorkingCopy()
|
||||
.then().usingResource(simpleDoc).assertThat().isNotPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to verify if checked out document is private working copy")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanVerifyIsPrivateWorkingCopy() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(checkedOutDoc)
|
||||
.assertThat().isPrivateWorkingCopy()
|
||||
.then().usingResource(simpleDoc).assertThat().isNotPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to verify if checked out document is private working copy")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void consumerCanVerifyIsPrivateWorkingCopy() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(checkedOutDoc)
|
||||
.assertThat().isPrivateWorkingCopy()
|
||||
.then().usingResource(simpleDoc).assertThat().isNotPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is able to verify if checked out document is private working copy in public site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void nonInvitedUserCanVerifyIsPrivateWorkingCopyInPublicSite() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(checkedOutDoc)
|
||||
.assertThat().isPrivateWorkingCopy()
|
||||
.then().usingResource(simpleDoc).assertThat().isNotPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to verify if checked out document is private working copy in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotVerifyIsPrivateWorkingCopyInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
FileModel privateFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(privateSite)
|
||||
.createFile(privateFile)
|
||||
.then().authenticateUser(nonInvitedUser)
|
||||
.assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to verify if checked out document is private working copy in moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotVerifyIsPrivateWorkingCopyInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
FileModel moderatedFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(moderatedSite)
|
||||
.createFile(moderatedFile)
|
||||
.then().authenticateUser(nonInvitedUser)
|
||||
.assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to verify if document created with CHECKEDOUT versioning state is private working copy")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void verifyIsPrivateWorkingCopyForDocumentWithCheckedOutVersioningState() throws Exception
|
||||
{
|
||||
FileModel checkedDoc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(checkedDoc, VersioningState.CHECKEDOUT).refreshResource()
|
||||
.assertThat().isPrivateWorkingCopy();
|
||||
}
|
||||
}
|
||||
@@ -1,357 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/28/2016.
|
||||
*/
|
||||
public class MoveTests extends CmisTest
|
||||
{
|
||||
UserModel unauthorizedUser;
|
||||
UserModel siteManager;
|
||||
UserModel contributorUser;
|
||||
UserModel collaboratorUser;
|
||||
UserModel consumerUser;
|
||||
SiteModel publicSite;
|
||||
FileModel sourceFile;
|
||||
FolderModel targetFolder, sourceFolder;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
contributorUser = dataUser.createRandomTestUser();
|
||||
collaboratorUser = dataUser.createRandomTestUser();
|
||||
consumerUser = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
|
||||
dataUser.addUserToSite(consumerUser, publicSite, UserRole.SiteConsumer);
|
||||
dataUser.addUserToSite(collaboratorUser, publicSite, UserRole.SiteCollaborator);
|
||||
dataUser.addUserToSite(contributorUser, publicSite, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to move a file to an existent location in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerMovesFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().moveTo(targetFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(sourceFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to move file to a nonexistent location in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerMovesFileToNonExistentTarget() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.createFolder(targetFolder).and().delete()
|
||||
.then().moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to move a nonexistent file in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerMovesNonExistentSourceFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().delete()
|
||||
.then().moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to move file that has multiple versions with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldMoveFileWithMultipleVersions() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().update("first content")
|
||||
.assertThat().documentHasVersion(1.1)
|
||||
.update("second content")
|
||||
.assertThat().documentHasVersion(1.2)
|
||||
.then().moveTo(targetFolder).and().assertThat().existsInRepo()
|
||||
.and().usingVersion().assertHasVersions(1.0, 1.1, 1.2)
|
||||
.usingResource(sourceFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to move folder structure to an existent location in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerMovesFolderStructure() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
FolderModel sourceParentFolder = FolderModel.getRandomFolderModel();
|
||||
FolderModel subFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFolder(sourceParentFolder).and().assertThat().existsInRepo()
|
||||
.then().usingResource(sourceParentFolder)
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.createFolder(subFolder).and().assertThat().existsInRepo()
|
||||
.when().usingResource(sourceParentFolder)
|
||||
.moveTo(targetFolder).and().assertThat().existsInRepo()
|
||||
.and().assertThat().hasChildren(sourceFile, subFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent is not able to move file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void inexistentUserCannotMoveFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(UserModel.getRandomUserModel())
|
||||
.moveTo(targetFolder).and().assertThat().existsInRepo()
|
||||
.usingResource(sourceFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to move checked out file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions=CmisUpdateConflictException.class)
|
||||
public void siteManagerShouldNotMoveCheckedOutFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.and().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(sourceFile)
|
||||
.moveTo(targetFolder).and().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to move folder with checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void siteManagerShouldMoveFolderWithCheckedOutFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
sourceFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFolder(sourceFolder).and().assertThat().existsInRepo()
|
||||
.then().usingResource(sourceFolder)
|
||||
.createFile(sourceFile, VersioningState.CHECKEDOUT)
|
||||
.and().assertThat().existsInRepo()
|
||||
.assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(sourceFolder)
|
||||
.moveTo(targetFolder).and().assertThat().existsInRepo()
|
||||
.and().assertThat().hasFiles(sourceFile);
|
||||
FileModel checkedOutDoc = cmisApi.getFiles().get(0);
|
||||
cmisApi.usingResource(checkedOutDoc).assertThat().documentIsCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify unauthorized user is no able to move a file")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserCannotMovesFile() throws Exception
|
||||
{
|
||||
targetFolder = FolderModel.getRandomFolderModel();
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(targetFolder).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(unauthorizedUser)
|
||||
.then().moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Manager verify PWC document object cannot be moved")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = CmisUpdateConflictException.class)
|
||||
public void managerCannotMovePWCDocumentObject() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(siteManager).usingSite(publicSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
FileModel pwcFile = cmisApi.authenticateUser(siteManager).usingResource(sourceFile).checkOut().withCMISUtil().getPWCFileModel();
|
||||
cmisApi.usingResource(pwcFile).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can move Document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void contributorCanMoveDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(contributorUser).usingSite(publicSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(contributorUser).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(sourceFile).moveTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFile)
|
||||
.usingSite(publicSite).assertThat().doesNotHaveFile(sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor cannot move Document created by Manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void contributorCannotMoveDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(siteManager).usingSite(publicSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(sourceFile).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can move Folder created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void contributorCanMoveFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(contributorUser).usingSite(publicSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(contributorUser).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(sourceFolder).moveTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFolder)
|
||||
.usingSite(publicSite).assertThat().doesNotHaveFolder(sourceFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor cannot move Folder created by Manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void contributorCannotMoveFolderCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(sourceFolder).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can move Document created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void collaboratorCanMoveDocumentCreatedBySelf() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(collaboratorUser).usingSite(publicSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(collaboratorUser).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(sourceFile).moveTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFile)
|
||||
.usingSite(publicSite).assertThat().doesNotHaveFile(sourceFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator cannot move Document created by Manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void collaboratorCannotMoveDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(siteManager).usingSite(publicSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(sourceFile).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can move Folder created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void collaboratorCanMoveFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(collaboratorUser).usingSite(publicSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(collaboratorUser).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(sourceFolder).moveTo(targetFolder)
|
||||
.usingResource(targetFolder).assertThat().hasChildren(sourceFolder)
|
||||
.usingSite(publicSite).assertThat().doesNotHaveFolder(sourceFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator cannot move Folder created by Manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void collaboratorCannotMoveFolderCreatedByManager() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(sourceFolder).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot move Document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerCannotMoveDocument() throws Exception
|
||||
{
|
||||
sourceFile = dataContent.usingUser(siteManager).usingSite(publicSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(consumerUser).usingResource(sourceFile).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot move Folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void consumerCannotMoveFolder() throws Exception
|
||||
{
|
||||
sourceFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
cmisApi.authenticateUser(consumerUser).usingResource(sourceFolder).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot move Document from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotMoveDocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
sourceFile = dataContent.usingUser(siteManager).usingSite(privateSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(privateSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFile).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot move Folder from private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotMoveFolderFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
sourceFolder = dataContent.usingUser(siteManager).usingSite(privateSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(privateSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFolder).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot move Document from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotMoveDocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
sourceFile = dataContent.usingUser(siteManager).usingSite(moderatedSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(moderatedSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFile).moveTo(targetFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user cannot move Folder from moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisUnauthorizedException.class, CmisPermissionDeniedException.class})
|
||||
public void unauthorizedUserCannotMoveFolderFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
sourceFolder = dataContent.usingUser(siteManager).usingSite(moderatedSite).createFolder();
|
||||
targetFolder = dataContent.usingUser(siteManager).usingSite(moderatedSite).createFolder();
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(sourceFolder).moveTo(targetFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/29/2016.
|
||||
*/
|
||||
public class RelationshipTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel publicSite, privateSite;
|
||||
FileModel sourceFile, targetFile;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to create relationship between a source object and a target object in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCreatesRelationshipBetween2Files() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create relationship between a invalid sources with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotCreateRelWithInvalidSources() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().delete().assertThat().doesNotExistInRepo()
|
||||
.createFile(sourceFile).and().delete().assertThat().doesNotExistInRepo()
|
||||
.then().createRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create relationship with checkout source document with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanCreateRelWithCheckedOutSourceDocument() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.then().createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that inexistent user is not able to create relationship between documents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void inexistentUserCannotCreateRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(UserModel.getRandomUserModel())
|
||||
.createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that user that was deleted is not able to create relationship between documents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void deletedUserCannotCreateRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
UserModel toBeDeleted = dataUser.createRandomTestUser();
|
||||
FolderModel shared = FolderModel.getSharedFolderModel();
|
||||
cmisApi.authenticateUser(toBeDeleted)
|
||||
.usingResource(shared)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo();
|
||||
dataUser.deleteUser(toBeDeleted);
|
||||
cmisApi.createRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager is able to create relationship between documents with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanCreateRelationshipInPrivateSite() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser())
|
||||
.usingSite(privateSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(siteManager)
|
||||
.createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create relationship between a invalid sources with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotGetRelWithInvalidObject() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FileModel invalidFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
invalidFile.setCmisLocation("/" + invalidFile.getName() + "/");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile)
|
||||
.createFile(sourceFile)
|
||||
.then().createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile)
|
||||
.assertThat().objectHasRelationshipWith(invalidFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to create relationship between a source folder and a target file with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminCreatesRelBetweenSourceFolderAndTargetFile() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel sourceFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingSite(publicSite)
|
||||
.createFile(targetFile).assertThat().existsInRepo()
|
||||
.createFolder(sourceFolder).assertThat().existsInRepo()
|
||||
.then().createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify contributor is not able to create relationship between a source object and a target object in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS},expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void contributorCannotCreateRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(sourceFile).createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator is able to create relationship between a source object and a target object in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanCreateRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(sourceFile).createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify consumer is not able to create relationship between a source object and a target object in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS},expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotCreateRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(sourceFile).createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify unauthorized user is not able to create relationship between a source object and a target object from a private site with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserCannotCreateRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(sourceFile).createRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify unauthorized user is not able to get relationship between a source object and a target object from a private site with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserCannotGetRelationship() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.usingResource(sourceFile).createRelationshipWith(targetFile)
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to create relationship for PWC source document with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisInvalidArgumentException.class,
|
||||
expectedExceptionsMessageRegExp = "^Source is not the latest version of a document, a folder or an item object!$")
|
||||
public void siteManagerCannotCreateRelationshipPWCSourceFile() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo().then().checkOut()
|
||||
.assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().createRelationshipWith(targetFile);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to create relationship with checkout target document with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanCreateRelWithCheckedOutTargetDocument() throws Exception
|
||||
{
|
||||
sourceFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
targetFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(targetFile).and().assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.createFile(sourceFile).and().assertThat().existsInRepo()
|
||||
.then().createRelationshipWith(targetFile)
|
||||
.and().assertThat().objectHasRelationshipWith(targetFile);
|
||||
}
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 10/3/2016.
|
||||
*/
|
||||
public class RemoveObjectFromFolderTests extends CmisTest
|
||||
{
|
||||
UserModel unauthorizedUser;
|
||||
UserModel siteManager;
|
||||
UserModel contributorUser;
|
||||
UserModel collaboratorUser;
|
||||
UserModel consumerUser;
|
||||
SiteModel publicSite;
|
||||
FolderModel parentFolder, testFolder;
|
||||
FileModel testFile;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
contributorUser = dataUser.createRandomTestUser();
|
||||
collaboratorUser = dataUser.createRandomTestUser();
|
||||
consumerUser = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
dataUser.addUserToSite(consumerUser, publicSite, UserRole.SiteConsumer);
|
||||
dataUser.addUserToSite(collaboratorUser, publicSite, UserRole.SiteCollaborator);
|
||||
dataUser.addUserToSite(contributorUser, publicSite, UserRole.SiteContributor);
|
||||
parentFolder = FolderModel.getRandomFolderModel();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.createFolder(parentFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to remove a document from folder in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerShouldRemoveFileToFolder() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingResource(parentFolder)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo()
|
||||
.when().removeDocumentFromFolder(testFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to leave a document without parent folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisInvalidArgumentException.class, expectedExceptionsMessageRegExp = "^Object is not a document!$")
|
||||
public void siteManagerShouldNotRemoveFolderFromFolder() throws Exception
|
||||
{
|
||||
FolderModel subFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager).usingResource(parentFolder)
|
||||
.createFolder(subFolder).assertThat().existsInRepo()
|
||||
.when().removeDocumentFromFolder(testFolder).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to remove a document without parent folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerShouldNotRemoveInvalidFileFromFolder() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
testFile.setCmisLocation("/" + testFile.getName() + "/");
|
||||
cmisApi.authenticateUser(siteManager).usingResource(testFile)
|
||||
.when().removeDocumentFromFolder(testFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to remove valid document from invalid folder with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerShouldNotRemoveFileToInvalidFolder() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
FolderModel invalidFolder = FolderModel.getRandomFolderModel();
|
||||
invalidFolder.setCmisLocation("/" + invalidFolder.getName() + "/");
|
||||
cmisApi.authenticateUser(siteManager).usingResource(parentFolder)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo()
|
||||
.when().removeDocumentFromFolder(invalidFolder)
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to remove a checked out document from folder in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerShouldRemovePWCFileToFolder() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingResource(parentFolder)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().addDocumentToFolder(testFolder, true)
|
||||
.then().assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.when().removeDocumentFromFolder(testFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().documentIsCheckedOut();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify unauthorized user is not able to remove a document from folder")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserShouldNotRemoveFileToFolder() throws Exception
|
||||
{
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingResource(parentFolder)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(unauthorizedUser)
|
||||
.removeDocumentFromFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can remove document from folder created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void contributorCanRemoveDocumentFromFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
parentFolder = dataContent.usingUser(contributorUser).usingSite(publicSite).createFolder();
|
||||
testFolder = dataContent.usingUser(contributorUser).usingSite(publicSite).createFolder();
|
||||
testFile = dataContent.usingUser(contributorUser).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo()
|
||||
.removeDocumentFromFolder(testFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can remove document from folder created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void contributorCannotRemoveDocumentFromFolderCreatedByManager() throws Exception
|
||||
{
|
||||
parentFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
testFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
testFile = dataContent.usingUser(siteManager).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
cmisApi.authenticateUser(siteManager).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true);
|
||||
|
||||
cmisApi.authenticateUser(contributorUser).usingResource(testFile).removeDocumentFromFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can remove document from folder created by self")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS })
|
||||
public void collaboratorCanRemoveDocumentFromFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
parentFolder = dataContent.usingUser(collaboratorUser).usingSite(publicSite).createFolder();
|
||||
testFolder = dataContent.usingUser(collaboratorUser).usingSite(publicSite).createFolder();
|
||||
testFile = dataContent.usingUser(collaboratorUser).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo()
|
||||
.removeDocumentFromFolder(testFolder).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can remove document from folder created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void collaboratorCannotRemoveDocumentFromFolderCreatedByManager() throws Exception
|
||||
{
|
||||
parentFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
testFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
testFile = dataContent.usingUser(siteManager).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
cmisApi.authenticateUser(siteManager).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true);
|
||||
|
||||
cmisApi.authenticateUser(collaboratorUser).usingResource(testFile).removeDocumentFromFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot remove document from folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotRemoveDocumentFromFolder() throws Exception
|
||||
{
|
||||
parentFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
testFolder = dataContent.usingUser(siteManager).usingSite(publicSite).createFolder();
|
||||
testFile = dataContent.usingUser(siteManager).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
cmisApi.authenticateUser(siteManager).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(consumerUser).usingResource(testFile).removeDocumentFromFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify remove document from folder by user that is outside a private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserCannotRemoveDocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
parentFolder = dataContent.usingUser(siteManager).usingSite(privateSite).createFolder();
|
||||
testFolder = dataContent.usingUser(siteManager).usingSite(privateSite).createFolder();
|
||||
testFile = dataContent.usingUser(siteManager).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
cmisApi.authenticateUser(siteManager).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(testFile).removeDocumentFromFolder(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify remove document from folder by user that is outside a moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS }, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void unauthorizedUserCannotRemoveDocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(siteManager).createModeratedRandomSite();
|
||||
parentFolder = dataContent.usingUser(siteManager).usingSite(moderatedSite).createFolder();
|
||||
testFolder = dataContent.usingUser(siteManager).usingSite(moderatedSite).createFolder();
|
||||
testFile = dataContent.usingUser(siteManager).usingResource(parentFolder)
|
||||
.createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
cmisApi.authenticateUser(siteManager).usingResource(testFile)
|
||||
.addDocumentToFolder(testFolder, true).then().assertThat().existsInRepo();
|
||||
|
||||
cmisApi.authenticateUser(unauthorizedUser).usingResource(testFile).removeDocumentFromFolder(testFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,351 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RenameTests extends CmisTest
|
||||
{
|
||||
SiteModel testSite;
|
||||
UserModel managerUser, inexistentUser, nonInvitedUser;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private String prefix = "-edit";
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerUser = dataUser.createRandomTestUser();
|
||||
nonInvitedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(managerUser).createPublicRandomSite();
|
||||
inexistentUser = new UserModel("inexistent", "inexistent");
|
||||
usersWithRoles = dataUser.usingUser(managerUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to rename document and folder created by himself")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerCanRenameContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().usingResource(testFile)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(testFolder)
|
||||
.rename(testFolder.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFolder).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user is able to rename document and folder created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void adminCanRenameContentFromPublicSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(testFile)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo()
|
||||
.usingResource(testFolder)
|
||||
.rename(testFolder.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFolder).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename inexistent document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotRenameInexistentDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
testFile.setCmisLocation("/fake-folder/test.txt");
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.then().usingResource(testFile)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename inexistent folder")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerCannotRenameInexistentFolder() throws Exception
|
||||
{
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
folder.setCmisLocation("/" + folder.getName() + "/");
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.then().usingResource(folder)
|
||||
.rename(prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename document with invalid symbols")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotRenameDocumentInvalidSymbols() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().usingResource(testFile)
|
||||
.rename("/.:?|\\`\\.txt").assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename folder with invalid symbols")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotRenameFolderInvalidSymbols() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().usingResource(testFolder)
|
||||
.rename("/.:?|\\`\\.txt").assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename document with empty string")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="New name must not be empty!*")
|
||||
public void siteManagerCannotRenameDocumentEmptyName() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().usingResource(testFile)
|
||||
.rename("").assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename folder with empty name")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="New name must not be empty!*")
|
||||
public void siteManagerCannotRenameFolderEmptyName() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().usingResource(testFolder)
|
||||
.rename("").assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename checked out document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUpdateConflictException.class)
|
||||
public void siteManagerCannotRenameCheckedOutDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(testFile)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to rename pwc document")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRenamePwcDocument() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
FileModel renamedPwc = new FileModel("pwc" + prefix + " (Working Copy)");
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().assertThat().documentIsCheckedOut()
|
||||
.then().usingResource(testFile)
|
||||
.usingPWCDocument().assertThat().existsInRepo()
|
||||
.rename("pwc" + prefix);
|
||||
renamedPwc.setCmisLocation(testFile.getCmisLocation().replace(testFile.getName(), renamedPwc.getName()));
|
||||
cmisApi.usingResource(renamedPwc).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to rename document with same name")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRenameDocumentWithSameName() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().usingResource(testFile)
|
||||
.rename(testFile.getName()).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to rename document with multiple versions")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRenameDocumentWithMultipleVersions() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().update("first content").assertThat().documentHasVersion(1.1)
|
||||
.then().update("second content").assertThat().documentHasVersion(1.2)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.and().assertThat().documentHasVersion(1.2);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to rename document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteCollaboratorCanRenameDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to rename folder created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteCollaboratorCanRenameFolderCreatedByManager() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.rename(testFolder.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFolder).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to rename folder created by collaborator")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanRenameFolderCreatedByCollaborator() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().authenticateUser(managerUser)
|
||||
.rename(testFolder.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFolder).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to rename document created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteCollaboratorCanRenameDocumentCreatedByHimself() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to rename document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void siteContributorCannotRenameDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to rename document created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteContributorCanRenameDocumentCreatedByHimself() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo()
|
||||
.when().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to rename document created by manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void siteConsumerCannotRenameDocumentCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to rename document in public site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void siteConsumerCannotRenameDocumentInPublicSite() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to rename document in private site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotRenameDocumentInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(managerUser).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(privateSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(nonInvitedUser)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to rename document in moderated site")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotRenameDocumentInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(managerUser).createModeratedRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(moderatedSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(nonInvitedUser)
|
||||
.rename(testFile.getName() + prefix).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to rename document with same name as another file in same location")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisContentAlreadyExistsException.class,
|
||||
expectedExceptionsMessageRegExp="An object with this name already exists.*")
|
||||
public void siteManagerCannotRenameDocumentWithSameNameFromOtherFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
FileModel secondFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(managerUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.createFile(secondFile)
|
||||
.then().usingResource(testFile)
|
||||
.rename(secondFile.getName()).assertThat().existsInRepo();
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
public class RenditionTests extends CmisTest
|
||||
{
|
||||
private SiteModel testSite;
|
||||
private UserModel testUser, inexistentUser, nonInvitedUser;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
nonInvitedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
inexistentUser = new UserModel("inexistent", "inexistent");
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get renditions for valid Document object")
|
||||
public void adminShouldGetRenditionsForDocument() throws Exception
|
||||
{
|
||||
FileModel txtModel = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingShared().createFile(txtModel);
|
||||
Utility.sleep(300, 10000, () -> cmisApi.usingResource(txtModel).assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify admin can get renditions for invalid Document object")
|
||||
public void adminCannotGetRenditionsForInvalidDocument() throws Exception
|
||||
{
|
||||
FileModel invalidFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
invalidFile.setCmisLocation("/" + invalidFile.getName() + "/");
|
||||
cmisApi.authenticateUser(dataUser.getAdminUser()).usingShared()
|
||||
.then().usingResource(invalidFile).assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager can get renditions for valid Document")
|
||||
public void managerGetRenditionsForDocument() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile);
|
||||
Utility.sleep(300, 10000, () -> cmisApi.authenticateUser(testUser)
|
||||
.usingResource(testFile).assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator can get renditions for valid Document")
|
||||
public void collaboratorGetRenditionsForDocument() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile);
|
||||
Utility.sleep(300, 10000, () -> cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor can get renditions for valid Document")
|
||||
public void contributorGetRenditionsForDocument() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile);
|
||||
Utility.sleep(300, 10000, () -> cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFile).assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer can get renditions for valid Document")
|
||||
public void consumerGetRenditionsForDocument() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile);
|
||||
Utility.sleep(300, 10000, () -> cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can get renditions for checked out document")
|
||||
public void managerGetRenditionsForCheckedOutDocument() throws Exception
|
||||
{
|
||||
FileModel checkedDoc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(checkedDoc, VersioningState.CHECKEDOUT).assertThat().documentIsCheckedOut();
|
||||
Utility.sleep(300, 10000, () -> cmisApi.usingResource(checkedDoc)
|
||||
.assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user can get renditions in public site")
|
||||
public void nonInvitedUserGetRenditionsInPublicSite() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile);
|
||||
Utility.sleep(300, 10000, () -> cmisApi.authenticateUser(nonInvitedUser)
|
||||
.usingResource(testFile)
|
||||
.assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user cannot get renditions in private site")
|
||||
public void nonInvitedUserCannotGetRenditionsInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
FileModel privateDoc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(privateDoc).assertThat().existsInRepo()
|
||||
.authenticateUser(nonInvitedUser)
|
||||
.usingResource(privateDoc)
|
||||
.assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user cannot get renditions in moderated site")
|
||||
public void nonInvitedUserCannotGetRenditionsInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel moderatedSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
FileModel moderatedDoc = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(moderatedSite)
|
||||
.createFile(moderatedDoc).assertThat().existsInRepo()
|
||||
.authenticateUser(nonInvitedUser)
|
||||
.usingResource(moderatedDoc)
|
||||
.assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS, TestGroup.RENDITIONS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user cannot get renditions")
|
||||
public void inexistentUserCannotGetRenditions() throws Exception
|
||||
{
|
||||
FileModel testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, documentContent);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile);
|
||||
cmisApi.authenticateUser(inexistentUser)
|
||||
.usingResource(testFile)
|
||||
.assertThat().renditionIsAvailable()
|
||||
.assertThat().thumbnailRenditionIsAvailable();
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
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.apache.chemistry.opencmis.commons.data.AclCapabilities;
|
||||
import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
|
||||
import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
|
||||
import org.apache.chemistry.opencmis.commons.enums.BindingType;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RepositoryInfoTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
UserModel unauthorizedUser;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
unauthorizedUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY, description = "Verify that valid user can get repositories")
|
||||
public void validUserCanGetRepositories() throws Exception
|
||||
{
|
||||
Assert.assertNotNull(cmisApi.authenticateUser(testUser).getSession());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS}, expectedExceptions = CmisUnauthorizedException.class)
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY, description = "Verify that valid user with invalid password cannot get repositories")
|
||||
public void unauthorizedUserCannotGetRepositories() throws Exception
|
||||
{
|
||||
unauthorizedUser.setPassword("invalidPass");
|
||||
cmisApi.authenticateUser(unauthorizedUser);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY, description = "Verify that valid user can get the repository informations")
|
||||
public void validUserCanGetRepositoryInfo() throws Exception
|
||||
{
|
||||
RepositoryInfo repoInfo = cmisApi.authenticateUser(testUser).getRepositoryInfo();
|
||||
Assert.assertNotNull(repoInfo.getRootFolderId());
|
||||
Assert.assertNotNull(repoInfo.getProductVersion());
|
||||
Assert.assertNotNull(repoInfo.getRootFolderId());
|
||||
Assert.assertNotNull(repoInfo.getId());
|
||||
Assert.assertEquals(repoInfo.getProductName(), String.format("Alfresco %s", serverHealth.getAlfrescoEdition()));
|
||||
Assert.assertEquals(repoInfo.getVendorName(), "Alfresco");
|
||||
RepositoryCapabilities capabilities = repoInfo.getCapabilities();
|
||||
Assert.assertNotNull(capabilities);
|
||||
Assert.assertEquals(capabilities.getContentStreamUpdatesCapability().value(), "anytime", "Verify repository capability: capabilityContentStreamUpdatability");
|
||||
Assert.assertEquals(capabilities.getRenditionsCapability().value(), "read", "Verify repository capability: capabilityRenditions");
|
||||
Assert.assertTrue(capabilities.isGetDescendantsSupported(), "Verify repository capability: capabilityGetDescendants");
|
||||
Assert.assertTrue(capabilities.isGetFolderTreeSupported(), "Verify repository capability: capabilityGetFolderTree");
|
||||
Assert.assertTrue(capabilities.isMultifilingSupported(), "Verify repository capability: capabilityMultifiling");
|
||||
Assert.assertFalse(capabilities.isUnfilingSupported(), "Verify repository capability: capabilityUnfiling");
|
||||
Assert.assertFalse(capabilities.isVersionSpecificFilingSupported(), "Verify repository capability: capabilityVersionSpecificFiling");
|
||||
Assert.assertFalse(capabilities.isPwcSearchableSupported(), "Verify repository capability: capabilityPWCSearchable");
|
||||
Assert.assertTrue(capabilities.isPwcUpdatableSupported(), "Verify repository capability: capabilityPWCUpdatable");
|
||||
Assert.assertFalse(capabilities.isAllVersionsSearchableSupported(), "Verify repository capability: capabilityAllVersionsSearchable");
|
||||
Assert.assertEquals(capabilities.getQueryCapability().value(), "bothcombined", "Verify repository capability: capabilityQuery");
|
||||
Assert.assertEquals(capabilities.getJoinCapability().value(), "none", "Verify repository capability: capabilityJoin");
|
||||
Assert.assertEquals(capabilities.getAclCapability().value(), "manage", "Verify repository capability: capabilityACL");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.SANITY, description = "Verify that valid user can get Acl Capabilities")
|
||||
public void validUserCanGetAclCapabilities() throws Exception
|
||||
{
|
||||
AclCapabilities aclCapabilities = cmisApi.authenticateUser(testUser).getAclCapabilities();
|
||||
Assert.assertNotNull(aclCapabilities);
|
||||
Assert.assertFalse(aclCapabilities.getPermissions().isEmpty(), "Verify acl capabilities: getPermissions");
|
||||
Assert.assertEquals(aclCapabilities.getSupportedPermissions().value(), "both", "Verify acl capabilities: getSupportedPermissions");
|
||||
Assert.assertEquals(aclCapabilities.getAclPropagation().value(), "propagate", "Verify acl capabilities: getAclPropagation");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUnauthorizedException.class)
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION, description = "Verify that invalid user cannot get repositories")
|
||||
public void invalidUserCannotGetRepositories() throws Exception
|
||||
{
|
||||
UserModel invalidUser = UserModel.getRandomUserModel();
|
||||
cmisApi.authenticateUser(invalidUser).getRepositoryInfo();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisConnectionException.class})
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION, description = "Verify that invalid user cannot get repositories")
|
||||
public void userCannotGetRepositoriesUsingWrongBrowserUrl() throws Exception
|
||||
{
|
||||
String wrongUrlPath = "//alfresco//api//-default-//public//cmis//versions//1.1";
|
||||
cmisApi.authUserUsingBrowserUrlAndBindingType(testUser, wrongUrlPath, BindingType.BROWSER.value()).getRepositoryInfo();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {IllegalArgumentException.class, CmisRuntimeException.class}, expectedExceptionsMessageRegExp = "Invalid binding type!")
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION, description = "Verify that invalid user cannot get repositories")
|
||||
public void userCannotGetRepositoriesUsingWrongBindingType() throws Exception
|
||||
{
|
||||
String wrongBindingType = BindingType.BROWSER.value() + "w";
|
||||
cmisApi.authUserUsingBrowserUrlAndBindingType(testUser, cmisApi.cmisProperties.envProperty().getFullServerUrl() + cmisApi.cmisProperties.getBasePath(), wrongBindingType).getRepositoryInfo();
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUnauthorizedException.class)
|
||||
@TestRail(section = { "cmis-api" }, executionType = ExecutionType.REGRESSION, description = "Verify that disabled user cannot get repositories")
|
||||
public void disabledUserCannotGetRepositories() throws Exception
|
||||
{
|
||||
UserModel disabledUser = dataUser.createRandomTestUser();
|
||||
Assert.assertNotNull(cmisApi.authenticateUser(disabledUser).getRepositoryInfo());
|
||||
dataUser.usingAdmin().disableUser(disabledUser);
|
||||
cmisApi.authenticateUser(disabledUser).getRepositoryInfo();
|
||||
}
|
||||
}
|
||||
@@ -1,287 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SecondaryTypesTests extends CmisTest
|
||||
{
|
||||
SiteModel testSite;
|
||||
UserModel testUser, nonInvitedUser;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
FileModel managerFile;
|
||||
FolderModel managerFolder;
|
||||
String titledAspect = "P:cm:titled";
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerFile = FileModel.getRandomFileModel(FileType.MSWORD2007, documentContent);
|
||||
managerFolder = FolderModel.getRandomFolderModel();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
nonInvitedUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(managerFile)
|
||||
.createFolder(managerFolder);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get secondary types for Document")
|
||||
public void userCanGetSecondaryTypesForDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to get secondary types for Folder")
|
||||
public void userCanGetSecondaryTypesForFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFolder)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = {CmisObjectNotFoundException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to get secondary types for Folder")
|
||||
public void userCannotGetSecondaryTypesForInvalidObject() throws Exception
|
||||
{
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
folder.setCmisLocation("/" + folder.getName() + "/");
|
||||
cmisApi.authenticateUser(testUser)
|
||||
.usingResource(folder)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is NOT able to get invalid secondary type for Folder")
|
||||
public void invalidSecondaryTypeIsNotAvailableForFolder() throws Exception
|
||||
{
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(folder).and().assertThat().existsInRepo()
|
||||
.and().assertThat().secondaryTypeIsNotAvailable(titledAspect + "-fake");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to get secondary types")
|
||||
public void collaboratorCanGetSecondaryTypesForContent() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to get secondary types")
|
||||
public void contributorCanGetSecondaryTypesForContent() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is able to get secondary types")
|
||||
public void consumerCanGetSecondaryTypesForContent() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is able to get secondary types in public site")
|
||||
public void nonInvitedUserCanGetSecondaryTypesForContentInPublicSite() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(nonInvitedUser)
|
||||
.usingResource(managerFolder)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().usingResource(managerFile)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get secondary types in private site")
|
||||
public void nonInvitedUserCannotGetSecondaryTypesForContentInPrivateSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
FileModel privateDoc = FileModel.getRandomFileModel(FileType.MSPOWERPOINT2007);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(privateDoc)
|
||||
.authenticateUser(nonInvitedUser)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to get secondary types in moderated site")
|
||||
public void nonInvitedUserCannotGetSecondaryTypesInModeratedSite() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
FileModel privateDoc = FileModel.getRandomFileModel(FileType.MSPOWERPOINT2007);
|
||||
cmisApi.authenticateUser(testUser).usingSite(privateSite)
|
||||
.createFile(privateDoc)
|
||||
.authenticateUser(nonInvitedUser)
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to add secondary types for Document")
|
||||
public void managerCanAddSecondaryTypesForDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:cm:dublincore")
|
||||
.assertThat().secondaryTypeIsAvailable("P:cm:dublincore")
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().updateProperty("cm:subject", "TAS Subject")
|
||||
.updateProperty("cm:rights", "TAS Rights")
|
||||
.updateProperty("cm:publisher", "TAS Team")
|
||||
.then().assertThat().objectHasProperty("cm:subject", "TAS Subject")
|
||||
.assertThat().objectHasProperty("cm:rights", "TAS Rights")
|
||||
.assertThat().objectHasProperty("cm:publisher", "TAS Team");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to add secondary types for folder")
|
||||
public void managerCanAddSecondaryTypesForFolder() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFolder)
|
||||
.addSecondaryTypes("P:cm:geographic")
|
||||
.assertThat().secondaryTypeIsAvailable("P:cm:geographic")
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().updateProperty("cm:longitude", 455.21)
|
||||
.updateProperty("cm:latitude", 101.32)
|
||||
.then().assertThat().objectHasProperty("cm:longitude", 455.21)
|
||||
.assertThat().objectHasProperty("cm:latitude", 101.32);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class,
|
||||
expectedExceptionsMessageRegExp="Type 'P:cm:fakeAspect' is unknown!*")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to add fake secondary type")
|
||||
public void managerCannotAddInexistentSecondaryType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFolder)
|
||||
.addSecondaryTypes("P:cm:fakeAspect");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to add twice same secondary type")
|
||||
public void managerCanAddTwiceSameSecondaryType() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:cm:dublincore")
|
||||
.assertThat().secondaryTypeIsAvailable("P:cm:dublincore")
|
||||
.then().addSecondaryTypes("P:cm:dublincore")
|
||||
.assertThat().secondaryTypeIsAvailable("P:cm:dublincore");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to add secondary types for document created by manager")
|
||||
public void collaboratorCanAddAspectForDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:audio:audio")
|
||||
.assertThat().secondaryTypeIsAvailable("P:audio:audio")
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().updateProperty("audio:channelType", "TAS")
|
||||
.updateProperty("audio:trackNumber", 9)
|
||||
.updateProperty("audio:sampleType", "TAS Sample")
|
||||
.then().assertThat().objectHasProperty("audio:channelType", "TAS")
|
||||
.assertThat().objectHasProperty("audio:trackNumber", 9)
|
||||
.assertThat().objectHasProperty("audio:sampleType", "TAS Sample");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to add secondary types for document created by manager")
|
||||
public void contributorCanAddAspectForDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:dp:restrictable")
|
||||
.assertThat().secondaryTypeIsAvailable("P:dp:restrictable")
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().updateProperty("dp:offlineExpiresAfter", 2)
|
||||
.and().assertThat().objectHasProperty("dp:offlineExpiresAfter", 2);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to add secondary types for document created by manager")
|
||||
public void consumerCanAddAspectForDocument() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:dp:restrictable")
|
||||
.assertThat().secondaryTypeIsAvailable("P:dp:restrictable")
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().updateProperty("dp:offlineExpiresAfter", 2)
|
||||
.and().assertThat().objectHasProperty("dp:offlineExpiresAfter", 2);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to add twice same secondary type")
|
||||
public void managerCanAddDateProperty() throws Exception
|
||||
{
|
||||
Date today = new Date();
|
||||
Date tomorow = new Date();
|
||||
tomorow = DateUtils.addDays(tomorow, 1);
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:cm:effectivity")
|
||||
.assertThat().secondaryTypeIsAvailable("P:cm:effectivity")
|
||||
.then().updateProperty("cm:to", today)
|
||||
.updateProperty("cm:from", tomorow)
|
||||
.and().assertThat().objectHasProperty("cm:to", today)
|
||||
.assertThat().objectHasProperty("cm:from", tomorow);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class,
|
||||
expectedExceptionsMessageRegExp="Property 'cm:fake-prop' is not valid for this type or one of the secondary types!*")
|
||||
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update aspect with fake property")
|
||||
public void managerCannotUpdateFakePropertyFromAspect() throws Exception
|
||||
{
|
||||
cmisApi.authenticateUser(testUser).usingResource(managerFile)
|
||||
.addSecondaryTypes("P:cm:dublincore")
|
||||
.assertThat().secondaryTypeIsAvailable("P:cm:dublincore")
|
||||
.assertThat().secondaryTypeIsAvailable(titledAspect)
|
||||
.then().updateProperty("cm:fake-prop", "fake-prop");
|
||||
}
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.cmis.exception.InvalidCmisObjectException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/28/2016.
|
||||
*/
|
||||
public class SetContentTests extends CmisTest
|
||||
{
|
||||
UserModel siteManager;
|
||||
SiteModel publicSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
private String someContent = "some content";
|
||||
private String secondContent = "second content";
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteManager = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteManager).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to set content to a valid document in DocumentLibrary with CMIS")
|
||||
public void siteManagerSetFileContentForFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().update("content")
|
||||
.then().setContent(someContent).and().refreshResource()
|
||||
.then().assertThat().contentIs(someContent)
|
||||
.and().assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = InvalidCmisObjectException.class, groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if exception is thrown when user tries to set content to an invalid document in DocumentLibrary with CMIS")
|
||||
public void siteManagerSetFolderContent() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(siteManager)
|
||||
.usingSite(publicSite)
|
||||
.createFolder(testFolder).setContent(someContent);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that inexistent user is not able to set content to a document with CMIS")
|
||||
public void inexistentUserCannotSetFileContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentLengthIs(0)
|
||||
.then().authenticateUser(UserModel.getRandomUserModel())
|
||||
.setContent(someContent);
|
||||
}
|
||||
|
||||
@Bug(id="ACE-5614")
|
||||
@Test(groups = { TestGroup.REGRESSION , TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to set content to a document with no content with overwrite parameter set to false with CMIS")
|
||||
public void siteManagerCanSetContentWithFalseOverwriteToDocWithNoContent() throws Exception
|
||||
{
|
||||
FileModel newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(newFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentLengthIs(0)
|
||||
.then().setContent(someContent, false).and()
|
||||
.and().assertThat().contentIs(someContent);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisContentAlreadyExistsException.class)
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to set content to a document with content with overwrite parameter set to false with CMIS")
|
||||
public void siteManagerCanSetContentWithFalseOverwriteToDocWithContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, someContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().contentIs(someContent)
|
||||
.then().setContent(secondContent, false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to set content to a document")
|
||||
public void unauthorizedUserCannotSetContent() throws Exception
|
||||
{
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, someContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(unauthorizedUser)
|
||||
.setContent(secondContent);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin is able to set file content with CMIS")
|
||||
public void adminCanSetFileContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(dataUser.getAdminUser())
|
||||
.and().setContent(someContent).and().refreshResource()
|
||||
.then().assertThat().contentIs(someContent)
|
||||
.and().assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to set file content for a file created by other user with CMIS")
|
||||
public void managerCanSetFileContentForFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.and().setContent(someContent).and().refreshResource()
|
||||
.then().assertThat().contentIs(someContent)
|
||||
.and().assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is not able to set content to a document created by other user with CMIS")
|
||||
public void contributorCannotSetFileContentForFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.then().setContent(someContent);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to set content to a document created by self with CMIS")
|
||||
public void contributorCanSetFileContentForFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().setContent(someContent).and().refreshResource()
|
||||
.then().assertThat().contentIs(someContent)
|
||||
.and().assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to set content to a document created by other user with CMIS")
|
||||
public void collaboratorCanSetFileContentForFileCreatedByOtherUser() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.then().usingResource(testFile)
|
||||
.setContent(someContent).and().refreshResource()
|
||||
.and().assertThat().contentIs(someContent)
|
||||
.assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to set content to a document created by self with CMIS")
|
||||
public void collaboratorCanSetFileContentForFileCreatedBySelf() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().setContent(someContent).and().refreshResource()
|
||||
.then().assertThat().contentIs(someContent)
|
||||
.and().assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to set file content with CMIS")
|
||||
public void consumerCannotSetFileContent() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.then().setContent(someContent);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions = CmisUpdateConflictException.class, expectedExceptionsMessageRegExp = "^.*Cannot perform operation since the node.*is locked.$")
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to set content to a checked out document with CMIS")
|
||||
public void siteManagerCannotSetContentToCheckedOutFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.setContent(someContent);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to set content to PWC document version with CMIS")
|
||||
public void siteManagerSetContentToPWCFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "first content");
|
||||
cmisApi.authenticateUser(siteManager).usingSite(publicSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().setContent(someContent).and().refreshResource()
|
||||
.then().assertThat().contentIs(someContent)
|
||||
.and().assertThat().contentLengthIs(12);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
@TestRail(section = {"cmis-api" }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to set content to a document from a private site")
|
||||
public void unauthorizedUserCannotSetContentToPrivateSiteDoc() throws Exception
|
||||
{
|
||||
SiteModel privateSite = dataSite.usingUser(siteManager).createPrivateRandomSite();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, someContent);
|
||||
cmisApi.authenticateUser(siteManager).usingSite(privateSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).setContent(secondContent);
|
||||
}
|
||||
}
|
||||
@@ -1,357 +0,0 @@
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 9/30/2016.
|
||||
*/
|
||||
public class UpdatePropertiesTests extends CmisTest
|
||||
{
|
||||
UserModel testUser;
|
||||
SiteModel testSite;
|
||||
FileModel testFile;
|
||||
FolderModel testFolder;
|
||||
String propertyNameValue;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
dataContent.deployContentModel("shared-resources/model/tas-model.xml");
|
||||
usersWithRoles = dataUser.usingUser(testUser)
|
||||
.addUsersWithRolesToSite(testSite, UserRole.SiteContributor, UserRole.SiteCollaborator, UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to update properties to a valid document in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerUpdatesFileProperties() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:name", propertyNameValue)
|
||||
.then().updateProperty("cmis:description", "some description")
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "some description");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager is able to update properties to a valid folder in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.SANITY, TestGroup.CMIS})
|
||||
public void siteManagerUpdatesFolderProperties() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:name", propertyNameValue)
|
||||
.then().updateProperty("cmis:description", "some description")
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "some description");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify if exception is thrown when user tries to update properties to a non existent document in DocumentLibrary with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisObjectNotFoundException.class)
|
||||
public void siteManagerUpdatesNoneExistentFileProperties() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().delete().and().assertThat().doesNotExistInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update properties with invalid property with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=IllegalArgumentException.class)
|
||||
public void siteManagerCannotUpdateFileWithInvalidProperty() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:fakeProp", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that deleted user is not able to update properties with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void deletedUserCannotUpdateFileProperties() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
UserModel toBeDeleted = dataUser.createRandomTestUser();
|
||||
FolderModel shared = FolderModel.getSharedFolderModel();
|
||||
cmisApi.authenticateUser(toBeDeleted)
|
||||
.usingResource(shared)
|
||||
.createFile(testFile).and().assertThat().existsInRepo();
|
||||
dataUser.deleteUser(toBeDeleted);
|
||||
cmisApi.updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update name property while document is checked out with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCannotUpdatePWCDocumentName() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut()
|
||||
.and().assertThat().documentIsCheckedOut()
|
||||
.usingPWCDocument().updateProperty("cmis:name", testFile.getName() + "-edit")
|
||||
.cancelCheckOut()
|
||||
.then().usingResource(testFile)
|
||||
.assertThat().contentPropertyHasValue("cmis:name", testFile.getName());
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to update the title and description while document is checked out with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanUpdateCheckOutDocTitleAndDescription() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().checkOut().and().assertThat().documentIsCheckedOut()
|
||||
.then().usingPWCDocument()
|
||||
.updateProperty("cmis:description", propertyNameValue)
|
||||
.updateProperty("cm:title", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", propertyNameValue)
|
||||
.assertThat().contentPropertyHasValue("cm:title", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to update the title and description for document with version is checked out with CMIS")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanUpdateDocumentWithVersion() throws Exception
|
||||
{
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).createFile(testFile).assertThat().existsInRepo()
|
||||
.then().update("first content").update("second content")
|
||||
.updateProperty("cmis:description", propertyNameValue)
|
||||
.updateProperty("cm:title", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", propertyNameValue)
|
||||
.assertThat().contentPropertyHasValue("cm:title", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update document name with invalid symbols")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotUpdateDocNameInvalidSymbols() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = "/.:?|\\`\\";
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update folder name with invalid symbols")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisConstraintException.class)
|
||||
public void siteManagerCannotUpdateFolderNameInvalidSymbols() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
propertyNameValue = "/.:?|\\`\\";
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update document name with empty value")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisRuntimeException.class,
|
||||
expectedExceptionsMessageRegExp="Local name cannot be null or empty.")
|
||||
public void siteManagerCannotUpdateDocNameEmptyValue() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", "");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is not able to update folder name with empty value")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisRuntimeException.class,
|
||||
expectedExceptionsMessageRegExp="Local name cannot be null or empty.")
|
||||
public void siteManagerCannotUpdateFolderNameEmptyValue() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFolder(testFolder).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", "");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to update Integer and Long types with max values")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanUpdateIntAndLongTypesWithMaxValue() throws Exception
|
||||
{
|
||||
FileModel customFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content");
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
properties.put(PropertyIds.OBJECT_TYPE_ID, "D:tas:document");
|
||||
properties.put(PropertyIds.NAME, customFile.getName());
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(customFile, properties, VersioningState.MAJOR).assertThat().existsInRepo()
|
||||
.then().updateProperty("tas:IntPropertyC", Integer.MAX_VALUE)
|
||||
.and().assertThat().contentPropertyHasValue("tas:IntPropertyC", String.valueOf(Integer.MAX_VALUE))
|
||||
.then().updateProperty("tas:LongPropertyC", Long.MAX_VALUE)
|
||||
.and().assertThat().contentPropertyHasValue("tas:LongPropertyC", String.valueOf(Long.MAX_VALUE));
|
||||
cmisApi.usingResource(customFile).delete().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager is able to update Integer and Long types with min values")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void siteManagerCanUpdateIntAndLongTypesWithMinValue() throws Exception
|
||||
{
|
||||
FileModel customFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "custom content");
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
properties.put(PropertyIds.OBJECT_TYPE_ID, "D:tas:document");
|
||||
properties.put(PropertyIds.NAME, customFile.getName());
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(customFile, properties, VersioningState.MAJOR).assertThat().existsInRepo()
|
||||
.then().updateProperty("tas:IntPropertyC", Integer.MIN_VALUE)
|
||||
.and().assertThat().contentPropertyHasValue("tas:IntPropertyC", String.valueOf(Integer.MIN_VALUE))
|
||||
.then().updateProperty("tas:LongPropertyC", Long.MIN_VALUE)
|
||||
.and().assertThat().contentPropertyHasValue("tas:LongPropertyC", String.valueOf(Long.MIN_VALUE));
|
||||
cmisApi.usingResource(customFile).delete().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to update properties to a valid document created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanUpdateHisOwnFileProperties() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:name", propertyNameValue)
|
||||
.then().updateProperty("cmis:description", "some description")
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "some description");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to update properties to a valid document created by site manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void collaboratorCanUpdateFilePropertiesCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.and().updateProperty("cmis:name", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:name", propertyNameValue)
|
||||
.then().updateProperty("cmis:description", "some description")
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "some description");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site contributor is able to update properties to a valid document created by himself")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanUpdateHisOwnFileProperties() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().updateProperty("cmis:name", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:name", propertyNameValue)
|
||||
.then().updateProperty("cmis:description", "some description")
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "some description");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site collaborator is able to update properties to a valid document created by site manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS})
|
||||
public void contributorCanUpdateFilePropertiesCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.and().updateProperty("cmis:name", propertyNameValue)
|
||||
.and().assertThat().contentPropertyHasValue("cmis:name", propertyNameValue)
|
||||
.then().updateProperty("cmis:description", "some description")
|
||||
.and().assertThat().contentPropertyHasValue("cmis:description", "some description");
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site consumer is not able to update properties to a valid document created by site manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void consumerCannotUpdateFilePropertiesCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.and().updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
|
||||
@Bug(id="REPO-4301")
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify disabled user is not able to update properties")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions=CmisUnauthorizedException.class)
|
||||
public void disabledUserCannotUpdateFileProperties() throws Exception
|
||||
{
|
||||
UserModel disabledUser = dataUser.createRandomTestUser();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(disabledUser).usingShared()
|
||||
.createFile(testFile).assertThat().existsInRepo();
|
||||
dataUser.usingAdmin().disableUser(disabledUser);
|
||||
cmisApi.usingResource(testFile).updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
|
||||
@TestRail(section = {"cmis-api"}, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify non invited user is not able to update properties to a document created by site manager")
|
||||
@Test(groups = { TestGroup.REGRESSION, TestGroup.CMIS}, expectedExceptions={CmisPermissionDeniedException.class, CmisUnauthorizedException.class})
|
||||
public void nonInvitedUserCannotUpdateFilePropertiesCreatedByManager() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
UserModel nonInvitedUser = dataUser.createRandomTestUser();
|
||||
propertyNameValue = RandomData.getRandomAlphanumeric();
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite)
|
||||
.createFile(testFile).assertThat().existsInRepo()
|
||||
.then().authenticateUser(nonInvitedUser)
|
||||
.and().updateProperty("cmis:name", propertyNameValue);
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,14 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<context:annotation-config />
|
||||
<context:component-scan base-package="org.alfresco" />
|
||||
|
||||
<import resource="classpath:dataprep-context.xml" />
|
||||
<import resource="classpath*:alfresco-tester-context.xml" />
|
||||
|
||||
</beans>
|
||||
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-email-test</artifactId>
|
||||
<name>content-repository-community-email-test</name>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<artifactId>content-repository-community-tests</artifactId>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -28,6 +26,13 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-email-test</artifactId>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>email</artifactId>
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
package org.alfresco.email;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.alfresco.email.dsl.ServerConfiguration;
|
||||
import org.alfresco.utility.LogFactory;
|
||||
import org.alfresco.utility.data.*;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.network.ServerHealth;
|
||||
import org.alfresco.utility.network.TenantConsole;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
|
||||
import org.testng.annotations.*;
|
||||
|
||||
@ContextConfiguration("classpath:alfresco-email-context.xml")
|
||||
public abstract class EmailTest extends AbstractTestNGSpringContextTests
|
||||
{
|
||||
private static Logger LOG = LogFactory.getLogger();
|
||||
|
||||
@Autowired
|
||||
ServerHealth serverHealth;
|
||||
|
||||
@Autowired
|
||||
protected ImapWrapper imapProtocol;
|
||||
|
||||
@Autowired
|
||||
protected SmtpWrapper smtpProtocol;
|
||||
|
||||
@Autowired
|
||||
public DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
public DataGroup dataGroup;
|
||||
|
||||
@Autowired
|
||||
public DataSite dataSite;
|
||||
|
||||
@Autowired
|
||||
public DataContent dataContent;
|
||||
|
||||
@Autowired
|
||||
public DataLink dataLink;
|
||||
|
||||
@Autowired
|
||||
public DataCalendarEvent dataCalendarEvent;
|
||||
|
||||
@Autowired
|
||||
public DataWiki dataWiki;
|
||||
|
||||
@Autowired
|
||||
public TenantConsole tenantConsole;
|
||||
|
||||
protected UserModel adminUser;
|
||||
protected UserModel testUser;
|
||||
protected SiteModel adminSite;
|
||||
protected SiteModel testSite;
|
||||
protected FolderModel testFolder;
|
||||
protected FileModel testFile;
|
||||
protected ContentModel contentModel;
|
||||
|
||||
@BeforeSuite(alwaysRun = true)
|
||||
public void checkServerHealth() throws Exception
|
||||
{
|
||||
super.springTestContextPrepareTestInstance();
|
||||
serverHealth.assertServerIsOnline();
|
||||
|
||||
UserModel anonymousUser = new UserModel("anonymous", DataUser.PASSWORD);
|
||||
if (!dataUser.isUserInRepo(anonymousUser.getUsername()))
|
||||
{
|
||||
dataUser.createUser(anonymousUser);
|
||||
dataGroup.usingUser(anonymousUser).addUserToGroup(GroupModel.getEmailContributorsGroup());
|
||||
}
|
||||
|
||||
String jmxUseJolokiaAgent = System.getProperty("jmx.useJolokiaAgent");
|
||||
if ("true".equals(jmxUseJolokiaAgent))
|
||||
{
|
||||
imapProtocol.assertThat().protocolIsEnabled();
|
||||
smtpProtocol.assertThat().protocolIsEnabled();
|
||||
ServerConfiguration.save(smtpProtocol.withJMX(), smtpProtocol.emailProperties);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.warn("*** Jolokia is not used! To use jolokia, please add next system property when running the tests: jmx.useJolokiaAgent=true ***");
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun=true)
|
||||
public void showStartTestInfo(Method method)
|
||||
{
|
||||
LOG.info(String.format("*** STARTING Test: [%s] ***",method.getName()));
|
||||
}
|
||||
|
||||
@AfterMethod(alwaysRun=true)
|
||||
public void showEndTestInfo(Method method)
|
||||
{
|
||||
LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
public class ImapCheckFolderTests extends EmailTest
|
||||
{
|
||||
UserModel managerUser;
|
||||
SiteModel managerTestSite;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
managerUser = dataUser.createRandomTestUser();
|
||||
managerTestSite = dataSite.usingUser(managerUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Returns the current working directory with admin user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldGetCurrentWorkingDirectory() throws Exception
|
||||
{
|
||||
testUser = dataUser.getAdminUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).assertThat().existsInRepo()
|
||||
.then().assertThat().currentDirectoryIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify in IMAP client current directory/list of directories for site manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldGetCurrentWorkingDirectory() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(managerUser).usingSite(managerTestSite).createFolder();
|
||||
imapProtocol.authenticateUser(managerUser).usingSite(managerTestSite).usingResource(testFolder).assertThat().existsInRepo()
|
||||
.then().assertThat().currentDirectoryIs(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Returns the directories list of the root for site manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldGetDirectoriesListOfRoot() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
FolderModel alfrescoImap = FolderModel.getRandomFolderModel();
|
||||
alfrescoImap.setName("Alfresco IMAP");
|
||||
FolderModel inbox = FolderModel.getRandomFolderModel();
|
||||
inbox.setName("INBOX");
|
||||
imapProtocol.authenticateUser(testUser).usingRoot()
|
||||
.then().assertThat().contains(alfrescoImap, inbox);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "User finds all its folders for IMAP Sites in Alfresco IMAP > Sites folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void userShouldFindAllIMAPSitesFoldersInAlfrescoIMAPFolder() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
SiteModel imapSite1 = dataSite.usingUser(testUser).createIMAPSite();
|
||||
SiteModel imapSite2 = dataSite.usingUser(testUser).createIMAPSite();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSites().assertThat().existsInImap()
|
||||
.then().assertThat().contains(imapSite1, imapSite2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify in IMAP client current directory/list of directories for COLLABORATOR user - folder created by other user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void collaboratorShouldGetCurrentWorkingDirectory() throws Exception
|
||||
{
|
||||
UserModel collaborator = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(managerUser).addUserToSite(collaborator, managerTestSite, UserRole.SiteCollaborator);
|
||||
|
||||
testFolder = dataContent.usingUser(managerUser).usingSite(managerTestSite).createFolder();
|
||||
imapProtocol.authenticateUser(collaborator).usingSite(managerTestSite).usingResource(testFolder).assertThat().existsInRepo()
|
||||
.then().assertThat().currentDirectoryIs(testFolder);
|
||||
|
||||
dataSite.usingUser(collaborator).usingSite(managerTestSite).setIMAPFavorite();
|
||||
|
||||
FolderModel testFolder1 = dataContent.usingUser(managerUser).usingSite(managerTestSite)
|
||||
.usingResource(testFolder).createFolder();
|
||||
FolderModel testFolder2 = dataContent.usingUser(managerUser).usingSite(managerTestSite)
|
||||
.usingResource(testFolder).createFolder();
|
||||
|
||||
imapProtocol.authenticateUser(collaborator).usingSite(managerTestSite)
|
||||
.usingResource(testFolder)
|
||||
.then().assertThat().contains(testFolder1,testFolder2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify in IMAP client current directory/list of directories for CONTRIBUTOR user - folder created by other user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void contributorShouldGetCurrentWorkingDirectory() throws Exception
|
||||
{
|
||||
UserModel contributor = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(managerUser).addUserToSite(contributor, managerTestSite, UserRole.SiteContributor);
|
||||
|
||||
testFolder = dataContent.usingUser(managerUser).usingSite(managerTestSite).createFolder();
|
||||
imapProtocol.authenticateUser(contributor).usingSite(managerTestSite).usingResource(testFolder).assertThat().existsInRepo()
|
||||
.then().assertThat().currentDirectoryIs(testFolder);
|
||||
|
||||
dataSite.usingUser(contributor).usingSite(managerTestSite).setIMAPFavorite();
|
||||
|
||||
FolderModel testFolder1 = dataContent.usingUser(managerUser).usingSite(managerTestSite)
|
||||
.usingResource(testFolder).createFolder();
|
||||
FolderModel testFolder2 = dataContent.usingUser(managerUser).usingSite(managerTestSite)
|
||||
.usingResource(testFolder).createFolder();
|
||||
|
||||
imapProtocol.authenticateUser(contributor).usingSite(managerTestSite)
|
||||
.usingResource(testFolder)
|
||||
.then().assertThat().contains(testFolder1,testFolder2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify in IMAP client current directory/list of directories for CONSUMER user - folder created by other user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void consumerShouldGetCurrentWorkingDirectory() throws Exception
|
||||
{
|
||||
UserModel consumer = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(managerUser).addUserToSite(consumer, managerTestSite, UserRole.SiteConsumer);
|
||||
|
||||
testFolder = dataContent.usingUser(managerUser).usingSite(managerTestSite).createFolder();
|
||||
imapProtocol.authenticateUser(consumer).usingSite(managerTestSite).usingResource(testFolder).assertThat().existsInRepo()
|
||||
.then().assertThat().currentDirectoryIs(testFolder);
|
||||
|
||||
dataSite.usingUser(consumer).usingSite(managerTestSite).setIMAPFavorite();
|
||||
|
||||
FolderModel testFolder1 = dataContent.usingUser(managerUser).usingSite(managerTestSite)
|
||||
.usingResource(testFolder).createFolder();
|
||||
FolderModel testFolder2 = dataContent.usingUser(managerUser).usingSite(managerTestSite)
|
||||
.usingResource(testFolder).createFolder();
|
||||
|
||||
imapProtocol.authenticateUser(consumer).usingSite(managerTestSite)
|
||||
.usingResource(testFolder)
|
||||
.then().assertThat().contains(testFolder1,testFolder2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized is not able to access document library section ( PUBLIC imap SITE)")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void unAuthorizedUserCannotAccessPublicImapSiteDocumentLibrary() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
SiteModel publicImapSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
dataSite.usingUser(unauthorizedUser).usingSite(publicImapSite).setIMAPFavorite();
|
||||
|
||||
imapProtocol.authenticateUser(unauthorizedUser).usingSite(publicImapSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized is not able to access document library section ( Moderated imap SITE)")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void unAuthorizedUserCannotAccessModeratedImapSiteDocumentLibrary() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
SiteModel moderatedImapSite = dataSite.usingUser(testUser).createModeratedRandomSite();
|
||||
dataSite.usingUser(unauthorizedUser).usingSite(moderatedImapSite).setIMAPFavorite();
|
||||
|
||||
imapProtocol.authenticateUser(unauthorizedUser).usingSite(moderatedImapSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized is not able to access document library section ( Private imap SITE)")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = MessagingException.class,
|
||||
expectedExceptionsMessageRegExp = ".*Access Denied.*You do not have the appropriate permissions to perform this operation.*")
|
||||
public void unAuthorizedUserCannotAccessPrivateImapSiteDocumentLibrary() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
SiteModel privateImapSite = dataSite.usingUser(testUser).createPrivateRandomSite();
|
||||
dataSite.usingUser(unauthorizedUser).usingSite(privateImapSite).setIMAPFavorite();
|
||||
|
||||
imapProtocol.authenticateUser(unauthorizedUser).usingSite(privateImapSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.exception.TestConfigurationException;
|
||||
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.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for Connection to Imap
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class ImapConnectionTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user can connect successfully to IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void correctUserConnectsToIMAPSuccessfully() throws Exception
|
||||
{
|
||||
imapProtocol.authenticateUser(testUser).then().assertThat().userIsConnected();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user fails to connect to IMAP on different port")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY }, expectedExceptions = TestConfigurationException.class)
|
||||
public void userFailsConnectToIMAPOnDifferentPort() throws Exception
|
||||
{
|
||||
imapProtocol.authenticateUser(testUser, 43).then().assertThat().userIsNotConnected();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user can disconnect successfully from IMAP Server")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void userDisconnectsFromImapServerSuccessfully() throws Exception
|
||||
{
|
||||
imapProtocol.authenticateUser(testUser)
|
||||
.disconnect().then().assertThat().userIsNotConnected();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user fails to connect to IMAP on different host")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = TestConfigurationException.class)
|
||||
public void userFailsConnectToIMAPOnDifferentHost() throws Exception
|
||||
{
|
||||
imapProtocol.authenticateUser(testUser, "172.29.101.1256").then().assertThat().userIsNotConnected();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify existing user with wrong password fails to connect to IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = TestConfigurationException.class,
|
||||
expectedExceptionsMessageRegExp =".*You missed some configuration settings in your tests: User failed to connect to IMAP server LOGIN failed. Invalid login/password$" )
|
||||
public void userFailsConnectToIMAPWithWrongPassword() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testUser.setPassword("invalid");
|
||||
imapProtocol.authenticateUser(testUser);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify a non existing user fails to connect to IMAP.")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = TestConfigurationException.class,
|
||||
expectedExceptionsMessageRegExp =".*You missed some configuration settings in your tests: User failed to connect to IMAP server LOGIN failed. Invalid login/password")
|
||||
public void nonExistentUserFailsConnectToIMAP() throws Exception
|
||||
{
|
||||
imapProtocol.authenticateUser(new UserModel("nonExistingUser", "pass"));
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
public class ImapCopyFolderTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify copy non-empty folder to a different location by admin user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldCopyNonEmptyFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
FolderModel copyFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
FolderModel copiedFolder = testFolder;
|
||||
copiedFolder.setProtocolLocation(Utility.buildPath(copyFolder.getProtocolLocation(), testFolder.getName()));
|
||||
dataContent.usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(adminUser).usingSite(adminSite).usingResource(testFolder)
|
||||
.copyTo(copyFolder).then().usingResource(copiedFolder).assertThat().countMessagesIs(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify copy folder with Manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldCopyFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel copyFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel copiedFolder = testFolder;
|
||||
copiedFolder.setCmisLocation(Utility.buildPath(copyFolder.getCmisLocation(), testFolder.getName()));
|
||||
copiedFolder.setProtocolLocation(Utility.buildPath(copyFolder.getProtocolLocation(), testFolder.getName()));
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.copyTo(copyFolder).then().usingResource(copiedFolder).assertThat().existsInRepo().assertThat().existsInImap();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify copy folder that has been deleted with Manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void siteManagerShouldNotCopyFolderThatHasBeenDeleted() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel folderModel = dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFolder).createFolder();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(folderModel).delete()
|
||||
.and().assertThat().doesNotExistInRepo().assertThat().doesNotContain(folderModel)
|
||||
.then().copyTo(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify copy folder with Contributor user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void contributorShouldCopyFolder() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel copyFolder = dataContent.usingUser(contributorUser).usingSite(testSite).createFolder();
|
||||
FolderModel copiedFolder = testFolder;
|
||||
copiedFolder.setProtocolLocation(Utility.buildPath(copyFolder.getProtocolLocation(), testFolder.getName()));
|
||||
dataContent.usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(contributorUser).usingSite(testSite).usingResource(testFolder)
|
||||
.copyTo(copyFolder).then().usingResource(copiedFolder).assertThat().countMessagesIs(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify copy folder with Collaborator user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void collaboratorShouldCopyFolder() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel copyFolder = dataContent.usingUser(collaboratorUser).usingSite(testSite).createFolder();
|
||||
FolderModel copiedFolder = testFolder;
|
||||
copiedFolder.setProtocolLocation(Utility.buildPath(copyFolder.getProtocolLocation(), testFolder.getName()));
|
||||
dataContent.usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(collaboratorUser).usingSite(testSite).usingResource(testFolder)
|
||||
.copyTo(copyFolder).then().usingResource(copiedFolder).assertThat().countMessagesIs(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that copy folder with Consumer user is not possible")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void consumerShouldNotCopyFolder() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(consumerUser, testSite, UserRole.SiteConsumer);
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel copyFolder = new FolderModel("copyFolder");
|
||||
imapProtocol.authenticateUser(consumerUser).usingSite(testSite).createFolder(copyFolder).usingResource(testFolder)
|
||||
.copyTo(copyFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify copy folder to a location for which the user does not have permission")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = MessagingException.class)
|
||||
public void userCopyFolderToALocationThatHeDoesNotHaveAccess() throws Exception
|
||||
{
|
||||
SiteModel siteModel = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
testFolder = dataContent.usingAdmin().usingSite(testSite).createFolder();
|
||||
FolderModel copyFolder = dataContent.usingAdmin().usingSite(siteModel).createFolder();
|
||||
dataContent.usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingResource(testFolder)
|
||||
.copyTo(copyFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
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.testng.SkipException;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImapCopyMessagesTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can copy non-empty file via IMAP client to a different location")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldCopyNonEmptyFile() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel fileModel = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(fileModel).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().copyMessageTo(testFolder).assertThat().containsMessages(fileModel);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can copy non-empty files via IMAP client to a different location")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldCopyNonEmptyFiles() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel fileModel1 = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
FileModel fileModel2 = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(fileModel1).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().usingSite(testSite).copyMessagesTo(testFolder).assertThat().containsMessages(fileModel1, fileModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can copy empty file via IMAP client to a different location")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerShouldCopyEmptyFile() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel fileModel = new FileModel("EmptyFile.txt", FileType.TEXT_PLAIN, "");
|
||||
fileModel = dataContent.usingUser(testUser).usingSite(testSite).createContent(fileModel);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(fileModel).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().copyMessageTo(testFolder).assertThat().containsMessages(fileModel);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can copy file via IMAP client to a location where the message already exists")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void userShouldCopyFileWhereAlreadyExists() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel fileModel = new FileModel("CopyFile.txt", FileType.TEXT_PLAIN, "content of copied file");
|
||||
dataContent.usingSite(testSite).usingResource(testFolder).createContent(fileModel);
|
||||
FileModel fileToBeCopied = dataContent.usingSite(testSite).createContent(fileModel);
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(fileToBeCopied).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().copyMessageTo(testFolder).assertThat().containsMessages(fileToBeCopied);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot copy a file via IMAP client if it was already deleted from repository")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = MessagingException.class,
|
||||
expectedExceptionsMessageRegExp ="There are no messages to be copied")
|
||||
public void userCannotCopyDeletedFile() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel fileModel = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(fileModel).assertThat().existsInImap();
|
||||
dataContent.usingResource(fileModel).deleteContent();
|
||||
imapProtocol.copyMessageTo(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot copy file via IMAP client to a location where you don't have permissions")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = MessagingException.class,
|
||||
expectedExceptionsMessageRegExp = ".*NO APPEND failed. Can't append message - Permission denied.*")
|
||||
public void userCannotCopyFileWhereNoPermissions() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
SiteModel site = dataSite.usingUser(user).createIMAPSite();
|
||||
FileModel file = dataContent.usingUser(user).usingSite(site).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
dataSite.usingUser(user).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
imapProtocol.authenticateUser(user).usingSite(site).usingResource(file).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().copyMessageTo(testFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
|
||||
/**
|
||||
* Tests for Create Folder action using IMAP client
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class ImapCreateFolderTests extends EmailTest
|
||||
{
|
||||
private UserModel adminUser;
|
||||
private SiteModel imapSite;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
imapSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin can create a folder in Afresco IMAP root folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminCanCreateFolderInAlfrescoImapRoot() throws Exception
|
||||
{
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(adminUser).usingAlfrescoImap().createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify user can create a folder in Afresco IMAP root folder, but it is not displayed in Alfresco Repository")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void userCanCreateFolderInAlfrescoImapRootButNotDisplayedInRepo() throws Exception
|
||||
{
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingAlfrescoImap().createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin can create a folder in Sites folder and it will be displayed in Alfresco Repository/Sites")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminCanCreateFolderInSitesFolder() throws Exception
|
||||
{
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(adminUser)
|
||||
.usingSites().createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify manager can create a folder in IMAP Site > documentLibrary")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void managerCanCreateFolderInIMAPSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(managerUser, imapSite, UserRole.SiteManager);
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(managerUser)
|
||||
.usingSite(imapSite).createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager can create a folder with spaces in name in IMAP Site > documentLibrary")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void managerCanCreateFolderWithSpacesInIMAPSite() throws Exception
|
||||
{
|
||||
UserModel managerUser = dataUser.createRandomTestUser();
|
||||
imapSite = dataSite.usingUser(managerUser).createIMAPSite();
|
||||
FolderModel folderToCreate = new FolderModel("Folder with spaces in name");
|
||||
|
||||
imapProtocol.authenticateUser(managerUser)
|
||||
.usingSite(imapSite).createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator can create a folder in IMAP Site > documentLibrary")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void collaboratorCanCreateFolderInImapSite() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser, imapSite, UserRole.SiteCollaborator);
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(collaboratorUser)
|
||||
.usingSite(imapSite).createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor can create a folder in IMAP Site > documentLibrary")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void contributorCanCreateFolderInImapSite() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, imapSite, UserRole.SiteCollaborator);
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(contributorUser)
|
||||
.usingSite(imapSite).createFolder(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer cannot create a folder in IMAP Site > documentLibrary")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void consumerCannotCreateFolderInImapSite() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser, imapSite, UserRole.SiteConsumer);
|
||||
dataSite.usingUser(consumerUser).usingSite(imapSite).setIMAPFavorite();
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(consumerUser).usingSite(imapSite).createFolder(folderToCreate)
|
||||
.and()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.then().usingSite(imapSite)
|
||||
.assertThat().doesNotContain(folderToCreate);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can create folder successfully with name that contains special characters")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanCreateFolderWithSpecialCharacters() throws Exception
|
||||
{
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
FolderModel folderToCreate = new FolderModel("(a)[b]!#%^");
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(folderToCreate)
|
||||
.then()
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can create folder successfully with name that contains symbols")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanCreateFolderWithSymbols() throws Exception
|
||||
{
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
FolderModel folderToCreate = new FolderModel("a£¥€$♊♎ ♏ ♐ ♑ ♒ ♓");
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(folderToCreate)
|
||||
.then()
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot create folder with name omegaΩ_<>./?")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCannotCreateFolderWithNameThatContainsRestrictedCharacters() throws Exception
|
||||
{
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
FolderModel folderToCreate = new FolderModel("omegaΩ_<>./?");
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(folderToCreate)
|
||||
.and()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.then().usingSite(testSite)
|
||||
.assertThat().doesNotContain(folderToCreate);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify create folder using an user and check folder can be view by another user with access to the same location/site")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void verifyUserCanViewTheFolderCreatedByAnotherUser() throws Exception
|
||||
{
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
UserModel collaboratorUser = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
FolderModel folderToCreate = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(collaboratorUser).usingSite(testSite).createFolder(folderToCreate).disconnect();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(folderToCreate)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify error is returned for unauthenticated user on creating folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = IllegalStateException.class,
|
||||
expectedExceptionsMessageRegExp = "Not connected")
|
||||
public void verifyErrorIsReturnedForUnauthenticatedUserTryingToCreateFolder() throws Exception
|
||||
{
|
||||
imapProtocol.authenticateUser(testUser).usingSite(imapSite).disconnect().then().createFolder(FolderModel.getRandomFolderModel());
|
||||
}
|
||||
}
|
||||
@@ -1,259 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
|
||||
public class ImapDeleteFolderTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify admin can delete folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldDeleteFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(adminUser).usingSite(adminSite).createFolder(testFolder)
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(adminSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site Manager can delete a folder with a message(file)")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldDeleteNonEmptyFolder() throws Exception
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
SiteModel site = dataSite.usingUser(user).createIMAPSite();
|
||||
FolderModel folder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(user).usingSite(site).createFolder(folder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
dataContent.usingUser(user).usingSite(site).usingResource(folder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.usingSite(site).usingResource(folder).assertThat().countMessagesIs(1)
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(site).assertThat().doesNotContain(folder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can delete a empty folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerShouldDeleteFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(testSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can delete a folder that contains collaborator user messages")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, enabled = false)//disable since it's failing intermitent
|
||||
public void siteManagerShouldDeleteFolderWithCollaboratorMessages() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
testFile = dataContent.usingUser(collaboratorUser).usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.usingSite(testSite).usingResource(testFolder)
|
||||
.assertThat().countMessagesIs(1)
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(testSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can delete a folder that contains contributor user messages")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, enabled = false)//disable since it's failing intermitent
|
||||
public void siteManagerShouldDeleteFolderWithContributorMessages() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
dataContent.usingUser(contributorUser).usingSite(testSite).usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.usingSite(testSite).usingResource(testFolder).assertThat().countMessagesIs(1)
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(testSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that an unauthorized user can not delete folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void unauthorizedUserShouldNotDeleteFolder() throws Exception
|
||||
{
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
imapProtocol.authenticateUser(unauthorizedUser).usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can delete a folder that contains consumer user messages")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void siteManagerShouldDeleteFolderWithConsumerMessages() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser, testSite, UserRole.SiteContributor);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo();
|
||||
dataContent.usingUser(consumerUser).usingSite(testSite).usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
dataUser.usingUser(testUser).removeUserFromSite(consumerUser, testSite);
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser, testSite, UserRole.SiteConsumer);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).assertThat().countMessagesIs(1)
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(testSite).assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot delete folder that no longer exists")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void userCannotDeleteFolderThatNoLongerExists() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo()
|
||||
.delete()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.usingSite(testSite).assertThat().doesNotContain(testFolder)
|
||||
.usingResource(testFolder)
|
||||
.delete();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleting folder that contains messages by COLLABORATOR user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void collaboratorTriesToDeleteFolderContainingMessagesByCollaborator() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser1 = dataUser.createRandomTestUser();
|
||||
UserModel collaboratorUser2 = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser1, testSite, UserRole.SiteCollaborator);
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser2, testSite, UserRole.SiteCollaborator);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
dataSite.usingUser(collaboratorUser1).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(collaboratorUser1).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo()
|
||||
.disconnect();
|
||||
testFile = dataContent.usingUser(collaboratorUser1).usingSite(testSite).usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
dataSite.usingUser(collaboratorUser2).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(collaboratorUser2).usingSite(testSite).usingResource(testFolder)
|
||||
.delete()
|
||||
.assertThat().existsInRepo()
|
||||
.usingSite(testSite).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleting folder that contains messages by CONTRIBUTOR user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void contributorTriesToDeleteFolderContainingMessagesByContributor() throws Exception
|
||||
{
|
||||
UserModel contributorUser1 = dataUser.createRandomTestUser();
|
||||
UserModel contributorUser2 = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser1, testSite, UserRole.SiteContributor);
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser2, testSite, UserRole.SiteContributor);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
dataSite.usingUser(contributorUser1).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(contributorUser1).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo()
|
||||
.disconnect();
|
||||
testFile = dataContent.usingUser(contributorUser1).usingSite(testSite).usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
dataSite.usingUser(contributorUser2).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(contributorUser2).usingSite(testSite).usingResource(testFolder)
|
||||
.delete()
|
||||
.assertThat().existsInRepo()
|
||||
.usingSite(testSite).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleting folder that contains messages by CONSUMER user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void consumerTriesToDeleteFolderContainingMessagesByConsumer() throws Exception
|
||||
{
|
||||
UserModel consumerUser1 = dataUser.createRandomTestUser();
|
||||
UserModel consumerUser2 = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser1, testSite, UserRole.SiteCollaborator);
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser2, testSite, UserRole.SiteConsumer);
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
dataSite.usingUser(consumerUser1).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(consumerUser1).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo()
|
||||
.disconnect();
|
||||
testFile = dataContent.usingUser(consumerUser1).usingSite(testSite).usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
dataUser.usingUser(testUser).removeUserFromSite(consumerUser1, testSite);
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser1, testSite, UserRole.SiteConsumer);
|
||||
dataSite.usingUser(consumerUser2).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(consumerUser2).usingSite(testSite).usingResource(testFolder)
|
||||
.delete()
|
||||
.assertThat().existsInRepo()
|
||||
.usingSite(testSite).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify delete folder from a location where you don't have permission")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void userTriesToDeleteFolderFromALocationToWhichHeDoesNotHavePermissionToDelete() throws Exception
|
||||
{
|
||||
UserModel userModel = dataUser.createRandomTestUser();
|
||||
SiteModel privateSite = dataSite.usingAdmin().createIMAPSite();
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(dataUser.getAdminUser()).usingSite(privateSite).createFolder(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo()
|
||||
.disconnect();
|
||||
|
||||
dataSite.usingUser(userModel).usingSite(privateSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(userModel).usingSite(testSite).usingResource(testFolder).delete();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin cannot delete a open folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = IllegalStateException.class,
|
||||
expectedExceptionsMessageRegExp = "This operation is not allowed on an open folder")
|
||||
public void adminTriesToDeleteOpenFolder() throws Exception
|
||||
{
|
||||
testFolder = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(adminUser).usingSite(adminSite).createFolder(testFolder)
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.attemptToDeleteOpenFolder();
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
public class ImapDeleteMessagesTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify message can be deleted from IMAP client by admin")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldDeleteMessage() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingAdmin().usingSite(adminSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(dataUser.getAdminUser()).usingSite(adminSite).assertThat().containsMessages(testFile)
|
||||
.and().usingResource(testFile).assertThat().existsInRepo().deleteMessage()
|
||||
.and().assertThat().doesNotContainMessages(testFile)
|
||||
.then().usingResource(testFile).assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify deleting message via IMAP client by user with MANAGER role")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldDeleteMessage() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingResource(testFile).assertThat().existsInRepo()
|
||||
.and().usingSite(testSite).assertThat().containsMessages(testFile).deleteMessage(testFile.getName())
|
||||
.and().assertThat().doesNotContainMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify message has been deleted via REPOSITORU by user with MANAGER role")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerVerifyMessageHasBeenDeletedFromRepository() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
dataContent.usingUser(testUser).usingResource(testFile).deleteContent();
|
||||
imapProtocol.authenticateUser(testUser).usingResource(testFile).assertThat().doesNotExistInRepo()
|
||||
.and().usingSite(testSite).assertThat().doesNotContainMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleting message via IMAP client by user with CONTRIBUTOR role")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteContributorShouldDeleteMessage() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
testFile = dataContent.usingUser(contributorUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(contributorUser).usingResource(testFile).deleteMessage()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo()
|
||||
.and().usingSite(testSite).assertThat().doesNotContainMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleting message via IMAP client by user with COLLABORATOR role")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteCollaboratorShouldDeleteMessage() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
testFile = dataContent.usingUser(collaboratorUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(collaboratorUser).usingResource(testFile).deleteMessage()
|
||||
.usingResource(testFile).assertThat().doesNotExistInRepo()
|
||||
.and().usingSite(testSite).assertThat().doesNotContainMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify deleting message via IMAP client by user with CONSUMER role is not permitted")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = MessagingException.class,
|
||||
expectedExceptionsMessageRegExp = ".*No permission to set DELETED flag")
|
||||
public void siteConsumerShouldNotDeleteMessage() throws Exception
|
||||
{
|
||||
UserModel consumerUser = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(consumerUser, testSite, UserRole.SiteConsumer);
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(consumerUser).usingResource(testFile).deleteMessage();
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.Flags;
|
||||
|
||||
public class ImapMessageFlagsTests extends EmailTest
|
||||
{
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can set flags action to a content(message) through IMAP Client")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldSetFlagsToAContent() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
FileModel fileModel = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingResource(fileModel).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.and().withMessage().setAnsweredFlag().setSeenFlag().updateFlags()
|
||||
.then().assertThat().messageContainsFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can set flags to a content(message) through IMAP Client")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerShouldSetFlagsToContent() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
FileModel fileModel = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingResource(fileModel).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.and().withMessage().setFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN).updateFlags()
|
||||
.then().assertThat().messageContainsFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site manager can remove flags from a content(message) through IMAP Client")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerShouldRemoveFlagsFromContent() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
FileModel fileModel = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingResource(fileModel).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.and().withMessage().setFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN).updateFlags()
|
||||
.and().assertThat().messageContainsFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN)
|
||||
.and().withMessage().removeFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN).updateFlags()
|
||||
.then().assertThat().messageDoesNotContainFlags(Flags.Flag.ANSWERED, Flags.Flag.SEEN);
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImapMoveFolderTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify move non-empty folder to a different location by admin user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldMoveNonEmptyFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
dataContent.usingAdmin().usingResource(testFolder).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(adminUser).usingSite(adminSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.and().usingResource(testFolder).assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(moveToFolder).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify move folder with Manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldMoveFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.and().usingResource(testFolder).assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(moveToFolder).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify move folder at location where the folder already exists is successful")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void userShouldMoveFolderWhereAlreadyExists() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
dataContent.usingUser(testUser).usingSite(testSite)
|
||||
.usingResource(moveToFolder)
|
||||
.createFolder(testFolder);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.and().usingResource(testFolder).assertThat().doesNotExistInRepo()
|
||||
.then().usingResource(moveToFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify move folder with Contributor will create the new folder, but is NOT able to delete the current one")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteContributorCannotMoveFolder() throws Exception
|
||||
{
|
||||
UserModel siteContributor = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(siteContributor, testSite, UserRole.SiteContributor);
|
||||
dataSite.usingUser(siteContributor).usingSite(testSite).setIMAPFavorite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
|
||||
imapProtocol.authenticateUser(siteContributor).usingSite(testSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.usingResource(moveToFolder).assertThat().contains(testFolder)
|
||||
.and().usingResource(testFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify move folder with Collaborator will create the new folder, but is NOT able to delete the current one")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteCollaboratorCannotMoveFolder() throws Exception
|
||||
{
|
||||
UserModel siteCollaborator = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(siteCollaborator, testSite, UserRole.SiteContributor);
|
||||
dataSite.usingUser(siteCollaborator).usingSite(testSite).setIMAPFavorite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
|
||||
imapProtocol.authenticateUser(siteCollaborator).usingSite(testSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.usingResource(moveToFolder).assertThat().contains(testFolder)
|
||||
.and().usingResource(testFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify move folder with Consumer will create the new folder, but is NOT able to delete the current one")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteConsumerCannotMoveFolder() throws Exception
|
||||
{
|
||||
UserModel siteConsumer = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(siteConsumer, testSite, UserRole.SiteContributor);
|
||||
dataSite.usingUser(siteConsumer).usingSite(testSite).setIMAPFavorite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
|
||||
imapProtocol.authenticateUser(siteConsumer).usingSite(testSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.usingResource(moveToFolder).assertThat().contains(testFolder)
|
||||
.and().usingResource(testFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify move folder fails using user that doesn't have permission to the IMAP site")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void unauthorizedUserCannotMoveFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
dataSite.usingUser(unauthorizedUser).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
imapProtocol.authenticateUser(unauthorizedUser).usingSite(testSite).usingResource(testFolder).moveTo(moveToFolder)
|
||||
.usingResource(moveToFolder).assertThat().doesNotContain(testFolder)
|
||||
.and().usingResource(testFolder).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify move folder with Manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void siteManagerShouldNotMoveDeletedFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FolderModel moveToFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.assertThat().existsInImap()
|
||||
.assertThat().existsInRepo()
|
||||
.delete()
|
||||
.moveTo(moveToFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImapMoveMessagesTests extends EmailTest
|
||||
{
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify site manager can move message via IMAP client to a different location")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldMoveNonEmptyFile() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
FileModel fileModel = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(fileModel).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().moveMessageTo(testFolder).assertThat().containsMessages(fileModel)
|
||||
.and().usingSite(testSite).assertThat().doesNotContainMessages(fileModel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImapReadMessagesAcsTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can see wiki pages via IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerCanViewWikiPages() throws Exception
|
||||
{
|
||||
dataWiki.usingUser(testUser).usingSite(testSite).createRandomWiki();
|
||||
imapProtocol.authenticateUser(testUser).usingSiteWikiContainer(testSite).assertThat().countMessagesIs(1);
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.Flags;
|
||||
import javax.mail.MessagingException;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ImapReadMessagesTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify folders created in repository in other folder via IMAP client by admin user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldGetFoldersCreatedInRepositoryViaImap() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingAdmin().usingSite(testSite).createFolder();
|
||||
FolderModel testFolder1 = FolderModel.getRandomFolderModel();
|
||||
FolderModel testFolder2 = FolderModel.getRandomFolderModel();
|
||||
imapProtocol.authenticateUser(adminUser).usingSite(adminSite).usingResource(testFolder).createFolder(testFolder1)
|
||||
.and().assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().usingResource(testFolder).createFolder(testFolder2).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify file and its content are displayed via IMAP client when the file is created by site manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldGetFileAndItsContentsViaImap() throws Exception
|
||||
{
|
||||
FileModel fileModel = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().containsMessages(fileModel)
|
||||
.and().usingResource(fileModel).assertThat().existsInRepo()
|
||||
.then().assertThat().fileContentIsDisplayed();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that file content in IMAP client contains creator, title, description, created date, " +
|
||||
"modifier, modified date, size, three links to content folder, to content url, to download url")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldVerifyFileContent() throws Exception
|
||||
{
|
||||
FileModel fileModel = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().containsMessages(fileModel)
|
||||
.and().usingResource(fileModel).assertThat().existsInRepo()
|
||||
.then().assertThat().messageContentMatchesFileModelData(fileModel);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that the admin user can mark a message as read")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void adminCanMarkMessageAsRead() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(adminUser).usingSite(adminSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
imapProtocol.authenticateUser(adminUser).usingResource(testFile).withMessage().setSeenFlag().updateFlags()
|
||||
.then().assertThat().messageContainsFlags(Flags.Flag.SEEN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can see wiki pages via IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerCanViewWikiPages() throws Exception
|
||||
{
|
||||
dataWiki.usingUser(testUser).usingSite(testSite).createRandomWiki();
|
||||
imapProtocol.authenticateUser(testUser).usingSiteWikiContainer(testSite).assertThat().countMessagesIs(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator can see files created by self")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void collaboratorCanViewFileCreatedBySelf() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
testFile = dataContent.usingUser(collaboratorUser).usingSite(testSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
imapProtocol.authenticateUser(collaboratorUser).usingSite(testSite).assertThat().containsMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that contributor can see files created by self")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void contributorCanViewFileCreatedBySelf() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.createRandomTestUser();
|
||||
dataUser.addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
testFile = dataContent.usingUser(contributorUser).usingSite(testSite).createContent(FileModel.getRandomFileModel(FileType.TEXT_PLAIN));
|
||||
imapProtocol.authenticateUser(contributorUser).usingSite(testSite).assertThat().containsMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify file created with spaces in the name is displayed in IMAP client")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void fileWithSpacesInNameIsDisplayedInImap() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(new FileModel("name with spaces.txt", FileType.TEXT_PLAIN));
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().containsMessages(testFile);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that a file created with name which contains special characters is visible in IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanViewFileWithSpecialCharactersInNameViaIMAP() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(new FileModel("(a)[b]!#%^.txt", FileType.TEXT_PLAIN));
|
||||
imapProtocol.authenticateUser(testUser)
|
||||
.usingSite(testSite).assertThat().containsMessages(testFile)
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that a file created with name which contains symbols is visible in IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanViewFileWithSymbolsInNameViaIMAP() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(new FileModel("a£¥€$♊♎♏♐♑♒♓Ω.txt", FileType.TEXT_PLAIN));
|
||||
imapProtocol.authenticateUser(testUser)
|
||||
.usingSite(testSite).assertThat().containsMessages(testFile)
|
||||
.usingResource(testFile).assertThat().existsInRepo();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can see links via IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void siteManagerCanViewLinks() throws Exception
|
||||
{
|
||||
dataLink.usingUser(testUser).usingSite(testSite).createRandomLink();
|
||||
imapProtocol.authenticateUser(testUser).usingSiteLinksContainer(testSite).assertThat().countMessagesIs(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can see calendar events via IMAP")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void siteManagerCanViewCalendarEvents() throws Exception
|
||||
{
|
||||
dataCalendarEvent.usingUser(testUser).usingSite(testSite).createRandomCalendarEvent();
|
||||
imapProtocol.authenticateUser(testUser).usingSiteCalendarContainer(testSite).assertThat().countMessagesIs(1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager cannot read file via IMAP if it is already deleted from repository")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = MessagingException.class,
|
||||
expectedExceptionsMessageRegExp = "No message with subject .* has been found")
|
||||
public void siteManagerCannotReadFileInImapIfItWasDeletedFromRepository() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite)
|
||||
.createContent(new FileModel(RandomData.getRandomName("File"), FileType.TEXT_PLAIN));
|
||||
dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFile).deleteContent();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFile).assertThat().fileContentIsDisplayed();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager cannot read file via IMAP client if it is locked by an user in repository")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = IOException.class,
|
||||
expectedExceptionsMessageRegExp = "No content")
|
||||
public void siteManagerCannotReadFileInImapIfItsLocked() throws Exception
|
||||
{
|
||||
String content = RandomData.getRandomAlphanumeric();
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite)
|
||||
.createContent(new FileModel(RandomData.getRandomName("File"), FileType.TEXT_PLAIN, content));
|
||||
dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFile).checkOutDocument();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFile).assertThat().fileContentIsDisplayed();
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.exception.TestConfigurationException;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.apache.commons.lang3.RandomStringUtils;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImapRenameFolderTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
adminSite = dataSite.usingAdmin().createIMAPSite();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify rename folder by admin user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void adminShouldRenameFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(adminUser).usingSite(adminSite).usingResource(testFolder).rename(newFolderName)
|
||||
.usingSite(adminSite)
|
||||
.assertThat().contains(new FolderModel(newFolderName))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify renaming folder by user with MANAGER role")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldRenameFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).rename(newFolderName)
|
||||
.usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel(newFolderName))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user with MANAGER role is not able to rename an nonexistent folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void siteManagerShouldNotRenameNonExistentFolder() throws Exception
|
||||
{
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(FolderModel.getRandomFolderModel())
|
||||
.rename(newFolderName)
|
||||
.assertThat().contains(testFolder)
|
||||
.and().assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user with MANAGER role is able to rename a folder with long name")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerShouldRenameFolderWithLongName() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String longName = RandomStringUtils.randomAlphabetic(200);
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.rename(longName)
|
||||
.usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel(longName))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify unauthorized user is not able to rename a folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void unauthorizedUserShouldNotRenameFolder() throws Exception
|
||||
{
|
||||
UserModel unauthorizedUser = dataUser.createRandomTestUser();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
|
||||
dataSite.usingUser(unauthorizedUser).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(unauthorizedUser).usingResource(testFolder)
|
||||
.rename(newFolderName)
|
||||
.then().assertThat().doesNotExistInRepo()
|
||||
.assertThat().contains(testFolder)
|
||||
.and().assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent user is not able to rename a folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = TestConfigurationException.class,
|
||||
expectedExceptionsMessageRegExp = ".*You missed some configuration settings in your tests: User failed to connect to IMAP server LOGIN failed. Invalid login/password$")
|
||||
public void nonexistentUserShouldNotRenameFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
|
||||
imapProtocol.authenticateUser(UserModel.getRandomUserModel()).usingResource(testFolder)
|
||||
.rename(newFolderName)
|
||||
.then().assertThat().doesNotExistInRepo()
|
||||
.and().assertThat().contains(testFolder)
|
||||
.and().assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify disconnected user is not able to rename a folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = IllegalStateException.class,
|
||||
expectedExceptionsMessageRegExp= "Not connected")
|
||||
public void disconnectedUserShouldNotRenameFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingResource(testFolder).assertThat().existsInImap().then()
|
||||
.disconnect().usingResource(testFolder)
|
||||
.rename(newFolderName)
|
||||
.then().assertThat().doesNotExistInRepo()
|
||||
.and().assertThat().contains(testFolder)
|
||||
.and().assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify renaming folder by user with COLLABORATOR role - folder created by self")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void collaboratorShouldRenameFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
|
||||
dataSite.usingUser(collaboratorUser).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
testFolder = dataContent.usingUser(collaboratorUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(collaboratorUser).usingSite(testSite).usingResource(testFolder)
|
||||
.rename(newFolderName)
|
||||
.usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel(newFolderName))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user with COLLABORATOR role is not able to rename a folder created by other user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void collaboratorShouldNotRenameFolderCreatedByOtherUser() throws Exception
|
||||
{
|
||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(collaboratorUser, testSite, UserRole.SiteCollaborator);
|
||||
|
||||
dataSite.usingUser(collaboratorUser).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(collaboratorUser).usingResource(testFolder).rename(newFolderName)
|
||||
.usingSite(testSite)
|
||||
.assertThat().contains(testFolder)
|
||||
.assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user with CONTRIBUTOR role is able to rename a folder created by self")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void contributorShouldRenameFolderCreatedBySelf() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
|
||||
dataSite.usingUser(contributorUser).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
testFolder = dataContent.usingUser(contributorUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(contributorUser).usingSite(testSite).usingResource(testFolder)
|
||||
.rename(newFolderName)
|
||||
.usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel(newFolderName))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user with CONTRIBUTOR role is NOT able to rename a folder created by other user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void contributorShouldNotRenameFolderCreatedByOtherUser() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
|
||||
dataSite.usingUser(contributorUser).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
FolderModel testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(contributorUser).usingSite(testSite).usingResource(testFolder)
|
||||
.rename(newFolderName).usingSite(testSite).then().assertThat().contains(testFolder)
|
||||
.and().assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user with CONSUMER role is not able to rename a folder created by other user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void consumerShouldNotRenameFolderCreatedByOtherUser() throws Exception
|
||||
{
|
||||
UserModel consumer = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(consumer, testSite, UserRole.SiteConsumer);
|
||||
|
||||
dataSite.usingUser(consumer).usingSite(testSite).setIMAPFavorite();
|
||||
|
||||
FolderModel testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String newFolderName = RandomData.getRandomName("Folder");
|
||||
imapProtocol.authenticateUser(consumer).usingSite(testSite).usingResource(testFolder)
|
||||
.rename(newFolderName).usingSite(testSite).then()
|
||||
.assertThat().contains(testFolder)
|
||||
.and().assertThat().doesNotContain(new FolderModel(newFolderName));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify renaming folder fails when it was deleted by another user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void userCannotRenameFolderDeletedByAnotherUser() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
dataSite.usingUser(contributorUser).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(contributorUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.delete().disconnect();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).rename("deletedFolderRename");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can rename folder to a name that contains white spaces")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanRenameFolderToAFolderThatContainsWhiteSpaces() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and()
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.rename("folder with name that contains spaces")
|
||||
.then().usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel("folder with name that contains spaces"))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can rename folder successfully with name that contains special characters")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanRenameFolderWithSpecialCharacters() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and()
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.rename("(a)[b]!#%^")
|
||||
.then().usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel("(a)[b]!#%^"))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can rename folder successfully with name that contains symbols")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCanRenameFolderWithSymbols() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and()
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.rename("a£¥€$♊♎ ♏ ♐ ♑ ♒ ♓")
|
||||
.then().usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel("a£¥€$♊♎ ♏ ♐ ♑ ♒ ♓"))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user cannot create folder with name omegaΩ_<>./?")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void userCannotRenameFolderWithNameThatContainsRestrictedCharacters() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and()
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.rename("omegaΩ_<>./?")
|
||||
.then().usingSite(testSite)
|
||||
.assertThat().contains(testFolder)
|
||||
.assertThat().doesNotContain(new FolderModel("omegaΩ_<>./?"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify renaming folder fails when it was renamed by another user")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void userCannotRenameFolderRenamedByAnotherUser() throws Exception
|
||||
{
|
||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||
dataUser.usingUser(testUser).addUserToSite(contributorUser, testSite, UserRole.SiteContributor);
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
dataSite.usingUser(contributorUser).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(contributorUser).usingSite(testSite).createFolder(testFolder)
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.rename("folderRenamedByUser").disconnect();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder).rename("deletedFolderRename");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify a site folder cannot be renamed via IMAP client")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void verifyASiteFolderCannotBeRenamedViaImap() throws Exception
|
||||
{
|
||||
SiteModel siteModel = dataSite.usingUser(testUser).createIMAPSite();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSiteRoot(siteModel).rename("new site name")
|
||||
.and()
|
||||
.assertThat().doesNotExistInRepo()
|
||||
.then().usingSites()
|
||||
.assertThat().doesNotContain(new FolderModel("new site name"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify renaming folder by changing the case")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL })
|
||||
public void verifyFolderCanBeRenamedByChangingTheCase() throws Exception
|
||||
{
|
||||
FolderModel testFolder = FolderModel.getRandomFolderModel();
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).createFolder(testFolder)
|
||||
.and()
|
||||
.assertThat().existsInRepo()
|
||||
.assertThat().existsInImap()
|
||||
.rename(testFolder.getName().toUpperCase())
|
||||
.then().usingSite(testSite)
|
||||
.assertThat().contains(new FolderModel(testFolder.getName().toUpperCase()))
|
||||
.assertThat().doesNotContain(testFolder);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImapRenameMessagesTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify the renamed file from repository is still preset in IMAP client with the old name for site manager")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void siteManagerShouldVerifyFileContentForRenamedFileViaImap() throws Exception
|
||||
{
|
||||
testFile = dataContent.usingUser(testUser).usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||
FileModel renamedFile = testFile;
|
||||
renamedFile.setName(FileModel.getRandomFileModel(FileType.TEXT_PLAIN).getName());
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFile).assertThat().existsInRepo()
|
||||
.and().assertThat().existsInImap()
|
||||
.then().renameMessageTo(renamedFile).assertThat().messageContentMatchesFileModelData(testFile);
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests for Search for Messages in IMAP client
|
||||
*
|
||||
* @author Cristina Axinte
|
||||
*
|
||||
*/
|
||||
public class ImapSearchMessagesTests extends EmailTest
|
||||
{
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that no results are returned when searching for a message name term with no match")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void noResultsReturnedWhenSearchingForNotExistingMessage() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String fileName1="File-new1";
|
||||
FileModel fileModel1 = dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.createContent(new FileModel(fileName1, fileName1, fileName1 + "description", FileType.TEXT_PLAIN, fileName1 + "content"));
|
||||
String fileName2="File2";
|
||||
FileModel fileModel2 = dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.createContent(new FileModel(fileName2, fileName2, fileName2 + "description", FileType.TEXT_PLAIN, fileName2 + "content"));
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.searchSubjectFor("new").assertThat().resultsContainMessage(fileModel1)
|
||||
.assertThat().resultsDoNotContainMessage(fileModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that searched message is returned when searching for full message name")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.SANITY })
|
||||
public void searchedMessageIsReturnedWhenSearchingForFullMessageName() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
String fileName1="File-new1";
|
||||
FileModel fileModel1 = dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.createContent(new FileModel(fileName1, fileName1, fileName1 + "description", FileType.TEXT_PLAIN, fileName1 + "content"));
|
||||
String fileName2="File2";
|
||||
FileModel fileModel2 = dataContent.usingUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.createContent(new FileModel(fileName2, fileName2, fileName2 + "description", FileType.TEXT_PLAIN, fileName2 + "content"));
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.searchSubjectFor("File2").assertThat().resultsContainMessage(fileModel2)
|
||||
.assertThat().resultsDoNotContainMessage(fileModel1);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that search results are returned for search term containing white spaces")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerVerifySearchResultsForWhiteSpaces() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
String fileName1="File new";
|
||||
FileModel fileModel1 = dataContent.usingUser(testUser).usingSite(testSite)
|
||||
.createContent(new FileModel(fileName1, fileName1, fileName1 + "description", FileType.TEXT_PLAIN, fileName1 + "content"));
|
||||
String fileName2="File new1";
|
||||
FileModel fileModel2 = dataContent.usingSite(testSite)
|
||||
.createContent(new FileModel(fileName2, fileName2, fileName2 + "description", FileType.TEXT_PLAIN, fileName2 + "content"));
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).searchSubjectFor("File new")
|
||||
.assertThat().resultsContainMessage(fileModel1, fileModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that search results are returned for search term containing wildcards")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerVerifySearchResultsForWildcards() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
String fileName1="File new 1";
|
||||
FileModel fileModel1 = dataContent.usingUser(testUser).usingSite(testSite)
|
||||
.createContent(new FileModel(fileName1, fileName1, fileName1 + "description", FileType.TEXT_PLAIN, fileName1 + "content"));
|
||||
String fileName2="File presentation 2";
|
||||
FileModel fileModel2 = dataContent.usingSite(testSite)
|
||||
.createContent(new FileModel(fileName2, fileName2, fileName2 + "description", FileType.TEXT_PLAIN, fileName2 + "content"));
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).searchSubjectWithWildcardsFor("File.*1.*")
|
||||
.assertThat().resultsContainMessage(fileModel1)
|
||||
.assertThat().resultsDoNotContainMessage(fileModel2);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that search results are returned for search term containing special characters")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerVerifySearchResultsForSpecialCharacters() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
String fileName1="File@#$%^&()-_=+-[]{};'";
|
||||
FileModel fileModel1 = dataContent.usingUser(testUser).usingSite(testSite)
|
||||
.createContent(new FileModel(fileName1, fileName1, fileName1 + "description", FileType.TEXT_PLAIN, fileName1 + "content"));
|
||||
String fileName2="File";
|
||||
FileModel fileModel2 = dataContent.usingSite(testSite)
|
||||
.createContent(new FileModel(fileName2, fileName2, fileName2 + "description", FileType.TEXT_PLAIN, fileName2 + "content"));
|
||||
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite)
|
||||
.searchSubjectFor("=").assertThat().resultsContainMessage(fileModel1).assertThat().resultsDoNotContainMessage(fileModel2)
|
||||
.searchSubjectFor("@").assertThat().resultsContainMessage(fileModel1).assertThat().resultsDoNotContainMessage(fileModel2)
|
||||
.searchSubjectFor("#").assertThat().resultsContainMessage(fileModel1).assertThat().resultsDoNotContainMessage(fileModel2)
|
||||
.searchSubjectFor("$").assertThat().resultsContainMessage(fileModel1).assertThat().resultsDoNotContainMessage(fileModel2)
|
||||
.searchSubjectFor("@#").assertThat().resultsContainMessage(fileModel1).assertThat().resultsDoNotContainMessage(fileModel2)
|
||||
.searchSubjectFor("[]").assertThat().resultsContainMessage(fileModel1).assertThat().resultsDoNotContainMessage(fileModel2);
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package org.alfresco.email.imap;
|
||||
|
||||
import org.alfresco.email.EmailTest;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.mail.FolderNotFoundException;
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
public class ImapSitesTests extends EmailTest
|
||||
{
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
testSite = dataSite.usingUser(testUser).createIMAPSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager can unsubscribe from a folder")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerCanUnSubscribeFromAFolder() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().isSubscribed()
|
||||
.usingResource(testFolder).assertThat().isSubscribed()
|
||||
.unsubscribe().assertThat().isNotSubscribed()
|
||||
.usingSite(testSite).assertThat().isSubscribed();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site manager is subscribed to folders created by self")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
|
||||
public void siteManagerIsSubscribedToFoldersCreatedBySelf() throws Exception
|
||||
{
|
||||
testFolder = new FolderModel("newFolder");
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().isSubscribed()
|
||||
.createFolder(testFolder).assertThat().existsInRepo().assertThat().existsInImap()
|
||||
.assertThat().isSubscribed();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that operations on a private site are not permitted")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = MessagingException.class,
|
||||
expectedExceptionsMessageRegExp = ".* Access Denied.*You do not have the appropriate permissions to perform this operation.*")
|
||||
public void verifyOperationsOnPrivateSiteAreNotPermitted() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminSite = dataSite.usingAdmin().createPrivateRandomSite();
|
||||
testFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
dataSite.usingUser(testUser).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(adminSite).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that operations on a moderated site are not permitted")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void verifyOperationsOnModeratedSiteAreNotPermitted() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
adminSite = dataSite.usingAdmin().createModeratedRandomSite();
|
||||
testFolder = dataContent.usingAdmin().usingSite(adminSite).createFolder();
|
||||
dataSite.usingUser(testUser).usingSite(testSite).setIMAPFavorite();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(adminSite).assertThat().contains(testFolder);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify site cannot be accessed in IMAP client if it is no longer an IMAP site or marked as IMAP favorite")
|
||||
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.FULL }, expectedExceptions = FolderNotFoundException.class)
|
||||
public void userCannotAccessSiteThatIsNoLongerAnImapSiteOrMarkedAsImapFavorite() throws Exception
|
||||
{
|
||||
testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().contains(testFolder);
|
||||
dataSite.usingUser(testUser).usingSite(testSite).unsetIMAPFavorite();
|
||||
imapProtocol.authenticateUser(testUser).usingSite(testSite).assertThat().contains(testFolder);
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,12 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<context:annotation-config />
|
||||
<context:component-scan base-package="org.alfresco" />
|
||||
|
||||
<import resource="classpath:dataprep-context.xml" />
|
||||
<import resource="classpath*:alfresco-tester-context.xml" />
|
||||
</beans>
|
||||
@@ -1,143 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="Tests for Test Group = sanity" verbose="1">
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener" />
|
||||
<listener class-name="org.alfresco.utility.report.HtmlReportListener" />
|
||||
</listeners>
|
||||
|
||||
<test name="Tas email sanity suite">
|
||||
<classes>
|
||||
<class name="org.alfresco.email.imap.ImapMoveMessagesTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldMoveNonEmptyFile" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapMessageFlagsTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldSetFlagsToAContent" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCopyFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldCopyNonEmptyFolder" />
|
||||
<include name="siteManagerShouldCopyFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapDeleteMessagesTests">
|
||||
<methods>
|
||||
<include name="adminShouldDeleteMessage" />
|
||||
<include name="siteManagerShouldDeleteMessage" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapRenameFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldRenameFolder" />
|
||||
<include name="siteManagerShouldRenameFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapRenameMessagesTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldVerifyFileContentForRenamedFileViaImap" />
|
||||
</methods>
|
||||
</class>
|
||||
<!-- <class name="org.alfresco.email.imap.ImapSearchMessagesTests">
|
||||
<methods>
|
||||
<include name="noResultsReturnedWhenSearchingForNotExistingMessage" />
|
||||
<include name="searchedMessageIsReturnedWhenSearchingForFullMessageName" />
|
||||
</methods>
|
||||
</class> -->
|
||||
<class name="org.alfresco.email.smtp.SmtpOverwriteDuplicatesTests">
|
||||
<methods>
|
||||
<include name="overwriteFileWhenOverwriteDuplicatesIsDisabled" />
|
||||
<include name="overwriteFileWhenOverwriteDuplicatesIsEnabled" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapDeleteFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldDeleteFolder" />
|
||||
<include name="siteManagerShouldDeleteNonEmptyFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapReadMessagesTests">
|
||||
<methods>
|
||||
<include name="adminShouldGetFoldersCreatedInRepositoryViaImap" />
|
||||
<include name="siteManagerShouldGetFileAndItsContentsViaImap" />
|
||||
<include name="siteManagerShouldVerifyFileContent" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapConnectionTests">
|
||||
<methods>
|
||||
<include name="correctUserConnectsToIMAPSuccessfully" />
|
||||
<include name="userDisconnectsFromImapServerSuccessfully" />
|
||||
<include name="userFailsConnectToIMAPOnDifferentPort" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCopyMessagesTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldCopyNonEmptyFile" />
|
||||
<include name="siteManagerShouldCopyNonEmptyFiles" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpConnectionTests">
|
||||
<methods>
|
||||
<include name="adminShouldConnectToSMTP" />
|
||||
<include name="adminShouldNotConnectToDisabledServer" />
|
||||
<!-- <include name="updateSmtpServerPort" /> -->
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCheckFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldGetCurrentWorkingDirectory" />
|
||||
<include name="siteManagerShouldGetCurrentWorkingDirectory" />
|
||||
<include name="siteManagerShouldGetDirectoriesListOfRoot" />
|
||||
<include name="userShouldFindAllIMAPSitesFoldersInAlfrescoIMAPFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpUnknownUserTests">
|
||||
<methods>
|
||||
<include name="emailSentSuccessfullyWithAnExistingUser" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpAllowedSendersTests">
|
||||
<methods>
|
||||
<include name="sendMailIsSuccessfulForAllowedUser" />
|
||||
<include name="sendingMailIsSuccessfulForAllUsers" />
|
||||
<include name="sendingMailIsSuccessfulForUsersBelongingToDomain" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapMoveFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldMoveNonEmptyFolder" />
|
||||
<include name="siteManagerShouldMoveFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpBlockedSendersTests">
|
||||
<methods>
|
||||
<include name="emailSentSuccessfullyWithUserAddedToEmailContributorsGroup" />
|
||||
<include name="sendMailIsDeniedForAllUsers" />
|
||||
<include name="sendMailIsDeniedForBlockedUser" />
|
||||
<include name="sendMailIsDeniedForUsersBelongingToDomain" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCreateFolderTests">
|
||||
<methods>
|
||||
<include name="adminCanCreateFolderInAlfrescoImapRoot" />
|
||||
<include name="adminCanCreateFolderInSitesFolder" />
|
||||
<include name="managerCanCreateFolderInIMAPSite" />
|
||||
<include name="userCanCreateFolderInAlfrescoImapRootButNotDisplayedInRepo" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpDisableInboundEmailTests">
|
||||
<methods>
|
||||
<include name="randomUserCannotConnectWithInboundDisabled" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpFolderAliasTests">
|
||||
<methods>
|
||||
<include name="randomUserWithAliasFolderReceivesEmail" />
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="Tests for Test Group = sanity" verbose="1">
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener" />
|
||||
<listener class-name="org.alfresco.utility.report.HtmlReportListener" />
|
||||
</listeners>
|
||||
|
||||
<test name="Tas email sanity suite">
|
||||
<classes>
|
||||
<class name="org.alfresco.email.imap.ImapMoveMessagesTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldMoveNonEmptyFile" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapMessageFlagsTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldSetFlagsToAContent" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCopyFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldCopyNonEmptyFolder" />
|
||||
<include name="siteManagerShouldCopyFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapDeleteMessagesTests">
|
||||
<methods>
|
||||
<include name="adminShouldDeleteMessage" />
|
||||
<include name="siteManagerShouldDeleteMessage" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapRenameFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldRenameFolder" />
|
||||
<include name="siteManagerShouldRenameFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapRenameMessagesTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldVerifyFileContentForRenamedFileViaImap" />
|
||||
</methods>
|
||||
</class>
|
||||
<!-- <class name="org.alfresco.email.imap.ImapSearchMessagesTests">
|
||||
<methods>
|
||||
<include name="noResultsReturnedWhenSearchingForNotExistingMessage" />
|
||||
<include name="searchedMessageIsReturnedWhenSearchingForFullMessageName" />
|
||||
</methods>
|
||||
</class> -->
|
||||
<class name="org.alfresco.email.smtp.SmtpOverwriteDuplicatesTests">
|
||||
<methods>
|
||||
<include name="overwriteFileWhenOverwriteDuplicatesIsDisabled" />
|
||||
<include name="overwriteFileWhenOverwriteDuplicatesIsEnabled" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapDeleteFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldDeleteFolder" />
|
||||
<include name="siteManagerShouldDeleteNonEmptyFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapReadMessagesTests">
|
||||
<methods>
|
||||
<include name="adminShouldGetFoldersCreatedInRepositoryViaImap" />
|
||||
<include name="siteManagerShouldGetFileAndItsContentsViaImap" />
|
||||
<include name="siteManagerShouldVerifyFileContent" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapConnectionTests">
|
||||
<methods>
|
||||
<include name="correctUserConnectsToIMAPSuccessfully" />
|
||||
<include name="userDisconnectsFromImapServerSuccessfully" />
|
||||
<include name="userFailsConnectToIMAPOnDifferentPort" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCopyMessagesTests">
|
||||
<methods>
|
||||
<include name="siteManagerShouldCopyNonEmptyFile" />
|
||||
<include name="siteManagerShouldCopyNonEmptyFiles" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpConnectionTests">
|
||||
<methods>
|
||||
<include name="adminShouldConnectToSMTP" />
|
||||
<include name="adminShouldNotConnectToDisabledServer" />
|
||||
<!-- <include name="updateSmtpServerPort" /> -->
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCheckFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldGetCurrentWorkingDirectory" />
|
||||
<include name="siteManagerShouldGetCurrentWorkingDirectory" />
|
||||
<include name="siteManagerShouldGetDirectoriesListOfRoot" />
|
||||
<include name="userShouldFindAllIMAPSitesFoldersInAlfrescoIMAPFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpUnknownUserTests">
|
||||
<methods>
|
||||
<include name="emailSentSuccessfullyWithAnExistingUser" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpAllowedSendersTests">
|
||||
<methods>
|
||||
<include name="sendMailIsSuccessfulForAllowedUser" />
|
||||
<include name="sendingMailIsSuccessfulForAllUsers" />
|
||||
<include name="sendingMailIsSuccessfulForUsersBelongingToDomain" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapMoveFolderTests">
|
||||
<methods>
|
||||
<include name="adminShouldMoveNonEmptyFolder" />
|
||||
<include name="siteManagerShouldMoveFolder" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpBlockedSendersTests">
|
||||
<methods>
|
||||
<include name="emailSentSuccessfullyWithUserAddedToEmailContributorsGroup" />
|
||||
<include name="sendMailIsDeniedForAllUsers" />
|
||||
<include name="sendMailIsDeniedForBlockedUser" />
|
||||
<include name="sendMailIsDeniedForUsersBelongingToDomain" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.imap.ImapCreateFolderTests">
|
||||
<methods>
|
||||
<include name="adminCanCreateFolderInAlfrescoImapRoot" />
|
||||
<include name="adminCanCreateFolderInSitesFolder" />
|
||||
<include name="managerCanCreateFolderInIMAPSite" />
|
||||
<include name="userCanCreateFolderInAlfrescoImapRootButNotDisplayedInRepo" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpDisableInboundEmailTests">
|
||||
<methods>
|
||||
<include name="randomUserCannotConnectWithInboundDisabled" />
|
||||
</methods>
|
||||
</class>
|
||||
<class name="org.alfresco.email.smtp.SmtpFolderAliasTests">
|
||||
<methods>
|
||||
<include name="randomUserWithAliasFolderReceivesEmail" />
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
@@ -4,14 +4,12 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-integration-test</artifactId>
|
||||
<name>content-repository-community-integration-test</name>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<artifactId>content-repository-community-tests</artifactId>
|
||||
<version>7.0.0-TEST4</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -30,6 +28,13 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>alfresco-community-repo-integration-test</artifactId>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
|
||||
-1494
File diff suppressed because it is too large
Load Diff
-1800
File diff suppressed because it is too large
Load Diff
-477
@@ -1,477 +0,0 @@
|
||||
package org.alfresco.tas.integration;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
import org.alfresco.rest.model.RestSiteContainerModel;
|
||||
import org.alfresco.rest.model.RestSiteContainerModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteEntry;
|
||||
import org.alfresco.rest.model.RestSiteMemberModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteMembershipRequestModel;
|
||||
import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.RandomData;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class IntegrationFullTests1 extends IntegrationTest
|
||||
{
|
||||
UserModel testUser1, testUser2, testUser3;
|
||||
SiteModel testSitePublic, testSiteModerated;
|
||||
|
||||
/**
|
||||
* Scenario 87
|
||||
* 1. Using RestApi Admin user creates a new group1
|
||||
* 2. Using CMIS create test users: U1, U2 and U3
|
||||
* 3. Using RestApi add users U2 and U3 to group1
|
||||
* 4. U1 creates public test site1 using CMIS
|
||||
* 5. U1 creates file1 using CMIS, WebDav, FTP
|
||||
* 6. U1 apply Acl permission in the new documents for testGroup with role Site Consumer using CMIS
|
||||
* 7. Get permissions for U2 using CMIS
|
||||
* 8. U2 edits files created with CMIS, WebDav, FTP using WebDav
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify document permissions are added for a group of users")
|
||||
public void addDocumentPermissionsForGroupOfUsers() throws Exception
|
||||
{
|
||||
STEP("1. Using RestApi Admin user creates a new group1");
|
||||
GroupModel group1 = dataGroup.createRandomGroup();
|
||||
|
||||
STEP("2. Using CMIS create test users: U1, U2 and U3");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
testUser3 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("3. Using RestApi add users U2 and U3 to group1");
|
||||
dataGroup.usingUser(testUser2).addUserToGroup(group1);
|
||||
dataGroup.usingUser(testUser3).addUserToGroup(group1);
|
||||
|
||||
STEP("4. U1 creates public test site1 using CMIS");
|
||||
testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("5. U1 creates file1 using CMIS, WebDav, FTP");
|
||||
FileModel cmisFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
|
||||
cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFile(cmisFile);
|
||||
FileModel webDavFile = FileModel.getRandomFileModel(FileType.HTML);
|
||||
webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFile(webDavFile);
|
||||
FileModel ftpFile = FileModel.getRandomFileModel(FileType.XML);
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFile(ftpFile);
|
||||
|
||||
STEP("6. U1 apply Acl permission in the new documents for testGroup with role Site Consumer using CMIS");
|
||||
cmisAPI.usingResource(cmisFile).addAcl(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(webDavFile).addAcl(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(ftpFile).addAcl(group1, UserRole.SiteConsumer);
|
||||
|
||||
STEP("7. Get permissions for U2 using CMIS");
|
||||
cmisAPI.usingResource(cmisFile).assertThat().permissionIsSetForGrup(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(webDavFile).assertThat().permissionIsSetForGrup(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(ftpFile).assertThat().permissionIsSetForGrup(group1, UserRole.SiteConsumer);
|
||||
|
||||
STEP("8. U2 edits files created with CMIS, WebDav, FTP using WebDav");
|
||||
String newContent = "new content";
|
||||
webDavProtocol.authenticateUser(testUser2)
|
||||
.usingResource(cmisFile).update(newContent)
|
||||
.assertThat().hasStatus(org.apache.commons.httpclient.HttpStatus.SC_FORBIDDEN)
|
||||
.usingResource(webDavFile).update(newContent)
|
||||
.assertThat().hasStatus(org.apache.commons.httpclient.HttpStatus.SC_FORBIDDEN)
|
||||
.usingResource(ftpFile).update(newContent)
|
||||
.assertThat().hasStatus(org.apache.commons.httpclient.HttpStatus.SC_FORBIDDEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 88
|
||||
* 1. Using RestApi Admin user creates a new group1
|
||||
* 2. Using CMIS create test users: U1, U2 and U3
|
||||
* 3. Using RestApi add users U2 and U3 to group1
|
||||
* 4. U1 creates public test site1 using CMIS
|
||||
* 5. U1 creates folder1 using CMIS, WebDav, FTP
|
||||
* 6. U1 apply Acl permission in the new folders for testGroup with role Site Consumer using CMIS
|
||||
* 7. Get permissions for U2 using CMIS
|
||||
* 8. U2 edits folders created with CMIS, WebDav, FTP using WebDav
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify folder permissions are added for a group of users")
|
||||
public void addFolderPermissionsForGroupOfUsers() throws Exception
|
||||
{
|
||||
STEP("1. Using RestApi Admin user creates a new group1");
|
||||
GroupModel group1 = dataGroup.createRandomGroup();
|
||||
|
||||
STEP("2. Using CMIS create test users: U1, U2 and U3");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
testUser3 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("3. Using RestApi add users U2 and U3 to group1");
|
||||
dataGroup.usingUser(testUser2).addUserToGroup(group1);
|
||||
dataGroup.usingUser(testUser3).addUserToGroup(group1);
|
||||
|
||||
STEP("4. U1 creates public test site1 using CMIS");
|
||||
testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("5. U1 creates folders using CMIS, WebDav, FTP");
|
||||
FolderModel cmisFolder = FolderModel.getRandomFolderModel();
|
||||
cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(cmisFolder);
|
||||
FolderModel webDavFolder = FolderModel.getRandomFolderModel();
|
||||
webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(webDavFolder);
|
||||
FolderModel ftpFolder = FolderModel.getRandomFolderModel();
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(ftpFolder);
|
||||
|
||||
STEP("6. U1 apply Acl permission in the new folders for testGroup with role Site Consumer using CMIS");
|
||||
cmisAPI.usingResource(cmisFolder).addAcl(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(webDavFolder).addAcl(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(ftpFolder).addAcl(group1, UserRole.SiteConsumer);
|
||||
|
||||
STEP("7. Get permissions for U2 using CMIS");
|
||||
cmisAPI.usingResource(cmisFolder).assertThat().permissionIsSetForGrup(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(webDavFolder).assertThat().permissionIsSetForGrup(group1, UserRole.SiteConsumer);
|
||||
cmisAPI.usingResource(ftpFolder).assertThat().permissionIsSetForGrup(group1, UserRole.SiteConsumer);
|
||||
|
||||
STEP("8. U2 edits folders created with CMIS, WebDav, FTP using WebDav");
|
||||
String newName = "newName";
|
||||
webDavProtocol.authenticateUser(testUser2)
|
||||
.usingResource(cmisFolder).rename(newName)
|
||||
.assertThat().hasStatus(org.apache.commons.httpclient.HttpStatus.SC_FORBIDDEN)
|
||||
.usingResource(webDavFolder).rename(newName)
|
||||
.assertThat().hasStatus(org.apache.commons.httpclient.HttpStatus.SC_FORBIDDEN)
|
||||
.usingResource(ftpFolder).rename(newName)
|
||||
.assertThat().hasStatus(org.apache.commons.httpclient.HttpStatus.SC_FORBIDDEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 102
|
||||
* 1. Using CMIS create test users: U1 and U2
|
||||
* 2. U1 creates moderated test site1 using CMIS
|
||||
* 3. U2 creates site membership request to site1 with RestAPI
|
||||
* 4. U2 gets site membership request, check new message using RestAPI
|
||||
* 5. U2 updates site membership request with a new message using RestAPI
|
||||
* 6. U2 gets site membership request, check new message using RestAPI
|
||||
* 7. U1 changes site visibility to private site using RestAPI
|
||||
* 8. U2 updates site membership request with a new message using RestAPI
|
||||
* 9. U2 gets site membership request, check new message using RestAPI
|
||||
* 10. U1 change site visibility to moderated site RestAPI
|
||||
* 11. U2 gets site membership request, check new message using RestAPI
|
||||
* 12. U2 updates site membership request with a new message using RestAPI
|
||||
* 13. U2 get site membership request, check new message using RestAPI
|
||||
* 14. U1 user1 changes site visibility to public using RestAPI
|
||||
* 15. U2 updates site membership request with a new message with RestAPI
|
||||
* 16. U2 gets site membership request, check new message using RestAPI
|
||||
* 17. U1 changes site visibility to moderated site RestAPI");
|
||||
* 18. U2 gets site membership request, check new message using RestAPI");
|
||||
* 19. U2 updates new site membership request using RestAPI
|
||||
* 20. U1 approves site membership using RestAPI
|
||||
* 21. U2 gets site membership request - no request using RestAPI
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user can update or not site membership request when site visibility is updated")
|
||||
public void updateSiteMembershipRequestWhenSiteVisibilityIsUpdated() throws Exception
|
||||
{
|
||||
STEP("1. Using CMIS create 2 test users: U1 and U2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("2. U1 creates moderated test site1 using CMIS");
|
||||
testSiteModerated = dataSite.usingUser(testUser1).createModeratedRandomSite();
|
||||
|
||||
STEP("3. U2 creates site membership request to site1 with RestAPI");
|
||||
restAPI.authenticateUser(testUser2).withCoreAPI().usingMe().addSiteMembershipRequest("Please add me 1", testSiteModerated, "Request1");
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("4. U2 gets site membership request, check new message using RestAPI");
|
||||
RestSiteMembershipRequestModel request = restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
request.assertThat().field("message").is("Please add me 1");
|
||||
|
||||
STEP("5. U2 updates site membership request with a new message using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().updateSiteMembershipRequest(testSiteModerated, "Please add me 2");
|
||||
request.assertThat().field("message").is("Please add me 2");
|
||||
|
||||
STEP("6. U2 gets site membership request, check new message using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
request.assertThat().field("message").is("Please add me 2");
|
||||
|
||||
STEP("7. U1 changes site visibility to private site using RestAPI");
|
||||
dataSite.usingUser(testUser1).updateSiteVisibility(testSiteModerated, Visibility.PRIVATE);
|
||||
|
||||
STEP("8. U2 updates site membership request with a new message using RestAPI");
|
||||
restAPI.withCoreAPI().usingMe().updateSiteMembershipRequest(testSiteModerated, "Please add me 2");
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
|
||||
STEP("9. U2 gets site membership request, check new message using RestAPI");
|
||||
restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
|
||||
STEP("10. U1 change site visibility to moderated site RestAPI");
|
||||
dataSite.usingUser(testUser1).updateSiteVisibility(testSiteModerated, Visibility.MODERATED);
|
||||
|
||||
STEP("11. U2 gets site membership request, check new message using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
request.assertThat().field("message").is("Please add me 2");
|
||||
|
||||
STEP("12. U2 updates site membership request with a new message using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().updateSiteMembershipRequest(testSiteModerated, "Please add me 3");
|
||||
request.assertThat().field("message").is("Please add me 3");
|
||||
|
||||
STEP("13. U2 get site membership request, check new message using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
request.assertThat().field("message").is("Please add me 3");
|
||||
|
||||
STEP("14. U1 user1 changes site visibility to public using RestAPI");
|
||||
dataSite.usingUser(testUser1).updateSiteVisibility(testSiteModerated, Visibility.PUBLIC);
|
||||
|
||||
STEP("15. U2 updates site membership request with a new message with RestAPI");
|
||||
restAPI.withCoreAPI().usingMe().updateSiteMembershipRequest(testSiteModerated, "Please add me 4");
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
|
||||
STEP("16. U2 gets site membership request, check new message using RestAPI");
|
||||
restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
|
||||
STEP("17. U1 changes site visibility to moderated site RestAPI");
|
||||
dataSite.usingUser(testUser1).updateSiteVisibility(testSiteModerated, Visibility.MODERATED);
|
||||
|
||||
STEP("18. U2 gets site membership request, check new message using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
request.assertThat().field("message").is("Please add me 3");
|
||||
|
||||
STEP("19. U2 updates new site membership request using RestAPI");
|
||||
request = restAPI.withCoreAPI().usingMe().updateSiteMembershipRequest(testSiteModerated, "Please add me 5");
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
request.assertThat().field("message").is("Please add me 5");
|
||||
|
||||
STEP("20. U1 approves site membership using RestAPI");
|
||||
RestTaskModel taskModel = restAPI.withWorkflowAPI().getTasks().getTaskModelByDescription(testSiteModerated);
|
||||
workflow.approveSiteMembershipRequest(testUser1.getUsername(), testUser1.getPassword(), taskModel.getId(), true, "Approve");
|
||||
|
||||
STEP("21. U2 gets site membership request - no request using RestAPI");
|
||||
restAPI.withCoreAPI().usingMe().getSiteMembershipRequest(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
RestSiteEntry site= restAPI.withCoreAPI().usingMe().getSiteMembership(testSiteModerated);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
site.assertThat().field("id").is(testSiteModerated.getId())
|
||||
.and().field("role").isNotEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 104
|
||||
* 1. Using CMIS create test user A1
|
||||
* 2. A1 creates public test site1 using CMIS
|
||||
* 3. Using CMIS create test user U1
|
||||
* 4. A1 adds U1 to site1 as site manager using RestAPI
|
||||
* 5. A1 get site members using RestAPI
|
||||
* 6. Using CMIS create test user U2
|
||||
* 7. A1 adds U2 to site1 as site collaborator using RestAPI
|
||||
* 8. A1 get site members using RestAPI
|
||||
* 9. Using CMIS create test user U3
|
||||
* 10. A1 add U3 to site1 as site contributor using RestAPI
|
||||
* 11. A1 get site members using RestAPI
|
||||
* 12. Using CMIS create test user U4
|
||||
* 13. A1 add U4 to site1 as site consumer using RestAPI
|
||||
* 14. A1 get site members using RestAPI
|
||||
* 15. Using CMIS delete test user U1
|
||||
* 16. A1 get site members using RestAPI
|
||||
* 17. Using CMIS delete test user U2
|
||||
* 18. A1 get site members using RestAPI
|
||||
* 19. Using CMIS delete test user U3
|
||||
* 20. A1 get site members using RestAPI
|
||||
* 21. Using CMIS delete test user U4
|
||||
* 22. A1 get site members using RestAPI
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify get site members when users are added to site or deleted")
|
||||
public void getSiteMembersWhenUsersAreAddedOrDeleted() throws Exception
|
||||
{
|
||||
STEP("1. Using CMIS create test user A1");
|
||||
UserModel testUser = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("2. A1 creates public test site1 using CMIS");
|
||||
testSitePublic = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
|
||||
STEP("3. Using CMIS create test user U1");
|
||||
UserModel user1 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("4. A1 adds U1 to site1 as site manager using RestAPI");
|
||||
user1.setUserRole(UserRole.SiteManager);
|
||||
restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).addPerson(user1);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("5. A1 get site members using RestAPI");
|
||||
RestSiteMemberModelsCollection members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("2");
|
||||
members.assertThat().entriesListContains("id", user1.getUsername())
|
||||
.and().entriesListContains("role", UserRole.SiteManager.toString());
|
||||
|
||||
STEP("6. Using CMIS create test user U2");
|
||||
UserModel user2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("7. A1 adds U2 to site1 as site collaborator using RestAPI");
|
||||
user2.setUserRole(UserRole.SiteCollaborator);
|
||||
restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).addPerson(user2);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("8. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("3");
|
||||
members.assertThat().entriesListContains("id", user2.getUsername())
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.toString());
|
||||
|
||||
STEP("9. Using CMIS create test user U3");
|
||||
UserModel user3 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("10. A1 add U3 to site1 as site contributor using RestAPI");
|
||||
user3.setUserRole(UserRole.SiteContributor);
|
||||
restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).addPerson(user3);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("11. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("4");
|
||||
members.assertThat().entriesListContains("id", user3.getUsername())
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.toString());
|
||||
|
||||
STEP("12. Using CMIS create test user U4");
|
||||
UserModel user4 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("13. A1 add U4 to site1 as site consumer using RestAPI");
|
||||
user4.setUserRole(UserRole.SiteConsumer);
|
||||
restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).addPerson(user4);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("14. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("5");
|
||||
members.assertThat().entriesListContains("id", user4.getUsername())
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.toString());
|
||||
|
||||
STEP("15. Using CMIS delete test user U1");
|
||||
dataUser.deleteUser(user1);
|
||||
|
||||
STEP("16. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("4");
|
||||
members.assertThat().entriesListDoesNotContain("id", user1.getUsername());
|
||||
|
||||
STEP("17. Using CMIS delete test user U2");
|
||||
dataUser.deleteUser(user2);
|
||||
|
||||
STEP("18. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("3");
|
||||
members.assertThat().entriesListDoesNotContain("id", user2.getUsername());
|
||||
|
||||
STEP("19. Using CMIS delete test user U3");
|
||||
dataUser.deleteUser(user3);
|
||||
|
||||
STEP("20. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("2");
|
||||
members.assertThat().entriesListDoesNotContain("id", user3.getUsername());
|
||||
|
||||
STEP("21. Using CMIS delete test user U4");
|
||||
dataUser.deleteUser(user4);
|
||||
|
||||
STEP("22. A1 get site members using RestAPI");
|
||||
members = restAPI.authenticateUser(testUser).withCoreAPI().usingSite(testSitePublic).getSiteMembers();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
members.assertThat().paginationField("count").is("1");
|
||||
members.assertThat().entriesListDoesNotContain("id", user4.getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 105
|
||||
* 1. Using CMIS create test user U1
|
||||
* 2. U1 creates public test site1 using CMIS
|
||||
* 3. U1 creates file1 using Webdav
|
||||
* 4. U1 updates file1 properties using CMIS
|
||||
* 5. U1 gets file1 properties using CMIS
|
||||
* 6. U1 renames file1 using Webdav
|
||||
* 7. U1 updates file1 content using FTP
|
||||
* 8. U1 adds tags to file1 using RestAPI
|
||||
* 9. U1 updates file1 properties using CMIS
|
||||
* 10. U1 gets file1 properties using CMIS
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify file properties with file properties are updated")
|
||||
public void checkFilePropertiesWhenFileIsUpdated() throws Exception
|
||||
{
|
||||
STEP("1. Using CMIS create test user U1");
|
||||
UserModel testUser = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("2. U1 creates public test site1 using CMIS");
|
||||
testSitePublic = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
|
||||
STEP("3. U1 creates file1 using Webdav");
|
||||
FileModel file1 = FileModel.getRandomFileModel(FileType.MSWORD2007);
|
||||
file1.setContent("content1");
|
||||
webDavProtocol.authenticateUser(testUser).usingSite(testSitePublic).createFile(file1);
|
||||
|
||||
STEP("4. U1 updates file1 properties using CMIS");
|
||||
String newDescription = "New-" + file1.getDescription();
|
||||
String newTitle = "New title-" +file1.getTitle();
|
||||
cmisAPI.authenticateUser(testUser).usingSite(testSitePublic).usingResource(file1).updateProperty("cmis:description", newDescription)
|
||||
.updateProperty("cm:title", newTitle);
|
||||
|
||||
STEP("5. U1 gets file1 properties using CMIS");
|
||||
cmisAPI.authenticateUser(testUser).usingResource(file1).assertThat().contentPropertyHasValue("cmis:description", newDescription)
|
||||
.assertThat().contentPropertyHasValue("cm:title", newTitle);
|
||||
|
||||
STEP("6. U1 renames file1 using Webdav");
|
||||
String newName = "Edited-" + file1.getName();
|
||||
webDavProtocol.authenticateUser(testUser).usingSite(testSitePublic).usingResource(file1).rename(newName);
|
||||
|
||||
STEP("7. U1 updates file1 content using FTP");
|
||||
String newContent = "New " + file1.getContent();
|
||||
ftpProtocol.authenticateUser(testUser).usingSite(testSitePublic).usingResource(file1).update(newContent)
|
||||
.assertThat().contentIs(newContent);
|
||||
|
||||
STEP("8. U1 adds tags to file1 using RestAPI");
|
||||
String newTag = RandomData.getRandomName("tag");
|
||||
RestTagModel tag = restAPI.authenticateUser(testUser).withCoreAPI().usingResource(file1).addTag(newTag);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("9. U1 updates file1 properties using CMIS");
|
||||
newTitle = "New title2-" + file1.getTitle();
|
||||
cmisAPI.authenticateUser(testUser).usingSite(testSitePublic).usingResource(file1).updateProperty("cm:title", newTitle);
|
||||
|
||||
STEP("10. U1 gets file1 properties using CMIS");
|
||||
cmisAPI.authenticateUser(testUser).usingResource(file1).assertThat().contentPropertyHasValue("cmis:description", newDescription)
|
||||
.assertThat().contentPropertyHasValue("cm:title", newTitle)
|
||||
.assertThat().contentPropertyHasValue("cmis:name", newName)
|
||||
.assertThat().contentPropertyHasValue("cm:taggable", tag.getId())
|
||||
.assertThat().contentIs(newContent);
|
||||
}
|
||||
}
|
||||
-490
@@ -1,490 +0,0 @@
|
||||
package org.alfresco.tas.integration;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.*;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class IntegrationFullTestsBulk2 extends IntegrationTest
|
||||
{
|
||||
private UserModel testUser1;
|
||||
private SiteModel testSitePublic;
|
||||
private FolderModel testFolder1, testFolder2;
|
||||
private FileModel wordFile, testFile;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
|
||||
wordFile = FileModel.getRandomFileModel(FileType.MSWORD2007, "tasTesting");
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun = true)
|
||||
public void setup() throws DataPreparationException {
|
||||
testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
testFolder1 = FolderModel.getRandomFolderModel();
|
||||
testFolder2 = FolderModel.getRandomFolderModel();
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "testContent");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 73
|
||||
* 1. Create file1 using ftp
|
||||
* 2. Open document for edit using CMIS
|
||||
* 3. Try to edit document using Webdav while checked-out with CMIS
|
||||
* 4. Copy document to testFolder2 with ftp
|
||||
* 5. Update document from folder2, check its content is updated with Webdav
|
||||
* 6. Update document with WebDAV - should fail since document is checked out
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Edit checked out document using several protocols")
|
||||
public void updateFileUsingDifferentProtocolsWhileDocumentIsCheckedOut() throws Exception
|
||||
{
|
||||
STEP("1. Create testFile1 using ftp");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1)
|
||||
.usingResource(testFolder1).createFile(wordFile)
|
||||
.assertThat().contentIs("tasTesting");
|
||||
|
||||
STEP("2. Open document for edit using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(wordFile).checkOut();
|
||||
FileModel wordFilePWC = cmisAPI.usingResource(wordFile).withCMISUtil().getPWCFileModel();
|
||||
|
||||
STEP("3. Try to edit document using Webdav while checked-out with CMIS - content should be updated");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(wordFilePWC).update("update")
|
||||
.and().assertThat().contentIs("update");
|
||||
|
||||
STEP("4. Copy document to testFolder2 with ftp");
|
||||
FileModel copiedWordFile = new FileModel(wordFile);
|
||||
ftpProtocol.usingSite(testSitePublic).createFolder(testFolder2)
|
||||
.usingResource(wordFile).copyTo(testFolder2);
|
||||
copiedWordFile.setCmisLocation(ftpProtocol.getLastResourceWithoutPrefix());
|
||||
ftpProtocol.usingResource(testFolder1).assertThat().hasFiles(wordFile)
|
||||
.and().usingResource(testFolder2).assertThat().hasFiles(copiedWordFile);
|
||||
|
||||
STEP("5. Update document from folder2, check its content is updated with Webdav");
|
||||
webDavProtocol.usingResource(copiedWordFile).update("Step5")
|
||||
.and().assertThat().contentIs("Step5");
|
||||
|
||||
STEP("6. Update document with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(wordFile).update("WebDAVUpdate");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 84
|
||||
* 1. Create folder1 with webdav
|
||||
* 2. Upload new file, file1 with ftp
|
||||
* 3. Set content for file1 with cmis
|
||||
* 4. CheckOut file1 with cmis
|
||||
* 5. Try to edit file while checked-out with ftp
|
||||
* 6. Cancel checkout with cmis
|
||||
* 7. Try again to edit file with ftp
|
||||
* 8. Edit file content using webDav
|
||||
* 9. Get content using cmis, validate it
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL } )
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Update checked out document")
|
||||
public void updateCheckedOutFile() throws Exception
|
||||
{
|
||||
STEP("1. Create folder1 with webdav");
|
||||
webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Upload new file, file1 with ftp");
|
||||
ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(testFile)
|
||||
.and().assertThat().existsInRepo().and().assertThat().existsInFtp();
|
||||
|
||||
STEP("3. Set content for file1 with cmis");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile).update("cmisUpdate")
|
||||
.and().assertThat().contentIs("testContentcmisUpdate");
|
||||
|
||||
STEP("4. CheckOut file1 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut();
|
||||
|
||||
STEP("5. Try to edit file while checked-out with ftp - content should not be updated since file is checked out");
|
||||
ftpProtocol.usingResource(testFile).update("ftpUpdate")
|
||||
.and().assertThat().contentIs("testContentcmisUpdate");
|
||||
|
||||
STEP("6. Cancel checkout with cmis");
|
||||
cmisAPI.usingResource(testFile).cancelCheckOut();
|
||||
|
||||
STEP("7. Try again to edit file with ftp");
|
||||
ftpProtocol.usingResource(testFile).update("ftpUpdate")
|
||||
.and().assertThat().contentIs("ftpUpdate");
|
||||
|
||||
STEP("8. Edit file content using webDav");
|
||||
webDavProtocol.usingResource(testFile).update("webdavUpdate").and().assertThat().contentIs("webdavUpdate");
|
||||
|
||||
STEP("9. Get content using cmis, validate it");
|
||||
cmisAPI.usingResource(testFile).assertThat().contentIs("webdavUpdate");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Create folder1 with cmis
|
||||
* 2. Add new file with webdav
|
||||
* 3. Open file with Manager, add some content, save with webdav
|
||||
* 4. Open file with Consumer, add some content, save with ftp
|
||||
* 5. Open file with Contributor, delete some content, save with webdav
|
||||
* 6. Open file with Collaborator, add some content, save with WebDAV
|
||||
* 7. Open file with Consumer, delete some content, save with webdav
|
||||
* 8. Open file with Manager, add new content, save with cmis
|
||||
* 9. Open file with Collaborator, delete content that Manager added with ftp
|
||||
* 10. Open file with Manager, add new content with webdav
|
||||
* 11. Delete all content with admin using FTP
|
||||
* 12. Delete file with cmis
|
||||
* 13. Check file is deleted with WebDAV
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Update file with different user roles and protocols")
|
||||
public void updateFileWithDifferentRolesUsingDifferentProtocols() throws Exception
|
||||
{
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(testSitePublic, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
|
||||
STEP("1. Create folder1 with cmis");
|
||||
cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Add new file with webdav");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("3. Open file with Manager, add some content, save with webdav");
|
||||
webDavProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingResource(testFile).update("webdavUpdate")
|
||||
.and().assertThat().contentIs("webdavUpdate");
|
||||
|
||||
STEP("4. Open file with Consumer, add some content, save with ftp");
|
||||
ftpProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).update("ftpUpdate").and().assertThat().contentIs("webdavUpdate");
|
||||
|
||||
STEP("5. Open file with Contributor, delete some content, save with webdav");
|
||||
webDavProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFile).update("webdavUpdate").and().assertThat().contentIs("webdavUpdate");
|
||||
|
||||
STEP("6. Open file with Collaborator, add some content, save with WebDAV");
|
||||
webDavProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).update("webdavUpdate2").and().assertThat().contentIs("webdavUpdate2");
|
||||
|
||||
STEP("7. Open file with Consumer, delete some content, save with webdav");
|
||||
webDavProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.usingResource(testFile).update("webdavUpdate3").and().assertThat().contentIs("webdavUpdate2");
|
||||
|
||||
STEP("8. Open file with Manager, add new content, save with cmis");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).update("cmisUpdate").and().assertThat().contentIs("webdavUpdate2cmisUpdate");
|
||||
|
||||
STEP("9. Open file with Collaborator, delete content that Manager added with ftp");
|
||||
ftpProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(testFile).update("ftpUpdate").and().assertThat().contentIs("ftpUpdate");
|
||||
|
||||
STEP("10. Open file with Contributor, add new page with webdav");
|
||||
webDavProtocol.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
|
||||
.usingResource(testFile).update("webdavUpdate").and().assertThat().contentIs("webdavUpdate");
|
||||
|
||||
STEP("11. Delete all content with admin using FTP");
|
||||
ftpProtocol.authenticateUser(dataUser.getAdminUser())
|
||||
.usingResource(testFile).update("").and().assertThat().contentIs("");
|
||||
|
||||
STEP("12. Delete file with cmis");
|
||||
cmisAPI.usingResource(testFile).delete().and().assertThat().doesNotExistInRepo();
|
||||
|
||||
STEP("13. Check file is deleted with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile).assertThat().doesNotExistInWebdav();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add file1 to document library with ftp
|
||||
* 2. Update file content with WebDAV
|
||||
* 3. Add a minor change to a document with cmis
|
||||
* 4. Add a change with webdav, check document version with cmis
|
||||
* 5. Add a major change to a document with cmis
|
||||
* 6. Delete document last version with cmis
|
||||
* 7. Try to edit previous version with cmis
|
||||
* 8. Update content with ftp, check version
|
||||
* 9. Check document content with WebDAV
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check document versioning")
|
||||
public void documentVersioningTest() throws Exception
|
||||
{
|
||||
STEP("1. Add file1 to document library with ftp");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Update file content with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile).update("WebDAVUpdate").and().assertThat().contentIs("WebDAVUpdate");
|
||||
|
||||
STEP("3. Add a minor change to a document with cmis");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile).update("cmisUpdate")
|
||||
.then().assertThat().documentHasVersion(1.1).and().assertThat().contentIs("WebDAVUpdatecmisUpdate");
|
||||
|
||||
STEP("4. Check document version with webdav");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile).update("webdavUpdate");
|
||||
cmisAPI.assertThat().documentHasVersion(1.2);
|
||||
|
||||
STEP("5. Add a major change to a document with cmis");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile).checkOut().prepareDocumentForCheckIn().withMajorVersion().checkIn()
|
||||
.and().assertThat().documentHasVersion(2.0);
|
||||
|
||||
STEP("6. Delete document last version with cmis");
|
||||
cmisAPI.usingResource(testFile).deleteAllVersions(false).and().assertThat().documentHasVersion(1.2);
|
||||
|
||||
STEP("7. Try to edit previous version with cmis");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile).update("cmisUpdate")
|
||||
.then().assertThat().documentHasVersion(1.3).and().assertThat().contentIs("webdavUpdatecmisUpdate");
|
||||
|
||||
STEP("8. Update content with ftp, check version");
|
||||
ftpProtocol.usingResource(testFile).update("ftpUpdate");
|
||||
cmisAPI.assertThat().documentHasVersion(1.4);
|
||||
|
||||
STEP("9. Check document content with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile).assertThat().contentIs("ftpUpdate");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 82
|
||||
* 1. Create user1, user2
|
||||
* 2. User1 creates site1 and invites user2 as manager
|
||||
* 3. User1 adds document1 and tag1 to doc
|
||||
* 4. User2 gets tags and verifies tag1 appears
|
||||
* 5. User2 delete tag1
|
||||
* 6. User1 tries to update tag1
|
||||
* 7. User1 add new tag tag2
|
||||
* 8. User2 verifies tag2 appears and tag1 is not in the list
|
||||
* 9. User2 deletes document1
|
||||
* 10. User1 tries to delete tag2
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, description = "Check negative scenarios for tags")
|
||||
public void tagsNegativeScenariosTest() throws Exception
|
||||
{
|
||||
STEP("1. Create user1, user2");
|
||||
UserModel user1 = dataUser.createRandomTestUser();
|
||||
UserModel user2 = dataUser.createRandomTestUser();
|
||||
user2.setUserRole(UserRole.SiteManager);
|
||||
|
||||
STEP("2. User1 creates site1 and invites user2 as manager");
|
||||
SiteModel site = dataSite.usingUser(user1).createPublicRandomSite();
|
||||
restAPI.authenticateUser(user1).withCoreAPI().usingSite(site).addPerson(user2);
|
||||
|
||||
STEP("3. User1 adds document1 and tag1 to doc");
|
||||
dataContent.usingUser(user1).usingSite(site).createContent(testFile);
|
||||
RestTagModel tag = restAPI.withCoreAPI().usingResource(testFile).addTag("tag1");
|
||||
restAPI.withCoreAPI().usingResource(testFile).getNodeTags().assertThat().entriesListContains("tag", "tag1");
|
||||
|
||||
STEP("4. User2 gets tags and verifies tag1 appears");
|
||||
restAPI.authenticateUser(user2).withCoreAPI().usingResource(testFile).getNodeTags().assertThat().entriesListContains("tag", "tag1");
|
||||
|
||||
STEP("5. User2 delete tag1");
|
||||
restAPI.withCoreAPI().usingResource(testFile).deleteTag(tag);
|
||||
restAPI.withCoreAPI().usingResource(testFile).getNodeTags().assertThat().entriesListDoesNotContain("tag", "tag1");
|
||||
|
||||
STEP("6. User1 tries to update tag1");
|
||||
restAPI.authenticateUser(user2).withCoreAPI().usingTag(tag).update("updatedTag");
|
||||
restAPI.assertStatusCodeIs(HttpStatus.FORBIDDEN)
|
||||
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED)
|
||||
.containsErrorKey(RestErrorModel.PERMISSION_DENIED_ERRORKEY);
|
||||
|
||||
STEP("7. User1 add new tag tag2");
|
||||
tag = restAPI.authenticateUser(user1).withCoreAPI().usingResource(testFile).addTag("tag2");
|
||||
restAPI.withCoreAPI().usingResource(testFile).getNodeTags().assertThat().entriesListContains("tag", "tag2");
|
||||
|
||||
STEP("8. User2 verifies tag2 appears and tag1 is not in the list");
|
||||
restAPI.authenticateUser(user2).withCoreAPI().usingResource(testFile).getNodeTags()
|
||||
.assertThat().entriesListDoesNotContain("tag", "tag1")
|
||||
.assertThat().entriesListContains("tag", "tag2");
|
||||
|
||||
STEP("9. User2 deletes document1");
|
||||
dataContent.usingUser(user2).usingResource(testFile).deleteContent();
|
||||
|
||||
STEP("10. User1 tries to delete tag2");
|
||||
restAPI.authenticateUser(user1).withCoreAPI().usingResource(testFile).deleteTag(tag);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile.getNodeRefWithoutVersion()))
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 83
|
||||
* 1. Create user1, user2
|
||||
* 2. User1 creates site1 and invites user2 as manager with rest api
|
||||
* 3. User1 adds document1 with webdav
|
||||
* 4. User2 reads the document1 with ftp
|
||||
* 5. User1 update document1 with WebDAV
|
||||
* 6. User2 update the document1 with WebDAV
|
||||
* 7. User1 deletes the document1 with ftp
|
||||
* 8. Verify user2 cannot update document1 with cmis
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL }, expectedExceptions = CmisObjectNotFoundException.class, expectedExceptionsMessageRegExp = ".*Object not found:.*")
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Negative scenarios for update document")
|
||||
public void fileUpdateNegativeScenariosTest() throws Exception
|
||||
{
|
||||
STEP("1. Create user1, user2");
|
||||
UserModel user1 = dataUser.createRandomTestUser();
|
||||
UserModel user2 = dataUser.createRandomTestUser();
|
||||
user2.setUserRole(UserRole.SiteManager);
|
||||
|
||||
STEP("2. User1 creates site1 and invites user2 as manager with rest api");
|
||||
SiteModel site = dataSite.usingUser(user1).createPublicRandomSite();
|
||||
restAPI.authenticateUser(user1).withCoreAPI().usingSite(site).addPerson(user2);
|
||||
|
||||
STEP("3. User1 adds document1 with webdav");
|
||||
webDavProtocol.authenticateUser(user1).usingSite(site).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("4. User2 reads the document1 with ftp");
|
||||
ftpProtocol.authenticateUser(user2).usingResource(testFile).assertThat().contentIs("testContent");
|
||||
|
||||
STEP("5. User1 update document1 with WebDAV");
|
||||
webDavProtocol.authenticateUser(user1).usingResource(testFile).update("WebDAVUpdate1").assertThat().contentIs("WebDAVUpdate1");
|
||||
|
||||
STEP("6. User2 update the document1 with WebDAV");
|
||||
webDavProtocol.authenticateUser(user2).usingResource(testFile).update("WebDAVUpdate2").assertThat().contentIs("WebDAVUpdate2");
|
||||
|
||||
STEP("7. User1 deletes the document1 with ftp");
|
||||
ftpProtocol.authenticateUser(user1).usingResource(testFile).delete().assertThat().doesNotExistInFtp().assertThat().doesNotExistInRepo();
|
||||
|
||||
STEP("8. Verify user2 cannot update document1 with cmis");
|
||||
cmisAPI.authenticateUser(user2).usingResource(testFile).update("cmisUpdate");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 85
|
||||
* 1. Upload file with CMIS
|
||||
* 2. Add some content with ftp
|
||||
* 3. Add a minor change to document, 1.2 with cmis
|
||||
* 4. Add a major change to document, 2.0 with cmis
|
||||
* 5. Add a minor change to document, 2.1 with cmis
|
||||
* 6. Delete version 2.0 with cmis with cmis
|
||||
* 7. Get document version with cmis
|
||||
* 8. Try to edit version 2.0 with cmis
|
||||
* 9. Delete version 2.1 with cmis
|
||||
* 10. Get document version with cmis
|
||||
* 11. Try to edit version 2.0 with cmis
|
||||
* 12. Check document content with ftp
|
||||
* 13. Check document version with cmis
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "File versioning test scenarios")
|
||||
public void fileVersioningScenariosTest() throws Exception
|
||||
{
|
||||
STEP("1. Upload file with CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Add some content with ftp ");
|
||||
ftpProtocol.authenticateUser(testUser1).usingResource(testFile).update("ftpUpdate").and().assertThat().contentIs("ftpUpdate");
|
||||
|
||||
STEP("3. Add a minor change to document, 1.1 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMinorVersion().checkIn().refreshResource().and().assertThat().documentHasVersion(1.2);
|
||||
|
||||
STEP("4. Add a major change to document, 2.0 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMajorVersion().checkIn().and().assertThat().documentHasVersion(2.0);
|
||||
|
||||
STEP("5. Add a minor change to document, 2.1 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMinorVersion().checkIn().and().assertThat().documentHasVersion(2.1);
|
||||
|
||||
STEP("6. Delete version 2.0 with cmis with cmis");
|
||||
cmisAPI.usingResource(testFile).deleteAllVersions(false);
|
||||
|
||||
STEP("7. Get document version with cmis");
|
||||
cmisAPI.usingResource(testFile).assertThat().documentHasVersion(2.0);
|
||||
|
||||
STEP("8. Try to edit version 2.0 with cmis");
|
||||
cmisAPI.usingResource(testFile).update("cmisUpdate").and().assertThat().contentIs("cmisUpdatecmisUpdate")
|
||||
.and().assertThat().documentHasVersion(2.1);
|
||||
|
||||
STEP("9. Delete version 2.1 with cmis");
|
||||
cmisAPI.usingResource(testFile).deleteAllVersions(false);
|
||||
|
||||
STEP("10. Get document version with cmis");
|
||||
cmisAPI.usingResource(testFile).assertThat().documentHasVersion(2.0);
|
||||
|
||||
STEP("11. Try to edit version 2.0 with cmis");
|
||||
cmisAPI.usingResource(testFile).update("cmisUpdate").and().assertThat().contentIs("cmisUpdatecmisUpdate")
|
||||
.and().assertThat().documentHasVersion(2.1);
|
||||
|
||||
STEP("12. Update and check document content with ftp");
|
||||
ftpProtocol.authenticateUser(testUser1).usingResource(testFile).update("ftpUpdate").assertThat().contentIs("ftpUpdate");
|
||||
|
||||
STEP("13. Check document version with cmis");
|
||||
cmisAPI.usingResource(testFile).assertThat().documentHasVersion(2.2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Upload file with cmis
|
||||
* 2. Add some content with WebDAV
|
||||
* 3. Add a minor change to document, 1.2 with cmis
|
||||
* 4. Add a major change to document, 2.0 with cmis
|
||||
* 5. Add a minor change to document, 2.1 with cmis
|
||||
* 6. Delete version 2.1 with cmis
|
||||
* 7. Try to edit the last version (which is now 2.0) with webdav
|
||||
* 8. Check version with CMIS
|
||||
* 9. Add new major change, version 3.0 with cmis
|
||||
* 10. Delete previous version with cmis
|
||||
* 11. Delete document with ftp
|
||||
* 12. Check document version with cmis
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL }, expectedExceptionsMessageRegExp = ".*Version Series not found.*",
|
||||
expectedExceptions = CmisObjectNotFoundException.class)
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "File versioning additional test scenarios")
|
||||
public void fileVersioningNegativeScenariosTest() throws Exception
|
||||
{
|
||||
STEP("1. Upload file with cmis");
|
||||
cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFile(testFile).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Add some content with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile).update("WebDAVUpdate").and().assertThat().contentIs("WebDAVUpdate");
|
||||
|
||||
STEP("3. Add a minor change to document, 1.2 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMinorVersion().checkIn().refreshResource().and().assertThat().documentHasVersion(1.2);
|
||||
|
||||
STEP("4. Add a major change to document, 2.0 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMajorVersion().checkIn().and().assertThat().documentHasVersion(2.0);
|
||||
|
||||
STEP("5. Add a minor change to document, 2.1 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMinorVersion().checkIn().refreshResource().and().assertThat().documentHasVersion(2.1);
|
||||
|
||||
STEP("6. Delete version 2.1 with cmis");
|
||||
cmisAPI.usingResource(testFile).deleteAllVersions(false).assertThat().documentHasVersion(2.0);
|
||||
|
||||
STEP("7. Try to edit the last version (which is now 2.0) with webdav");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile).update("webdavUpdate");
|
||||
|
||||
STEP("8. Check version with CMIS");
|
||||
cmisAPI.usingResource(testFile).assertThat().documentHasVersion(2.1);
|
||||
|
||||
STEP("9. Add new major change, version 3.0 with cmis");
|
||||
cmisAPI.usingResource(testFile).checkOut().prepareDocumentForCheckIn().withContent("cmisUpdate")
|
||||
.withMajorVersion().checkIn().and().assertThat().documentHasVersion(3.0);
|
||||
|
||||
STEP("10. Delete previous version with cmis");
|
||||
cmisAPI.usingResource(testFile).deleteAllVersions(false).assertThat().documentHasVersion(2.1);
|
||||
|
||||
STEP("11. Delete document with ftp");
|
||||
ftpProtocol.authenticateUser(testUser1).usingResource(testFile).delete().assertThat().doesNotExistInRepo();
|
||||
|
||||
STEP("12. Check document version with cmis - should fail");
|
||||
cmisAPI.usingResource(testFile).assertThat().documentHasVersion(2.1);
|
||||
}
|
||||
}
|
||||
-433
@@ -1,433 +0,0 @@
|
||||
package org.alfresco.tas.integration;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
import org.alfresco.rest.model.RestCommentModelsCollection;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
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.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class IntegrationFullTestsBulk3 extends IntegrationTest
|
||||
{
|
||||
private UserModel testUser1, testUser2;
|
||||
private SiteModel publicSite, moderatedSite, privateSite;
|
||||
private RestCommentModelsCollection comments;
|
||||
private FileModel testFile1, testFile2, wordFile ;
|
||||
private ListUserWithRoles usersWithRoles;
|
||||
private FolderModel testFolder1;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testFolder1 = FolderModel.getRandomFolderModel();
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 64
|
||||
* 1. Create folder1 with WEBDAV
|
||||
* 2. Create wordFile inside folder1 with CMIS
|
||||
* 3. Delete wordFile content with CMIS
|
||||
* 4. Update content using Collaborator role with CMIS
|
||||
* 5. Append content using Manager role with WebDAV
|
||||
* 6. Delete content that Manager added using Collaborator role with CMIS
|
||||
* 7. Rename wordFile with WebDAV
|
||||
* 9. Delete wordFile with WEBDAV
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "File handling using several protocols")
|
||||
public void fileHandlingWithCollaboratorRole() throws Exception
|
||||
{
|
||||
String contentCollaborator = "content added by Collaborator";
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteCollaborator);
|
||||
wordFile = FileModel.getRandomFileModel(FileType.MSWORD2007, "tasTesting");
|
||||
|
||||
STEP("1. Create folder1 with webdav");
|
||||
webDavProtocol.authenticateUser(testUser1).usingSite(publicSite).createFolder(testFolder1).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Create testFile1 inside folder1 using CMIS");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite).usingResource(testFolder1).createFile(wordFile)
|
||||
.assertThat().existsInRepo();
|
||||
|
||||
STEP("3. Delete wordFile content with WebDAV");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(wordFile).deleteContent();
|
||||
|
||||
STEP("4. Update content using Collaborator role with CMIS");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(wordFile).update(contentCollaborator)
|
||||
.assertThat().contentIs(contentCollaborator);
|
||||
|
||||
STEP("5. Append content using Manager role with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(wordFile).update("content added by Manager").assertThat().contentIs("content added by Manager");
|
||||
|
||||
STEP("6. Delete content that Manager added using Collaborator role with CMIS");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.usingResource(wordFile).deleteAllVersions(false)
|
||||
.and().assertThat().documentHasVersion(1.2);
|
||||
|
||||
STEP("7. Rename wordFile with FTP");
|
||||
ftpProtocol.authenticateUser(testUser1).usingResource(wordFile).rename("renamedFile.docx");
|
||||
|
||||
STEP("8. Delete file with WEBDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(wordFile).delete()
|
||||
.assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 65
|
||||
* 1. Create folder1 with WEBDAV
|
||||
* 2. Create wordFile inside folder1 with CMIS
|
||||
* 3. Delete wordFile content with CMIS
|
||||
* 4. Update content using Contributor role with CMIS
|
||||
* 5. Append content using Manager role with WebDAV
|
||||
* 6. Delete content that Manager added using Collaborator role with CMIS
|
||||
* 7. Rename wordFile with WEBDAV
|
||||
* 8. Delete wordFile with FTP
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "File handling using several protocols")
|
||||
public void fileHandlingWithContributorRole() throws Exception
|
||||
{
|
||||
String contentContributor = "content added by Contributor";
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteContributor);
|
||||
wordFile = FileModel.getRandomFileModel(FileType.MSWORD2007, "tasTesting");
|
||||
|
||||
STEP("1. Create folder1 with webdav");
|
||||
webDavProtocol.authenticateUser(testUser1).usingSite(publicSite).createFolder(testFolder1).and().assertThat().existsInRepo();
|
||||
|
||||
STEP("2. Create testFile1 inside folder1 using CMIS");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(testFolder1).createFile(wordFile)
|
||||
.assertThat().existsInRepo();
|
||||
|
||||
STEP("3. Delete wordFile content with CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(wordFile).deleteContent();
|
||||
|
||||
STEP("4. Update content using Contributor role with CMIS");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(wordFile).update(contentContributor)
|
||||
.assertThat().contentIs(contentContributor);
|
||||
|
||||
STEP("5. Append content using Manager role with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1)
|
||||
.usingResource(wordFile).update("content added by Manager")
|
||||
.assertThat().contentIs("content added by Manager");
|
||||
|
||||
STEP("6. Delete content that Manager added using Contributor role with CMIS");
|
||||
cmisAPI.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.usingResource(wordFile).deleteAllVersions(false)
|
||||
.and().assertThat().documentHasVersion(1.2);
|
||||
|
||||
STEP("7. Rename wordFile with WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(wordFile).rename("renamedFile.docx");
|
||||
|
||||
STEP("8. Delete file with FTP");
|
||||
ftpProtocol.authenticateUser(testUser1).usingResource(wordFile).delete().assertThat().doesNotExistInRepo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 76
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a public site using CMIS
|
||||
* 3. U1 creates testFile1 in public site's document library using FTP
|
||||
* 4. U1 adds comment1 for testFile1 using REST API
|
||||
* 5. U2 gets comment1 using REST API
|
||||
* 6. U1 updates testFile1 using WEBDAV
|
||||
* 7. U2 gets comment1 using REST API
|
||||
* 8. U1 deletes testFile1 using WebDAV
|
||||
* 9. U2 can not get comment1 using REST API
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT, TestGroup.COMMENTS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify comment is deleted .")
|
||||
public void negativeScenarioWithComments() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a public site using CMIS");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in public site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 adds comment1 for testFile1 using REST API");
|
||||
String newComment = "This is a new comment added by " + testUser1.getUsername();
|
||||
restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile1).addComment(newComment).assertThat().field("content").isNotEmpty().and().field("content").is(newComment);
|
||||
restAPI.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("* 5. U2 gets comment1 using REST API");
|
||||
comments = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1).getNodeComments();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", newComment);
|
||||
|
||||
STEP("* 6. U1 updates testFile1 using WEBDAV");
|
||||
String newContent = "This is new content added by " + testUser1.getUsername();
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile1).update(newContent).and().assertThat().contentIs(newContent);
|
||||
|
||||
STEP("* 7. U2 gets comment1 using REST API");
|
||||
comments = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1).getNodeComments();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.OK);
|
||||
comments.assertThat().entriesListContains("content", newComment);
|
||||
|
||||
STEP("* 8. U1 deletes testFile1 using WebDAV");
|
||||
webDavProtocol.authenticateUser(testUser1).usingResource(testFile1).delete().and().assertThat().doesNotExistInRepo();
|
||||
|
||||
STEP("* 9. U2 can not get comment1 using REST API");
|
||||
comments = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1).getNodeComments();
|
||||
restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 77
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a public site using CMIS
|
||||
* 3. U1 creates a file in public site's document library using FTP
|
||||
* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS
|
||||
* 5. U2 edits the document using FTP
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager permission to a document in a public site - is able to edit document.")
|
||||
public void addManagerPermissionToADocumentFromPublicSite() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a public site using CMIS");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in public site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile1).addAcl(testUser2, UserRole.SiteManager).then().assertThat().permissionIsSetForUser(testUser2, UserRole.SiteManager);
|
||||
|
||||
STEP("* 5. U2 edits the document using FTP");
|
||||
ftpProtocol.authenticateUser(testUser2).usingSite(publicSite).usingResource(testFile1).update("new Content").assertThat().contentIs("new Content");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 78
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a public site using CMIS
|
||||
* 3. U1 creates a file in public site's document library using FTP
|
||||
* 4. U1 applyAcl(permission) for U2 with role Site Collaborator to the document using CMIS
|
||||
* 5. U2 edits the document using FTP
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify collaborator permission to a document in a public site - is able to edit document.")
|
||||
public void addCollaboratorPermissionToADocumentFromPublicSite() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a public site using CMIS");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in public site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile1).addAcl(testUser2, UserRole.SiteCollaborator).then().assertThat().permissionIsSetForUser(testUser2, UserRole.SiteCollaborator);
|
||||
|
||||
STEP("* 5. U2 edits the document using FTP");
|
||||
ftpProtocol.authenticateUser(testUser2).usingSite(publicSite).usingResource(testFile1).update("new Content").assertThat().contentIs("new Content");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 79
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a public site using CMIS
|
||||
* 3. U1 creates a file in public site's document library using FTP
|
||||
* 4. U1 applyAcl(permission) for U2 with role Site Contributor to the document using CMIS
|
||||
* 5. U2 edits the document using FTP
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify contributor permission to a document in a public site - is not able to edit document.")
|
||||
public void addContributorPermissionToADocumentFromPublicSite() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a public site using CMIS");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in public site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile1).addAcl(testUser2, UserRole.SiteContributor).then().assertThat().permissionIsSetForUser(testUser2, UserRole.SiteContributor);
|
||||
|
||||
STEP("* 5. U2 edits the document using FTP");
|
||||
ftpProtocol.authenticateUser(testUser2).usingSite(publicSite).usingResource(testFile1).update("new Content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).usingResource(testFile1).assertThat().contentIs("file1 content");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 80
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a public site using CMIS
|
||||
* 3. U1 creates a file in public site's document library using FTP
|
||||
* 4. U1 applyAcl(permission) for U2 with role Site Consumer to the document using CMIS
|
||||
* 5. U2 edits the document using FTP
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify consumer permission to a document in a public site - is not able to edit document.")
|
||||
public void addConsumerPermissionToADocumentFromPublicSite() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a public site using CMIS");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in public site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile1).addAcl(testUser2, UserRole.SiteConsumer).then().assertThat().permissionIsSetForUser(testUser2, UserRole.SiteConsumer);
|
||||
|
||||
STEP("* 5. U2 edits the document using FTP");
|
||||
ftpProtocol.authenticateUser(testUser2).usingSite(publicSite).usingResource(testFile1).update("new Content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).usingResource(testFile1).assertThat().contentIs("file1 content");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 107
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a moderated site using CMIS
|
||||
* 3. U1 creates a file in moderated site's document library using FTP
|
||||
* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS
|
||||
* 5. U2 edits the document using FTP
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager permission to a document in a moderated site - is not able to edit document.")
|
||||
public void addManagerPermissionToADocumentFromModeratedSite() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a moderated site using CMIS");
|
||||
moderatedSite = dataSite.usingUser(testUser1).createModeratedRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in moderated site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(moderatedSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile1).addAcl(testUser2, UserRole.SiteManager).then().assertThat().permissionIsSetForUser(testUser2, UserRole.SiteManager);
|
||||
|
||||
STEP("* 5. U2 edits the document using FTP");
|
||||
ftpProtocol.authenticateUser(testUser2).usingSite(moderatedSite).usingResource(testFile1).update("new Content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(moderatedSite).usingResource(testFile1).assertThat().contentIs("file1 content");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 108
|
||||
* 1. Using CMIS create two users: u1 and u2
|
||||
* 2. U1 creates a private site using CMIS
|
||||
* 3. U1 creates a file in private site's document library using FTP
|
||||
* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS
|
||||
* 5. U2 edits the document using FTP
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager permission to a document in a private site - is not able to edit document.")
|
||||
public void addManagerPermissionToADocumentFromPrivateSite() throws Exception
|
||||
{
|
||||
STEP("* 1. Using CMIS create two users: u1 and u2");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
testUser2 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("* 2. U1 creates a private site using CMIS");
|
||||
privateSite = dataSite.usingUser(testUser1).createPrivateRandomSite();
|
||||
|
||||
STEP("* 3. U1 creates a file in private site's document library using FTP");
|
||||
testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(privateSite).createFile(testFile1).then().assertThat().existsInRepo();
|
||||
|
||||
STEP("* 4. U1 applyAcl(permission) for U2 with role Site Manager to the document using CMIS");
|
||||
cmisAPI.authenticateUser(testUser1).usingResource(testFile1).addAcl(testUser2, UserRole.SiteManager).then().assertThat().permissionIsSetForUser(testUser2, UserRole.SiteManager);
|
||||
|
||||
STEP("* 5. U2 edits the document using FTP");
|
||||
ftpProtocol.authenticateUser(testUser2).usingSite(privateSite).usingResource(testFile1).update("new Content");
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(privateSite).usingResource(testFile1).assertThat().contentIs("file1 content");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 60
|
||||
* 1. Using CMIS creates one test user: u1
|
||||
* 2. U1 creates testFile1 in public site using FTP
|
||||
* 3. U1 creates testFile2 in public site using FTP
|
||||
* 4. U1 updates testFile2 using FTP
|
||||
* 5. Compare created date with modified date
|
||||
*/
|
||||
@Test(groups = { TestGroup.INTEGRATION, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT}, executionType = ExecutionType.REGRESSION, description = "Compare Modified Date")
|
||||
public void manageModificationTimeOfFile() throws Exception
|
||||
{
|
||||
STEP("1. Using CMIS creates one test user: u1");
|
||||
testUser1 = dataUser.createRandomTestUser();
|
||||
|
||||
STEP("2. U1 creates testFile1 in a public site using FTP");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
testFile1 = new FileModel("testFile1", FileType.TEXT_PLAIN);
|
||||
ftpProtocol.authenticateUser(testUser1).usingSite(publicSite).createFile(testFile1).assertThat().existsInRepo();
|
||||
String modifiedDate1 = ftpProtocol.getModificationTime();
|
||||
|
||||
STEP("3. U1 creates testFile2 in a public site using FTP");
|
||||
publicSite = dataSite.usingUser(testUser1).createPublicRandomSite();
|
||||
testFile2 = new FileModel("testFile1", FileType.TEXT_PLAIN);
|
||||
Utility.waitToLoopTime(2);
|
||||
ftpProtocol.usingSite(publicSite).createFile(testFile2).assertThat().existsInRepo();
|
||||
String modifiedDate2 = ftpProtocol.getModificationTime();
|
||||
Utility.waitToLoopTime(2, "Waiting for update");
|
||||
|
||||
STEP("4. U1 updates testFile2 in a public site using FTP");
|
||||
ftpProtocol.update("test update").assertThat().contentIs("test update");
|
||||
String updatedDate2 = ftpProtocol.getModificationTime();
|
||||
|
||||
STEP("5. Compare created date with modified date");
|
||||
Assert.assertNotEquals(modifiedDate1, modifiedDate2, "Updated and modified dates are equal");
|
||||
Assert.assertNotEquals(modifiedDate2, updatedDate2, "Modified and updated dates are equal");
|
||||
}
|
||||
|
||||
}
|
||||
-1109
File diff suppressed because it is too large
Load Diff
-106
@@ -1,106 +0,0 @@
|
||||
package org.alfresco.tas.integration;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.alfresco.cmis.CmisProperties;
|
||||
import org.alfresco.cmis.CmisWrapper;
|
||||
import org.alfresco.dataprep.WorkflowService;
|
||||
import org.alfresco.email.EmailProperties;
|
||||
import org.alfresco.email.ImapWrapper;
|
||||
import org.alfresco.email.SmtpWrapper;
|
||||
import org.alfresco.ftp.FTPWrapper;
|
||||
import org.alfresco.rest.core.RestProperties;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.utility.LogFactory;
|
||||
import org.alfresco.utility.data.DataContent;
|
||||
import org.alfresco.utility.data.DataGroup;
|
||||
import org.alfresco.utility.data.DataSite;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.data.DataWorkflow;
|
||||
import org.alfresco.utility.extension.ExtentionPointTestUtility;
|
||||
import org.alfresco.utility.network.ServerHealth;
|
||||
import org.alfresco.webdav.WebDavWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.BeforeSuite;
|
||||
|
||||
@ContextConfiguration("classpath:alfresco-integration-context.xml")
|
||||
public abstract class IntegrationTest extends AbstractTestNGSpringContextTests
|
||||
{
|
||||
private static Logger LOG = LogFactory.getLogger();
|
||||
|
||||
@Autowired
|
||||
protected DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
protected DataSite dataSite;
|
||||
|
||||
@Autowired
|
||||
protected DataContent dataContent;
|
||||
|
||||
@Autowired
|
||||
protected DataGroup dataGroup;
|
||||
|
||||
@Autowired
|
||||
protected DataWorkflow dataWorkflow;
|
||||
|
||||
@Autowired
|
||||
protected WorkflowService workflow;
|
||||
|
||||
@Autowired
|
||||
protected FTPWrapper ftpProtocol;
|
||||
|
||||
@Autowired
|
||||
protected WebDavWrapper webDavProtocol;
|
||||
|
||||
@Autowired
|
||||
protected CmisWrapper cmisAPI;
|
||||
|
||||
@Autowired
|
||||
protected CmisProperties cmisProperties;
|
||||
|
||||
@Autowired
|
||||
protected ImapWrapper imapProtocol;
|
||||
|
||||
@Autowired
|
||||
protected RestWrapper restAPI;
|
||||
|
||||
@Autowired
|
||||
protected ServerHealth serverHealth;
|
||||
|
||||
@Autowired
|
||||
protected RestProperties restProperties;
|
||||
|
||||
@Autowired
|
||||
protected ExtentionPointTestUtility extentionPointTestUtility;
|
||||
|
||||
@Autowired
|
||||
protected SmtpWrapper smtpProtocol;
|
||||
|
||||
@Autowired
|
||||
EmailProperties emailProperties;
|
||||
|
||||
@BeforeSuite(alwaysRun = true)
|
||||
public void checkServerHealth() throws Exception
|
||||
{
|
||||
super.springTestContextPrepareTestInstance();
|
||||
serverHealth.assertServerIsOnline();
|
||||
}
|
||||
|
||||
@BeforeMethod(alwaysRun=true)
|
||||
public void showStartTestInfo(Method method)
|
||||
{
|
||||
LOG.info(String.format("*** STARTING Test: [%s] ***",method.getName()));
|
||||
}
|
||||
|
||||
@AfterMethod(alwaysRun=true)
|
||||
public void showEndTestInfo(Method method)
|
||||
{
|
||||
LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user