From 8f509047858ac327c6d1703ca23f8215e804451e Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sun, 27 Sep 2020 10:53:41 +0100 Subject: [PATCH] REPO-5271 Backport new structure to relaese/6.2.1 (#20) - Simplify dependencies and standardise order - README updated - Green builds - Changes to make Jars in enterprise war match - Changes to make files in enterprise image match - Added travis_wait 40 to the initial build as it can take 20 minutes to download artifacts - Removed NodesTest.siteConsumerWillGet403OnFileWithDisabledInherittedPermissions introduced in 7.0.0 and fails in earlier versions. - GetSiteMember[s]Tests changed in 7.0.0. Setting test back to previous values. --- core/.gitbugtraq => .gitbugtraq | 0 ...ravis.settings.xml => .travis.settings.xml | 10 +- .travis.yml | 252 ++ core/.whitesource => .whitesource | 0 ...-agent.config => .wss-unified-agent.config | 0 core/CONTRIBUTING.md => CONTRIBUTING.md | 0 core/LICENSE.txt => LICENSE.txt | 0 README.md | 141 + core/.gitattributes | 8 - core/.gitignore | 34 - core/.travis.settings.xml | 10 - core/.travis.yml | 52 - core/.wss-unified-agent.config | 228 -- core/pom.xml | 393 ++- data-model/.gitattributes | 8 - data-model/.gitbugtraq | 4 - data-model/.gitignore | 34 - data-model/.travis.settings.xml | 10 - data-model/.travis.yml | 46 - data-model/.whitesource | 8 - data-model/.wss-unified-agent.config | 228 -- data-model/CONTRIBUTING.md | 16 - data-model/LICENSE.txt | 165 - data-model/pom.xml | 103 +- packaging/.gitattributes | 8 - packaging/.gitbugtraq | 4 - packaging/.gitignore | 41 - packaging/.travis.yml | 143 - packaging/.whitesource | 8 - packaging/.wss-unified-agent.config | 228 -- packaging/CHANGELOG.md | 218 -- packaging/CONTRIBUTING.md | 16 - packaging/LICENSE | 191 -- packaging/README.md | 37 - packaging/distribution/pom.xml | 175 - .../src/assembly/distribution.xml | 118 - .../src/main/resources/README.txt | 8 - .../src/main/resources/bin/apply_amps.bat | 41 - .../src/main/resources/bin/apply_amps.sh | 66 - .../src/main/resources/bin/clean_tomcat.bat | 13 - .../src/main/resources/bin/clean_tomcat.sh | 9 - .../resources/keystore/CreateSSLKeystores.txt | 141 - .../resources/keystore/generate_keystores.bat | 58 - .../resources/keystore/generate_keystores.sh | 82 - .../src/main/resources/keystore/readme.txt | 7 - .../conf/Catalina/localhost/alfresco.xml | 8 - packaging/docker-alfresco/Dockerfile | 58 +- packaging/docker-alfresco/pom.xml | 226 +- packaging/pom.xml | 542 +-- packaging/public-javadoc/pom.xml | 100 - .../scripts/travis/copy_to_release_bucket.sh | 17 - packaging/scripts/travis/maven_release.sh | 31 - .../scripts/travis/verify_release_tag.sh | 31 - .../docker-compose-minimal+transforms.yml | 10 +- .../environment/docker-compose-minimal.yml | 10 +- packaging/tests/pom.xml | 75 +- packaging/tests/scripts/start-compose.sh | 17 + packaging/tests/scripts/stop-compose.sh | 10 +- .../tests/scripts/wait-for-alfresco-start.sh | 13 + packaging/tests/tas-cmis/pom.xml | 10 +- .../org/alfresco/cmis/DataListsTests.java | 590 ---- .../alfresco/cmis/UpdatePropertiesTests.java | 718 ++-- .../test/resources/alfresco-cmis-context.xml | 31 +- packaging/tests/tas-email/pom.xml | 10 +- .../java/org/alfresco/email/EmailTest.java | 202 +- .../email/imap/ImapReadMessagesTests.java | 351 +- .../test/resources/alfresco-email-context.xml | 25 +- packaging/tests/tas-integration/pom.xml | 12 +- .../tas/integration/IntegrationCoreTests.java | 2988 ++++++++--------- packaging/tests/tas-restapi/pom.xml | 10 +- .../org/alfresco/rest/nodes/NodesTests.java | 112 +- .../rest/people/GetPeopleFullTests.java | 176 +- .../sites/members/GetSiteMemberTests.java | 790 ++--- .../sites/members/GetSiteMembersTests.java | 708 ++-- packaging/tests/tas-webdav/pom.xml | 10 +- .../resources/alfresco-webdav-context.xml | 27 +- packaging/war/pom.xml | 13 +- .../resources/alfresco/version.properties | 6 +- pom.xml | 698 ++++ remote-api/.gitbugtraq | 4 - remote-api/.gitignore | 39 - remote-api/.travis.settings.xml | 10 - remote-api/.travis.yml | 64 - remote-api/.whitesource | 8 - remote-api/.wss-unified-agent.config | 228 -- remote-api/CONTRIBUTING.md | 16 - remote-api/LICENSE | 165 - remote-api/pom.xml | 120 +- repository/.gitbugtraq | 4 - repository/.gitignore | 40 - repository/.travis.settings.xml | 15 - repository/.travis.yml | 122 - repository/.whitesource | 8 - repository/CONTRIBUTING.md | 16 - repository/LICENSE | 165 - repository/pom.xml | 156 +- .../test/resources/alfresco/keystore/keystore | Bin 0 -> 645 bytes .../keystore/keystore-passwords.properties | 10 + scripts/travis/build.sh | 9 + scripts/travis/build_functions.sh | 120 + scripts/travis/cleanup_cache.sh | 19 + scripts/travis/init.sh | 18 + scripts/travis/maven_release.sh | 17 + scripts/travis/trigger_travis.sh | 48 + scripts/travis/update_downstream.sh | 46 + scripts/travis/verify_release_tag.sh | 24 + 106 files changed, 4848 insertions(+), 8640 deletions(-) rename core/.gitbugtraq => .gitbugtraq (100%) rename packaging/.travis.settings.xml => .travis.settings.xml (81%) create mode 100644 .travis.yml rename core/.whitesource => .whitesource (100%) rename repository/.wss-unified-agent.config => .wss-unified-agent.config (100%) rename core/CONTRIBUTING.md => CONTRIBUTING.md (100%) rename core/LICENSE.txt => LICENSE.txt (100%) delete mode 100644 core/.gitattributes delete mode 100644 core/.gitignore delete mode 100644 core/.travis.settings.xml delete mode 100644 core/.travis.yml delete mode 100644 core/.wss-unified-agent.config delete mode 100644 data-model/.gitattributes delete mode 100644 data-model/.gitbugtraq delete mode 100644 data-model/.gitignore delete mode 100644 data-model/.travis.settings.xml delete mode 100644 data-model/.travis.yml delete mode 100644 data-model/.whitesource delete mode 100644 data-model/.wss-unified-agent.config delete mode 100644 data-model/CONTRIBUTING.md delete mode 100644 data-model/LICENSE.txt delete mode 100644 packaging/.gitattributes delete mode 100644 packaging/.gitbugtraq delete mode 100644 packaging/.gitignore delete mode 100644 packaging/.travis.yml delete mode 100644 packaging/.whitesource delete mode 100644 packaging/.wss-unified-agent.config delete mode 100644 packaging/CHANGELOG.md delete mode 100644 packaging/CONTRIBUTING.md delete mode 100644 packaging/LICENSE delete mode 100644 packaging/README.md delete mode 100644 packaging/distribution/pom.xml delete mode 100644 packaging/distribution/src/assembly/distribution.xml delete mode 100644 packaging/distribution/src/main/resources/README.txt delete mode 100644 packaging/distribution/src/main/resources/bin/apply_amps.bat delete mode 100644 packaging/distribution/src/main/resources/bin/apply_amps.sh delete mode 100644 packaging/distribution/src/main/resources/bin/clean_tomcat.bat delete mode 100644 packaging/distribution/src/main/resources/bin/clean_tomcat.sh delete mode 100644 packaging/distribution/src/main/resources/keystore/CreateSSLKeystores.txt delete mode 100644 packaging/distribution/src/main/resources/keystore/generate_keystores.bat delete mode 100644 packaging/distribution/src/main/resources/keystore/generate_keystores.sh delete mode 100644 packaging/distribution/src/main/resources/keystore/readme.txt delete mode 100644 packaging/distribution/src/main/resources/web-server/conf/Catalina/localhost/alfresco.xml delete mode 100644 packaging/public-javadoc/pom.xml delete mode 100755 packaging/scripts/travis/copy_to_release_bucket.sh delete mode 100755 packaging/scripts/travis/maven_release.sh delete mode 100755 packaging/scripts/travis/verify_release_tag.sh delete mode 100644 packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/DataListsTests.java create mode 100644 pom.xml delete mode 100644 remote-api/.gitbugtraq delete mode 100644 remote-api/.gitignore delete mode 100644 remote-api/.travis.settings.xml delete mode 100644 remote-api/.travis.yml delete mode 100644 remote-api/.whitesource delete mode 100644 remote-api/.wss-unified-agent.config delete mode 100644 remote-api/CONTRIBUTING.md delete mode 100644 remote-api/LICENSE delete mode 100644 repository/.gitbugtraq delete mode 100644 repository/.gitignore delete mode 100644 repository/.travis.settings.xml delete mode 100644 repository/.travis.yml delete mode 100644 repository/.whitesource delete mode 100644 repository/CONTRIBUTING.md delete mode 100644 repository/LICENSE create mode 100644 repository/src/test/resources/alfresco/keystore/keystore create mode 100644 repository/src/test/resources/alfresco/keystore/keystore-passwords.properties create mode 100644 scripts/travis/build.sh create mode 100644 scripts/travis/build_functions.sh create mode 100644 scripts/travis/cleanup_cache.sh create mode 100644 scripts/travis/init.sh create mode 100755 scripts/travis/maven_release.sh create mode 100755 scripts/travis/trigger_travis.sh create mode 100644 scripts/travis/update_downstream.sh create mode 100755 scripts/travis/verify_release_tag.sh diff --git a/core/.gitbugtraq b/.gitbugtraq similarity index 100% rename from core/.gitbugtraq rename to .gitbugtraq diff --git a/packaging/.travis.settings.xml b/.travis.settings.xml similarity index 81% rename from packaging/.travis.settings.xml rename to .travis.settings.xml index 48b88983e0..10539b04b4 100644 --- a/packaging/.travis.settings.xml +++ b/.travis.settings.xml @@ -25,11 +25,19 @@ https://artifacts.alfresco.com/nexus/content/groups/public + + + ${env.WHITESOURCE_API_KEY} + - + + alfresco-public + ${env.MAVEN_USERNAME} + ${env.MAVEN_PASSWORD} + alfresco-internal ${env.MAVEN_USERNAME} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..359fcf58ca --- /dev/null +++ b/.travis.yml @@ -0,0 +1,252 @@ +--- +dist: xenial +language: java +jdk: openjdk11 + +services: + - docker + +git: + depth: false + quiet: true + +cache: + directories: + - ${HOME}/.m2/repository + +# the cache can grow constantly +before_cache: bash scripts/travis/cleanup_cache.sh + +branches: + only: + - master + - /release\/.*/ + +env: + global: + - TAS_SCRIPTS=../alfresco-community-repo/packaging/tests/scripts + - TAS_ENVIRONMENT=./packaging/tests/environment + +stages: + - name: test + if: commit_message !~ /\[skip tests\]/ + - name: release + if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/ + - name: update_downstream + if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/ + - name: trigger_downstream + if: fork = false AND (branch != master AND branch !~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/ + +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" + stage: test + # only on release branches or master and if it is not a PR + if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request + script: + # Download the latest version of WhiteSource Unified Agent + - curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar + # Run WhiteSource Unified Agent + - java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config -d ./packaging/war + +# - name: "Source Clear Scan" +# # only on release branches or master and if it is not a PR +# if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request +# script: skip +# addons: +# srcclr: true + + - name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test" + script: + - travis_retry mvn -B test -pl core,data-model + - travis_retry mvn -B test -pl repository -Dtest=AllUnitTestsSuite + + - name: "Repository - AppContext01TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - AppContext02TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - AppContext03TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ + + - name: "Repository - AppContext04TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - AppContext05TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + - mkdir -p "${HOME}/tmp" + - cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp" + - export HOST_IP=$(hostname -I | cut -f1 -d' ') + - docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json quay.io/alfresco/alfresco-identity-service:1.2 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth" + + - name: "Repository - AppContext06TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ + + - name: "Repository - AppContextExtraTestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - MiscContextTestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.4 + script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ + + - name: "Repository - MySQL tests" + if: commit_message !~ /\[skip db\]/ + before_script: + - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - PostgreSQL 10 tests" + if: commit_message !~ /\[skip db\]/ + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - PostgreSQL 11 tests" + if: commit_message !~ /\[skip db\]/ + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Repository - MariaDB tests" + if: commit_message !~ /\[skip db\]/ + before_script: + - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver + + - name: "Remote-api - AppContext01TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Remote-api - AppContext02TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Remote-api - AppContext03TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Remote-api - AppContext04TestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "Remote-api - AppContextExtraTestSuite" + before_script: + - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' + - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 + script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + + - name: "REST API TAS tests part1" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false + + - name: "REST API TAS tests part2" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false + + - name: "REST API TAS tests part3" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false + + - name: "CMIS TAS tests" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false + + - name: "Email TAS tests" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false + + - name: "WebDAV TAS tests" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false + + - name: "Integration TAS tests" + if: commit_message =~ /\[tas\]/ + 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 -B install -f packaging/tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false + + - name: "Push to Nexus" + stage: release + before_script: bash scripts/travis/verify_release_tag.sh + script: travis_wait 40 bash scripts/travis/maven_release.sh + + - name: "Update alfresco-enterprise-repo" + stage: update_downstream + install: skip + script: bash scripts/travis/update_downstream.sh + + - name: "Trigger alfresco-enterprise-repo build" + stage: trigger_downstream + before_install: skip + install: skip + script: bash scripts/travis/trigger_travis.sh "Alfresco" "alfresco-enterprise-repo" "${TRAVIS_BRANCH}" + diff --git a/core/.whitesource b/.whitesource similarity index 100% rename from core/.whitesource rename to .whitesource diff --git a/repository/.wss-unified-agent.config b/.wss-unified-agent.config similarity index 100% rename from repository/.wss-unified-agent.config rename to .wss-unified-agent.config diff --git a/core/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 100% rename from core/CONTRIBUTING.md rename to CONTRIBUTING.md diff --git a/core/LICENSE.txt b/LICENSE.txt similarity index 100% rename from core/LICENSE.txt rename to LICENSE.txt diff --git a/README.md b/README.md index e69de29bb2..3b7f4292a2 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,141 @@ +# alfresco-community-repo + +[![Build Status](https://travis-ci.com/Alfresco/alfresco-community-repo.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-community-repo) + +This project contains the bulk of the [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository) code. + +To make the development process simpler, it brings together code historically in `alfresco-core`, +`alfresco-data-madel`, `alfresco-repository`, `alfresco-remote-api` and repository specific +tests and war file creation from `acs-community-packaging`. They exist as sub projects within the Maven Reactor and still +create the same artifacts. + +#### Alfresco Core + +Alfresco Core is a library packaged as a jar file which contains the following: +* Various helpers and utils +* Canned queries interface and supporting classes +* Generic encryption supporting classes + +Version 7 of the library uses Spring 5, Quartz 2.3 and does not have Hibernate dependency. + +#### Alfresco Data Model +Data model is a library packaged as a jar file which contains the following: +* Dictionary, Repository and Search Services interfaces +* Models for data types and Dictionary implementation +* Parsers + +#### Alfresco Repository + +Repository is a library packaged as a jar file which contains the following: +* DAOs and SQL scripts +* Various Service implementations +* Utility classes + +Tests are combined into test classes split by test type or Spring application context used in the test, see classes +in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test +class name and a set of DB connection properties. Check the travis.yml file for docker images that should be started +to provide a sutable test environment. For example: +~~~ +mvn clean test -Dtest=SomeRepoTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco +~~~ + +#### Alfresco Remote API + +Remote API is a library packaged as a jar file which contains the following: +* REST API framework +* WebScript implementations including [V1 REST APIs](https://community.alfresco.com/community/ecm/blog/2017/05/02/v1-rest-api-10-things-you-should-know) +* [OpenCMIS](https://chemistry.apache.org/java/opencmis.html) implementations + +Like the `alfresco-repository` tests are combined in test classes split by test type or Spring application context used +in the test. + +#### Artifacts +The artifacts can be obtained by: +* downloading from [Alfresco maven repository](https://artifacts.alfresco.com/nexus/content/groups/public) +* getting as Maven dependency by adding the dependency to your pom file: +~~~ + + org.alfresco + alfresco-core + version + + + + org.alfresco + alfresco-data-model + version + + + + org.alfresco + alfresco-repository + version + + + + org.alfresco + alfresco-remote-api + version + + + + org.alfresco + content-services-community + version + war + +~~~ +and Alfresco maven repository: +~~~ + + alfresco-maven-repo + https://artifacts.alfresco.com/nexus/content/groups/public + +~~~ +The SNAPSHOT versions of the artifact are not published. + +All current source versions are held in github. Historic versions can be found in [Alfresco SVN](https://svn.alfresco.com/repos/alfresco-open-mirror/services/alfresco-core/) + +### Contributing guide +Please use [this guide](CONTRIBUTING.md) to make a contribution to the project. + +## Setting up your development environment +Although it is possible to work on individual github projects, we recommend working on +the `alfresco-community-repo`, `alfresco-enterprise-repo`, `acs-packaging` and `acs-community-packaging` +in a single Intellij IDEA project. They depend on each other and typically you +will want to make changes to all of them if you are changing the repository code. +In the case of older branches, there is generally no need for the `acs-community-packaging` as you will +not be creating a community release. + + +Although it is possible to work on individual github projects, we recommend working on the `alfresco-community-repo` +and `acs-community-packaging` in a single Intellij IDEA project. They depend on each other and typically you will +want to make changes to both of them if you are changing the repository code. + +~~~ +$ mkdir work +$ cd work +$ git clone git@github.com:Alfresco/alfresco-community-repo.git +$ git clone git@github.com:Alfresco/acs-community-packaging.git +~~~ +If you wish to build these projects from the command line, use the following commands. +~~~ +$ cd alfresco-community-repo +$ mvn clean install -PcommunityDocker -DskipTests=true -Dversion.edition=Community +$ cd .. + +$ cd acs-community-packaging +$ mvn clean install -PcommunityDocker -Dmaven.javadoc.skip=true +$ cd .. +~~~ +In Itellij IDEA, create a new project using the `work` directory as the source. +* File > New Project from Existing Sources > .../work > Maven + +## Branches +As multiple projects have been combined, branch names use the ACS version they are targeting. +For example the code used to create the repository in ACS 6.2.1 in a branch called `releases/6.2.1`. + +The actual version number of the **repository artifacts** created by `alfresco-community-repo` are however different. +For example `release/6.2.1` artifacts are `7.183.x`. This adds some complexity, but ensures that +version numbers do not go backwards in existing releases. It also provides some level of +independence between the repository and other ACS components. diff --git a/core/.gitattributes b/core/.gitattributes deleted file mode 100644 index 8303247a39..0000000000 --- a/core/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -.* eol=crlf -*.html eol=crlf -*.java eol=crlf -*.txt eol=crlf -*.css eol=crlf -*.xml eol=crlf -*.js eol=crlf -*.properties eol=crlf \ No newline at end of file diff --git a/core/.gitignore b/core/.gitignore deleted file mode 100644 index 9346843361..0000000000 --- a/core/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -*.class - -# Eclipse -.classpath -.settings -.project - -# Intellij -.idea/ -*.iml -*.iws - -# Mac -.DS_Store - -# Maven -target -*.log -*.log.* - -# Mobile Tools for Java (J2ME) - -.mtj -.tmp/ - -# Package Files # - -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml - -hs_err_pid* diff --git a/core/.travis.settings.xml b/core/.travis.settings.xml deleted file mode 100644 index dffe7fbfe1..0000000000 --- a/core/.travis.settings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - alfresco-public - ${env.MAVEN_USERNAME} - ${env.MAVEN_PASSWORD} - - - diff --git a/core/.travis.yml b/core/.travis.yml deleted file mode 100644 index 203105794c..0000000000 --- a/core/.travis.yml +++ /dev/null @@ -1,52 +0,0 @@ -dist: trusty -sudo: required -language: java -jdk: - - openjdk11 - -cache: - directories: - - $HOME/.m2 - -branches: - only: - - master - - /support\/.*/ - -install: travis_retry mvn install -DskipTests=true -B -V - -stages: - - test - - release - -jobs: - include: - - stage: test - name: "Build and test" - script: travis_retry mvn test - - name: "WhiteSource scan" - # only on SP branches or master and if it is not a PR - if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request - script: - # Download the latest version of WhiteSource Unified Agent - - curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar - # Run WhiteSource Unified Agent - - java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config - - name: "Source Clear Scan" - # only on SP branches or master and if it is not a PR - if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request - script: skip - addons: - srcclr: true - - stage: release - name: "Push to Nexus" - if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/ - before_install: - - "cp .travis.settings.xml $HOME/.m2/settings.xml" - script: - # Use full history for release - - git checkout -B "${TRAVIS_BRANCH}" - # Add email to link commits to user - - git config user.email "${GIT_EMAIL}" - # Skip building of release commits - - mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform diff --git a/core/.wss-unified-agent.config b/core/.wss-unified-agent.config deleted file mode 100644 index 6f9cb57795..0000000000 --- a/core/.wss-unified-agent.config +++ /dev/null @@ -1,228 +0,0 @@ -#################################################################### -# WhiteSource Unified-Agent configuration file -#################################################################### -########################################## -# GENERAL SCAN MODE: Files and Package Managers -########################################## - -checkPolicies=true -forceCheckAllDependencies=true -forceUpdate=true -forceUpdate.failBuildOnPolicyViolation=true -offline=false -#ignoreSourceFiles=true -#scanComment= -#updateInventory=false -#resolveAllDependencies=false -#failErrorLevel=ALL -#requireKnownSha1=false -#generateScanReport=true -#scanReportTimeoutMinutes=10 -#excludeDependenciesFromNodes=.*commons-io.*,.*maven-model - -#projectPerFolder=true -#projectPerFolderIncludes= -#projectPerFolderExcludes= - -#wss.connectionTimeoutMinutes=60 -# Change the below URL to your WhiteSource server. -# Use the 'WhiteSource Server URL' which can be retrieved -# from your 'Profile' page on the 'Server URLs' panel. -# Then, add the '/agent' path to it. -wss.url=https://saas.whitesourcesoftware.com/agent - -#npm.resolveDependencies=false -#npm.ignoreSourceFiles=false -#npm.includeDevDependencies=true -#npm.runPreStep=true -#npm.ignoreNpmLsErrors=true -#npm.ignoreScripts=true -#npm.yarnProject=true -#npm.accessToken= -#npm.identifyByNameAndVersion=true - -#bower.resolveDependencies=false -#bower.ignoreSourceFiles=true -#bower.runPreStep=true - -#nuget.resolvePackagesConfigFiles=false -#nuget.resolveCsProjFiles=false -#nuget.resolveDependencies=false -#nuget.restoreDependencies=true -#nuget.ignoreSourceFiles=true -#nuget.runPreStep=true -#nuget.resolveNuspecFiles=false - -#python.resolveDependencies=false -#python.ignoreSourceFiles=false -#python.ignorePipInstallErrors=true -#python.installVirtualenv=true -#python.resolveHierarchyTree=false -#python.requirementsFileIncludes=requirements.txt -#python.resolveSetupPyFiles=true -#python.runPipenvPreStep=true -#python.pipenvDevDependencies=true -#python.IgnorePipenvInstallErrors=true - -#maven.ignoredScopes=test provided -maven.resolveDependencies=true -#maven.ignoreSourceFiles=true -#maven.aggregateModules=true -maven.ignorePomModules=false -#maven.runPreStep=true -#maven.ignoreMvnTreeErrors=true -#maven.environmentPath= -#maven.m2RepositoryPath= - -#gradle.ignoredScopes= -#gradle.resolveDependencies=false -#gradle.runAssembleCommand=false -#gradle.runPreStep=true -#gradle.ignoreSourceFiles=true -#gradle.aggregateModules=true -#gradle.preferredEnvironment=wrapper -#gradle.localRepositoryPath= - -#paket.resolveDependencies=false -#paket.ignoredGroups= -#paket.ignoreSourceFiles=false -#paket.runPreStep=true -#paket.exePath= - -#go.resolveDependencies=false -#go.collectDependenciesAtRuntime=true -#go.dependencyManager= -#go.ignoreSourceFiles=true -#go.glide.ignoreTestPackages=false -#go.gogradle.enableTaskAlias=true - -#ruby.resolveDependencies = false -#ruby.ignoreSourceFiles = false -#ruby.installMissingGems = true -#ruby.runBundleInstall = true -#ruby.overwriteGemFile = true - -#sbt.resolveDependencies=false -#sbt.ignoreSourceFiles=true -#sbt.aggregateModules=true -#sbt.runPreStep=true -#sbt.targetFolder= - -#php.resolveDependencies=false -#php.runPreStep=true -#php.includeDevDependencies=true - -#html.resolveDependencies=false - -#cocoapods.resolveDependencies=false -#cocoapods.runPreStep=true -#cocoapods.ignoreSourceFiles=false - -#hex.resolveDependencies=false -#hex.runPreStep=true -#hex.ignoreSourceFiles=false -#hex.aggregateModules=true - -################################## -# Organization tokens: -################################## -apiKey= - -#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option -#userKey= - -projectName=alfresco-core -projectVersion= -projectToken= - -productName=ACS Community -productVersion= -productToken= -#updateType=APPEND -#requesterEmail=user@provider.com - -######################################################################################### -# Includes/Excludes Glob patterns - PLEASE USE ONLY ONE EXCLUDE LINE AND ONE INCLUDE LINE -######################################################################################### -#includes=**/*.c **/*.cc **/*.cp **/*.cpp **/*.cxx **/*.c++ **/*.h **/*.hpp **/*.hxx - -#includes=**/*.m **/*.mm **/*.js **/*.php -includes=**/*.jar -#includes=**/*.gem **/*.rb -#includes=**/*.dll **/*.cs **/*.nupkg -#includes=**/*.tgz **/*.deb **/*.gzip **/*.rpm **/*.tar.bz2 -#includes=**/*.zip **/*.tar.gz **/*.egg **/*.whl **/*.py - -## Exclude file extensions or specific directories by adding **/*. or **/** -excludes=**/*sources.jar **/*javadoc.jar - -case.sensitive.glob=false -followSymbolicLinks=true - -################################## -# Archive properties -################################## -#archiveExtractionDepth=2 -#archiveIncludes=**/*.war **/*.ear -#archiveExcludes=**/*sources.jar - -################################## -# Proxy settings -################################## -#proxy.host= -#proxy.port= -#proxy.user= -#proxy.pass= - -################################## -# SCM settings -################################## -#scm.type= -#scm.user= -#scm.pass= -#scm.ppk= -#scm.url= -#scm.branch= -#scm.tag= -#scm.npmInstall= -#scm.npmInstallTimeoutMinutes= -#scm.repositoriesFile= - -############################################## -# SCAN MODE: Linux package manager settings -############################################## -#scanPackageManager=true - -################################## -# SCAN MODE: Docker images -################################## -#docker.scanImages=true -#docker.includes=.*.* -#docker.excludes= -#docker.pull.enable=true -#docker.pull.images=.*.* -#docker.pull.maxImages=10 -#docker.pull.tags=.*.* -#docker.pull.digest= -#docker.delete.force=true -#docker.login.sudo=false - -#docker.aws.enable=true -#docker.aws.registryIds= - -################################## -# SCAN MODE: Docker containers -################################## -#docker.scanContainers=true -#docker.containerIncludes=.*.* -#docker.containerExcludes= - -################################ -# Serverless settings -################################ -#serverless.provider= -#serverless.scanFunctions=true -#serverless.includes= -#serverless.excludes= -#serverless.region= -#serverless.maxFunctions=10 diff --git a/core/pom.xml b/core/pom.xml index 00a51e925d..8c63273a26 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,206 +1,187 @@ - - 4.0.0 - - - org.alfresco - alfresco-super-pom - 12 - - alfresco-core - 7.33 - Alfresco Core - Alfresco core libraries and utils - - - scm:git:https://github.com/Alfresco/alfresco-core.git - scm:git:https://github.com/Alfresco/alfresco-core.git - https://github.com/Alfresco/alfresco-core - 7.33 - - - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/repositories/releases - - - - - 5.1.15.RELEASE - 7.14 - 11 - - - - - commons-codec - commons-codec - 1.14 - - - commons-httpclient - commons-httpclient - 3.1-HTTPCLIENT-1265 - - - commons-logging - commons-logging - 1.2 - - - commons-io - commons-io - 2.6 - - - org.apache.commons - commons-math3 - 3.6.1 - - - org.safehaus.jug - jug - 2.0.0 - asl - - - log4j - log4j - 1.2.17 - - - org.json - json - 20160212 - - - org.springframework - spring-orm - ${dependency.spring.version} - - - - - org.springframework - spring-jcl - - - - - org.springframework - spring-context - ${dependency.spring.version} - - - org.quartz-scheduler - quartz - 2.3.2 - - - - - com.mchange - * - - - - - org.alfresco.surf - spring-surf-core-configservice - ${dependency.surf.version} - - - javax.xml.bind - jaxb-api - 2.3.1 - - - com.sun.xml.bind - jaxb-impl - 2.3.2 - - - com.sun.xml.bind - jaxb-core - 2.3.0.1 - - - org.codehaus.guessencoding - guessencoding - 1.4 - - - javax.transaction - jta - 1.1 - - - joda-time - joda-time - 2.10.5 - - - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - - - org.slf4j - slf4j-log4j12 - 1.7.30 - test - - - junit - junit - 4.13 - test - - - org.mockito - mockito-core - 3.2.4 - test - - - commons-dbcp - commons-dbcp - 1.4-DBCP330 - test - - - - - - - - maven-release-plugin - - true - @{project.version} - - - - - - - - maven-jar-plugin - 3.2.0 - - - - test-jar - - - - - - - - + + 4.0.0 + alfresco-core + Alfresco Core + Alfresco core libraries and utils + + + org.alfresco + alfresco-community-repo + 7.183.300-TEST1-SNAPSHOT + + + + 20160212 + + + + + commons-codec + commons-codec + 1.14 + + + commons-httpclient + commons-httpclient + + + commons-logging + commons-logging + 1.2 + + + commons-io + commons-io + 2.6 + + + org.apache.commons + commons-math3 + 3.6.1 + + + org.safehaus.jug + jug + 2.0.0 + asl + + + log4j + log4j + 1.2.17 + + + org.json + json + 20160212 + + + org.springframework + spring-orm + ${dependency.spring.version} + + + + + org.springframework + spring-jcl + + + + + org.springframework + spring-context + ${dependency.spring.version} + + + org.quartz-scheduler + quartz + 2.3.2 + + + + + com.mchange + * + + + + + org.alfresco.surf + spring-surf-core-configservice + ${dependency.webscripts.version} + + + javax.xml.bind + jaxb-api + 2.3.1 + + + com.sun.xml.bind + jaxb-impl + 2.3.2 + + + com.sun.xml.bind + jaxb-core + 2.3.0.1 + + + org.codehaus.guessencoding + guessencoding + 1.4 + + + javax.transaction + jta + 1.1 + + + joda-time + joda-time + 2.10.5 + + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + + org.slf4j + slf4j-log4j12 + test + + + junit + junit + 4.13 + test + + + org.mockito + mockito-core + 3.2.4 + test + + + commons-dbcp + commons-dbcp + 1.4-DBCP330 + test + + + + + + + + maven-release-plugin + + true + @{project.version} + + + + + + + + maven-jar-plugin + 3.2.0 + + + + test-jar + + + + + + + + diff --git a/data-model/.gitattributes b/data-model/.gitattributes deleted file mode 100644 index 8303247a39..0000000000 --- a/data-model/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -.* eol=crlf -*.html eol=crlf -*.java eol=crlf -*.txt eol=crlf -*.css eol=crlf -*.xml eol=crlf -*.js eol=crlf -*.properties eol=crlf \ No newline at end of file diff --git a/data-model/.gitbugtraq b/data-model/.gitbugtraq deleted file mode 100644 index bacffb702d..0000000000 --- a/data-model/.gitbugtraq +++ /dev/null @@ -1,4 +0,0 @@ -# For SmartGit -[bugtraq "jira"] - url = https://issues.alfresco.com/jira/browse/%BUGID% - logRegex = ([A-Z]+-\\d+) diff --git a/data-model/.gitignore b/data-model/.gitignore deleted file mode 100644 index 9346843361..0000000000 --- a/data-model/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -*.class - -# Eclipse -.classpath -.settings -.project - -# Intellij -.idea/ -*.iml -*.iws - -# Mac -.DS_Store - -# Maven -target -*.log -*.log.* - -# Mobile Tools for Java (J2ME) - -.mtj -.tmp/ - -# Package Files # - -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml - -hs_err_pid* diff --git a/data-model/.travis.settings.xml b/data-model/.travis.settings.xml deleted file mode 100644 index dffe7fbfe1..0000000000 --- a/data-model/.travis.settings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - alfresco-public - ${env.MAVEN_USERNAME} - ${env.MAVEN_PASSWORD} - - - diff --git a/data-model/.travis.yml b/data-model/.travis.yml deleted file mode 100644 index 8875933e0c..0000000000 --- a/data-model/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -dist: trusty -sudo: required -language: java -jdk: - - openjdk11 - -cache: - directories: - - $HOME/.m2 - -branches: - only: - - master - - /support\/.*/ - -install: travis_retry mvn install -DskipTests=true -B -V - -stages: - - test - - release - -jobs: - include: - - stage: test - name: "Build and test" - script: travis_retry mvn test - - name: "WhiteSource scan" - # only on SP branches or master and if it is not a PR - if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request - script: - # Download the latest version of WhiteSource Unified Agent - - curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar - # Run WhiteSource Unified Agent - - java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config - - stage: release - name: "Push to Nexus" - if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/ - before_install: - - "cp .travis.settings.xml $HOME/.m2/settings.xml" - script: - # Use full history for release - - git checkout -B "${TRAVIS_BRANCH}" - # Add email to link commits to user - - git config user.email "${GIT_EMAIL}" - # Skip building of release commits - - mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform diff --git a/data-model/.whitesource b/data-model/.whitesource deleted file mode 100644 index f056952141..0000000000 --- a/data-model/.whitesource +++ /dev/null @@ -1,8 +0,0 @@ -{ - "generalSettings": { - "shouldScanRepo": true - }, - "checkRunSettings": { - "vulnerableCheckRunConclusionLevel": "failure" - } -} \ No newline at end of file diff --git a/data-model/.wss-unified-agent.config b/data-model/.wss-unified-agent.config deleted file mode 100644 index a79b4c9581..0000000000 --- a/data-model/.wss-unified-agent.config +++ /dev/null @@ -1,228 +0,0 @@ -#################################################################### -# WhiteSource Unified-Agent configuration file -#################################################################### -########################################## -# GENERAL SCAN MODE: Files and Package Managers -########################################## - -checkPolicies=true -forceCheckAllDependencies=true -forceUpdate=true -forceUpdate.failBuildOnPolicyViolation=true -offline=false -#ignoreSourceFiles=true -#scanComment= -#updateInventory=false -#resolveAllDependencies=false -#failErrorLevel=ALL -#requireKnownSha1=false -#generateScanReport=true -#scanReportTimeoutMinutes=10 -#excludeDependenciesFromNodes=.*commons-io.*,.*maven-model - -#projectPerFolder=true -#projectPerFolderIncludes= -#projectPerFolderExcludes= - -#wss.connectionTimeoutMinutes=60 -# Change the below URL to your WhiteSource server. -# Use the 'WhiteSource Server URL' which can be retrieved -# from your 'Profile' page on the 'Server URLs' panel. -# Then, add the '/agent' path to it. -wss.url=https://saas.whitesourcesoftware.com/agent - -#npm.resolveDependencies=false -#npm.ignoreSourceFiles=false -#npm.includeDevDependencies=true -#npm.runPreStep=true -#npm.ignoreNpmLsErrors=true -#npm.ignoreScripts=true -#npm.yarnProject=true -#npm.accessToken= -#npm.identifyByNameAndVersion=true - -#bower.resolveDependencies=false -#bower.ignoreSourceFiles=true -#bower.runPreStep=true - -#nuget.resolvePackagesConfigFiles=false -#nuget.resolveCsProjFiles=false -#nuget.resolveDependencies=false -#nuget.restoreDependencies=true -#nuget.ignoreSourceFiles=true -#nuget.runPreStep=true -#nuget.resolveNuspecFiles=false - -#python.resolveDependencies=false -#python.ignoreSourceFiles=false -#python.ignorePipInstallErrors=true -#python.installVirtualenv=true -#python.resolveHierarchyTree=false -#python.requirementsFileIncludes=requirements.txt -#python.resolveSetupPyFiles=true -#python.runPipenvPreStep=true -#python.pipenvDevDependencies=true -#python.IgnorePipenvInstallErrors=true - -#maven.ignoredScopes=test provided -maven.resolveDependencies=true -#maven.ignoreSourceFiles=true -#maven.aggregateModules=true -maven.ignorePomModules=false -#maven.runPreStep=true -#maven.ignoreMvnTreeErrors=true -#maven.environmentPath= -#maven.m2RepositoryPath= - -#gradle.ignoredScopes= -#gradle.resolveDependencies=false -#gradle.runAssembleCommand=false -#gradle.runPreStep=true -#gradle.ignoreSourceFiles=true -#gradle.aggregateModules=true -#gradle.preferredEnvironment=wrapper -#gradle.localRepositoryPath= - -#paket.resolveDependencies=false -#paket.ignoredGroups= -#paket.ignoreSourceFiles=false -#paket.runPreStep=true -#paket.exePath= - -#go.resolveDependencies=false -#go.collectDependenciesAtRuntime=true -#go.dependencyManager= -#go.ignoreSourceFiles=true -#go.glide.ignoreTestPackages=false -#go.gogradle.enableTaskAlias=true - -#ruby.resolveDependencies = false -#ruby.ignoreSourceFiles = false -#ruby.installMissingGems = true -#ruby.runBundleInstall = true -#ruby.overwriteGemFile = true - -#sbt.resolveDependencies=false -#sbt.ignoreSourceFiles=true -#sbt.aggregateModules=true -#sbt.runPreStep=true -#sbt.targetFolder= - -#php.resolveDependencies=false -#php.runPreStep=true -#php.includeDevDependencies=true - -#html.resolveDependencies=false - -#cocoapods.resolveDependencies=false -#cocoapods.runPreStep=true -#cocoapods.ignoreSourceFiles=false - -#hex.resolveDependencies=false -#hex.runPreStep=true -#hex.ignoreSourceFiles=false -#hex.aggregateModules=true - -################################## -# Organization tokens: -################################## -apiKey= - -#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option -#userKey= - -projectName=alfresco-data-model -projectVersion=8.50.N -projectToken= - -productName=ACS Community -productVersion= -productToken= -#updateType=APPEND -#requesterEmail=user@provider.com - -######################################################################################### -# Includes/Excludes Glob patterns - PLEASE USE ONLY ONE EXCLUDE LINE AND ONE INCLUDE LINE -######################################################################################### -#includes=**/*.c **/*.cc **/*.cp **/*.cpp **/*.cxx **/*.c++ **/*.h **/*.hpp **/*.hxx - -#includes=**/*.m **/*.mm **/*.js **/*.php -includes=**/*.jar -#includes=**/*.gem **/*.rb -#includes=**/*.dll **/*.cs **/*.nupkg -#includes=**/*.tgz **/*.deb **/*.gzip **/*.rpm **/*.tar.bz2 -#includes=**/*.zip **/*.tar.gz **/*.egg **/*.whl **/*.py - -## Exclude file extensions or specific directories by adding **/*. or **/** -excludes=**/*sources.jar **/*javadoc.jar - -case.sensitive.glob=false -followSymbolicLinks=true - -################################## -# Archive properties -################################## -#archiveExtractionDepth=2 -#archiveIncludes=**/*.war **/*.ear -#archiveExcludes=**/*sources.jar - -################################## -# Proxy settings -################################## -#proxy.host= -#proxy.port= -#proxy.user= -#proxy.pass= - -################################## -# SCM settings -################################## -#scm.type= -#scm.user= -#scm.pass= -#scm.ppk= -#scm.url= -#scm.branch= -#scm.tag= -#scm.npmInstall= -#scm.npmInstallTimeoutMinutes= -#scm.repositoriesFile= - -############################################## -# SCAN MODE: Linux package manager settings -############################################## -#scanPackageManager=true - -################################## -# SCAN MODE: Docker images -################################## -#docker.scanImages=true -#docker.includes=.*.* -#docker.excludes= -#docker.pull.enable=true -#docker.pull.images=.*.* -#docker.pull.maxImages=10 -#docker.pull.tags=.*.* -#docker.pull.digest= -#docker.delete.force=true -#docker.login.sudo=false - -#docker.aws.enable=true -#docker.aws.registryIds= - -################################## -# SCAN MODE: Docker containers -################################## -#docker.scanContainers=true -#docker.containerIncludes=.*.* -#docker.containerExcludes= - -################################ -# Serverless settings -################################ -#serverless.provider= -#serverless.scanFunctions=true -#serverless.includes= -#serverless.excludes= -#serverless.region= -#serverless.maxFunctions=10 diff --git a/data-model/CONTRIBUTING.md b/data-model/CONTRIBUTING.md deleted file mode 100644 index 8d059e27ca..0000000000 --- a/data-model/CONTRIBUTING.md +++ /dev/null @@ -1,16 +0,0 @@ -### Contributing -Thanks for your interest in contributing to this project! - -The following is a set of guidelines for contributing to this library. Most of them will make the life of the reviewer easier and therefore decrease the time required for the patch be included in the next version. - -Because this project forms a part of Alfresco Content Services, the guidelines are hosted in the [Alfresco Social Community](http://community.alfresco.com/community/ecm) where they can be referenced from multiple projects. - -Read an [overview on how this project is goverened](https://community.alfresco.com/docs/DOC-6385-project-overview-repository). - -You can report an issue in the ALF project of the [Alfresco issue tracker](http://issues.alfresco.com). - -Read [instructions for a good issue report](https://community.alfresco.com/docs/DOC-6263-reporting-an-issue). - -Read [instructions for making a contribution](https://community.alfresco.com/docs/DOC-6269-submitting-contributions). - -Please follow [the coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards). diff --git a/data-model/LICENSE.txt b/data-model/LICENSE.txt deleted file mode 100644 index 65c5ca88a6..0000000000 --- a/data-model/LICENSE.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/data-model/pom.xml b/data-model/pom.xml index 342a162cfe..46fe1dba8b 100644 --- a/data-model/pom.xml +++ b/data-model/pom.xml @@ -1,42 +1,22 @@ 4.0.0 - - - org.alfresco - alfresco-super-pom - 12 - - alfresco-data-model Alfresco Data Model Alfresco Data Model classes - 8.50.14 - - scm:git:https://github.com/Alfresco/alfresco-data-model.git - scm:git:https://github.com/Alfresco/alfresco-data-model.git - https://github.com/Alfresco/alfresco-data-model - 8.50.14 - - - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/repositories/releases - - + + org.alfresco + alfresco-community-repo + 7.183.300-TEST1-SNAPSHOT + - 7.33 - - 3.3.5 source/java/org/alfresco/repo/search/impl/parsers/CMIS*er.java, source/java/org/alfresco/repo/search/impl/parsers/FTSParser.java, source/java/org/alfresco/repo/search/impl/parsers/FTSLexer.java - 11 @@ -140,78 +120,11 @@ - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-rs-client - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-transports-http - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-ws-policy - ${dependency.cxf.version} - - - - org.bouncycastle - bcmail-jdk15on - 1.64 - - - - com.github.junrar - junrar - 4.0.0 - - - - org.jsoup - jsoup - 1.12.1 - - - - com.google.guava - guava - 28.2-jre - - - - org.apache.commons - commons-compress - 1.19 - - - - org.apache.pdfbox - pdfbox - 2.0.17 - - - - org.alfresco alfresco-core - ${dependency.alfresco-core.version} + ${project.version} - - org.alfresco - content-services-community - ${project.version} - war - - - org.alfresco - alfresco-repository - - - org.alfresco - alfresco-data-model - - - org.alfresco - alfresco-server-root - war - - - org.alfresco - alfresco-mmt - - - - org.postgresql - postgresql - ${dependency.postgresql.version} - - - - org.alfresco - alfresco-pdf-renderer - linux - tgz - - - org.alfresco - alfresco-pdf-renderer - win64 - tgz - - - - org.alfresco - alfresco-content-services-share-distribution - zip - - - * - * - - - - - - - ${project.artifactId}-${project.version} - - - src/main/resources - true - - - - - maven-dependency-plugin - - - extract-keystore - generate-resources - - unpack - - - - - - org.alfresco - alfresco-repository - alfresco/keystore/** - - - - org.alfresco - alfresco-content-services-share-distribution - zip - - - - - - extract-jlan-dll - generate-resources - - unpack - - - - - org.alfresco - alfresco-jlan-embed - windll - *.dll - - - - - - - - copy-resources - generate-resources - - copy - - - - - org.alfresco - alfresco-server-root - war - ${project.build.outputDirectory}/web-server/webapps - ROOT.war - - - org.alfresco.aos-module - alfresco-vti-bin - war - ${project.build.outputDirectory}/web-server/webapps - _vti_bin.war - - - - - - - - - maven-assembly-plugin - - - make-assembly - package - - single - - - false - - src/assembly/distribution.xml - - - - - - - - - diff --git a/packaging/distribution/src/assembly/distribution.xml b/packaging/distribution/src/assembly/distribution.xml deleted file mode 100644 index e1d5d3da9a..0000000000 --- a/packaging/distribution/src/assembly/distribution.xml +++ /dev/null @@ -1,118 +0,0 @@ - - distribution - - - - zip - - - - - - target/classes - - - - - ${highest.basedir}/installer/bitrock/licenses - licenses - - - - target/dependency/alfresco/keystore - alf_data/keystore - - - - target/dependency - bin - - *.dll - - - - - - ${project.build.directory}/dependency/alfresco-content-services-share-distribution-${alfresco.share.version} - - - web-server/** - modules/** - amps/** - - - - ${project.build.directory}/dependency/alfresco-content-services-share-distribution-${alfresco.share.version}/web-extension-samples - web-server/shared/classes/alfresco/web-extension - - - - - - - false - amps - ${artifact.artifactId}.${artifact.extension} - - *:*:amp - - - - - false - true - bin - ${artifact.artifactId}.${artifact.extension} - - org.alfresco:alfresco-mmt - - - - - - false - true - web-server/webapps - alfresco.war - - org.alfresco:content-services*:war - - - - false - true - web-server/lib - - org.postgresql:* - - - - false - true - web-server/shared/classes - - org.alfresco:*:jar - - true - - - alfresco/extension/** - alfresco-global.properties.sample - - - - - - - false - true - alfresco-pdf-renderer - - org.alfresco:alfresco-pdf-renderer - - - - - - diff --git a/packaging/distribution/src/main/resources/README.txt b/packaging/distribution/src/main/resources/README.txt deleted file mode 100644 index ca56b88ec5..0000000000 --- a/packaging/distribution/src/main/resources/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/packaging/distribution/src/main/resources/bin/apply_amps.bat b/packaging/distribution/src/main/resources/bin/apply_amps.bat deleted file mode 100644 index 87008216d5..0000000000 --- a/packaging/distribution/src/main/resources/bin/apply_amps.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo off -rem ------- -rem Script for apply AMPs to installed WAR -rem ------- - -set ALF_AMP_PARAMS= -set ALF_AMP_NOWAIT= - -:ParamsLoop -if "%~1"=="" goto ParamsLoopContinue -if "%~1"=="nowait" shift & set ALF_AMP_NOWAIT=yes& goto ParamsLoop -set ALF_AMP_PARAMS=%ALF_AMP_PARAMS% %1 -shift -goto :ParamsLoop - -:ParamsLoopContinue -for /D %%D IN (%~dp0..\) do set ALF_HOME=%%~dpD -set CATALINA_HOME=%ALF_HOME%tomcat - -if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat" - -:start -echo This script will apply all the AMPs in %ALF_HOME%amps to the alfresco.war and share.war files in %CATALINA_HOME%\webapps -if "%ALF_AMP_NOWAIT%" == "yes" goto nowait1 -echo Press control-c to stop this script . . . -pause -:nowait1 -"%JAVA_HOME%\bin\java" -jar "%ALF_HOME%bin\alfresco-mmt.jar" install "%ALF_HOME%amps" "%CATALINA_HOME%\webapps\alfresco.war" -directory%ALF_AMP_PARAMS% -"%JAVA_HOME%\bin\java" -jar "%ALF_HOME%bin\alfresco-mmt.jar" list "%CATALINA_HOME%\webapps\alfresco.war" -"%JAVA_HOME%\bin\java" -jar "%ALF_HOME%bin\alfresco-mmt.jar" install "%ALF_HOME%amps_share" "%CATALINA_HOME%\webapps\share.war" -directory%ALF_AMP_PARAMS% -"%JAVA_HOME%\bin\java" -jar "%ALF_HOME%bin\alfresco-mmt.jar" list "%CATALINA_HOME%\webapps\share.war" -echo . -echo About to clean out tomcat/webapps/alfresco directory and temporary files... -if "%ALF_AMP_NOWAIT%" == "yes" goto nowait2 -pause -:nowait2 -set ALF_AMP_PARAMS= -set ALF_AMP_NOWAIT= -rmdir /S /Q "%CATALINA_HOME%\webapps\alfresco" -rmdir /S /Q "%CATALINA_HOME%\webapps\share" -call "%ALF_HOME%bin\clean_tomcat.bat" \ No newline at end of file diff --git a/packaging/distribution/src/main/resources/bin/apply_amps.sh b/packaging/distribution/src/main/resources/bin/apply_amps.sh deleted file mode 100644 index c8095bd1de..0000000000 --- a/packaging/distribution/src/main/resources/bin/apply_amps.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# ------- -# Script for apply AMPs to installed WAR -# ------- -pushd $(dirname $0)>/dev/null -export SCRIPTPATH=$(pwd) -export ALF_HOME=${SCRIPTPATH%/*} -export CATALINA_HOME=$ALF_HOME/tomcat -required_java_version="1.7" - -if [ -f $CATALINA_HOME/bin/setenv.sh ]; then - . $CATALINA_HOME/bin/setenv.sh -fi - -# Verify Java installation into ALF_HOME folder -if [ -f $ALF_HOME/java/bin/java ] && [ -x $ALF_HOME/java/bin/java ]; then - echo - echo "Found java executable in $ALF_HOME/java" - _java=$ALF_HOME/java/bin/java - -# Verify Java installation into JAVA_HOME -elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then - echo - echo "Found java executable in JAVA_HOME: $JAVA_HOME" - - _java="$JAVA_HOME/bin/java" - -# Verify Java installation from linux repositories -elif type -p java; then - echo - echo "Found installed java executable on the system" - - _java=java - -else - echo - echo "Java is not installed . . . The required Java version is $required_java_version or higher" - echo "Please install Java and try again. Script will be closed. " - read DUMMY - exit 15 -fi - -echo -echo "This script will apply all the AMPs in amps and amps_share to the alfresco.war and share.war files in $CATALINA_HOME/webapps" -echo "Press control-c to stop this script . . ." -echo "Press any other key to continue . . ." -read RESP -{ -$_java -jar $ALF_HOME/bin/alfresco-mmt.jar install $ALF_HOME/amps $CATALINA_HOME/webapps/alfresco.war -directory $* -$_java -jar $ALF_HOME/bin/alfresco-mmt.jar list $CATALINA_HOME/webapps/alfresco.war -$_java -jar $ALF_HOME/bin/alfresco-mmt.jar install $ALF_HOME/amps_share $CATALINA_HOME/webapps/share.war -directory $* -$_java -jar $ALF_HOME/bin/alfresco-mmt.jar list $CATALINA_HOME/webapps/share.war -} || -{ - echo - echo "Error. Appling of the AMPs is failed. See error message above." - echo -} -echo "About to clean out $ALF_HOME/tomcat/webapps/alfresco and share directories and temporary files..." -echo "Press control-c to stop this script . . ." -echo "Press any other key to continue . . ." -read DUMMY -rm -rf $CATALINA_HOME/webapps/alfresco -rm -rf $CATALINA_HOME/webapps/share -. $ALF_HOME/bin/clean_tomcat.sh -popd>/dev/null \ No newline at end of file diff --git a/packaging/distribution/src/main/resources/bin/clean_tomcat.bat b/packaging/distribution/src/main/resources/bin/clean_tomcat.bat deleted file mode 100644 index 5014e508d6..0000000000 --- a/packaging/distribution/src/main/resources/bin/clean_tomcat.bat +++ /dev/null @@ -1,13 +0,0 @@ -rem @echo off -rem --------------------------------- -rem Script to clean Tomcat temp files -rem --------------------------------- - -set ALF_HOME=%~dp0.. -set CATALINA_HOME=%ALF_HOME%\tomcat - -echo Cleaning temporary Alfresco files from Tomcat... -rmdir /S /Q "%CATALINA_HOME%\temp\Alfresco" "%CATALINA_HOME%\work\Catalina\localhost\alfresco" -rmdir /S /Q "%CATALINA_HOME%\work\Catalina\localhost\share" -rmdir /S /Q "%CATALINA_HOME%\work\Catalina\localhost\awe" -rmdir /S /Q "%CATALINA_HOME%\work\Catalina\localhost\wcmqs" \ No newline at end of file diff --git a/packaging/distribution/src/main/resources/bin/clean_tomcat.sh b/packaging/distribution/src/main/resources/bin/clean_tomcat.sh deleted file mode 100644 index 0298283e6f..0000000000 --- a/packaging/distribution/src/main/resources/bin/clean_tomcat.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# --------------------------------- -# Script to clean Tomcat temp files -# --------------------------------- -echo "Cleaning temporary Alfresco files from Tomcat..." -rm -rf tomcat/temp/Alfresco tomcat/work/Catalina/localhost/alfresco -rm -rf tomcat/work/Catalina/localhost/share -rm -rf tomcat/work/Catalina/localhost/awe -rm -rf tomcat/work/Catalina/localhost/wcmqs \ No newline at end of file diff --git a/packaging/distribution/src/main/resources/keystore/CreateSSLKeystores.txt b/packaging/distribution/src/main/resources/keystore/CreateSSLKeystores.txt deleted file mode 100644 index a949d3e576..0000000000 --- a/packaging/distribution/src/main/resources/keystore/CreateSSLKeystores.txt +++ /dev/null @@ -1,141 +0,0 @@ -Instructions for Generating Repository SSL Keystores -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - is the keystore password. The file ${dir.keystore}/ssl-keystore-passwords.properties contains passwords for the SSL keystore, -${dir.keystore}/ssl-truststore-passwords.properties contains passwords for the SSL truststore. - -These instructions will create an RSA public/private key pair for the repository with a certificate that has been signed by the Alfresco Certificate Authority (CA). -It will also create a truststore for the repository containing the CA certificate; this will be used to authenticate connections to specific repository -URLs from Solr. It assumes the existence of the Alfresco CA key and certificate to sign the repository certificate; for security reasons these are not generally available. -You can either generate your own CA key and certificate (see instructions below) or use a recognised Certificate Authority such as Verisign. For Alfresco employees the key -and certificate are available in svn. - -(i) Generate the repository public/private key pair in a keystore: - -$ keytool -genkey -alias ssl.repo -keyalg RSA -keystore ssl.keystore -storetype JCEKS -storepass -Enter keystore password: -Re-enter new password: -What is your first and last name? - [Unknown]: Alfresco Repository -What is the name of your organizational unit? - [Unknown]: -What is the name of your organization? - [Unknown]: Alfresco Software Ltd. -What is the name of your City or Locality? - [Unknown]: Maidenhead -What is the name of your State or Province? - [Unknown]: UK -What is the two-letter country code for this unit? - [Unknown]: GB -Is CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB correct? - [no]: yes - -Enter key password for - (RETURN if same as keystore password): - -(ii) Generate a certificate request for the repository key - -$ keytool -keystore ssl.keystore -alias ssl.repo -certreq -file repo.csr -storetype JCEKS -storepass - -(iii) Alfresco CA signs the certificate request, creating a certificate that is valid for 365 days. - -$ openssl x509 -CA ca.crt -CAkey ca.key -CAcreateserial -req -in repo.csr -out repo.crt -days 365 -Signature ok -subject=/C=GB/ST=UK/L=Maidenhead/O=Alfresco Software Ltd./OU=Unknown/CN=Alfresco Repository -Getting CA Private Key -Enter pass phrase for ca.key: - -(iv) Import the Alfresco CA key into the repository key store - -$ keytool -import -alias ssl.alfreco.ca -file ca.crt -keystore ssl.keystore -storetype JCEKS -storepass -Enter keystore password: -Owner: CN=Alfresco CA, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB -Issuer: CN=Alfresco CA, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB -Serial number: 805ba6dc8f62f8b8 -Valid from: Fri Aug 12 13:28:58 BST 2011 until: Mon Aug 09 13:28:58 BST 2021 -Certificate fingerprints: - MD5: 4B:45:94:2D:8E:98:E8:12:04:67:AD:AE:48:3C:F5:A0 - SHA1: 74:42:22:D0:52:AD:82:7A:FD:37:46:37:91:91:F4:77:89:3A:C9:A3 - Signature algorithm name: SHA1withRSA - Version: 3 - -Extensions: - -#1: ObjectId: 2.5.29.14 Criticality=false -SubjectKeyIdentifier [ -KeyIdentifier [ -0000: 08 42 40 DC FE 4A 50 87 05 2B 38 4D 92 70 8E 51 .B@..JP..+8M.p.Q -0010: 4E 38 71 D6 N8q. -] -] - -#2: ObjectId: 2.5.29.19 Criticality=false -BasicConstraints:[ - CA:true - PathLen:2147483647 -] - -#3: ObjectId: 2.5.29.35 Criticality=false -AuthorityKeyIdentifier [ -KeyIdentifier [ -0000: 08 42 40 DC FE 4A 50 87 05 2B 38 4D 92 70 8E 51 .B@..JP..+8M.p.Q -0010: 4E 38 71 D6 N8q. -] - -[CN=Alfresco CA, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB] -SerialNumber: [ 805ba6dc 8f62f8b8] -] - -Trust this certificate? [no]: yes -Certificate was added to keystore - -(v) Import the CA-signed repository certificate into the repository keystore - -$ keytool -import -alias ssl.repo -file repo.crt -keystore ssl.keystore -storetype JCEKS -storepass -Enter keystore password: -Certificate reply was installed in keystore - -(vi) Convert the repository keystore to a pkcs12 keystore (for use in browsers such as Firefox). Give the pkcs12 key store the key store password 'alfresco'. - -keytool -importkeystore -srckeystore ssl.keystore -srcstorepass -srcstoretype JCEKS -srcalias ssl.repo -srckeypass kT9X6oe68t -destkeystore firefox.p12 -deststoretype pkcs12 -deststorepass alfresco -destalias ssl.repo -destkeypass alfresco - -(vi) Create a repository truststore containing the Alfresco CA certificate - -keytool -import -alias ssl.alfreco.ca -file ca.crt -keystore ssl.keystore -storetype JCEKS -storepass -keytool -import -alias alfreco.ca -file ca.crt -keystore ssl.truststore -storetype JCEKS -storepass - -(vii) Copy the keystore and truststore to the repository keystore location defined by the property 'dir.keystore'. -(viii) Update the SSL properties i.e. properties starting with the prefixes 'alfresco.encryption.ssl.keystore' and 'alfresco.encryption.ssl.truststore'. - -Instructions for Generating a Certificate Authority (CA) Key and Certificate -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -(i) Generate the CA private key - -$ openssl genrsa -des3 -out ca.key 1024 -Generating RSA private key, 1024 bit long modulus -..........++++++ -..++++++ -e is 65537 (0x10001) -Enter pass phrase for ca.key: -Verifying - Enter pass phrase for ca.key: - -(ii) Generate the CA self-signed certificate - -$ openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -Enter pass phrase for ca.key: -You are about to be asked to enter information that will be incorporated -into your certificate request. -What you are about to enter is what is called a Distinguished Name or a DN. -There are quite a few fields but you can leave some blank -For some fields there will be a default value, -If you enter '.', the field will be left blank. ------ -Country Name (2 letter code) [AU]:GB -State or Province Name (full name) [Some-State]:UK -Locality Name (eg, city) []:Maidenhead -Organization Name (eg, company) [Internet Widgits Pty Ltd]:Alfresco Software Ltd. -Organizational Unit Name (eg, section) []: -Common Name (eg, YOUR name) []:Alfresco CA -Email Address []: - diff --git a/packaging/distribution/src/main/resources/keystore/generate_keystores.bat b/packaging/distribution/src/main/resources/keystore/generate_keystores.bat deleted file mode 100644 index 5aed5e9fa0..0000000000 --- a/packaging/distribution/src/main/resources/keystore/generate_keystores.bat +++ /dev/null @@ -1,58 +0,0 @@ -@rem Please edit the variables below to suit your installation -@rem Note: for an installation created by the Alfresco installer, you only need to edit ALFRESCO_HOME - -@rem Alfresco installation directory -set ALFRESCO_HOME=C:\Alfresco-5.2 -@rem The directory containing the alfresco keystores, as referenced by keystoreFile and truststoreFile attributes in tomcat\conf\server.xml -set ALFRESCO_KEYSTORE_HOME=%ALFRESCO_HOME%\alf_data\keystore -@rem Java installation directory -set JAVA_HOME=%ALFRESCO_HOME%\java -@rem Location in which new keystore files will be generated -set CERTIFICATE_HOME=%USERPROFILE% -@rem The repository server certificate subject name, as specified in tomcat\conf\tomcat-users.xml with roles="repository" -set REPO_CERT_DNAME=CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB -@rem The SOLR client certificate subject name, as specified in tomcat\conf\tomcat-users.xml with roles="repoclient" -set SOLR_CLIENT_CERT_DNAME=CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB -@rem The number of days before the certificate expires -set CERTIFICATE_VALIDITY=36525 - -@rem Ensure certificate output dir exists -@if not exist "%CERTIFICATE_HOME%" mkdir "%CERTIFICATE_HOME%" - -@rem Remove old output files (note they are backed up elsewhere) -@if exist "%CERTIFICATE_HOME%\ssl.keystore" del "%CERTIFICATE_HOME%\ssl.keystore" -@if exist "%CERTIFICATE_HOME%\ssl.truststore" del "%CERTIFICATE_HOME%\ssl.truststore" -@if exist "%CERTIFICATE_HOME%\browser.p12" del "%CERTIFICATE_HOME%\browser.p12" -@if exist "%CERTIFICATE_HOME%\ssl.repo.client.keystore" del "%CERTIFICATE_HOME%\ssl.repo.client.keystore" -@if exist "%CERTIFICATE_HOME%\ssl.repo.client.truststore" del "%CERTIFICATE_HOME%\ssl.repo.client.truststore" - -@rem Generate new self-signed certificates for the repository and solr -"%JAVA_HOME%\bin\keytool" -genkeypair -keyalg RSA -dname "%REPO_CERT_DNAME%" -validity %CERTIFICATE_VALIDITY% -alias ssl.repo -keypass kT9X6oe68t -keystore "%CERTIFICATE_HOME%\ssl.keystore" -storetype JCEKS -storepass kT9X6oe68t -"%JAVA_HOME%\bin\keytool" -exportcert -alias ssl.repo -file "%CERTIFICATE_HOME%\ssl.repo.crt" -keystore "%CERTIFICATE_HOME%\ssl.keystore" -storetype JCEKS -storepass kT9X6oe68t -"%JAVA_HOME%\bin\keytool" -genkeypair -keyalg RSA -dname "%SOLR_CLIENT_CERT_DNAME%" -validity %CERTIFICATE_VALIDITY% -alias ssl.repo.client -keypass kT9X6oe68t -keystore "%CERTIFICATE_HOME%\ssl.repo.client.keystore" -storetype JCEKS -storepass kT9X6oe68t -"%JAVA_HOME%\bin\keytool" -exportcert -alias ssl.repo.client -file "%CERTIFICATE_HOME%\ssl.repo.client.crt" -keystore "%CERTIFICATE_HOME%\ssl.repo.client.keystore" -storetype JCEKS -storepass kT9X6oe68t - -@rem Create trust relationship between repository and solr -"%JAVA_HOME%\bin\keytool" -importcert -noprompt -alias ssl.repo.client -file "%CERTIFICATE_HOME%\ssl.repo.client.crt" -keystore "%CERTIFICATE_HOME%\ssl.truststore" -storetype JCEKS -storepass kT9X6oe68t -@rem Create trust relationship between repository and itself - used for searches -"%JAVA_HOME%\bin\keytool" -importcert -noprompt -alias ssl.repo -file "%CERTIFICATE_HOME%\ssl.repo.crt" -keystore "%CERTIFICATE_HOME%\ssl.truststore" -storetype JCEKS -storepass kT9X6oe68t -@rem Create trust relationship between solr and repository -"%JAVA_HOME%\bin\keytool" -importcert -noprompt -alias ssl.repo -file "%CERTIFICATE_HOME%\ssl.repo.crt" -keystore "%CERTIFICATE_HOME%\ssl.repo.client.truststore" -storetype JCEKS -storepass kT9X6oe68t -@rem Export repository keystore to pkcs12 format for browser compatibility -"%JAVA_HOME%\bin\keytool" -importkeystore -srckeystore "%CERTIFICATE_HOME%\ssl.keystore" -srcstorepass kT9X6oe68t -srcstoretype JCEKS -srcalias ssl.repo -srckeypass kT9X6oe68t -destkeystore "%CERTIFICATE_HOME%\browser.p12" -deststoretype pkcs12 -deststorepass alfresco -destalias ssl.repo -destkeypass alfresco - -@rem Ensure keystore dir actually exists -@if not exist "%ALFRESCO_KEYSTORE_HOME%" mkdir "%ALFRESCO_KEYSTORE_HOME%" - -@rem Install the new files -copy /Y "%CERTIFICATE_HOME%\ssl.keystore" "%ALFRESCO_KEYSTORE_HOME%\ssl.keystore" -copy /Y "%CERTIFICATE_HOME%\ssl.truststore" "%ALFRESCO_KEYSTORE_HOME%\ssl.truststore" -copy /Y "%CERTIFICATE_HOME%\browser.p12" "%ALFRESCO_KEYSTORE_HOME%\browser.p12" - -@echo **************************************** -@echo You must copy the following files to the correct location. -@echo %CERTIFICATE_HOME%\ssl.repo.client.keystore -@echo %CERTIFICATE_HOME%\ssl.repo.client.truststore -@echo eg. for Solr 4 the location is SOLR_HOME\workspace-SpacesStore\conf and SOLR_HOME\archive-SpacesStore\conf -@echo Please ensure that you set dir.keystore=%ALFRESCO_KEYSTORE_HOME% in alfresco-global.properties -@echo **************************************** \ No newline at end of file diff --git a/packaging/distribution/src/main/resources/keystore/generate_keystores.sh b/packaging/distribution/src/main/resources/keystore/generate_keystores.sh deleted file mode 100644 index 180c990945..0000000000 --- a/packaging/distribution/src/main/resources/keystore/generate_keystores.sh +++ /dev/null @@ -1,82 +0,0 @@ -#! /bin/sh -# Please edit the variables below to suit your installation -# Note: for an installation created by the Alfresco installer, you only need to edit ALFRESCO_HOME - -# Alfresco installation directory -if [ -z "$ALFRESCO_HOME" ]; then - ALFRESCO_HOME=/opt/alfresco-5.2 - echo "Setting ALFRESCO_HOME to $ALFRESCO_HOME" -fi - -# The directory containing the alfresco keystores, as referenced by keystoreFile and truststoreFile attributes in tomcat/conf/server.xml -ALFRESCO_KEYSTORE_HOME=$ALFRESCO_HOME/alf_data/keystore - -# Location in which new keystore files will be generated -if [ -z "$CERTIFICATE_HOME" ]; then - CERTIFICATE_HOME=$HOME - echo "Certificates will be generated in $CERTIFICATE_HOME and then moved to $ALFRESCO_KEYSTORE_HOME" -fi - -# Java installation directory -JAVA_HOME=$ALFRESCO_HOME/java - -# The repository server certificate subject name, as specified in tomcat/conf/tomcat-users.xml with roles="repository" -REPO_CERT_DNAME="CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB" -# The SOLR client certificate subject name, as specified in tomcat/conf/tomcat-users.xml with roles="repoclient" -SOLR_CLIENT_CERT_DNAME="CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB" -# The number of days before the certificate expires -CERTIFICATE_VALIDITY=36525 - -# Stop -if [ -f "$ALFRESCO_HOME/alfresco.sh" ]; then "$ALFRESCO_HOME/alfresco.sh" stop; fi - -# Ensure certificate output dir exists -mkdir -p "$CERTIFICATE_HOME" - -# Remove old output files (note they are backed up elsewhere) -if [ -f "$CERTIFICATE_HOME/ssl.keystore" ]; then rm "$CERTIFICATE_HOME/ssl.keystore"; fi -if [ -f "$CERTIFICATE_HOME/ssl.truststore" ]; then rm "$CERTIFICATE_HOME/ssl.truststore"; fi -if [ -f "$CERTIFICATE_HOME/browser.p12" ]; then rm "$CERTIFICATE_HOME/browser.p12"; fi -if [ -f "$CERTIFICATE_HOME/ssl.repo.client.keystore" ]; then rm "$CERTIFICATE_HOME/ssl.repo.client.keystore"; fi -if [ -f "$CERTIFICATE_HOME/ssl.repo.client.truststore" ]; then rm "$CERTIFICATE_HOME/ssl.repo.client.truststore"; fi - -# Generate new self-signed certificates for the repository and solr -"$JAVA_HOME/bin/keytool" -genkeypair -keyalg RSA -dname "$REPO_CERT_DNAME" -validity $CERTIFICATE_VALIDITY -alias ssl.repo -keypass kT9X6oe68t -keystore "$CERTIFICATE_HOME/ssl.keystore" -storetype JCEKS -storepass kT9X6oe68t -"$JAVA_HOME/bin/keytool" -exportcert -alias ssl.repo -file "$CERTIFICATE_HOME/ssl.repo.crt" -keystore "$CERTIFICATE_HOME/ssl.keystore" -storetype JCEKS -storepass kT9X6oe68t -"$JAVA_HOME/bin/keytool" -genkeypair -keyalg RSA -dname "$SOLR_CLIENT_CERT_DNAME" -validity $CERTIFICATE_VALIDITY -alias ssl.repo.client -keypass kT9X6oe68t -keystore "$CERTIFICATE_HOME/ssl.repo.client.keystore" -storetype JCEKS -storepass kT9X6oe68t -"$JAVA_HOME/bin/keytool" -exportcert -alias ssl.repo.client -file "$CERTIFICATE_HOME/ssl.repo.client.crt" -keystore "$CERTIFICATE_HOME/ssl.repo.client.keystore" -storetype JCEKS -storepass kT9X6oe68t - -# Create trust relationship between repository and solr -"$JAVA_HOME/bin/keytool" -importcert -noprompt -alias ssl.repo.client -file "$CERTIFICATE_HOME/ssl.repo.client.crt" -keystore "$CERTIFICATE_HOME/ssl.truststore" -storetype JCEKS -storepass kT9X6oe68t -# Create trust relationship between repository and itself - used for searches -"$JAVA_HOME/bin/keytool" -importcert -noprompt -alias ssl.repo -file "$CERTIFICATE_HOME/ssl.repo.crt" -keystore "$CERTIFICATE_HOME/ssl.truststore" -storetype JCEKS -storepass kT9X6oe68t -# Create trust relationship between solr and repository -"$JAVA_HOME/bin/keytool" -importcert -noprompt -alias ssl.repo -file "$CERTIFICATE_HOME/ssl.repo.crt" -keystore "$CERTIFICATE_HOME/ssl.repo.client.truststore" -storetype JCEKS -storepass kT9X6oe68t -# Export repository keystore to pkcs12 format for browser compatibility -"$JAVA_HOME/bin/keytool" -importkeystore -srckeystore "$CERTIFICATE_HOME/ssl.keystore" -srcstorepass kT9X6oe68t -srcstoretype JCEKS -srcalias ssl.repo -srckeypass kT9X6oe68t -destkeystore "$CERTIFICATE_HOME/browser.p12" -deststoretype pkcs12 -deststorepass alfresco -destalias ssl.repo -destkeypass alfresco - -# Ensure keystore dir actually exists -mkdir -p "$ALFRESCO_KEYSTORE_HOME" - -# Back up old files -cp "$ALFRESCO_KEYSTORE_HOME/ssl.keystore" "$ALFRESCO_KEYSTORE_HOME/ssl.keystore.old" -cp "$ALFRESCO_KEYSTORE_HOME/ssl.truststore" "$ALFRESCO_KEYSTORE_HOME/ssl.truststore.old" -cp "$ALFRESCO_KEYSTORE_HOME/browser.p12" "$ALFRESCO_KEYSTORE_HOME/browser.p12.old" - -# Install the new files -cp "$CERTIFICATE_HOME/ssl.keystore" "$ALFRESCO_KEYSTORE_HOME/ssl.keystore" -cp "$CERTIFICATE_HOME/ssl.truststore" "$ALFRESCO_KEYSTORE_HOME/ssl.truststore" -cp "$CERTIFICATE_HOME/browser.p12" "$ALFRESCO_KEYSTORE_HOME/browser.p12" - -echo " " -echo "*******************************************" -echo "You must copy the following files to the correct location." -echo " " -echo " $CERTIFICATE_HOME/ssl.repo.client.keystore" -echo " $CERTIFICATE_HOME/ssl.repo.client.truststore" -echo " eg. for Solr 4 the location is SOLR_HOME/workspace-SpacesStore/conf/ and SOLR_HOME/archive-SpacesStore/conf/" -echo " " -echo "$ALFRESCO_KEYSTORE_HOME/browser.p12 has also been generated." -echo " " -echo "Please ensure that you set dir.keystore=$ALFRESCO_KEYSTORE_HOME in alfresco-global.properties" -echo "*******************************************" diff --git a/packaging/distribution/src/main/resources/keystore/readme.txt b/packaging/distribution/src/main/resources/keystore/readme.txt deleted file mode 100644 index 25f317223c..0000000000 --- a/packaging/distribution/src/main/resources/keystore/readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -See https://wiki.alfresco.com/wiki/Data_Encryption and https://wiki.alfresco.com/wiki/Alfresco_And_SOLR. - -keystore is the secret key keystore, containing the secret key used to encrypt and decrypt node properties. -ssl.keystore is the repository keystore, containing the repository private/public key pair and certificate. -ssl.truststore is the repository truststore, containing certificates that the repository trusts. - -browser.p12 is a pkcs12 keystore generated from ssl.keystore that contains the repository private key and certificate for use in browsers such as Firefox. \ No newline at end of file diff --git a/packaging/distribution/src/main/resources/web-server/conf/Catalina/localhost/alfresco.xml b/packaging/distribution/src/main/resources/web-server/conf/Catalina/localhost/alfresco.xml deleted file mode 100644 index ac2960c148..0000000000 --- a/packaging/distribution/src/main/resources/web-server/conf/Catalina/localhost/alfresco.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/packaging/docker-alfresco/Dockerfile b/packaging/docker-alfresco/Dockerfile index 691b4356c7..7904e141ab 100644 --- a/packaging/docker-alfresco/Dockerfile +++ b/packaging/docker-alfresco/Dockerfile @@ -1,6 +1,9 @@ -# Fetch image based on Tomcat 8.5.43 and Java 11 +# Fetch image based on Tomcat 8.5 and Java 11 # More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat -FROM alfresco/alfresco-base-tomcat:8.5.43-java-11-openjdk-centos-7 +FROM alfresco/alfresco-base-tomcat:8.5.51-java-11-openjdk-centos-7 + +# Set default docker_context. +ARG resource_path=target # Set default user information ARG GROUPNAME=Alfresco @@ -13,46 +16,45 @@ ARG TOMCAT_DIR=/usr/local/tomcat # 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 +RUN mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/mimetypes && \ + mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/transform/renditions && \ + mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/transform/pipelines && \ + mkdir ${TOMCAT_DIR}/alfresco-mmt && \ + touch ${TOMCAT_DIR}/shared/classes/alfresco-global.properties # 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 ${resource_path}/war ${TOMCAT_DIR}/webapps +COPY ${resource_path}/connector/* ${TOMCAT_DIR}/lib/ +COPY ${resource_path}/alfresco-mmt/* ${TOMCAT_DIR}/alfresco-mmt/ # Copy Licenses to the root of the Docker image RUN mkdir /licenses -COPY target/licenses/ /licenses/ +COPY ${resource_path}/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 mkdir -p ${TOMCAT_DIR}/amps #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 ${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 -# Docker CMD from parent image starts the server +# Move the log file +RUN 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 && \ -# 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. @@ -68,6 +70,14 @@ RUN yum install -y fontconfig-2.13.0-4.3.el7 \ dejavu-sans-fonts-2.33-6.el7 && \ yum clean all +# Generate default keystore. Please generate new one for production systems +ARG CERT_DNAME="CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB" +ARG CERT_VALIDITY=36525 +ARG KEYSTORE_PASSWORD=mp6yc0UD9e +RUN mkdir ${TOMCAT_DIR}/shared/classes/alfresco/keystore && \ + keytool -genseckey -dname "$CERT_DNAME" -validity ${CERT_VALIDITY} -alias metadata -keyalg AES -keysize 256 -keystore ${TOMCAT_DIR}/shared/classes/alfresco/keystore/keystore -storetype pkcs12 -storepass ${KEYSTORE_PASSWORD} + + # 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 && \ @@ -75,7 +85,6 @@ RUN mkdir -p ${TOMCAT_DIR}/conf/Catalina/localhost && \ groupadd -g ${GROUPID} ${GROUPNAME} && \ useradd -u ${USERID} -G ${GROUPNAME} ${IMAGEUSERNAME} && \ chgrp -R ${GROUPNAME} ${TOMCAT_DIR} && \ - chmod g+w ${TOMCAT_DIR}/logs && \ chmod g+rx ${TOMCAT_DIR}/conf && \ chmod -R g+r ${TOMCAT_DIR}/conf && \ find ${TOMCAT_DIR}/webapps -type d -exec chmod 0750 {} \; && \ @@ -84,14 +93,17 @@ 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 && \ + chmod 664 ${TOMCAT_DIR}/alfresco-mmt/alfresco-mmt-*.jar && \ + find /licenses -type d -exec chmod 0775 {} \; && \ + find /licenses -type f -exec chmod 0664 {} \; - 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 +EXPOSE 10001 -# To remote debug into this image add: EXPOSE 8000 -# Changes are also required to the docker-compose/docker-compose.yml file. -# EXPOSE 8000 +# For remote debug +EXPOSE 8000 USER ${IMAGEUSERNAME} \ No newline at end of file diff --git a/packaging/docker-alfresco/pom.xml b/packaging/docker-alfresco/pom.xml index 3deda74e00..007c066e50 100644 --- a/packaging/docker-alfresco/pom.xml +++ b/packaging/docker-alfresco/pom.xml @@ -1,88 +1,24 @@ 4.0.0 - content-services-community-docker-alfresco - ACS Community Docker Image Builder for Alfresco Community + alfresco-community-repo-docker + Alfresco Community Repo Docker Base Builder pom org.alfresco - acs-community-packaging - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-packaging + 7.183.300-TEST1-SNAPSHOT - alfresco/alfresco-content-repository-community - quay.io + alfresco/alfresco-community-repo-base - - - org.alfresco - content-services-community - ${project.version} - war - - - org.alfresco - api-explorer - ${dependency.alfresco-api-explorer.version} - war - - - org.alfresco - alfresco-server-root - ${dependency.alfresco-server-root.version} - war - - - org.postgresql - postgresql - ${dependency.postgresql.version} - - - org.alfresco - alfresco-mmt - ${dependency.alfresco-mmt.version} - - - org.alfresco - alfresco-share-services - ${alfresco.alfresco-share-services.version} - amp - - - org.alfresco.aos-module - alfresco-aos-module - ${alfresco.aos-module.version} - amp - - - org.alfresco.aos-module - alfresco-aos-repo-binding - - - - - org.alfresco.aos-module - alfresco-vti-bin - ${alfresco.aos-module.version} - war - - - org.alfresco.integrations - alfresco-googledrive-repo-community - ${alfresco.googledrive.version} - amp - - - org.apache.maven.plugins maven-resources-plugin - 3.1.0 copy-licenses @@ -106,7 +42,6 @@ org.apache.maven.plugins maven-dependency-plugin - 3.1.2 unpack-war-files @@ -124,13 +59,6 @@ false ${project.build.directory}/war/alfresco - - org.alfresco - api-explorer - ${dependency.alfresco-api-explorer.version} - war - ${project.build.directory}/war/api-explorer - org.alfresco alfresco-server-root @@ -141,7 +69,6 @@ org.alfresco.aos-module alfresco-vti-bin - ${alfresco.aos-module.version} war ${project.build.directory}/war/_vti_bin @@ -159,7 +86,6 @@ org.postgresql postgresql - ${dependency.postgresql.version} jar false ${project.build.directory}/connector @@ -167,7 +93,6 @@ org.alfresco alfresco-mmt - ${dependency.alfresco-mmt.version} jar false ${project.build.directory}/alfresco-mmt @@ -184,18 +109,9 @@ - - org.alfresco - alfresco-share-services - ${alfresco.alfresco-share-services.version} - amp - false - ${project.build.directory}/amps - org.alfresco.aos-module alfresco-aos-module - ${alfresco.aos-module.version} amp false ${project.build.directory}/amps @@ -203,7 +119,6 @@ org.alfresco.integrations alfresco-googledrive-repo-community - ${alfresco.googledrive.version} amp false ${project.build.directory}/amps @@ -213,38 +128,35 @@ - - - io.fabric8 - fabric8-maven-plugin - ${dependency.fabric8.version} - - - - ${image.name} - - ${project.basedir}/ - - - - - communityDocker + io.fabric8 fabric8-maven-plugin - ${dependency.fabric8.version} + + + + ${image.name}:${image.tag} + + ${project.basedir}/ + + true + + + + + build-image - install + package build @@ -257,19 +169,33 @@ internal + io.fabric8 fabric8-maven-plugin - ${dependency.fabric8.version} + ${image.name}:${image.tag} ${image.registry} ${project.basedir}/ + + true + + + + + + ${image.name}:${image.tag} + + ${project.basedir}/ + + true + @@ -288,87 +214,5 @@ - - - master - - - - io.fabric8 - fabric8-maven-plugin - ${dependency.fabric8.version} - - - - ${image.name} - ${image.registry} - - ${project.basedir}/ - - - - ${image.name} - - ${project.basedir}/ - - - - - - - build-push-image - install - - build - push - - - - - - - - - - release - - - - io.fabric8 - fabric8-maven-plugin - ${dependency.fabric8.version} - - - - quay.io - ${image.name}:${project.version} - ${image.registry} - - ${project.basedir}/ - - - - dockerhub - ${image.name}:${project.version} - - ${project.basedir}/ - - - - - - - build-push-image - deploy - - build - push - - - - - - - diff --git a/packaging/pom.xml b/packaging/pom.xml index 7f92efd6d9..250a0f98f4 100644 --- a/packaging/pom.xml +++ b/packaging/pom.xml @@ -1,92 +1,26 @@ 4.0.0 - acs-community-packaging - Alfresco Content Services Community Packaging - 6.2.2-SNAPSHOT + alfresco-community-repo-packaging + Alfresco Community Repo Packaging pom org.alfresco - alfresco-super-pom - 12 + alfresco-community-repo + 7.183.300-TEST1-SNAPSHOT - - scm:git:https://github.com/Alfresco/acs-community-packaging.git - scm:git:https://github.com/Alfresco/acs-community-packaging.git - https://github.com/Alfresco/acs-community-packaging - HEAD - - - - - alfresco-internal - https://artifacts.alfresco.com/nexus/content/repositories/releases - - - alfresco-internal-snapshots - https://artifacts.alfresco.com/nexus/content/repositories/snapshots - - - - - - Community - latest - - 7.147 - 7.200 - 8.50.18 - 7.34 - - 1.0.12 - - 7.16 - 6.0 - 1.1 - 2.3 - 7.1 - 6.0.1 - 6.2.1.1 - 1.2.15 - 0.2 - - 5.1.15.RELEASE - 4.4.0 - 2.10.2 - 2.10.1 - 3.3.6 - - - 6.2.2 - 6.2.2 - - - 3.2.0 - - - 1.3.1 - - ${project.version} - alfresco-community - ${alfresco.package.name}-distribution - - 42.2.14 - - 3.0.20 - 3.3.0 - 1.1.4 - 1.37 - 1.13 - 1.8 - 1.6 - 1.5 - 2.3 - - 11 - - + + fullBuild + + true + + + war + docker-alfresco + + community @@ -100,18 +34,6 @@ docker-alfresco - - fullBuild - - true - - - war - distribution - public-javadoc - docker-alfresco - - all-tas-tests @@ -120,440 +42,4 @@ - - - - org.alfresco - alfresco-core - ${dependency.alfresco-core.version} - - - org.alfresco - alfresco-core - ${dependency.alfresco-core.version} - tests - - - org.alfresco - alfresco-data-model - ${dependency.alfresco-data-model.version} - - - org.alfresco - alfresco-jlan-embed - ${dependency.alfresco-jlan.version} - - - org.alfresco - alfresco-remote-api - ${dependency.alfresco-remote-api.version} - - - org.alfresco - alfresco-remote-api - ${dependency.alfresco-remote-api.version} - tests - - - org.alfresco - alfresco-repository - ${dependency.alfresco-repository.version} - - - org.alfresco - alfresco-repository - ${dependency.alfresco-repository.version} - tests - - - org.alfresco - alfresco-trashcan-cleaner - ${dependency.alfresco-trashcan-cleaner.version} - - - org.alfresco - alfresco-heartbeat-data-sender - ${dependency.alfresco-hb-data-sender.version} - - - xalan - xalan - 2.7.2-alfresco - - - org.alfresco.services - alfresco-messaging-repo - ${dependency.alfresco-messaging-repo.version} - - - org.alfresco - alfresco-mmt - ${dependency.alfresco-mmt.version} - - - org.alfresco - alfresco-pdf-renderer - ${dependency.alfresco-pdf-renderer.version} - linux - tgz - - - org.alfresco - alfresco-pdf-renderer - ${dependency.alfresco-pdf-renderer.version} - win64 - tgz - - - org.alfresco - alfresco-pdf-renderer - ${dependency.alfresco-pdf-renderer.version} - - - org.alfresco - alfresco-server-root - ${dependency.alfresco-server-root.version} - war - - - org.alfresco.surf - spring-surf-core-configservice - ${dependency.alfresco-spring-webscripts.version} - - - org.alfresco.surf - spring-webscripts - ${dependency.alfresco-spring-webscripts.version} - - - org.alfresco.surf - spring-webscripts-api - ${dependency.alfresco-spring-webscripts.version} - - - org.quartz-scheduler - quartz - 2.3.2 - - - - - com.mchange - * - - - - - org.apache.httpcomponents - httpcore - 4.4.13 - - - joda-time - joda-time - 2.10.5 - - - commons-httpclient - commons-httpclient - 3.1-HTTPCLIENT-1265 - - - commons-logging - commons-logging - 1.2 - - - commons-beanutils - commons-beanutils - 1.9.4 - - - commons-codec - commons-codec - 1.14 - - - commons-collections - commons-collections - 3.2.2 - - - - commons-digester - commons-digester - 2.1 - - - commons-lang - commons-lang - 2.6 - - - commons-fileupload - commons-fileupload - 1.4 - - - com.sun.xml.bind - jaxb-impl - 2.3.2 - - - org.apache.httpcomponents - httpclient - 4.5.12 - - - org.apache.httpcomponents - httpclient-cache - 4.5.12 - - - org.apache.xmlbeans - xmlbeans - 3.1.0 - - - org.springframework - spring-aop - ${dependency.spring.version} - - - org.springframework - spring-beans - ${dependency.spring.version} - - - org.springframework - spring-context - ${dependency.spring.version} - - - org.springframework - spring-context-support - ${dependency.spring.version} - - - org.springframework - spring-core - ${dependency.spring.version} - - - - - org.springframework - spring-jcl - - - - - org.springframework - spring-expression - ${dependency.spring.version} - - - org.springframework - spring-jdbc - ${dependency.spring.version} - - - org.springframework - spring-jms - ${dependency.spring.version} - - - org.springframework - spring-orm - ${dependency.spring.version} - - - - - org.springframework - spring-jcl - - - - - org.springframework - spring-tx - ${dependency.spring.version} - - - org.springframework - spring-web - ${dependency.spring.version} - - - org.springframework - spring-webmvc - ${dependency.spring.version} - - - com.fasterxml.jackson.core - jackson-core - ${dependency.jackson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${dependency.jackson-databind.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${dependency.jackson.version} - - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${dependency.jackson.version} - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-rs-client - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-transports-http - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-ws-policy - ${dependency.cxf.version} - - - - org.apache.commons - commons-email - 1.5 - - - - junit - junit - 4.13 - test - - - org.alfresco - alfresco-log-sanitizer - ${dependency.alfresco-log-sanitizer.version} - - - org.alfresco.aos-module - alfresco-aos-module - ${alfresco.aos-module.version} - amp - - - org.alfresco.aos-module - alfresco-aos-module-distributionzip - ${alfresco.aos-module.version} - zip - - - org.alfresco.aos-module - alfresco-vti-bin - ${alfresco.aos-module.version} - war - - - org.alfresco - alfresco-content-services-share-distribution - ${alfresco.share.version} - zip - - - org.alfresco - alfresco-share-services - ${alfresco.alfresco-share-services.version} - amp - - - org.alfresco - share - ${alfresco.share.version} - war - - - org.alfresco - alfresco-wcmqs-distribution - ${alfresco.share.version} - zip - - - org.alfresco - alfresco-wcmqs-web - ${alfresco.share.version} - classes - - - org.alfresco - alfresco-wcmqs-client-api - ${alfresco.share.version} - - - org.alfresco.integrations - alfresco-googledrive-repo-community - ${alfresco.googledrive.version} - amp - - - org.alfresco.integrations - alfresco-googledrive-share-community - ${alfresco.googledrive.version} - amp - - - - org.bouncycastle - bcprov-jdk15on - 1.65 - - - org.bouncycastle - bcmail-jdk15on - 1.65 - - - - com.github.junrar - junrar - 4.0.0 - - - - org.jsoup - jsoup - 1.13.1 - - - - com.drewnoakes - metadata-extractor - 2.13.0 - - - diff --git a/packaging/public-javadoc/pom.xml b/packaging/public-javadoc/pom.xml deleted file mode 100644 index 32aadaad86..0000000000 --- a/packaging/public-javadoc/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ - - 4.0.0 - alfresco-public-javadoc - Alfresco Content Services Public API Javadoc - - org.alfresco - acs-community-packaging - 6.2.2-SNAPSHOT - ../pom.xml - - pom - - - 1.6.1 - - - - - - org.alfresco - alfresco-remote-api - - - org.alfresco - share - classes - ${alfresco.share.version} - - - - - com.docflex - docflex-alfresco-license - 1.0 - license - provided - - - - - - - - maven-dependency-plugin - - - - default-cli - false - - unpack - - - - - com.docflex - docflex-javadoc - ${docflex.version} - zip - - - ${project.build.directory} - - - - - - - maven-javadoc-plugin - - com.docflex.javadoc.Doclet - ${project.build.directory}/docflex-javadoc-${docflex.version}/lib/docflex-javadoc.jar - - -license ${settings.localRepository}/com/docflex/docflex-alfresco-license/1.0/docflex-alfresco-license-1.0.license - -template ${project.build.directory}/docflex-javadoc-${docflex.version}/templates/JavadocPro/FramedDoc.tpl - -nodialog - -launchviewer=false - -p:filter.byAnns.include.classes=org.alfresco.api.AlfrescoPublicApi - -p:docTitle "Alfresco ${project.version} Public API" - -p:windowTitle "Alfresco ${project.version} Public API" - - true - true - - org.alfresco:* - - - org.alfresco:alfresco-xmlfactory - org.alfresco:alfresco-text-gen - - org.customer,org.apache - - - - - - - diff --git a/packaging/scripts/travis/copy_to_release_bucket.sh b/packaging/scripts/travis/copy_to_release_bucket.sh deleted file mode 100755 index f04dc95162..0000000000 --- a/packaging/scripts/travis/copy_to_release_bucket.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -ev - -if [ -z ${COMM_RELEASE_VERSION} ] || [ -z ${RELEASE_VERSION} ]; -then - echo "Please provide a COMM_RELEASE_VERSION and RELEASE_VERSION in the format - (6.3.0-EA or 6.3.0-SNAPSHOT)" - exit -1 -fi - -build_number=$1 -branch_name=$2 -build_stage=release -SOURCE=s3://alfresco-artefacts-staging/alfresco-content-services-community/$build_stage/$branch_name/$build_number -DESTINATION=s3://eu.dl.alfresco.com/release/community/$COMM_RELEASE_VERSION-build-$build_number - -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 \ No newline at end of file diff --git a/packaging/scripts/travis/maven_release.sh b/packaging/scripts/travis/maven_release.sh deleted file mode 100755 index b4e9155643..0000000000 --- a/packaging/scripts/travis/maven_release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -set -e - -releaseVersion=$1 -developmentVersion=$2 -scm_path=$(mvn help:evaluate -Dexpression=project.scm.url -q -DforceStdout) - -# Use full history for release -git checkout -B "${TRAVIS_BRANCH}" -# Add email to link commits to user -git config user.email "${GIT_EMAIL}" - -if [ -z ${releaseVersion} ] || [ -z ${developmentVersion} ]; - then echo "Please provide a Release and Development verison in the format - (6.3.0-EA or 6.3.0-SNAPSHOT)" - exit -1 -else - mvn --batch-mode \ - -PfullBuild,all-tas-tests \ - -Dusername="${GIT_USERNAME}" \ - -Dpassword="${GIT_PASSWORD}" \ - -DreleaseVersion=${releaseVersion} \ - -DdevelopmentVersion=${developmentVersion} \ - -Dbuild-number=${TRAVIS_BUILD_NUMBER} \ - -Dbuild-name="${TRAVIS_BUILD_STAGE_NAME}" \ - -Dscm-path=${scm_path} \ - -DscmCommentPrefix="[maven-release-plugin][skip ci]" \ - -DskipTests \ - "-Darguments=-DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER} '-Dbuild-name=${TRAVIS_BUILD_STAGE_NAME}' -Dscm-path=${scm_path} -PfullBuild,all-tas-tests" \ - release:clean release:prepare release:perform \ - -Prelease -fi diff --git a/packaging/scripts/travis/verify_release_tag.sh b/packaging/scripts/travis/verify_release_tag.sh deleted file mode 100755 index 51086b8ec7..0000000000 --- a/packaging/scripts/travis/verify_release_tag.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -set -e - -if [ -v ${RELEASE_VERSION} ]||[ -z ${RELEASE_VERSION} ]; then - echo "Please provide a RELEASE_VERSION in the format - (6.3.0-EA or 6.3.0-SNAPSHOT)" - exit -1 -fi -# get the image name from the pom file -alfresco_docker_image=$(mvn help:evaluate -f ./docker-alfresco/pom.xml -Dexpression=image.name -q -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' | egrep -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 diff --git a/packaging/tests/environment/docker-compose-minimal+transforms.yml b/packaging/tests/environment/docker-compose-minimal+transforms.yml index d8f0a1f7e6..30dfa8f706 100644 --- a/packaging/tests/environment/docker-compose-minimal+transforms.yml +++ b/packaging/tests/environment/docker-compose-minimal+transforms.yml @@ -7,10 +7,9 @@ version: "3" services: alfresco: - image: alfresco/alfresco-content-repository-community:latest + image: alfresco/alfresco-community-repo-base: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,19 +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\" - -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,http://localhost:8080 + -Dmetadata-keystore.password=mp6yc0UD9e + -Dmetadata-keystore.aliases=metadata + -Dmetadata-keystore.metadata.password=mp6yc0UD9e + -Dmetadata-keystore.metadata.algorithm=AES " ports: - 8082:8080 diff --git a/packaging/tests/environment/docker-compose-minimal.yml b/packaging/tests/environment/docker-compose-minimal.yml index 453db3ae8b..cb746e94b1 100644 --- a/packaging/tests/environment/docker-compose-minimal.yml +++ b/packaging/tests/environment/docker-compose-minimal.yml @@ -7,7 +7,7 @@ version: "3" services: alfresco: - image: alfresco/alfresco-content-repository-community:latest + image: alfresco/alfresco-community-repo-base:latest environment: CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n" JAVA_OPTS : @@ -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 diff --git a/packaging/tests/pom.xml b/packaging/tests/pom.xml index 95381bbe8c..e2cf57ba96 100644 --- a/packaging/tests/pom.xml +++ b/packaging/tests/pom.xml @@ -1,14 +1,12 @@ 4.0.0 - content-repository-community-tas-tests-parent - 6.2.2-SNAPSHOT + alfresco-community-repo-tests pom org.alfresco - acs-community-packaging - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-packaging + 7.183.300-TEST1-SNAPSHOT @@ -19,68 +17,7 @@ tas-integration - - - - org.alfresco.tas - utility - ${dependency.tas-utility.version} - test - - - io.rest-assured - rest-assured - ${dependency.rest-assured.version} - test - - - org.glassfish - javax.json - ${dependency.javax.json.version} - test - - - org.alfresco.tas - restapi - ${dependency.tas-restapi.version} - test - - - org.alfresco.tas - cmis - ${dependency.tas-cmis.version} - test - - - org.alfresco.tas - email - ${dependency.tas-email.version} - test - - - org.alfresco.tas - webdav - ${dependency.tas-webdav.version} - test - - - org.alfresco.tas - ftp - ${dependency.tas-ftp.version} - test - - - org.alfresco.test - dataprep - ${dependency.tas-dataprep.version} - test - - - org.springframework - spring-test - ${dependency.spring.version} - test - - - + + 20170516 + \ No newline at end of file diff --git a/packaging/tests/scripts/start-compose.sh b/packaging/tests/scripts/start-compose.sh index ace065bb0c..96c5cacf20 100755 --- a/packaging/tests/scripts/start-compose.sh +++ b/packaging/tests/scripts/start-compose.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash export DOCKER_COMPOSE_PATH=$1 +export CLEAN_UP="$2" if [ -z "$DOCKER_COMPOSE_PATH" ] then @@ -8,6 +9,22 @@ then exit 1 fi +# Cleans up any generated images. These are created if the docker-compose file has "build:" clauses. They are not +# recreated if an image with the same name already exist. Also cleans up existing containers. Generally only needed on +# dev systems, however... +# The second parameter can be used to avoid doing a clean up if we are doing a restart test. +if [ "$CLEAN_UP" != "no-clean-up" ] +then + docker-compose --file "${DOCKER_COMPOSE_PATH}" kill + docker-compose --file "${DOCKER_COMPOSE_PATH}" rm -f + + export GENERATED_IMAGES=$(docker images | grep '^environment_' | awk '{ print $3 }') + if [ -n "$GENERATED_IMAGES" ] + then + docker image rm -f $GENERATED_IMAGES + fi +fi + echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}" # .env files are picked up from project directory correctly on docker-compose 1.23.0+ diff --git a/packaging/tests/scripts/stop-compose.sh b/packaging/tests/scripts/stop-compose.sh index 6fe5738624..33dc6f54aa 100755 --- a/packaging/tests/scripts/stop-compose.sh +++ b/packaging/tests/scripts/stop-compose.sh @@ -10,10 +10,8 @@ fi echo "Killing ACS stack in ${DOCKER_COMPOSE_PATH}" -cd ${DOCKER_COMPOSE_PATH} - -docker-compose ps +docker-compose --file ${DOCKER_COMPOSE_PATH} ps # logs for debug -docker-compose logs --no-color -t alfresco -docker-compose kill -docker-compose rm -fv \ No newline at end of file +docker-compose --file ${DOCKER_COMPOSE_PATH} logs --no-color -t alfresco +docker-compose --file ${DOCKER_COMPOSE_PATH} kill +docker-compose --file ${DOCKER_COMPOSE_PATH} rm -fv \ No newline at end of file diff --git a/packaging/tests/scripts/wait-for-alfresco-start.sh b/packaging/tests/scripts/wait-for-alfresco-start.sh index df48191306..8b6940c3c5 100755 --- a/packaging/tests/scripts/wait-for-alfresco-start.sh +++ b/packaging/tests/scripts/wait-for-alfresco-start.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash export ALFRESCO_URL=$1 +export EXTRA_WAIT_INTERVAL=$2 if [ -z "$ALFRESCO_URL" ] then @@ -24,8 +25,20 @@ if (("$COUNTER" < "$TIMEOUT")) ; then t1=$(date +%s) delta=$((($t1 - $t0)/60)) echo "Alfresco Started in $delta minutes" + + if [ -n "$EXTRA_WAIT_INTERVAL" ] + then + echo "Waiting an extra $EXTRA_WAIT_INTERVAL for all the containers to initialise..." + sleep $EXTRA_WAIT_INTERVAL + echo "Waited $EXTRA_WAIT_INTERVAL seconds" + fi else echo "Waited $COUNTER seconds" echo "Alfresco Could not start in time." + echo "All started containers:" + docker ps -a + ALFCONTAINER=`docker ps -a | grep _alfresco | awk '{ print $1 }'` + echo "Last 200 lines from alfresco.log on container $ALFCONTAINER:" + docker logs --tail=200 $ALFCONTAINER exit 1 fi \ No newline at end of file diff --git a/packaging/tests/tas-cmis/pom.xml b/packaging/tests/tas-cmis/pom.xml index a0e5c20dba..ce3a8b68cd 100644 --- a/packaging/tests/tas-cmis/pom.xml +++ b/packaging/tests/tas-cmis/pom.xml @@ -2,16 +2,14 @@ 4.0.0 org.alfresco.tas - content-repository-community-cmis-test - content-repository-community-cmis-test - 6.2.2-SNAPSHOT + alfresco-community-repo-cmis-test + cmis test jar org.alfresco - content-repository-community-tas-tests-parent - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-tests + 7.183.300-TEST1-SNAPSHOT diff --git a/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/DataListsTests.java b/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/DataListsTests.java deleted file mode 100644 index fec6d4b7fc..0000000000 --- a/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/DataListsTests.java +++ /dev/null @@ -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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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 itemProperties = new HashMap(); - 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(); - } -} diff --git a/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/UpdatePropertiesTests.java b/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/UpdatePropertiesTests.java index da87ca47f6..95fa6e3bd5 100644 --- a/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/UpdatePropertiesTests.java +++ b/packaging/tests/tas-cmis/src/test/java/org/alfresco/cmis/UpdatePropertiesTests.java @@ -1,357 +1,361 @@ -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 properties = new HashMap(); - 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 properties = new HashMap(); - 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); - } -} +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); + // Token will still be valid right after this call + // Just wait for it to expire + Thread.sleep(120 * 1000); + + 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 properties = new HashMap(); + 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 properties = new HashMap(); + 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); + } +} diff --git a/packaging/tests/tas-cmis/src/test/resources/alfresco-cmis-context.xml b/packaging/tests/tas-cmis/src/test/resources/alfresco-cmis-context.xml index ecf3d2db4b..79891d863e 100644 --- a/packaging/tests/tas-cmis/src/test/resources/alfresco-cmis-context.xml +++ b/packaging/tests/tas-cmis/src/test/resources/alfresco-cmis-context.xml @@ -1,16 +1,15 @@ - - - - - - - - - - - + + + + + + + + + + diff --git a/packaging/tests/tas-email/pom.xml b/packaging/tests/tas-email/pom.xml index e6ea84e0fb..517f812fd0 100644 --- a/packaging/tests/tas-email/pom.xml +++ b/packaging/tests/tas-email/pom.xml @@ -2,16 +2,14 @@ 4.0.0 org.alfresco.tas - content-repository-community-email-test - content-repository-community-email-test - 6.2.2-SNAPSHOT + alfresco-community-repo-email-test + email test jar org.alfresco - content-repository-community-tas-tests-parent - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-tests + 7.183.300-TEST1-SNAPSHOT diff --git a/packaging/tests/tas-email/src/test/java/org/alfresco/email/EmailTest.java b/packaging/tests/tas-email/src/test/java/org/alfresco/email/EmailTest.java index 2a1a1b4a58..d29f7cc95f 100644 --- a/packaging/tests/tas-email/src/test/java/org/alfresco/email/EmailTest.java +++ b/packaging/tests/tas-email/src/test/java/org/alfresco/email/EmailTest.java @@ -1,100 +1,102 @@ -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())); - } -} +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 + protected EmailProperties emailProperties; + + @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()); + } + + if (emailProperties.getUseJolokiaAgent()) + { + 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())); + } +} diff --git a/packaging/tests/tas-email/src/test/java/org/alfresco/email/imap/ImapReadMessagesTests.java b/packaging/tests/tas-email/src/test/java/org/alfresco/email/imap/ImapReadMessagesTests.java index 9419f16216..74e1fc451f 100644 --- a/packaging/tests/tas-email/src/test/java/org/alfresco/email/imap/ImapReadMessagesTests.java +++ b/packaging/tests/tas-email/src/test/java/org/alfresco/email/imap/ImapReadMessagesTests.java @@ -1,180 +1,171 @@ -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(); - } -} +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 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(); + } +} diff --git a/packaging/tests/tas-email/src/test/resources/alfresco-email-context.xml b/packaging/tests/tas-email/src/test/resources/alfresco-email-context.xml index d6a5817e9c..bca77d2333 100644 --- a/packaging/tests/tas-email/src/test/resources/alfresco-email-context.xml +++ b/packaging/tests/tas-email/src/test/resources/alfresco-email-context.xml @@ -1,14 +1,13 @@ - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/packaging/tests/tas-integration/pom.xml b/packaging/tests/tas-integration/pom.xml index 5eaa878833..93d0213d16 100644 --- a/packaging/tests/tas-integration/pom.xml +++ b/packaging/tests/tas-integration/pom.xml @@ -2,16 +2,14 @@ 4.0.0 org.alfresco.tas - content-repository-community-integration-test - content-repository-community-integration-test - 6.2.2-SNAPSHOT + alfresco-community-repo-integration-test + integration test jar org.alfresco - content-repository-community-tas-tests-parent - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-tests + 7.183.300-TEST1-SNAPSHOT @@ -25,8 +23,6 @@ ${project.basedir}/src/test/resources/integration-suite.xml - 2.5.9 - 1.6.2 diff --git a/packaging/tests/tas-integration/src/test/java/org/alfresco/tas/integration/IntegrationCoreTests.java b/packaging/tests/tas-integration/src/test/java/org/alfresco/tas/integration/IntegrationCoreTests.java index 7f211292c1..bf46fae5b5 100644 --- a/packaging/tests/tas-integration/src/test/java/org/alfresco/tas/integration/IntegrationCoreTests.java +++ b/packaging/tests/tas-integration/src/test/java/org/alfresco/tas/integration/IntegrationCoreTests.java @@ -1,1494 +1,1494 @@ -package org.alfresco.tas.integration; - -import static org.alfresco.utility.report.log.Step.STEP; - -import javax.mail.FolderNotFoundException; - -import org.alfresco.rest.model.RestCommentModel; -import org.alfresco.rest.model.RestDeploymentModel; -import org.alfresco.rest.model.RestDeploymentModelsCollection; -import org.alfresco.rest.model.RestErrorModel; -import org.alfresco.rest.model.RestPersonFavoritesModel; -import org.alfresco.rest.model.RestPersonFavoritesModelsCollection; -import org.alfresco.rest.model.RestRatingModel; -import org.alfresco.utility.Utility; -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.CmisPermissionDeniedException; -import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; -import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException; -import org.apache.commons.lang3.RandomStringUtils; -import org.springframework.http.HttpStatus; -import org.testng.annotations.Test; - -import junit.framework.Assert; - -/** - * Created by Claudia Agache on 12/13/2016. - */ -public class IntegrationCoreTests extends IntegrationTest -{ - UserModel testUser1, testUser2; - SiteModel testSitePublic, testSiteModerated, testSitePrivate, secondPublicSite; - FolderModel testFolder1, testFolder2, parentFolder1; - private String renamePrefix = "edited-"; - FileModel testFile1, testFile2, childDoc1, childDoc2, childDoc3, childDoc4, childDoc5; - RestRatingModel returnedRatingModel; - RestPersonFavoritesModel restPersonFavoritesModel; - private String newContent = "new TAS content"; - - /** - * Scenario 22 - * 1. Using CMIS create 2 test users: u1 and u2 - * 2. U1 creates a public test site and U2 a public test site using CMIS - * 3. U1 creates a folder with a file in his public site's document library using WebDav - * 4. U1 tries to move his folder to U2 public site using IMAP - * 5. Verify folder with file is not moved. U1 is not authorized to access the public site - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user is not able to move a folder with a file to a public site if he is not a member of that site.") - public void moveFolderWithFileToPublicSiteByUninvitedUser() throws Exception - { - STEP("1. Using CMIS create 2 test users: u1 and u2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. U1 creates a public test site and U2 a public test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - secondPublicSite = dataSite.usingUser(testUser2).createIMAPSite(); - - STEP("3. U1 creates a folder with a file in public site's document library using WebDav"); - testFolder1 = FolderModel.getRandomFolderModel(); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content"); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) - .createFolder(testFolder1).assertThat().existsInWebdav() - .usingResource(testFolder1).createFile(testFile1).assertThat().existsInRepo(); - - STEP("4. U1 tries to move his folder to U2 public site using IMAP. 5. Verify folder with file is not moved. U1 is not authorized to access the U2 public site"); - FolderModel destination = new FolderModel(Utility.buildPath("Sites", secondPublicSite.getId(), "documentLibrary")); - destination.setProtocolLocation(imapProtocol.authenticateUser(testUser2).usingSite(secondPublicSite).getLastResourceWithoutPrefix()); - imapProtocol.authenticateUser(testUser1) - .usingResource(testFolder1).moveTo(destination) - .assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 23 - * 1. Using CMIS create 1 test user: u1 - * 2. U1 creates a public test site - * 3. U1 creates a folder (parentFolder) inside public site's document library using WebDav - * 4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP - * 5. Inside parentFolder create 1 subfolder using IMAP - * 6. Delete parentFolder using CMIS - * 7. Verify folder is deleted along with all its children - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user is able to delete parent folder along with all its children using CMIS.") - public void deleteFolderWithChildrenUsingCMIS() throws Exception - { - STEP("1. Using CMIS create 1 test user: u1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. U1 creates a public test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); - - STEP("3. U1 creates a folder (parentFolder) inside public site's document library using WebDav"); - FolderModel parentFolder = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1) - .usingSite(testSitePublic).createFolder(parentFolder) - .assertThat().existsInWebdav() - .and().assertThat().existsInRepo(); - - STEP("4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP"); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - FileModel testFile2 = FileModel.getRandomFileModel(FileType.MSWORD); - FileModel testFile3 = FileModel.getRandomFileModel(FileType.HTML); - FileModel testFile4 = FileModel.getRandomFileModel(FileType.EXE); - cmisAPI.authenticateUser(testUser1).usingResource(parentFolder) - .createFile(testFile1).assertThat().existsInRepo(); - webDavProtocol.usingResource(parentFolder).createFile(testFile2) - .assertThat().existsInWebdav().and() - .assertThat().existsInRepo(); - cmisAPI.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile3) - .assertThat().existsInRepo(); - ftpProtocol.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile4) - .assertThat().existsInFtp().and() - .assertThat().existsInRepo(); - - STEP("5. Inside parentFolder create 1 subfolder using IMAP"); - testFolder1 = FolderModel.getRandomFolderModel(); - imapProtocol.authenticateUser(testUser1) - .usingResource(parentFolder).createFolder(testFolder1) - .assertThat().existsInImap().and() - .assertThat().existsInRepo(); - - STEP("6. Delete parentFolder using CMIS 7. Verify folder is deleted along with all its children"); - cmisAPI.usingResource(parentFolder).deleteFolderTree().and().assertThat().doesNotExistInRepo() - .usingResource(testFolder1).assertThat().doesNotExistInRepo() - .usingResource(testFile1).assertThat().doesNotExistInRepo() - .usingResource(testFile2).assertThat().doesNotExistInRepo() - .usingResource(testFile3).assertThat().doesNotExistInRepo() - .usingResource(testFile4).assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 24 - * 1. Using CMIS create 1 test user: u1 - * 2. U1 creates a public test site - * 3. U1 creates a folder (parentFolder) inside public site's document library using IMAP - * 4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP - * 5. Inside parentFolder create 1 subfolder using WebDAV - * 6. Delete parentFolder using WebDAV - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user is able to delete parent folder along with all its children using WebDAV.") - public void deleteFolderWithChildrenUsingWebDAV() throws Exception - { - STEP("1. Using CMIS create 1 test user: u1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. U1 creates a public test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); - - STEP("3. U1 creates a folder (parentFolder) inside public site's document library using IMAP"); - FolderModel parentFolder = FolderModel.getRandomFolderModel(); - imapProtocol.authenticateUser(testUser1) - .usingSite(testSitePublic).createFolder(parentFolder) - .assertThat().existsInImap().and() - .assertThat().existsInRepo(); - - STEP("4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP"); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - FileModel testFile2 = FileModel.getRandomFileModel(FileType.MSWORD); - FileModel testFile3 = FileModel.getRandomFileModel(FileType.HTML); - FileModel testFile4 = FileModel.getRandomFileModel(FileType.EXE); - cmisAPI.authenticateUser(testUser1).usingResource(parentFolder) - .createFile(testFile1).assertThat().existsInRepo(); - webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile2) - .assertThat().existsInWebdav().and() - .assertThat().existsInRepo(); - ftpProtocol.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile4) - .assertThat().existsInFtp().and() - .assertThat().existsInRepo(); - - STEP("5. Inside parentFolder create 1 subfolder using WebDAV"); - testFolder1 = FolderModel.getRandomFolderModel(); - webDavProtocol.usingResource(parentFolder).createFolder(testFolder1) - .assertThat().existsInWebdav() - .and().assertThat().existsInRepo(); - - STEP("6. Delete parentFolder using WebDAV 7. Verify folder is deleted along with all its children"); - webDavProtocol.usingResource(parentFolder).delete().and().assertThat().doesNotExistInRepo() - .usingResource(testFolder1).assertThat().doesNotExistInRepo() - .usingResource(testFile1).assertThat().doesNotExistInRepo() - .usingResource(testFile2).assertThat().doesNotExistInRepo() - .usingResource(testFile3).assertThat().doesNotExistInRepo() - .usingResource(testFile4).assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 25 - * 1. Using CMIS create 2 test users: u1 and u2 - * 2. U1 creates a public test site and adds u2 as manager to his site using CMIS - * 3. U1 creates a folder (parentFolder) inside public site's document library using CMIS - * 4. U1 creates a subfolder1 and a file1 inside parentFolder using FTP - * 5. U1 creates a subfolder2 and a file2 inside subfolder1 using CMIS - * 6. U2 creates a subfolder3 and a file3 using WebDAV - * 7. U2 deletes parentFolder using FTP - * 8. Verify folder is deleted along with all its children - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user is able to delete parent folder along with all its children using FTP.") - public void deleteFolderWithChildrenUsingFTP() throws Exception - { - STEP("1. Using CMIS create 2 test users: u1 and u2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. U1 creates a public test site using CMIS and adds u2 as manager to his site using REST"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - dataUser.usingUser(testUser1).addUserToSite(testUser2, testSitePublic, UserRole.SiteManager); - testUser2.setUserRole(UserRole.SiteManager); - - STEP("3. U1 creates a folder (parentFolder) inside public site's document library using CMIS"); - FolderModel parentFolder = FolderModel.getRandomFolderModel(); - cmisAPI.authenticateUser(testUser1) - .usingSite(testSitePublic).createFolder(parentFolder) - .assertThat().existsInRepo(); - - STEP("4. U1 creates a subfolder1 and a file1 inside parentFolder using FTP"); - FolderModel subFolder1 = FolderModel.getRandomFolderModel(); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - - ftpProtocol.authenticateUser(testUser1) - .usingResource(parentFolder).createFolder(subFolder1) - .assertThat().existsInRepo() - .assertThat().existsInFtp() - .usingResource(parentFolder).createFile(testFile1) - .assertThat().existsInRepo() - .assertThat().existsInFtp(); - - STEP("5. U1 creates a subfolder2 and a file2 inside subfolder1 using CMIS"); - FolderModel subFolder2 = FolderModel.getRandomFolderModel(); - FileModel testFile2 = FileModel.getRandomFileModel(FileType.MSWORD); - - cmisAPI.authenticateUser(testUser1).usingResource(subFolder1) - .createFolder(subFolder2) - .assertThat().existsInRepo() - .createFile(testFile2) - .assertThat().existsInRepo(); - - STEP("6. U2 creates a subfolder3 and a file3 using WebDAV"); - FolderModel subFolder3 = FolderModel.getRandomFolderModel(); - FileModel testFile3 = FileModel.getRandomFileModel(FileType.HTML); - - webDavProtocol.authenticateUser(testUser2).usingResource(subFolder2) - .createFolder(subFolder3) - .assertThat().existsInWebdav() - .assertThat().existsInRepo() - .createFile(testFile3) - .assertThat().existsInWebdav() - .assertThat().existsInRepo(); - - STEP("7. U2 deletes parentFolder using FTP"); - ftpProtocol.authenticateUser(testUser2) - .usingResource(parentFolder).assertThat().existsInFtp() - .then().delete() - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp() - .usingResource(subFolder1) - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp() - .usingResource(subFolder2) - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp() - .usingResource(subFolder3) - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp() - .usingResource(testFile1) - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp() - .usingResource(testFile2) - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp() - .usingResource(testFile3) - .assertThat().doesNotExistInRepo().and() - .assertThat().doesNotExistInFtp(); - } - - /** - * Scenario 28 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a public test site - * 3. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder - * 4. Using CMIS, U1 checks out a document from parent folder - * 5. Using CMIS, U1 deletes parent folder (deleteTree) - * 6. Using WebDAV, U1 verifies that parent folder and all children are NOT present in Repo and WebDAV - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify deletion of a parentFolder with checkedout file using CMIS.") - public void deleteParentFolderWithCheckoutFileInUsingCMIS() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a public test site"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("3. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder"); - FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); - FileModel webdavTestFile = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); - FileModel ftpTestFile = FileModel.getRandomFileModel(FileType.MSWORD, "file 4 content"); - - testFolder1 = FolderModel.getRandomFolderModel(); - cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).assertThat().existsInRepo(); - cmisAPI.authenticateUser(testUser1).usingResource(testFolder1).createFile(cmisTestFile) - .assertThat().existsInRepo(); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(webdavTestFile) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(ftpTestFile) - .assertThat().existsInFtp().assertThat().existsInRepo(); - - FolderModel cmisTestFolder = FolderModel.getRandomFolderModel(); - FolderModel webdavTestFolder = FolderModel.getRandomFolderModel(); - FolderModel ftpTestFolder = FolderModel.getRandomFolderModel(); - - cmisAPI.usingResource(testFolder1).createFolder(cmisTestFolder) - .assertThat().existsInRepo(); - webDavProtocol.usingResource(testFolder1).createFolder(webdavTestFolder) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - ftpProtocol.usingResource(testFolder1).createFolder(ftpTestFolder) - .assertThat().existsInFtp().assertThat().existsInRepo(); - - cmisAPI.usingResource(testFolder1).assertThat() - .hasChildren(cmisTestFile, webdavTestFile, ftpTestFile, cmisTestFolder, webdavTestFolder, ftpTestFolder); - - STEP("Step 4: Using CMIS, U1 checks out a document from parent folder"); - cmisAPI.usingResource(webdavTestFile).checkOut().assertThat().documentIsCheckedOut(); - - STEP("Step 5: Using CMIS, U1 deletes parent folder (deleteTree)"); - - cmisAPI.usingResource(testFolder1).deleteFolderTree() - .assertThat().doesNotExistInRepo(); - STEP("Step 6. Using WebDAV, U1 verifies that parent folder and all children are not present"); - webDavProtocol.usingResource(testFolder1).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() - .and().usingResource(cmisTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() - .and().usingResource(webdavTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() - .and().usingResource(ftpTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() - .and().usingResource(cmisTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() - .and().usingResource(webdavTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() - .and().usingResource(ftpTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav(); - } - - /** - * Scenario 29 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a public test site - * 3. Using FTP U1 creates a parent folder in public site's document library - * 4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder - * 5. Using CMIS, U1 checks out a document from parent folder - * 6. Using WebDAV, U1 deletes parent folder (deleteFolder) - * 7. Using FTP, U1 verifies that parent folder and all children are NOT present in Repo and FTP - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify deletion of a parentFolder with checkedout file using WebDAV.") - public void deleteParentFolderWithCheckoutFileInUsingWebDAV() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a public test site"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("3. Using FTP U1 creates a parent folder"); - testFolder1 = FolderModel.getRandomFolderModel(); - ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).assertThat().existsInRepo(); - - STEP("4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder"); - FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); - FileModel webdavTestFile = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); - FileModel ftpTestFile = FileModel.getRandomFileModel(FileType.MSWORD, "file 4 content"); - - cmisAPI.authenticateUser(testUser1).usingResource(testFolder1).createFile(cmisTestFile) - .assertThat().existsInRepo(); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(webdavTestFile) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - ftpProtocol.usingResource(testFolder1).createFile(ftpTestFile) - .assertThat().existsInFtp().assertThat().existsInRepo(); - - FolderModel cmisTestFolder = FolderModel.getRandomFolderModel(); - FolderModel webdavTestFolder = FolderModel.getRandomFolderModel(); - - cmisAPI.usingResource(testFolder1).createFolder(cmisTestFolder) - .assertThat().existsInRepo(); - webDavProtocol.usingResource(testFolder1).createFolder(webdavTestFolder).assertThat().existsInWebdav() - .and().assertThat().existsInRepo(); - - cmisAPI.usingResource(testFolder1).assertThat().hasChildren(cmisTestFile, webdavTestFile, ftpTestFile, cmisTestFolder, webdavTestFolder); - - STEP("Step 5: Using CMIS, U1 checks out a document from parent folder"); - cmisAPI.usingResource(cmisTestFile).checkOut().assertThat().documentIsCheckedOut(); - - STEP("Step 6: Using WebDAV, U1 deletes parent folder (deleteFolder)"); - webDavProtocol.usingResource(testFolder1).assertThat().existsInRepo().and().assertThat().existsInWebdav() - .and().assertThat().hasFiles(cmisTestFile, webdavTestFile, ftpTestFile) - .and().assertThat().hasFolders(cmisTestFolder, webdavTestFolder) - .then().usingResource(testFolder1).delete() - .assertThat().doesNotExistInWebdav().assertThat().doesNotExistInRepo(); - - STEP("Step 7. Using FTP, U1 verifies that parent folder and all children are not present"); - ftpProtocol.usingResource(testFolder1).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() - .and().usingResource(cmisTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() - .and().usingResource(webdavTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() - .and().usingResource(ftpTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() - .and().usingResource(cmisTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() - .and().usingResource(webdavTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp(); - } - - /** - * Scenario 30 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a public test site - * 3. Using WebDAV U1 creates a parent folder in public site's document library - * 4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder - * 5. Using CMIS, U1 checks out a document from parent folder - * 6. Using FTP, U1 deletes parent folder (deleteDirectory) - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT}, executionType = ExecutionType.REGRESSION, description = "Verify deletion of a parentFolder with checkedout file using FTP.") - public void deleteParentFolderWithCheckoutFileInUsingFTP() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a public test site"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("3. Using WebDAV U1 creates a parent folder"); - testFolder1 = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).assertThat().existsInRepo().assertThat() - .existsInWebdav(); - - STEP("4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder"); - FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); - FileModel webdavTestFile = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); - - cmisAPI.authenticateUser(testUser1).usingResource(testFolder1).createFile(cmisTestFile) - .assertThat().existsInRepo(); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(webdavTestFile) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - - FolderModel cmisTestFolder = FolderModel.getRandomFolderModel(); - FolderModel webdavTestFolder = FolderModel.getRandomFolderModel(); - FolderModel ftpTestFolder = FolderModel.getRandomFolderModel(); - - cmisAPI.usingResource(testFolder1).createFolder(cmisTestFolder) - .assertThat().existsInRepo(); - webDavProtocol.usingResource(testFolder1).createFolder(webdavTestFolder) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFolder(ftpTestFolder) - .assertThat().existsInFtp().assertThat().existsInRepo(); - - cmisAPI.usingResource(testFolder1).assertThat() - .hasChildren(cmisTestFile, webdavTestFile, cmisTestFolder, webdavTestFolder, ftpTestFolder); - - STEP("Step 5: Using CMIS, U1 checks out a document from parent folder"); - cmisAPI.usingResource(webdavTestFile).checkOut().assertThat().documentIsCheckedOut(); - - STEP("Step 6: Using FTP, U1 deletes parent folder (deleteDirectory)"); - ftpProtocol.usingResource(testFolder1).delete() - .and().assertThat().doesNotExistInFtp().and().assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 32 - Document updates - * - * 1. Using CMIS create 2 test users: U1 and U2 - * 2. Using CMIS and RestAPI U1 creates a public test site and U2 user is added with collaborator role - * 3. Using WebDAV U1 creates a folder in his public site's document library - * 4. Using WebDAV U1 creates a document inside the above folder - * 5. Using RestAPI U2 adds the document to favorites - * 6. Using CMIS U1 adds content to document - * 7. Using WebDAV U2 validates document's content - * 8. Using WebDAV U2 updates content from document - * 9. Using CMIS U2 validates document's content - * 10. Using WebDAV U1 deletes the file - * 11. Using RestAPI U1 deletes the folder - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user with collaborator role can update document content in a public site.") - public void usersCanUpdateDocumentContentInsideAPublicSite() throws Exception - { - String originalContent = "originalContent"; - String updatedContent = "updatedContent"; - testFolder1 = FolderModel.getRandomFolderModel(); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - - STEP("1. Using CMIS create 2 test users: U1 and U2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS and RestAPI U1 creates a public test site and U2 user is added with collaborator role"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - testUser2.setUserRole(UserRole.SiteCollaborator); - restAPI.authenticateUser(testUser1).withCoreAPI().usingSite(testSitePublic).addPerson(testUser2); - - STEP("3. Using WebDAV U1 creates a folder in his public site's document library"); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1) - .and().assertThat().existsInRepo(); - - STEP("4. Using WebDAV U1 creates a document inside the above folder"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(testFile1) - .and().assertThat().existsInWebdav() - .and().assertThat().existsInRepo(); - - STEP("5. Using RestAPI U2 adds the document to favorites"); - restAPI.authenticateUser(testUser2).withCoreAPI().usingAuthUser().addFolderToFavorites(testFolder1); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - STEP("6. Using CMIS U1 adds content to document"); - cmisAPI.authenticateUser(testUser1).usingResource(testFile1) - .and().assertThat().existsInRepo() - .and().update(originalContent); - - STEP("7. Using WebDAV U2 validates document's content"); - webDavProtocol.authenticateUser(testUser2).usingResource(testFile1).assertThat().contentIs(originalContent); - - STEP("8. Using WebDAV U2 updates content from document"); - webDavProtocol.usingUser(testUser2).usingResource(testFile1) - .assertThat().existsInRepo() - .and().update(updatedContent); - - STEP("9. Using CMIS U2 validates document's content"); - cmisAPI.authenticateUser(testUser2).usingResource(testFile1).assertThat().contentIs(updatedContent); - - STEP("10. Using WebDAV U1 deletes the file"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFile1).delete() - .and().assertThat().doesNotExistInRepo(); - - STEP("11. Using WebDAV U1 deletes the folder"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).delete() - .and().assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 33 - Document likes - * - * 1. Using CMIS create 2 test users: U1 and U2 - * 2. Using RestAPI U1 creates a public test site and U2 user is added with contributor role - * 3. Using WebDAV U1 creates a folder in his public site's document library - * 4. Using WebDAV U1 creates a document1 inside the above folder - * 5. Using WebDAV U2 creates a document2 inside folder - * 6. Using RestAPI U2 likes document1 - * 7. Using RestAPI U1 likes document2 - * 8. Using RestAPI U1 dislikes document2 - * 9. Using RestAPI U2 add to favorites document1 - * 10. Using CMIS U1 delete document1 - * 11. Using CMIS U2 delete the folder - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }, expectedExceptions = {CmisPermissionDeniedException.class, CmisUnauthorizedException.class} ) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user with contributor role can like/favorite a document in a public site.") - public void usersCanLikeADocumentInPublicSite() throws Exception - { - STEP("1. Using CMIS create 2 test users: U1 and U2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. Using RestAPI U1 creates a public test site and U2 user is added with contributor role"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - testUser2.setUserRole(UserRole.SiteContributor); - restAPI.authenticateUser(testUser1).withCoreAPI().usingSite(testSitePublic).addPerson(testUser2); - - STEP("3. Using WebDAV U1 creates a folder in his public site's document library"); - testFolder1 = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) - .createFolder(testFolder1).assertThat().existsInWebdav() - .and().assertThat().existsInRepo(); - - STEP("4. Using WebDAV U1 creates a document1 inside the above folder"); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - webDavProtocol.usingResource(testFolder1).createFile(testFile1) - .assertThat().existsInRepo() - .and().assertThat().existsInWebdav(); - - STEP("5. Using WebDAV U2 creates a document2 inside folder"); - testFile2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - webDavProtocol.authenticateUser(testUser2) - .usingResource(testFolder1).createFile(testFile2).assertThat().existsInRepo() - .and().assertThat().existsInWebdav(); - - STEP("6. Using RestAPI U2 likes document1"); - RestRatingModel returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1).likeDocument(); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - returnedRatingModel.assertThat().field("myRating").is("true") - .and().field("id").is("likes").and().field("aggregate").isNotEmpty(); - - STEP("7. Using RestAPI U1 likes document2"); - returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile2).likeDocument(); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - returnedRatingModel.assertThat().field("myRating").is("true") - .and().field("id").is("likes").and().field("aggregate").isNotEmpty(); - - STEP("8. Using RestAPI U1 dislikes document2"); - restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile2).deleteLikeRating(); - restAPI.assertStatusCodeIs(HttpStatus.NO_CONTENT); - - STEP("9. Using RestAPI U2 add to favorites document1"); - RestPersonFavoritesModel restPersonFavoritesModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingAuthUser().addFileToFavorites(testFile1); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - restPersonFavoritesModel.assertThat().field("targetGuid").is(testFile1.getNodeRefWithoutVersion()); - - STEP("10. Using CMIS U1 delete document1"); - cmisAPI.authenticateUser(testUser1).usingResource(testFile1).delete() - .and().assertThat().doesNotExistInRepo(); - - restAPI.withCoreAPI().usingResource(testFile1).getLikeRating(); - restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() - .containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef())); - - RestPersonFavoritesModelsCollection userFavorites = restAPI.withCoreAPI().usingAuthUser().getFavorites(); - restAPI.assertStatusCodeIs(HttpStatus.OK); - userFavorites.assertThat().entriesListIsEmpty().and().paginationField("totalItems").is("0"); - - STEP("11. Using CMIS U2 delete the folder. With Contributor role, U2 does not have permission to delete files/folders created by others."); - cmisAPI.authenticateUser(testUser2).usingResource(testFolder1).assertThat().doesNotHaveFile(testFile1) - .and().assertThat().hasFiles(testFile2) - .and().usingResource(testFile2).delete() - .and().usingResource(testFolder1).delete(); - } - - /** - * Scenario 34 - Document ratings - * - * 1. Using CMIS create 2 test users: U1 and U2 - * 2. Using RestAPI U1 creates a public test site and U2 user is added with collaborator role - * 3. Using CMIS U1 creates a new folder in site - * 4. Using WebDAV U2 creates file1 in public site document library - * 5. Using WebDAV U1 creates a file2 in public site document library - * 6. Using RestAPI U2 rates with 5 stars file2 - * 7. Using RestAPI U1 rates with 1 star file1 - * 8. Using RestAPI U2 likes file1 - * 9. Using RestAPI U2 removes the rating of 5 stars for file2 - * 10. Using WebDAV U1 delete file1. Using RestAPI get ratings of file1. - * 11. Using WebDAV U1 delete the folder - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify user with collaborator role can rate a document in a public site.") - public void usersCanRateADocumentInPublicSite() throws Exception - { - RestRatingModel returnedRatingModel; - - STEP("1. Using CMIS create 2 test users: U1 and U2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. Using RestAPI U1 creates a public test site and U2 user is added with collaborator role"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - testUser2.setUserRole(UserRole.SiteCollaborator); - restAPI.authenticateUser(testUser1).withCoreAPI().usingSite(testSitePublic).addPerson(testUser2); - - STEP("3. Using CMIS U1 creates a new folder in site"); - testFolder1 = FolderModel.getRandomFolderModel(); - cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic) - .createFolder(testFolder1).assertThat().existsInRepo(); - - STEP("4. Using WebDAV U2 creates file1 in public site document library"); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - webDavProtocol.authenticateUser(testUser2).usingResource(testFolder1) - .createFile(testFile1).assertThat().existsInRepo() - .and().assertThat().existsInWebdav(); - - STEP("5. Using WebDAV U1 creates a file2 in public site document library"); - testFile2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) - .usingResource(testFolder1).createFile(testFile2).assertThat().existsInRepo(); - - STEP("6. Using RestAPI U2 rates with 5 stars file2"); - returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile2) - .rateStarsToDocument(5); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty(); - - STEP("7. Using RestAPI U1 rates with 1 star file1"); - returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile1) - .rateStarsToDocument(1); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - returnedRatingModel.assertThat().field("myRating").is("1").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty(); - - STEP("8. Using RestAPI U2 likes file1"); - returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1) - .likeDocument(); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - - returnedRatingModel.assertThat().field("myRating").is("true").and().field("id").is("likes").and().field("aggregate").isNotEmpty(); - - STEP("9. Using RestAPI U2 removes the rating of 5 stars for file2"); - restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile2).deleteFiveStarRating(); - restAPI.assertStatusCodeIs(HttpStatus.NO_CONTENT); - - returnedRatingModel = restAPI.withCoreAPI().usingResource(testFile2).getFiveStarRating(); - restAPI.assertStatusCodeIs(HttpStatus.OK); - returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0"); - - STEP("10. Using WebDAV U1 delete file1. Using RestAPI get ratings of file1."); - webDavProtocol.authenticateUser(testUser1).usingResource(testFile1).delete() - .and().assertThat().doesNotExistInRepo() - .and().assertThat().doesNotExistInWebdav(); - - restAPI.withCoreAPI().usingResource(testFile1).getLikeRating(); - restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() - .containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef())); - - restAPI.withCoreAPI().usingResource(testFile1).getFiveStarRating(); - restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() - .containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef())); - - STEP("11. Using WebDAV U1 delete the folder"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).assertThat().hasFiles(testFile2) - .and().usingResource(testFolder1).delete() - .and().assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 35 - * 1. Using CMIS create 2 test user: U1 and U2 - * 2. Using CMIS U1 creates a public test site - * 3. Using FTP U1 creates a folder in public site's document library: folder1 - * 4. Using WebDAV U1 creates inside folder1 a new folder: folder2 - * 5. Using WebDAV U1 creates inside folder2 a new folder: folder3 - * 6. Using CMIS U1 creates inside folder1 a new file: file1 - * 7. Using WebDAV U1 creates inside folder2 a new file: file2 - * 8. Using FTP U1 creates inside folder3 a new file: file3 - * 9. Using WebDAV U1 deletes file1 - * 10. Using IMAP U1 deletes file2 - * 11. Using WebDAV U1 updates content of file3 - * 12. Using RestAPI U1 adds a comment to file3 - * 13. Using RestAPI U1 likes file3 and user U2 rates file3 - * 14. Using CMIS U1 deletes file3 - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "File handling - perform actions: create, delete, add comment, like and rate, update file content ") - public void fileHandlingCreateUpdateContentDeleteLikeAndRate() throws Exception - { - STEP("1. Using CMIS create 1 test user: U1 and U2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. U1 creates a public test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); - - STEP("3. Using FTP U1 creates folder: folder1"); - FolderModel folder1 = FolderModel.getRandomFolderModel(); - ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder1) - .assertThat().existsInRepo(); - - STEP("4. Using WebDAV U1 creates folder2 inside folder1"); - FolderModel folder2 = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1).usingResource(folder1).createFolder(folder2); - - STEP("5. Using webDAV U1 creates folder3 inside folder2"); - FolderModel folder3 = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1).usingResource(folder2).createFolder(folder3); - - STEP("6. Using CMIS U1 creates file1 inside folder1"); - FileModel file1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); - cmisAPI.authenticateUser(testUser1).usingResource(folder1).createFile(file1) - .assertThat().existsInRepo(); - - STEP("7. Using webDAV U1 creates file2 inside folder2"); - FileModel file2 = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); - webDavProtocol.authenticateUser(testUser1).usingResource(folder2).createFile(file2) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - - STEP("8. Using FTP U1 creates file3 inside folder3"); - FileModel file3 = FileModel.getRandomFileModel(FileType.MSWORD, "file 3 content"); - ftpProtocol.authenticateUser(testUser1).usingResource(folder3).createFile(file3) - .assertThat().existsInRepo(); - - STEP("9. Using webDAV U1 deletes file1"); - webDavProtocol.authenticateUser(testUser1).usingResource(file1).delete() - .assertThat().doesNotExistInRepo().and().assertThat().doesNotExistInWebdav(); - - STEP("10. Using IMAP U1 deletes file2"); - imapProtocol.authenticateUser(testUser1).usingResource(file2).deleteMessage() - .and().usingResource(file2).assertThat().doesNotExistInRepo(); - - STEP("11. Using WebDAV U1 update content of file3"); - webDavProtocol.authenticateUser(testUser1) - .usingResource(file3).assertThat().existsInRepo() - .update(newContent).assertThat().contentIs(newContent); - - STEP("12. Using RestAPI U1 adds a comment to file3"); - String comment = RandomData.getRandomName("comment1"); - file3.setNodeRef(dataContent.usingUser(testUser1).usingSite(testSitePublic) - .usingResource(folder3).usingResource(file3).getNodeRef()); - RestCommentModel commentModel = restAPI.authenticateUser(testUser1).withCoreAPI() - .usingResource(file3).addComment(comment); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - commentModel.assertThat().field("content").isNotEmpty() - .and().field("content").is(comment); - - STEP("13. Using RestAPI U1 likes file3 and user U2 rates file3"); - returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(file3).likeDocument(); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - returnedRatingModel.assertThat().field("myRating").is("true").and().field("id").is("likes").and().field("aggregate").isNotEmpty(); - - returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI() - .usingResource(file3).rateStarsToDocument(5); - restAPI.assertStatusCodeIs(HttpStatus.CREATED); - returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty(); - - STEP("14. Using CMIS U1 deletes file3"); - cmisAPI.authenticateUser(testUser1).usingResource(file3).delete() - .assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 37 - * 1. Using CMIS creates 2 users: U1 and U - * 2. U1 creates a public test site using CMIS - * 3. Using CMIS U1 creates folder: folder1 - * 4. Using WebDAV U1 creates folder2 and folder3 inside folder1 - * 5. Using FTP U1 creates file1 inside folder1 - * 6. Using CMIS U1 copies file1 to folder2 - * 7. Using WebDAV U1 update content of file1 from folder2 - * 8. Using FTP U1 tries to move file1 from folder2 to folder1 - * 9. Using WebDAV U1 updates content of file1 from folder1 - * 10. Using RestAPI U1 adds file1 to favorites - * 11. Using RestAPI U1 likes file1 and U2 user rates file1 - * 12. Using CMIS U1 moves file1 from folder1 to folder3 - * 13. Using CMIS/RestAPI U1 checks that content, favorites and ratings are kept - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "File handling - perform actions: copy, move, add/update content, favorites, like and rate") - public void fileHandlingCopyMoveAddUpdateContentFavoritesLikeAndRate() throws Exception - { - STEP("1. Using CMIS creates 2 users: U1 and U2"); - testUser1 = dataUser.createRandomTestUser(); - testUser2 = dataUser.createRandomTestUser(); - - STEP("2. U1 creates a public test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("3. Using CMIS U1 creates folder: folder1"); - FolderModel folder1 = FolderModel.getRandomFolderModel(); - cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder1) - .assertThat().existsInRepo(); - - STEP("4. Using WebDAV U1 creates folder2 and folder3 inside folder1"); - FolderModel folder2 = FolderModel.getRandomFolderModel(); - FolderModel folder3 = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1) - .usingResource(folder1).createFolder(folder2).and().assertThat().existsInWebdav() - .usingResource(folder1).createFolder(folder3).and().assertThat().existsInWebdav(); - - STEP("5. Using FTP U1 creates file1 inside folder1"); - FileModel file1 = FileModel.getRandomFileModel(FileType.MSWORD2007, "tasTesting"); - ftpProtocol.authenticateUser(testUser1).usingResource(folder1).createFile(file1) - .assertThat().existsInRepo(); - - STEP("6. Using CMIS U1 copies file1 to folder2"); - FileModel copiedFile = new FileModel(file1); - cmisAPI.authenticateUser(testUser1).usingResource(file1).copyTo(folder2); - copiedFile.setCmisLocation(cmisAPI.getLastResource()); - cmisAPI.usingResource(folder2).assertThat().hasFiles(file1); - - STEP("7. Using WebDAV U1 update content of file1 from folder2"); - webDavProtocol.usingResource(copiedFile).assertThat().existsInRepo() - .update(newContent).assertThat().contentIs(newContent); - - STEP("8. Using FTP U1 tries to move file1 from folder2 to folder1"); - ftpProtocol.authenticateUser(testUser1) - .usingResource(copiedFile).moveTo(folder1).assertThat().existsInRepo(); - Assert.assertTrue(ftpProtocol.usingResource(folder1).getFiles().size() == 1); - - STEP("9. Using WebDAV U1 updates content of file1 from folder1"); - webDavProtocol.usingResource(file1).update("content folder1") - .assertThat().contentIs("content folder1"); - - STEP("10. Using RestAPI U1 adds file1 to favorites"); - file1.setNodeRef(dataContent.usingUser(testUser1).usingSite(testSitePublic) - .usingResource(folder1).usingResource(file1).getNodeRef()); - - restPersonFavoritesModel = restAPI.authenticateUser(testUser1).withCoreAPI() - .usingAuthUser().addFileToFavorites(file1); - restAPI.assertStatusCodeIs(org.springframework.http.HttpStatus.CREATED); - restPersonFavoritesModel.assertThat().field("targetGuid").is(file1.getNodeRefWithoutVersion()); - - STEP("11. Using RestAPI U1 likes file1 and U2 user rates file1"); - returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI() - .usingResource(file1).likeDocument(); - restAPI.assertStatusCodeIs(org.springframework.http.HttpStatus.CREATED); - returnedRatingModel.assertThat().field("myRating").is("true").and().field("id").is("likes") - .and().field("aggregate").isNotEmpty(); - - returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI() - .usingResource(file1).rateStarsToDocument(5); - restAPI.assertStatusCodeIs(org.springframework.http.HttpStatus.CREATED); - returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar") - .and().field("aggregate").isNotEmpty(); - - STEP("12. Using CMIS U1 moves file1 from folder1 to folder3"); - cmisAPI.usingSite(testSitePublic).usingResource(file1).moveTo(folder3) - .and().assertThat().existsInRepo(); - - STEP("13. Using CMIS/RestAPI U1 checks that content, favorites and ratings are kept"); - returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar") - .and().field("aggregate").isNotEmpty(); - restPersonFavoritesModel.assertThat().field("targetGuid").is(file1.getNodeRefWithoutVersion()); - } - - /** - * Scenario 38 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a new document in Share - * 3. Using WebDAV U1 creates a new document in User Home - * 4. Using WebDAV U1 updates both documents - * 5. Verify if only first document's version is increased using CMIS - * 6. Verify if content is updated using WebDav - * 7. Verify if the size of the document is increased - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify document versioning after appending content using WebDAV.") - public void checkDocumentVersionAfterAppendingContent() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a new document in Share"); - FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); - cmisAPI.authenticateUser(testUser1) - .usingShared().createFile(cmisTestFile) - .assertThat().existsInRepo(); - - STEP("3. Using WebDAV U1 creates a new document in User Home"); - FileModel webDAVTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 2 content"); - webDavProtocol.authenticateUser(testUser1) - .usingUserHome().createFile(webDAVTestFile) - .assertThat().existsInWebdav().and() - .assertThat().existsInRepo(); - - STEP("4. Using WebDAV U1 updates both documents"); - webDavProtocol.usingResource(cmisTestFile).update("cmis file content") - .usingResource(webDAVTestFile).update("WebDAV file content"); - - STEP("5. Verify if only first document's version is increased using CMIS"); - cmisAPI.usingResource(cmisTestFile).assertThat().documentHasVersion(1.1) - .usingResource(webDAVTestFile).assertThat().documentHasVersion(1.0); - - STEP("6. Verify if content is updated using WebDav"); - webDavProtocol.authenticateUser(testUser1) - .usingResource(cmisTestFile).assertThat().contentIs("cmis file content") - .usingResource(webDAVTestFile).assertThat().contentIs("WebDAV file content"); - - STEP("7. Verify if the size of the document is increased"); - cmisAPI.usingResource(cmisTestFile).assertThat().contentLengthIs(17) - .usingResource(webDAVTestFile).assertThat().contentLengthIs(19); - } - - /** - * Scenario 40 - * 1. Using CMIS create test user: U1 - * 2. U1 creates a private test site using CMIS - * 3. Using WebDAV U1 creates a folder - * 4. Using WebDAV U1 creates a file inside the folder - * 5. Using CMIS, check out the document - * 6. Using CMIS verify if PWC is created - * 7. Using CMIS check in document with content - * 8. Using CMIS verify that version does not increase - * 9. Using CMIS verify new content is added to document - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify increased version and new content of a file that was check out then check in.") - public void verifyIncreasedVersionAndNewContentOfCheckInDocument() throws Exception - { - STEP("Step 1. Using CMIS create test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("Step 2. U1 creates a private test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createPrivateRandomSite(); - - STEP("Step 3. Using WebDAV U1 creates a folder"); - FolderModel folder = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder); - - STEP("Step 4. Using WebDAV U1 creates a file inside the folder"); - FileModel file = FileModel.getRandomFileModel(FileType.XML, "file content"); - webDavProtocol.authenticateUser(testUser1).usingResource(folder).createFile(file) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - - STEP("Step 5: Using CMIS, check out the document and verify document version"); - cmisAPI.authenticateUser(testUser1).usingResource(file).checkOut() - .assertThat().documentIsCheckedOut(); - - STEP("Step 6: Using CMIS verify if PWC is created"); - FileModel filePWC = cmisAPI.usingResource(file).withCMISUtil().getPWCFileModel(); - cmisAPI.usingResource(filePWC).assertThat().existsInRepo(); - - STEP("Step 7: Using CMIS check in document with content"); - String newContent = "new major content"; - cmisAPI.usingResource(folder).assertThat().folderHasCheckedOutDocument(file); - cmisAPI.usingResource(file).prepareDocumentForCheckIn() - .withMajorVersion() - .withContent(newContent) - .checkIn().refreshResource() - .and().assertThat().documentIsNotCheckedOut(); - - STEP("Step 8: Using CMIS verify that version does not increase"); - cmisAPI.usingResource(file).assertThat().documentHasVersion(1.0); - - STEP("Step 9: Using CMIS verify new content is added to document"); - cmisAPI.usingResource(file).assertThat().contentIs(newContent); - } - - /** - * Scenario 41 - * 1. Using CMIS create test user: U1 - * 2. U1 creates a private test site using CMIS - * 3. Using WebDAV U1 creates a folder - * 4. Using WebDAV U1 creates a file inside the folder - * 5. Using CMIS, check out the document - * 6. Using CMIS verify if PWC is created - * 7. Using CMIS, cancel check out - * 8. Using CMIS, verify original document has version 1.0 - * 9. Using CMIS, verify original document has same content - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Verify that version and the content of a file are not changed if the checkout is canceled.") - public void verifyVersionAndContentOfACanceledCheckoutDocument() throws Exception - { - STEP("Step 1. Using CMIS create test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("Step 2. U1 creates a private test site using CMIS"); - testSitePublic = dataSite.usingUser(testUser1).createPrivateRandomSite(); - - STEP("Step 3. Using WebDAV U1 creates a folder"); - FolderModel folder = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder); - - STEP("Step 4. Using WebDAV U1 creates a file inside the folder"); - FileModel file = FileModel.getRandomFileModel(FileType.XML, "file content"); - webDavProtocol.authenticateUser(testUser1).usingResource(folder).createFile(file) - .assertThat().existsInWebdav().assertThat().existsInRepo(); - - STEP("Step 5: Using CMIS, check out the document"); - cmisAPI.authenticateUser(testUser1).usingResource(file).checkOut(); - - STEP("Step 6: Using CMIS verify if PWC is created"); - FileModel filePWC = cmisAPI.usingResource(file).withCMISUtil().getPWCFileModel(); - cmisAPI.usingResource(filePWC).assertThat().existsInRepo(); - - STEP("Step 7: Using CMIS, cancel check out"); - cmisAPI.usingResource(file).cancelCheckOut().then() - .assertThat().documentIsNotCheckedOut(); - - STEP("Step 8: Using CMIS, verify original document has version 1.0"); - cmisAPI.usingResource(file).assertThat().isNotPrivateWorkingCopy() - .then().assertThat().documentHasVersion(1.0); - - STEP("Step 9: Using CMIS, verify original document has same content"); - cmisAPI.usingResource(file).assertThat().contentIs("file content"); - } - - /** - * Scenario 42 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a file: file - * 3. Using WebDAV U1 renames file and verify if the new document exists - * 4. Using FTP verify old document does not exists - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Edit document name and verify document with new name") - public void renameDocument() throws Exception - { - STEP("1. Using CMIS create test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates file"); - FileModel file = FileModel.getRandomFileModel(FileType.PDF, "file content"); - cmisAPI.authenticateUser(testUser1).usingUserHome().createFile(file) - .assertThat().existsInRepo(); - - STEP("3. Using WebDAV U1 renames file and verify if the new document exists"); - FileModel oldFile = new FileModel(file); - webDavProtocol.authenticateUser(testUser1).usingResource(file).rename(renamePrefix + file.getName()) - .and().assertThat().existsInRepo().and().assertThat().existsInWebdav(); - - STEP("4. Using FTP verify old document does not exists"); - ftpProtocol.authenticateUser(testUser1).usingResource(oldFile) - .assertThat().doesNotExistInRepo() - .and().assertThat().doesNotExistInFtp(); - } - - /** - * Scenario 43 - * 1. Using CMIS create test user: U1 - * 2. Using WebDAV U1 creates a file using shared - * 3. Using webDAV append content to document - * 4. Using CMIS, verify original document has version 1.0 - * 5. Using CMIS delete document - * 6. Using WebDAV, verify document is deleted - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, - description = "Delete document after append content and verify document version.") - public void deleteDocumentAfterAppendContent() throws Exception - { - STEP("Step 1. Using CMIS create test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("Step 2. Using WebDAV U1 creates a file using shared"); - FileModel file = FileModel.getRandomFileModel(FileType.XML, "file content"); - webDavProtocol.authenticateUser(testUser1).usingUserHome().createFile(file) - .assertThat().existsInRepo(); - - STEP("Step 3. Using webDAV append content to document"); - String newContentToAppend = " - append this text to the file"; - webDavProtocol.authenticateUser(testUser1).usingResource(file).assertThat().contentIs("file content") - .then().update(file.getContent() + newContentToAppend) - .assertThat().contentIs(file.getContent() + newContentToAppend); - - STEP("Step 4: Using CMIS, verify original document has version 1.0"); - cmisAPI.authenticateUser(testUser1).usingResource(file).assertThat().isNotPrivateWorkingCopy() - .then().assertThat().documentHasVersion(1.0); - - STEP("Step 4: Using CMIS, delete document"); - cmisAPI.usingResource(file).assertThat().existsInRepo().delete(); - - STEP("Step 5: Using WebDAV, verify document is deleted"); - webDavProtocol.authenticateUser(testUser1).usingResource(file).assertThat().doesNotExistInWebdav() - .and().assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 44 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a public test site - * 3. Using WebDAV U1 creates a new file in User Home - * 4. Using WebDAV U1 creates another file in public site document library. - * 5. Using CMIS U1 creates a relationship between documents - * 6. Verify if relationship is created - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify if relationship is created between 2 items using CMIS.") - public void checkRelationshipBetween2Files() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a public test site"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("3. Using WebDAV U1 creates a new file in User Home"); - FileModel sourceFile= FileModel.getRandomFileModel(FileType.PDF, "file content"); - webDavProtocol.authenticateUser(testUser1).usingUserHome() - .createFile(sourceFile).assertThat().existsInRepo(); - - STEP("4. Using WebDAV U1 creates another file in public site document library."); - FileModel targetFile= FileModel.getRandomFileModel(FileType.PDF, "file content"); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) - .createFile(targetFile).assertThat().existsInRepo(); - - STEP("5. Using CMIS U1 creates a relationship between documents. 6. Verify if relationship is created"); - cmisAPI.authenticateUser(testUser1).usingResource(sourceFile).createRelationshipWith(targetFile) - .assertThat().objectHasRelationshipWith(targetFile); - } - - /** - * Scenario 46 - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates an imap test site - * 3. Using CMIS U1 creates cmisFolder in Shared - * 4. Using IMAP U1 creates parentFolder in private site document library. - * 5. Using FTP U1 creates a subfolder in parentFolder - * 6. Using WebDAV U1 creates a webdavFolder in User Home - * 7. Using WebDAV U1 creates a document in parentFolder - * 8. Using CMIS U1 adds document to cmisFolder, subfolder, webdavFolder - * 9. Using WebDAV verify document is present in all folders - * 10. Using CMIS U1 removes document from subFolder - * 11. Using WebDAV verify document is not present in subFolder - * 12. Using FTP U1 deletes original document from parentFolder - * 13. Using CMIS verify document does not exist - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify parents list for an object using CMIS.") - public void addAndRemoveDocumentFromFolders() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates an imap test site"); - testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); - - STEP("3. Using CMIS U1 creates cmisFolder in Shared"); - FolderModel cmisFolder = FolderModel.getRandomFolderModel(); - cmisAPI.authenticateUser(testUser1) - .usingShared().createFolder(cmisFolder) - .assertThat().existsInRepo(); - - STEP("4. Using IMAP U1 creates parentFolder in private site document library."); - FolderModel parentFolder = FolderModel.getRandomFolderModel(); - imapProtocol.authenticateUser(testUser1) - .usingSite(testSitePublic).createFolder(parentFolder) - .assertThat().existsInRepo(); - - STEP("5. Using FTP U1 creates a subfolder in parentFolder"); - FolderModel subFolder = FolderModel.getRandomFolderModel(); - ftpProtocol.authenticateUser(testUser1) - .usingResource(parentFolder).createFolder(subFolder) - .assertThat().existsInRepo(); - - STEP("6. Using WebDAV U1 creates a webdavFolder in User Home"); - FolderModel webdavFolder = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1) - .usingUserHome().createFolder(webdavFolder) - .assertThat().existsInRepo(); - - STEP("7. Using WebDAV U1 creates a document in parentFolder"); - testFile1= FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file content"); - webDavProtocol.authenticateUser(testUser1) - .usingResource(parentFolder).createFile(testFile1) - .assertThat().existsInRepo(); - - STEP("8. Using CMIS U1 adds document to cmisFolder, subfolder, webdavFolder"); - cmisAPI.usingResource(testFile1) - .addDocumentToFolder(cmisFolder, true).assertThat().hasParents(parentFolder.getName(), cmisFolder.getName()) - .addDocumentToFolder(subFolder, true).assertThat().hasParents(parentFolder.getName(), cmisFolder.getName(), subFolder.getName()) - .addDocumentToFolder(webdavFolder, true).assertThat().hasParents(parentFolder.getName(), cmisFolder.getName(), subFolder.getName(), webdavFolder.getName()); - - STEP("9. Using WebDAV verify document is present in all folders"); - FileModel fileAddedInCMISFolder = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); - fileAddedInCMISFolder.setCmisLocation(Utility.buildPath(cmisFolder.getCmisLocation(), testFile1.getName())); - - FileModel fileAddedInSubFolder = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); - fileAddedInSubFolder.setCmisLocation(Utility.buildPath(subFolder.getCmisLocation(), testFile1.getName())); - - FileModel fileAddedInWebDAVFolder = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); - fileAddedInWebDAVFolder.setCmisLocation(Utility.buildPath(webdavFolder.getCmisLocation(), testFile1.getName())); - - webDavProtocol.usingResource(fileAddedInCMISFolder).assertThat().existsInWebdav() - .usingResource(fileAddedInSubFolder).assertThat().existsInWebdav() - .usingResource(fileAddedInWebDAVFolder).assertThat().existsInWebdav(); - - STEP("10. Using CMIS U1 removes document from subFolder"); - cmisAPI.usingResource(testFile1).removeDocumentFromFolder(subFolder) - .assertThat().hasParents(parentFolder.getName(), cmisFolder.getName(), webdavFolder.getName()); - - STEP("11. Using WebDAV verify document is not present in subFolder"); - webDavProtocol.usingResource(testFile1).assertThat().existsInWebdav() - .usingResource(fileAddedInCMISFolder).assertThat().existsInWebdav() - .usingResource(fileAddedInSubFolder).assertThat().doesNotExistInWebdav() - .usingResource(fileAddedInWebDAVFolder).assertThat().existsInWebdav(); - - STEP("12. Using FTP U1 deletes original document from parentFolder"); - ftpProtocol.usingResource(testFile1).delete().assertThat().doesNotExistInFtp(); - - STEP("13. Using CMIS verify document does not exist"); - cmisAPI.usingResource(fileAddedInCMISFolder).assertThat().doesNotExistInRepo() - .usingResource(fileAddedInWebDAVFolder).assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 47 - Delete many documents - * - * 1. Using CMIS create test user: U1 - * 2. Using CMIS U1 creates a public test site - * 3. Using CMIS and WebDAV U1 creates parentFolder1, doc1 and doc2 in document library - * 4. Using WebDAV and FTP U1 creates inside parentFolder1: childDoc1 to childDoc5 - * 5. Using IMAP bulk delete doc1 and doc2 - * 6. Using CMIS verify that doc1 and doc2 are deleted - * 7. Using IMAP delete childDoc1 to childDoc4 - * 8. Using WebDAV and FTP verify if docs are deleted from their folders - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT}, executionType = ExecutionType.REGRESSION, - description = "Verify users can delete many documents in a public site using different protocols.") - public void usersCanDeleteManyDocuments() throws Exception - { - FolderModel parentFolder1 = FolderModel.getRandomFolderModel(); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - testFile2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - FileModel childDoc1, childDoc2, childDoc3, childDoc4, childDoc5; - childDoc1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - childDoc2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - childDoc3 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - childDoc4 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - childDoc5 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - - STEP("1. Using CMIS create test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a public test site"); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("3. Using CMIS and WebDAV U1 creates parentFolder1, doc1 and doc2 in document library"); - cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(parentFolder1) - .and().assertThat().existsInRepo(); - - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFile(testFile1) - .and().createFile(testFile2); - - STEP("4. Using WebDAV and FTP U1 creates inside parentFolder1: childDoc1 to childDoc5"); - webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder1) - .createFile(childDoc1).and().createFile(childDoc2); - - ftpProtocol.authenticateUser(testUser1).usingResource(parentFolder1) - .createFile(childDoc3).and().createFile(childDoc4).and().createFile(childDoc5); - - STEP("5. Using IMAP bulk delete doc1 and doc2"); - imapProtocol.authenticateUser(testUser1).usingSite(testSitePublic).deleteMessage(testFile1.getName(), testFile2.getName()).assertThat().doesNotContainMessages(testFile1, testFile2); - Utility.waitToLoopTime(10); - - STEP("6. Using CMIS verify that doc1 and doc2 are deleted"); - cmisAPI.authenticateUser(testUser1) - .usingResource(testFile1).assertThat().doesNotExistInRepo() - .and().usingResource(testFile2).assertThat().doesNotExistInRepo(); - - STEP("7. Using IMAP delete childDoc1 to childDoc4"); - imapProtocol.authenticateUser(testUser1).usingResource(parentFolder1).deleteMessage(childDoc1.getName(), childDoc2.getName(), childDoc3.getName(), childDoc4.getName()) - .assertThat().doesNotContainMessages(childDoc1, childDoc2, childDoc3, childDoc4); - Utility.waitToLoopTime(10); - - STEP("8. Using WebDAV and FTP verify if docs are deleted from their folders"); - webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder1).assertThat().hasFiles(childDoc5) - .and().usingResource(childDoc1).assertThat().doesNotExistInRepo() - .and().usingResource(childDoc2).assertThat().doesNotExistInRepo(); - - ftpProtocol.authenticateUser(testUser1).usingResource(childDoc3) - .assertThat().doesNotExistInRepo() - .and().usingResource(childDoc4).assertThat().doesNotExistInRepo(); - } - - /** - * Scenario 48 - Move folder in another folder - * - * 1. Using CMIS create user u1 and public site - * 2. Using WebDAV U1 creates folder1 and folder2 - * 3. Using WebDAV U1 creates doc1 in folder1 - * 4. Using FTP U1 moves folder1 in folder2 - * 5. Using WebDAV verify that folder1 is not in the original location and is present in folder2 - * 6. Using CMIS verify if doc1 is still present in folder1 - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to move a non empty folder to another folder from the same site.") - public void moveFolderInAnotherFolder() throws Exception - { - testFolder1 = FolderModel.getRandomFolderModel(); - testFolder2 = FolderModel.getRandomFolderModel(); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - - STEP("1. Using CMIS create user u1 and public site"); - testUser1 = dataUser.createRandomTestUser(); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("2. Using WebDAV U1 creates folder1 and folder2"); - webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) - .createFolder(testFolder1) - .and().assertThat().existsInRepo().and().assertThat().existsInWebdav() - .then().createFolder(testFolder2) - .and().assertThat().existsInRepo().and().assertThat().existsInWebdav(); - - STEP("3. Using WebDAV U1 creates doc1 in folder1"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(testFile1) - .and().assertThat().existsInRepo().and().assertThat().existsInWebdav() - .and().usingResource(testFolder1).assertThat().hasFiles(testFile1); - - STEP("4. Using FTP U1 moves folder1 in folder2"); - ftpProtocol.authenticateUser(testUser1) - .usingResource(testFolder1).moveTo(testFolder2) - .assertThat().existsInRepo() - .then().usingResource(testFolder1).assertThat().doesNotExistInRepo(); - - STEP("5. Using WebDAV verify that folder1 is not in the original location and is present in folder2"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).assertThat().doesNotExistInRepo() - .and().usingResource(testFolder2).assertThat().hasFolders(testFolder1); - - STEP("6. Using CMIS verify if doc1 is still present in folder1"); - FolderModel newTestFolder1 = new FolderModel(testFolder1.getName(), testFolder1.getTitle(), testFolder1.getDescription()); - newTestFolder1.setCmisLocation(Utility.buildPath(testFolder2.getCmisLocation(), testFolder1.getName())); - - FileModel newTestFile1 = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); - newTestFile1.setCmisLocation(Utility.buildPath(newTestFolder1.getCmisLocation(), testFile1.getName())); - - cmisAPI.authenticateUser(testUser1).usingResource(newTestFolder1) - .assertThat().existsInRepo() - .assertThat().hasFiles(newTestFile1); - } - - /** - * Scenario 49 - Copy folder in another folder - * - * 1. Using CMIS create user u1 and public site - * 2. Using CMIS U1 creates folder1 and folder2 - * 3. Using WebDAV U1 creates doc1 in folder1 - * 4. Using WebDAV U1 copies folder1 in folder2 - * 5. Using FTP verify that folder1 is in the original location and contains doc1 - * 6. Using WebDAV verify that folder1 is in folder2 and contains doc1 - */ - - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to copy non empty folder to another folder in the same site.") - public void copyFolderInAnotherFolder() throws Exception - { - testFolder1 = FolderModel.getRandomFolderModel(); - testFolder2 = FolderModel.getRandomFolderModel(); - testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); - - STEP("1. Using CMIS create user u1 and public site"); - testUser1 = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20)); - testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); - - STEP("2. Using CMIS U1 creates folder1 and folder2"); - cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic) - .createFolder(testFolder1).and().assertThat().existsInRepo().and() - .createFolder(testFolder2).and().assertThat().existsInRepo(); - - STEP("3. Using WebDAV U1 creates doc1 in folder1"); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1) - .createFile(testFile1).and().assertThat().existsInRepo() - .and().assertThat().existsInWebdav(); - - STEP("4. Using WebDAV U1 copies folder1 in folder2"); - testFolder2.setProtocolLocation(webDavProtocol.getPrefixSpace() + testFolder2.getCmisLocation()); - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).copyTo(testFolder2) - .assertThat().existsInRepo() - .then().usingResource(testFolder1).assertThat().existsInRepo(); - - STEP("5. Using FTP verify that folder1 is in the original location and contains doc1"); - ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1) - .assertThat().existsInRepo() - .and().assertThat().existsInFtp() - .and().assertThat().hasFiles(testFile1); - - STEP("6. Using WebDAV verify that folder1 is in folder2 and contains doc1"); - FolderModel newTestFolder1 = new FolderModel(testFolder1.getName(), testFolder1.getTitle(), testFolder1.getDescription()); - newTestFolder1.setCmisLocation(Utility.buildPath(testFolder2.getCmisLocation(), testFolder1.getName())); - - FileModel newTestFile1 = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); - newTestFile1.setCmisLocation(Utility.buildPath(newTestFolder1.getCmisLocation(), testFile1.getName())); - - webDavProtocol.authenticateUser(testUser1).usingResource(testFolder2) - .assertThat().hasFolders(newTestFolder1) - .and().usingResource(newTestFolder1) - .assertThat().existsInRepo().and().assertThat().existsInWebdav() - .and().assertThat().hasFiles(newTestFile1); - } - - /** - * Scenario 50 - Rename site - * - * 1. Using CMIS create one test user: U1 - * 2. Using CMIS U1 creates a moderated site - * 3. Using WebDAV U1 creates a folder in the moderated site document library - * 4. Using CMIS U1 tries to rename site - * 5. Verify that a site cannot be renamed - */ - @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }, expectedExceptions = CmisRuntimeException.class, expectedExceptionsMessageRegExp = "^.*Sites can not be renamed.$") - @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify sites cannot be renamed using CMIS.") - public void renameSite() throws Exception - { - STEP("1. Using CMIS create one test user: U1"); - testUser1 = dataUser.createRandomTestUser(); - - STEP("2. Using CMIS U1 creates a moderated site"); - testSiteModerated = dataSite.usingUser(testUser1).createModeratedRandomSite(); - - STEP("3. Using WebDAV U1 creates a folder in the moderated site document library"); - testFolder1 = FolderModel.getRandomFolderModel(); - webDavProtocol.authenticateUser(testUser1) - .usingSite(testSiteModerated).createFolder(testFolder1) - .assertThat().existsInWebdav() - .assertThat().existsInRepo(); - - STEP("4. Using CMIS U1 tries to rename site 5. Verify that a site cannot be renamed"); - FolderModel siteFolder = new FolderModel(String.format("/Sites/%s", testSiteModerated.getId())); - cmisAPI.authenticateUser(testUser1).usingResource(siteFolder).rename("renamedSite"); - } -} +package org.alfresco.tas.integration; + +import static org.alfresco.utility.report.log.Step.STEP; + +import javax.mail.FolderNotFoundException; + +import org.alfresco.rest.model.RestCommentModel; +import org.alfresco.rest.model.RestDeploymentModel; +import org.alfresco.rest.model.RestDeploymentModelsCollection; +import org.alfresco.rest.model.RestErrorModel; +import org.alfresco.rest.model.RestPersonFavoritesModel; +import org.alfresco.rest.model.RestPersonFavoritesModelsCollection; +import org.alfresco.rest.model.RestRatingModel; +import org.alfresco.utility.Utility; +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.CmisPermissionDeniedException; +import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; +import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException; +import org.apache.commons.lang3.RandomStringUtils; +import org.springframework.http.HttpStatus; +import org.testng.annotations.Test; + +import junit.framework.Assert; + +/** + * Created by Claudia Agache on 12/13/2016. + */ +public class IntegrationCoreTests extends IntegrationTest +{ + UserModel testUser1, testUser2; + SiteModel testSitePublic, testSiteModerated, testSitePrivate, secondPublicSite; + FolderModel testFolder1, testFolder2, parentFolder1; + private String renamePrefix = "edited-"; + FileModel testFile1, testFile2, childDoc1, childDoc2, childDoc3, childDoc4, childDoc5; + RestRatingModel returnedRatingModel; + RestPersonFavoritesModel restPersonFavoritesModel; + private String newContent = "new TAS content"; + + /** + * Scenario 22 + * 1. Using CMIS create 2 test users: u1 and u2 + * 2. U1 creates a public test site and U2 a public test site using CMIS + * 3. U1 creates a folder with a file in his public site's document library using WebDav + * 4. U1 tries to move his folder to U2 public site using IMAP + * 5. Verify folder with file is not moved. U1 is not authorized to access the public site + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }, expectedExceptions = FolderNotFoundException.class) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user is not able to move a folder with a file to a public site if he is not a member of that site.") + public void moveFolderWithFileToPublicSiteByUninvitedUser() throws Exception + { + STEP("1. Using CMIS create 2 test users: u1 and u2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. U1 creates a public test site and U2 a public test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + secondPublicSite = dataSite.usingUser(testUser2).createIMAPSite(); + + STEP("3. U1 creates a folder with a file in public site's document library using WebDav"); + testFolder1 = FolderModel.getRandomFolderModel(); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file1 content"); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) + .createFolder(testFolder1).assertThat().existsInWebdav() + .usingResource(testFolder1).createFile(testFile1).assertThat().existsInRepo(); + + STEP("4. U1 tries to move his folder to U2 public site using IMAP. 5. Verify folder with file is not moved. U1 is not authorized to access the U2 public site"); + FolderModel destination = new FolderModel(Utility.buildPath("Sites", secondPublicSite.getId(), "documentLibrary")); + destination.setProtocolLocation(imapProtocol.authenticateUser(testUser2).usingSite(secondPublicSite).getLastResourceWithoutPrefix()); + imapProtocol.authenticateUser(testUser1) + .usingResource(testFolder1).moveTo(destination) + .assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 23 + * 1. Using CMIS create 1 test user: u1 + * 2. U1 creates a public test site + * 3. U1 creates a folder (parentFolder) inside public site's document library using WebDav + * 4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP + * 5. Inside parentFolder create 1 subfolder using IMAP + * 6. Delete parentFolder using CMIS + * 7. Verify folder is deleted along with all its children + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user is able to delete parent folder along with all its children using CMIS.") + public void deleteFolderWithChildrenUsingCMIS() throws Exception + { + STEP("1. Using CMIS create 1 test user: u1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. U1 creates a public test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); + + STEP("3. U1 creates a folder (parentFolder) inside public site's document library using WebDav"); + FolderModel parentFolder = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1) + .usingSite(testSitePublic).createFolder(parentFolder) + .assertThat().existsInWebdav() + .and().assertThat().existsInRepo(); + + STEP("4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP"); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + FileModel testFile2 = FileModel.getRandomFileModel(FileType.MSWORD); + FileModel testFile3 = FileModel.getRandomFileModel(FileType.HTML); + FileModel testFile4 = FileModel.getRandomFileModel(FileType.EXE); + cmisAPI.authenticateUser(testUser1).usingResource(parentFolder) + .createFile(testFile1).assertThat().existsInRepo(); + webDavProtocol.usingResource(parentFolder).createFile(testFile2) + .assertThat().existsInWebdav().and() + .assertThat().existsInRepo(); + cmisAPI.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile3) + .assertThat().existsInRepo(); + ftpProtocol.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile4) + .assertThat().existsInFtp().and() + .assertThat().existsInRepo(); + + STEP("5. Inside parentFolder create 1 subfolder using IMAP"); + testFolder1 = FolderModel.getRandomFolderModel(); + imapProtocol.authenticateUser(testUser1) + .usingResource(parentFolder).createFolder(testFolder1) + .assertThat().existsInImap().and() + .assertThat().existsInRepo(); + + STEP("6. Delete parentFolder using CMIS 7. Verify folder is deleted along with all its children"); + cmisAPI.usingResource(parentFolder).deleteFolderTree().and().assertThat().doesNotExistInRepo() + .usingResource(testFolder1).assertThat().doesNotExistInRepo() + .usingResource(testFile1).assertThat().doesNotExistInRepo() + .usingResource(testFile2).assertThat().doesNotExistInRepo() + .usingResource(testFile3).assertThat().doesNotExistInRepo() + .usingResource(testFile4).assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 24 + * 1. Using CMIS create 1 test user: u1 + * 2. U1 creates a public test site + * 3. U1 creates a folder (parentFolder) inside public site's document library using IMAP + * 4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP + * 5. Inside parentFolder create 1 subfolder using WebDAV + * 6. Delete parentFolder using WebDAV + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user is able to delete parent folder along with all its children using WebDAV.") + public void deleteFolderWithChildrenUsingWebDAV() throws Exception + { + STEP("1. Using CMIS create 1 test user: u1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. U1 creates a public test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); + + STEP("3. U1 creates a folder (parentFolder) inside public site's document library using IMAP"); + FolderModel parentFolder = FolderModel.getRandomFolderModel(); + imapProtocol.authenticateUser(testUser1) + .usingSite(testSitePublic).createFolder(parentFolder) + .assertThat().existsInImap().and() + .assertThat().existsInRepo(); + + STEP("4. Inside parentFolder create 4 files using CMIS, WebDAV, FTP"); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + FileModel testFile2 = FileModel.getRandomFileModel(FileType.MSWORD); + FileModel testFile3 = FileModel.getRandomFileModel(FileType.HTML); + FileModel testFile4 = FileModel.getRandomFileModel(FileType.EXE); + cmisAPI.authenticateUser(testUser1).usingResource(parentFolder) + .createFile(testFile1).assertThat().existsInRepo(); + webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile2) + .assertThat().existsInWebdav().and() + .assertThat().existsInRepo(); + ftpProtocol.authenticateUser(testUser1).usingResource(parentFolder).createFile(testFile4) + .assertThat().existsInFtp().and() + .assertThat().existsInRepo(); + + STEP("5. Inside parentFolder create 1 subfolder using WebDAV"); + testFolder1 = FolderModel.getRandomFolderModel(); + webDavProtocol.usingResource(parentFolder).createFolder(testFolder1) + .assertThat().existsInWebdav() + .and().assertThat().existsInRepo(); + + STEP("6. Delete parentFolder using WebDAV 7. Verify folder is deleted along with all its children"); + webDavProtocol.usingResource(parentFolder).delete().and().assertThat().doesNotExistInRepo() + .usingResource(testFolder1).assertThat().doesNotExistInRepo() + .usingResource(testFile1).assertThat().doesNotExistInRepo() + .usingResource(testFile2).assertThat().doesNotExistInRepo() + .usingResource(testFile3).assertThat().doesNotExistInRepo() + .usingResource(testFile4).assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 25 + * 1. Using CMIS create 2 test users: u1 and u2 + * 2. U1 creates a public test site and adds u2 as manager to his site using CMIS + * 3. U1 creates a folder (parentFolder) inside public site's document library using CMIS + * 4. U1 creates a subfolder1 and a file1 inside parentFolder using FTP + * 5. U1 creates a subfolder2 and a file2 inside subfolder1 using CMIS + * 6. U2 creates a subfolder3 and a file3 using WebDAV + * 7. U2 deletes parentFolder using FTP + * 8. Verify folder is deleted along with all its children + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user is able to delete parent folder along with all its children using FTP.") + public void deleteFolderWithChildrenUsingFTP() throws Exception + { + STEP("1. Using CMIS create 2 test users: u1 and u2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. U1 creates a public test site using CMIS and adds u2 as manager to his site using REST"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + dataUser.usingUser(testUser1).addUserToSite(testUser2, testSitePublic, UserRole.SiteManager); + testUser2.setUserRole(UserRole.SiteManager); + + STEP("3. U1 creates a folder (parentFolder) inside public site's document library using CMIS"); + FolderModel parentFolder = FolderModel.getRandomFolderModel(); + cmisAPI.authenticateUser(testUser1) + .usingSite(testSitePublic).createFolder(parentFolder) + .assertThat().existsInRepo(); + + STEP("4. U1 creates a subfolder1 and a file1 inside parentFolder using FTP"); + FolderModel subFolder1 = FolderModel.getRandomFolderModel(); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + + ftpProtocol.authenticateUser(testUser1) + .usingResource(parentFolder).createFolder(subFolder1) + .assertThat().existsInRepo() + .assertThat().existsInFtp() + .usingResource(parentFolder).createFile(testFile1) + .assertThat().existsInRepo() + .assertThat().existsInFtp(); + + STEP("5. U1 creates a subfolder2 and a file2 inside subfolder1 using CMIS"); + FolderModel subFolder2 = FolderModel.getRandomFolderModel(); + FileModel testFile2 = FileModel.getRandomFileModel(FileType.MSWORD); + + cmisAPI.authenticateUser(testUser1).usingResource(subFolder1) + .createFolder(subFolder2) + .assertThat().existsInRepo() + .createFile(testFile2) + .assertThat().existsInRepo(); + + STEP("6. U2 creates a subfolder3 and a file3 using WebDAV"); + FolderModel subFolder3 = FolderModel.getRandomFolderModel(); + FileModel testFile3 = FileModel.getRandomFileModel(FileType.HTML); + + webDavProtocol.authenticateUser(testUser2).usingResource(subFolder2) + .createFolder(subFolder3) + .assertThat().existsInWebdav() + .assertThat().existsInRepo() + .createFile(testFile3) + .assertThat().existsInWebdav() + .assertThat().existsInRepo(); + + STEP("7. U2 deletes parentFolder using FTP"); + ftpProtocol.authenticateUser(testUser2) + .usingResource(parentFolder).assertThat().existsInFtp() + .then().delete() + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp() + .usingResource(subFolder1) + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp() + .usingResource(subFolder2) + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp() + .usingResource(subFolder3) + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp() + .usingResource(testFile1) + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp() + .usingResource(testFile2) + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp() + .usingResource(testFile3) + .assertThat().doesNotExistInRepo().and() + .assertThat().doesNotExistInFtp(); + } + + /** + * Scenario 28 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a public test site + * 3. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder + * 4. Using CMIS, U1 checks out a document from parent folder + * 5. Using CMIS, U1 deletes parent folder (deleteTree) + * 6. Using WebDAV, U1 verifies that parent folder and all children are NOT present in Repo and WebDAV + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify deletion of a parentFolder with checkedout file using CMIS.") + public void deleteParentFolderWithCheckoutFileInUsingCMIS() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a public test site"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("3. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder"); + FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); + FileModel webdavTestFile = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); + FileModel ftpTestFile = FileModel.getRandomFileModel(FileType.MSWORD, "file 4 content"); + + testFolder1 = FolderModel.getRandomFolderModel(); + cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).assertThat().existsInRepo(); + cmisAPI.authenticateUser(testUser1).usingResource(testFolder1).createFile(cmisTestFile) + .assertThat().existsInRepo(); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(webdavTestFile) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(ftpTestFile) + .assertThat().existsInFtp().assertThat().existsInRepo(); + + FolderModel cmisTestFolder = FolderModel.getRandomFolderModel(); + FolderModel webdavTestFolder = FolderModel.getRandomFolderModel(); + FolderModel ftpTestFolder = FolderModel.getRandomFolderModel(); + + cmisAPI.usingResource(testFolder1).createFolder(cmisTestFolder) + .assertThat().existsInRepo(); + webDavProtocol.usingResource(testFolder1).createFolder(webdavTestFolder) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + ftpProtocol.usingResource(testFolder1).createFolder(ftpTestFolder) + .assertThat().existsInFtp().assertThat().existsInRepo(); + + cmisAPI.usingResource(testFolder1).assertThat() + .hasChildren(cmisTestFile, webdavTestFile, ftpTestFile, cmisTestFolder, webdavTestFolder, ftpTestFolder); + + STEP("Step 4: Using CMIS, U1 checks out a document from parent folder"); + cmisAPI.usingResource(webdavTestFile).checkOut().assertThat().documentIsCheckedOut(); + + STEP("Step 5: Using CMIS, U1 deletes parent folder (deleteTree)"); + + cmisAPI.usingResource(testFolder1).deleteFolderTree() + .assertThat().doesNotExistInRepo(); + STEP("Step 6. Using WebDAV, U1 verifies that parent folder and all children are not present"); + webDavProtocol.usingResource(testFolder1).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() + .and().usingResource(cmisTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() + .and().usingResource(webdavTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() + .and().usingResource(ftpTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() + .and().usingResource(cmisTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() + .and().usingResource(webdavTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav() + .and().usingResource(ftpTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInWebdav(); + } + + /** + * Scenario 29 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a public test site + * 3. Using FTP U1 creates a parent folder in public site's document library + * 4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder + * 5. Using CMIS, U1 checks out a document from parent folder + * 6. Using WebDAV, U1 deletes parent folder (deleteFolder) + * 7. Using FTP, U1 verifies that parent folder and all children are NOT present in Repo and FTP + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify deletion of a parentFolder with checkedout file using WebDAV.") + public void deleteParentFolderWithCheckoutFileInUsingWebDAV() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a public test site"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("3. Using FTP U1 creates a parent folder"); + testFolder1 = FolderModel.getRandomFolderModel(); + ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).assertThat().existsInRepo(); + + STEP("4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder"); + FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); + FileModel webdavTestFile = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); + FileModel ftpTestFile = FileModel.getRandomFileModel(FileType.MSWORD, "file 4 content"); + + cmisAPI.authenticateUser(testUser1).usingResource(testFolder1).createFile(cmisTestFile) + .assertThat().existsInRepo(); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(webdavTestFile) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + ftpProtocol.usingResource(testFolder1).createFile(ftpTestFile) + .assertThat().existsInFtp().assertThat().existsInRepo(); + + FolderModel cmisTestFolder = FolderModel.getRandomFolderModel(); + FolderModel webdavTestFolder = FolderModel.getRandomFolderModel(); + + cmisAPI.usingResource(testFolder1).createFolder(cmisTestFolder) + .assertThat().existsInRepo(); + webDavProtocol.usingResource(testFolder1).createFolder(webdavTestFolder).assertThat().existsInWebdav() + .and().assertThat().existsInRepo(); + + cmisAPI.usingResource(testFolder1).assertThat().hasChildren(cmisTestFile, webdavTestFile, ftpTestFile, cmisTestFolder, webdavTestFolder); + + STEP("Step 5: Using CMIS, U1 checks out a document from parent folder"); + cmisAPI.usingResource(cmisTestFile).checkOut().assertThat().documentIsCheckedOut(); + + STEP("Step 6: Using WebDAV, U1 deletes parent folder (deleteFolder)"); + webDavProtocol.usingResource(testFolder1).assertThat().existsInRepo().and().assertThat().existsInWebdav() + .and().assertThat().hasFiles(cmisTestFile, webdavTestFile, ftpTestFile) + .and().assertThat().hasFolders(cmisTestFolder, webdavTestFolder) + .then().usingResource(testFolder1).delete() + .assertThat().doesNotExistInWebdav().assertThat().doesNotExistInRepo(); + + STEP("Step 7. Using FTP, U1 verifies that parent folder and all children are not present"); + ftpProtocol.usingResource(testFolder1).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() + .and().usingResource(cmisTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() + .and().usingResource(webdavTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() + .and().usingResource(ftpTestFile).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() + .and().usingResource(cmisTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp() + .and().usingResource(webdavTestFolder).assertThat().doesNotExistInRepo().assertThat().doesNotExistInFtp(); + } + + /** + * Scenario 30 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a public test site + * 3. Using WebDAV U1 creates a parent folder in public site's document library + * 4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder + * 5. Using CMIS, U1 checks out a document from parent folder + * 6. Using FTP, U1 deletes parent folder (deleteDirectory) + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE}) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT}, executionType = ExecutionType.REGRESSION, description = "Verify deletion of a parentFolder with checkedout file using FTP.") + public void deleteParentFolderWithCheckoutFileInUsingFTP() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a public test site"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("3. Using WebDAV U1 creates a parent folder"); + testFolder1 = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1).assertThat().existsInRepo().assertThat() + .existsInWebdav(); + + STEP("4. Using CMIS, WebDAV and FTP U1 creates multiple files and folders in parent folder"); + FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); + FileModel webdavTestFile = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); + + cmisAPI.authenticateUser(testUser1).usingResource(testFolder1).createFile(cmisTestFile) + .assertThat().existsInRepo(); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(webdavTestFile) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + + FolderModel cmisTestFolder = FolderModel.getRandomFolderModel(); + FolderModel webdavTestFolder = FolderModel.getRandomFolderModel(); + FolderModel ftpTestFolder = FolderModel.getRandomFolderModel(); + + cmisAPI.usingResource(testFolder1).createFolder(cmisTestFolder) + .assertThat().existsInRepo(); + webDavProtocol.usingResource(testFolder1).createFolder(webdavTestFolder) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFolder(ftpTestFolder) + .assertThat().existsInFtp().assertThat().existsInRepo(); + + cmisAPI.usingResource(testFolder1).assertThat() + .hasChildren(cmisTestFile, webdavTestFile, cmisTestFolder, webdavTestFolder, ftpTestFolder); + + STEP("Step 5: Using CMIS, U1 checks out a document from parent folder"); + cmisAPI.usingResource(webdavTestFile).checkOut().assertThat().documentIsCheckedOut(); + + STEP("Step 6: Using FTP, U1 deletes parent folder (deleteDirectory)"); + ftpProtocol.usingResource(testFolder1).delete() + .and().assertThat().doesNotExistInFtp().and().assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 32 - Document updates + * + * 1. Using CMIS create 2 test users: U1 and U2 + * 2. Using CMIS and RestAPI U1 creates a public test site and U2 user is added with collaborator role + * 3. Using WebDAV U1 creates a folder in his public site's document library + * 4. Using WebDAV U1 creates a document inside the above folder + * 5. Using RestAPI U2 adds the document to favorites + * 6. Using CMIS U1 adds content to document + * 7. Using WebDAV U2 validates document's content + * 8. Using WebDAV U2 updates content from document + * 9. Using CMIS U2 validates document's content + * 10. Using WebDAV U1 deletes the file + * 11. Using RestAPI U1 deletes the folder + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user with collaborator role can update document content in a public site.") + public void usersCanUpdateDocumentContentInsideAPublicSite() throws Exception + { + String originalContent = "originalContent"; + String updatedContent = "updatedContent"; + testFolder1 = FolderModel.getRandomFolderModel(); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + + STEP("1. Using CMIS create 2 test users: U1 and U2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS and RestAPI U1 creates a public test site and U2 user is added with collaborator role"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + testUser2.setUserRole(UserRole.SiteCollaborator); + restAPI.authenticateUser(testUser1).withCoreAPI().usingSite(testSitePublic).addPerson(testUser2); + + STEP("3. Using WebDAV U1 creates a folder in his public site's document library"); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(testFolder1) + .and().assertThat().existsInRepo(); + + STEP("4. Using WebDAV U1 creates a document inside the above folder"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(testFile1) + .and().assertThat().existsInWebdav() + .and().assertThat().existsInRepo(); + + STEP("5. Using RestAPI U2 adds the document to favorites"); + restAPI.authenticateUser(testUser2).withCoreAPI().usingAuthUser().addFolderToFavorites(testFolder1); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + STEP("6. Using CMIS U1 adds content to document"); + cmisAPI.authenticateUser(testUser1).usingResource(testFile1) + .and().assertThat().existsInRepo() + .and().update(originalContent); + + STEP("7. Using WebDAV U2 validates document's content"); + webDavProtocol.authenticateUser(testUser2).usingResource(testFile1).assertThat().contentIs(originalContent); + + STEP("8. Using WebDAV U2 updates content from document"); + webDavProtocol.usingUser(testUser2).usingResource(testFile1) + .assertThat().existsInRepo() + .and().update(updatedContent); + + STEP("9. Using CMIS U2 validates document's content"); + cmisAPI.authenticateUser(testUser2).usingResource(testFile1).assertThat().contentIs(updatedContent); + + STEP("10. Using WebDAV U1 deletes the file"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFile1).delete() + .and().assertThat().doesNotExistInRepo(); + + STEP("11. Using WebDAV U1 deletes the folder"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).delete() + .and().assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 33 - Document likes + * + * 1. Using CMIS create 2 test users: U1 and U2 + * 2. Using RestAPI U1 creates a public test site and U2 user is added with contributor role + * 3. Using WebDAV U1 creates a folder in his public site's document library + * 4. Using WebDAV U1 creates a document1 inside the above folder + * 5. Using WebDAV U2 creates a document2 inside folder + * 6. Using RestAPI U2 likes document1 + * 7. Using RestAPI U1 likes document2 + * 8. Using RestAPI U1 dislikes document2 + * 9. Using RestAPI U2 add to favorites document1 + * 10. Using CMIS U1 delete document1 + * 11. Using CMIS U2 delete the folder + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }, expectedExceptions = {CmisPermissionDeniedException.class, CmisUnauthorizedException.class} ) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user with contributor role can like/favorite a document in a public site.") + public void usersCanLikeADocumentInPublicSite() throws Exception + { + STEP("1. Using CMIS create 2 test users: U1 and U2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. Using RestAPI U1 creates a public test site and U2 user is added with contributor role"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + testUser2.setUserRole(UserRole.SiteContributor); + restAPI.authenticateUser(testUser1).withCoreAPI().usingSite(testSitePublic).addPerson(testUser2); + + STEP("3. Using WebDAV U1 creates a folder in his public site's document library"); + testFolder1 = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) + .createFolder(testFolder1).assertThat().existsInWebdav() + .and().assertThat().existsInRepo(); + + STEP("4. Using WebDAV U1 creates a document1 inside the above folder"); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + webDavProtocol.usingResource(testFolder1).createFile(testFile1) + .assertThat().existsInRepo() + .and().assertThat().existsInWebdav(); + + STEP("5. Using WebDAV U2 creates a document2 inside folder"); + testFile2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + webDavProtocol.authenticateUser(testUser2) + .usingResource(testFolder1).createFile(testFile2).assertThat().existsInRepo() + .and().assertThat().existsInWebdav(); + + STEP("6. Using RestAPI U2 likes document1"); + RestRatingModel returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1).likeDocument(); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + returnedRatingModel.assertThat().field("myRating").is("true") + .and().field("id").is("likes").and().field("aggregate").isNotEmpty(); + + STEP("7. Using RestAPI U1 likes document2"); + returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile2).likeDocument(); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + returnedRatingModel.assertThat().field("myRating").is("true") + .and().field("id").is("likes").and().field("aggregate").isNotEmpty(); + + STEP("8. Using RestAPI U1 dislikes document2"); + restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile2).deleteLikeRating(); + restAPI.assertStatusCodeIs(HttpStatus.NO_CONTENT); + + STEP("9. Using RestAPI U2 add to favorites document1"); + RestPersonFavoritesModel restPersonFavoritesModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingAuthUser().addFileToFavorites(testFile1); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + restPersonFavoritesModel.assertThat().field("targetGuid").is(testFile1.getNodeRefWithoutVersion()); + + STEP("10. Using CMIS U1 delete document1"); + cmisAPI.authenticateUser(testUser1).usingResource(testFile1).delete() + .and().assertThat().doesNotExistInRepo(); + + restAPI.withCoreAPI().usingResource(testFile1).getLikeRating(); + restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() + .containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef())); + + RestPersonFavoritesModelsCollection userFavorites = restAPI.withCoreAPI().usingAuthUser().getFavorites(); + restAPI.assertStatusCodeIs(HttpStatus.OK); + userFavorites.assertThat().entriesListIsEmpty().and().paginationField("totalItems").is("0"); + + STEP("11. Using CMIS U2 delete the folder. With Contributor role, U2 does not have permission to delete files/folders created by others."); + cmisAPI.authenticateUser(testUser2).usingResource(testFolder1).assertThat().doesNotHaveFile(testFile1) + .and().assertThat().hasFiles(testFile2) + .and().usingResource(testFile2).delete() + .and().usingResource(testFolder1).delete(); + } + + /** + * Scenario 34 - Document ratings + * + * 1. Using CMIS create 2 test users: U1 and U2 + * 2. Using RestAPI U1 creates a public test site and U2 user is added with collaborator role + * 3. Using CMIS U1 creates a new folder in site + * 4. Using WebDAV U2 creates file1 in public site document library + * 5. Using WebDAV U1 creates a file2 in public site document library + * 6. Using RestAPI U2 rates with 5 stars file2 + * 7. Using RestAPI U1 rates with 1 star file1 + * 8. Using RestAPI U2 likes file1 + * 9. Using RestAPI U2 removes the rating of 5 stars for file2 + * 10. Using WebDAV U1 delete file1. Using RestAPI get ratings of file1. + * 11. Using WebDAV U1 delete the folder + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify user with collaborator role can rate a document in a public site.") + public void usersCanRateADocumentInPublicSite() throws Exception + { + RestRatingModel returnedRatingModel; + + STEP("1. Using CMIS create 2 test users: U1 and U2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. Using RestAPI U1 creates a public test site and U2 user is added with collaborator role"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + testUser2.setUserRole(UserRole.SiteCollaborator); + restAPI.authenticateUser(testUser1).withCoreAPI().usingSite(testSitePublic).addPerson(testUser2); + + STEP("3. Using CMIS U1 creates a new folder in site"); + testFolder1 = FolderModel.getRandomFolderModel(); + cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic) + .createFolder(testFolder1).assertThat().existsInRepo(); + + STEP("4. Using WebDAV U2 creates file1 in public site document library"); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + webDavProtocol.authenticateUser(testUser2).usingResource(testFolder1) + .createFile(testFile1).assertThat().existsInRepo() + .and().assertThat().existsInWebdav(); + + STEP("5. Using WebDAV U1 creates a file2 in public site document library"); + testFile2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) + .usingResource(testFolder1).createFile(testFile2).assertThat().existsInRepo(); + + STEP("6. Using RestAPI U2 rates with 5 stars file2"); + returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile2) + .rateStarsToDocument(5); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty(); + + STEP("7. Using RestAPI U1 rates with 1 star file1"); + returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(testFile1) + .rateStarsToDocument(1); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + returnedRatingModel.assertThat().field("myRating").is("1").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty(); + + STEP("8. Using RestAPI U2 likes file1"); + returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile1) + .likeDocument(); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + + returnedRatingModel.assertThat().field("myRating").is("true").and().field("id").is("likes").and().field("aggregate").isNotEmpty(); + + STEP("9. Using RestAPI U2 removes the rating of 5 stars for file2"); + restAPI.authenticateUser(testUser2).withCoreAPI().usingResource(testFile2).deleteFiveStarRating(); + restAPI.assertStatusCodeIs(HttpStatus.NO_CONTENT); + + returnedRatingModel = restAPI.withCoreAPI().usingResource(testFile2).getFiveStarRating(); + restAPI.assertStatusCodeIs(HttpStatus.OK); + returnedRatingModel.getAggregate().assertThat().field("numberOfRatings").is("0"); + + STEP("10. Using WebDAV U1 delete file1. Using RestAPI get ratings of file1."); + webDavProtocol.authenticateUser(testUser1).usingResource(testFile1).delete() + .and().assertThat().doesNotExistInRepo() + .and().assertThat().doesNotExistInWebdav(); + + restAPI.withCoreAPI().usingResource(testFile1).getLikeRating(); + restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() + .containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef())); + + restAPI.withCoreAPI().usingResource(testFile1).getFiveStarRating(); + restAPI.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() + .containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, testFile1.getNodeRef())); + + STEP("11. Using WebDAV U1 delete the folder"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).assertThat().hasFiles(testFile2) + .and().usingResource(testFolder1).delete() + .and().assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 35 + * 1. Using CMIS create 2 test user: U1 and U2 + * 2. Using CMIS U1 creates a public test site + * 3. Using FTP U1 creates a folder in public site's document library: folder1 + * 4. Using WebDAV U1 creates inside folder1 a new folder: folder2 + * 5. Using WebDAV U1 creates inside folder2 a new folder: folder3 + * 6. Using CMIS U1 creates inside folder1 a new file: file1 + * 7. Using WebDAV U1 creates inside folder2 a new file: file2 + * 8. Using FTP U1 creates inside folder3 a new file: file3 + * 9. Using WebDAV U1 deletes file1 + * 10. Using IMAP U1 deletes file2 + * 11. Using WebDAV U1 updates content of file3 + * 12. Using RestAPI U1 adds a comment to file3 + * 13. Using RestAPI U1 likes file3 and user U2 rates file3 + * 14. Using CMIS U1 deletes file3 + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "File handling - perform actions: create, delete, add comment, like and rate, update file content ") + public void fileHandlingCreateUpdateContentDeleteLikeAndRate() throws Exception + { + STEP("1. Using CMIS create 1 test user: U1 and U2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. U1 creates a public test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); + + STEP("3. Using FTP U1 creates folder: folder1"); + FolderModel folder1 = FolderModel.getRandomFolderModel(); + ftpProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder1) + .assertThat().existsInRepo(); + + STEP("4. Using WebDAV U1 creates folder2 inside folder1"); + FolderModel folder2 = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1).usingResource(folder1).createFolder(folder2); + + STEP("5. Using webDAV U1 creates folder3 inside folder2"); + FolderModel folder3 = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1).usingResource(folder2).createFolder(folder3); + + STEP("6. Using CMIS U1 creates file1 inside folder1"); + FileModel file1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); + cmisAPI.authenticateUser(testUser1).usingResource(folder1).createFile(file1) + .assertThat().existsInRepo(); + + STEP("7. Using webDAV U1 creates file2 inside folder2"); + FileModel file2 = FileModel.getRandomFileModel(FileType.HTML, "file 2 content"); + webDavProtocol.authenticateUser(testUser1).usingResource(folder2).createFile(file2) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + + STEP("8. Using FTP U1 creates file3 inside folder3"); + FileModel file3 = FileModel.getRandomFileModel(FileType.MSWORD, "file 3 content"); + ftpProtocol.authenticateUser(testUser1).usingResource(folder3).createFile(file3) + .assertThat().existsInRepo(); + + STEP("9. Using webDAV U1 deletes file1"); + webDavProtocol.authenticateUser(testUser1).usingResource(file1).delete() + .assertThat().doesNotExistInRepo().and().assertThat().doesNotExistInWebdav(); + + STEP("10. Using IMAP U1 deletes file2"); + imapProtocol.authenticateUser(testUser1).usingResource(file2).deleteMessage() + .and().usingResource(file2).assertThat().doesNotExistInRepo(); + + STEP("11. Using WebDAV U1 update content of file3"); + webDavProtocol.authenticateUser(testUser1) + .usingResource(file3).assertThat().existsInRepo() + .update(newContent).assertThat().contentIs(newContent); + + STEP("12. Using RestAPI U1 adds a comment to file3"); + String comment = RandomData.getRandomName("comment1"); + file3.setNodeRef(dataContent.usingUser(testUser1).usingSite(testSitePublic) + .usingResource(folder3).usingResource(file3).getNodeRef()); + RestCommentModel commentModel = restAPI.authenticateUser(testUser1).withCoreAPI() + .usingResource(file3).addComment(comment); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + commentModel.assertThat().field("content").isNotEmpty() + .and().field("content").is(comment); + + STEP("13. Using RestAPI U1 likes file3 and user U2 rates file3"); + returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI().usingResource(file3).likeDocument(); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + returnedRatingModel.assertThat().field("myRating").is("true").and().field("id").is("likes").and().field("aggregate").isNotEmpty(); + + returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI() + .usingResource(file3).rateStarsToDocument(5); + restAPI.assertStatusCodeIs(HttpStatus.CREATED); + returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar").and().field("aggregate").isNotEmpty(); + + STEP("14. Using CMIS U1 deletes file3"); + cmisAPI.authenticateUser(testUser1).usingResource(file3).delete() + .assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 37 + * 1. Using CMIS creates 2 users: U1 and U + * 2. U1 creates a public test site using CMIS + * 3. Using CMIS U1 creates folder: folder1 + * 4. Using WebDAV U1 creates folder2 and folder3 inside folder1 + * 5. Using FTP U1 creates file1 inside folder1 + * 6. Using CMIS U1 copies file1 to folder2 + * 7. Using WebDAV U1 update content of file1 from folder2 + * 8. Using FTP U1 tries to move file1 from folder2 to folder1 + * 9. Using WebDAV U1 updates content of file1 from folder1 + * 10. Using RestAPI U1 adds file1 to favorites + * 11. Using RestAPI U1 likes file1 and U2 user rates file1 + * 12. Using CMIS U1 moves file1 from folder1 to folder3 + * 13. Using CMIS/RestAPI U1 checks that content, favorites and ratings are kept + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "File handling - perform actions: copy, move, add/update content, favorites, like and rate") + public void fileHandlingCopyMoveAddUpdateContentFavoritesLikeAndRate() throws Exception + { + STEP("1. Using CMIS creates 2 users: U1 and U2"); + testUser1 = dataUser.createRandomTestUser(); + testUser2 = dataUser.createRandomTestUser(); + + STEP("2. U1 creates a public test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("3. Using CMIS U1 creates folder: folder1"); + FolderModel folder1 = FolderModel.getRandomFolderModel(); + cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder1) + .assertThat().existsInRepo(); + + STEP("4. Using WebDAV U1 creates folder2 and folder3 inside folder1"); + FolderModel folder2 = FolderModel.getRandomFolderModel(); + FolderModel folder3 = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1) + .usingResource(folder1).createFolder(folder2).and().assertThat().existsInWebdav() + .usingResource(folder1).createFolder(folder3).and().assertThat().existsInWebdav(); + + STEP("5. Using FTP U1 creates file1 inside folder1"); + FileModel file1 = FileModel.getRandomFileModel(FileType.MSWORD2007, "tasTesting"); + ftpProtocol.authenticateUser(testUser1).usingResource(folder1).createFile(file1) + .assertThat().existsInRepo(); + + STEP("6. Using CMIS U1 copies file1 to folder2"); + FileModel copiedFile = new FileModel(file1); + cmisAPI.authenticateUser(testUser1).usingResource(file1).copyTo(folder2); + copiedFile.setCmisLocation(cmisAPI.getLastResource()); + cmisAPI.usingResource(folder2).assertThat().hasFiles(file1); + + STEP("7. Using WebDAV U1 update content of file1 from folder2"); + webDavProtocol.usingResource(copiedFile).assertThat().existsInRepo() + .update(newContent).assertThat().contentIs(newContent); + + STEP("8. Using FTP U1 tries to move file1 from folder2 to folder1"); + ftpProtocol.authenticateUser(testUser1) + .usingResource(copiedFile).moveTo(folder1).assertThat().existsInRepo(); + Assert.assertTrue(ftpProtocol.usingResource(folder1).getFiles().size() == 1); + + STEP("9. Using WebDAV U1 updates content of file1 from folder1"); + webDavProtocol.usingResource(file1).update("content folder1") + .assertThat().contentIs("content folder1"); + + STEP("10. Using RestAPI U1 adds file1 to favorites"); + file1.setNodeRef(dataContent.usingUser(testUser1).usingSite(testSitePublic) + .usingResource(folder1).usingResource(file1).getNodeRef()); + + restPersonFavoritesModel = restAPI.authenticateUser(testUser1).withCoreAPI() + .usingAuthUser().addFileToFavorites(file1); + restAPI.assertStatusCodeIs(org.springframework.http.HttpStatus.CREATED); + restPersonFavoritesModel.assertThat().field("targetGuid").is(file1.getNodeRefWithoutVersion()); + + STEP("11. Using RestAPI U1 likes file1 and U2 user rates file1"); + returnedRatingModel = restAPI.authenticateUser(testUser1).withCoreAPI() + .usingResource(file1).likeDocument(); + restAPI.assertStatusCodeIs(org.springframework.http.HttpStatus.CREATED); + returnedRatingModel.assertThat().field("myRating").is("true").and().field("id").is("likes") + .and().field("aggregate").isNotEmpty(); + + returnedRatingModel = restAPI.authenticateUser(testUser2).withCoreAPI() + .usingResource(file1).rateStarsToDocument(5); + restAPI.assertStatusCodeIs(org.springframework.http.HttpStatus.CREATED); + returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar") + .and().field("aggregate").isNotEmpty(); + + STEP("12. Using CMIS U1 moves file1 from folder1 to folder3"); + cmisAPI.usingSite(testSitePublic).usingResource(file1).moveTo(folder3) + .and().assertThat().existsInRepo(); + + STEP("13. Using CMIS/RestAPI U1 checks that content, favorites and ratings are kept"); + returnedRatingModel.assertThat().field("myRating").is("5").and().field("id").is("fiveStar") + .and().field("aggregate").isNotEmpty(); + restPersonFavoritesModel.assertThat().field("targetGuid").is(file1.getNodeRefWithoutVersion()); + } + + /** + * Scenario 38 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a new document in Share + * 3. Using WebDAV U1 creates a new document in User Home + * 4. Using WebDAV U1 updates both documents + * 5. Verify if only first document's version is increased using CMIS + * 6. Verify if content is updated using WebDav + * 7. Verify if the size of the document is increased + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify document versioning after appending content using WebDAV.") + public void checkDocumentVersionAfterAppendingContent() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a new document in Share"); + FileModel cmisTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 1 content"); + cmisAPI.authenticateUser(testUser1) + .usingShared().createFile(cmisTestFile) + .assertThat().existsInRepo(); + + STEP("3. Using WebDAV U1 creates a new document in User Home"); + FileModel webDAVTestFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file 2 content"); + webDavProtocol.authenticateUser(testUser1) + .usingUserHome().createFile(webDAVTestFile) + .assertThat().existsInWebdav().and() + .assertThat().existsInRepo(); + + STEP("4. Using WebDAV U1 updates both documents"); + webDavProtocol.usingResource(cmisTestFile).update("cmis file content") + .usingResource(webDAVTestFile).update("WebDAV file content"); + + STEP("5. Verify if only first document's version is increased using CMIS"); + cmisAPI.usingResource(cmisTestFile).assertThat().documentHasVersion(1.1) + .usingResource(webDAVTestFile).assertThat().documentHasVersion(1.0); + + STEP("6. Verify if content is updated using WebDav"); + webDavProtocol.authenticateUser(testUser1) + .usingResource(cmisTestFile).assertThat().contentIs("cmis file content") + .usingResource(webDAVTestFile).assertThat().contentIs("WebDAV file content"); + + STEP("7. Verify if the size of the document is increased"); + cmisAPI.usingResource(cmisTestFile).assertThat().contentLengthIs(17) + .usingResource(webDAVTestFile).assertThat().contentLengthIs(19); + } + + /** + * Scenario 40 + * 1. Using CMIS create test user: U1 + * 2. U1 creates a private test site using CMIS + * 3. Using WebDAV U1 creates a folder + * 4. Using WebDAV U1 creates a file inside the folder + * 5. Using CMIS, check out the document + * 6. Using CMIS verify if PWC is created + * 7. Using CMIS check in document with content + * 8. Using CMIS verify that version does not increase + * 9. Using CMIS verify new content is added to document + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify increased version and new content of a file that was check out then check in.") + public void verifyIncreasedVersionAndNewContentOfCheckInDocument() throws Exception + { + STEP("Step 1. Using CMIS create test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("Step 2. U1 creates a private test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createPrivateRandomSite(); + + STEP("Step 3. Using WebDAV U1 creates a folder"); + FolderModel folder = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder); + + STEP("Step 4. Using WebDAV U1 creates a file inside the folder"); + FileModel file = FileModel.getRandomFileModel(FileType.XML, "file content"); + webDavProtocol.authenticateUser(testUser1).usingResource(folder).createFile(file) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + + STEP("Step 5: Using CMIS, check out the document and verify document version"); + cmisAPI.authenticateUser(testUser1).usingResource(file).checkOut() + .assertThat().documentIsCheckedOut(); + + STEP("Step 6: Using CMIS verify if PWC is created"); + FileModel filePWC = cmisAPI.usingResource(file).withCMISUtil().getPWCFileModel(); + cmisAPI.usingResource(filePWC).assertThat().existsInRepo(); + + STEP("Step 7: Using CMIS check in document with content"); + String newContent = "new major content"; + cmisAPI.usingResource(folder).assertThat().folderHasCheckedOutDocument(file); + cmisAPI.usingResource(file).prepareDocumentForCheckIn() + .withMajorVersion() + .withContent(newContent) + .checkIn().refreshResource() + .and().assertThat().documentIsNotCheckedOut(); + + STEP("Step 8: Using CMIS verify that version does not increase"); + cmisAPI.usingResource(file).assertThat().documentHasVersion(1.0); + + STEP("Step 9: Using CMIS verify new content is added to document"); + cmisAPI.usingResource(file).assertThat().contentIs(newContent); + } + + /** + * Scenario 41 + * 1. Using CMIS create test user: U1 + * 2. U1 creates a private test site using CMIS + * 3. Using WebDAV U1 creates a folder + * 4. Using WebDAV U1 creates a file inside the folder + * 5. Using CMIS, check out the document + * 6. Using CMIS verify if PWC is created + * 7. Using CMIS, cancel check out + * 8. Using CMIS, verify original document has version 1.0 + * 9. Using CMIS, verify original document has same content + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Verify that version and the content of a file are not changed if the checkout is canceled.") + public void verifyVersionAndContentOfACanceledCheckoutDocument() throws Exception + { + STEP("Step 1. Using CMIS create test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("Step 2. U1 creates a private test site using CMIS"); + testSitePublic = dataSite.usingUser(testUser1).createPrivateRandomSite(); + + STEP("Step 3. Using WebDAV U1 creates a folder"); + FolderModel folder = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(folder); + + STEP("Step 4. Using WebDAV U1 creates a file inside the folder"); + FileModel file = FileModel.getRandomFileModel(FileType.XML, "file content"); + webDavProtocol.authenticateUser(testUser1).usingResource(folder).createFile(file) + .assertThat().existsInWebdav().assertThat().existsInRepo(); + + STEP("Step 5: Using CMIS, check out the document"); + cmisAPI.authenticateUser(testUser1).usingResource(file).checkOut(); + + STEP("Step 6: Using CMIS verify if PWC is created"); + FileModel filePWC = cmisAPI.usingResource(file).withCMISUtil().getPWCFileModel(); + cmisAPI.usingResource(filePWC).assertThat().existsInRepo(); + + STEP("Step 7: Using CMIS, cancel check out"); + cmisAPI.usingResource(file).cancelCheckOut().then() + .assertThat().documentIsNotCheckedOut(); + + STEP("Step 8: Using CMIS, verify original document has version 1.0"); + cmisAPI.usingResource(file).assertThat().isNotPrivateWorkingCopy() + .then().assertThat().documentHasVersion(1.0); + + STEP("Step 9: Using CMIS, verify original document has same content"); + cmisAPI.usingResource(file).assertThat().contentIs("file content"); + } + + /** + * Scenario 42 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a file: file + * 3. Using WebDAV U1 renames file and verify if the new document exists + * 4. Using FTP verify old document does not exists + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Edit document name and verify document with new name") + public void renameDocument() throws Exception + { + STEP("1. Using CMIS create test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates file"); + FileModel file = FileModel.getRandomFileModel(FileType.PDF, "file content"); + cmisAPI.authenticateUser(testUser1).usingUserHome().createFile(file) + .assertThat().existsInRepo(); + + STEP("3. Using WebDAV U1 renames file and verify if the new document exists"); + FileModel oldFile = new FileModel(file); + webDavProtocol.authenticateUser(testUser1).usingResource(file).rename(renamePrefix + file.getName()) + .and().assertThat().existsInRepo().and().assertThat().existsInWebdav(); + + STEP("4. Using FTP verify old document does not exists"); + ftpProtocol.authenticateUser(testUser1).usingResource(oldFile) + .assertThat().doesNotExistInRepo() + .and().assertThat().doesNotExistInFtp(); + } + + /** + * Scenario 43 + * 1. Using CMIS create test user: U1 + * 2. Using WebDAV U1 creates a file using shared + * 3. Using webDAV append content to document + * 4. Using CMIS, verify original document has version 1.0 + * 5. Using CMIS delete document + * 6. Using WebDAV, verify document is deleted + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, + description = "Delete document after append content and verify document version.") + public void deleteDocumentAfterAppendContent() throws Exception + { + STEP("Step 1. Using CMIS create test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("Step 2. Using WebDAV U1 creates a file using shared"); + FileModel file = FileModel.getRandomFileModel(FileType.XML, "file content"); + webDavProtocol.authenticateUser(testUser1).usingUserHome().createFile(file) + .assertThat().existsInRepo(); + + STEP("Step 3. Using webDAV append content to document"); + String newContentToAppend = " - append this text to the file"; + webDavProtocol.authenticateUser(testUser1).usingResource(file).assertThat().contentIs("file content") + .then().update(file.getContent() + newContentToAppend) + .assertThat().contentIs(file.getContent() + newContentToAppend); + + STEP("Step 4: Using CMIS, verify original document has version 1.0"); + cmisAPI.authenticateUser(testUser1).usingResource(file).assertThat().isNotPrivateWorkingCopy() + .then().assertThat().documentHasVersion(1.0); + + STEP("Step 4: Using CMIS, delete document"); + cmisAPI.usingResource(file).assertThat().existsInRepo().delete(); + + STEP("Step 5: Using WebDAV, verify document is deleted"); + webDavProtocol.authenticateUser(testUser1).usingResource(file).assertThat().doesNotExistInWebdav() + .and().assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 44 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a public test site + * 3. Using WebDAV U1 creates a new file in User Home + * 4. Using WebDAV U1 creates another file in public site document library. + * 5. Using CMIS U1 creates a relationship between documents + * 6. Verify if relationship is created + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify if relationship is created between 2 items using CMIS.") + public void checkRelationshipBetween2Files() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a public test site"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("3. Using WebDAV U1 creates a new file in User Home"); + FileModel sourceFile= FileModel.getRandomFileModel(FileType.PDF, "file content"); + webDavProtocol.authenticateUser(testUser1).usingUserHome() + .createFile(sourceFile).assertThat().existsInRepo(); + + STEP("4. Using WebDAV U1 creates another file in public site document library."); + FileModel targetFile= FileModel.getRandomFileModel(FileType.PDF, "file content"); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) + .createFile(targetFile).assertThat().existsInRepo(); + + STEP("5. Using CMIS U1 creates a relationship between documents. 6. Verify if relationship is created"); + cmisAPI.authenticateUser(testUser1).usingResource(sourceFile).createRelationshipWith(targetFile) + .assertThat().objectHasRelationshipWith(targetFile); + } + + /** + * Scenario 46 + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates an imap test site + * 3. Using CMIS U1 creates cmisFolder in Shared + * 4. Using IMAP U1 creates parentFolder in private site document library. + * 5. Using FTP U1 creates a subfolder in parentFolder + * 6. Using WebDAV U1 creates a webdavFolder in User Home + * 7. Using WebDAV U1 creates a document in parentFolder + * 8. Using CMIS U1 adds document to cmisFolder, subfolder, webdavFolder + * 9. Using WebDAV verify document is present in all folders + * 10. Using CMIS U1 removes document from subFolder + * 11. Using WebDAV verify document is not present in subFolder + * 12. Using FTP U1 deletes original document from parentFolder + * 13. Using CMIS verify document does not exist + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify parents list for an object using CMIS.") + public void addAndRemoveDocumentFromFolders() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates an imap test site"); + testSitePublic = dataSite.usingUser(testUser1).createIMAPSite(); + + STEP("3. Using CMIS U1 creates cmisFolder in Shared"); + FolderModel cmisFolder = FolderModel.getRandomFolderModel(); + cmisAPI.authenticateUser(testUser1) + .usingShared().createFolder(cmisFolder) + .assertThat().existsInRepo(); + + STEP("4. Using IMAP U1 creates parentFolder in private site document library."); + FolderModel parentFolder = FolderModel.getRandomFolderModel(); + imapProtocol.authenticateUser(testUser1) + .usingSite(testSitePublic).createFolder(parentFolder) + .assertThat().existsInRepo(); + + STEP("5. Using FTP U1 creates a subfolder in parentFolder"); + FolderModel subFolder = FolderModel.getRandomFolderModel(); + ftpProtocol.authenticateUser(testUser1) + .usingResource(parentFolder).createFolder(subFolder) + .assertThat().existsInRepo(); + + STEP("6. Using WebDAV U1 creates a webdavFolder in User Home"); + FolderModel webdavFolder = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1) + .usingUserHome().createFolder(webdavFolder) + .assertThat().existsInRepo(); + + STEP("7. Using WebDAV U1 creates a document in parentFolder"); + testFile1= FileModel.getRandomFileModel(FileType.TEXT_PLAIN, "file content"); + webDavProtocol.authenticateUser(testUser1) + .usingResource(parentFolder).createFile(testFile1) + .assertThat().existsInRepo(); + + STEP("8. Using CMIS U1 adds document to cmisFolder, subfolder, webdavFolder"); + cmisAPI.usingResource(testFile1) + .addDocumentToFolder(cmisFolder, true).assertThat().hasParents(parentFolder.getName(), cmisFolder.getName()) + .addDocumentToFolder(subFolder, true).assertThat().hasParents(parentFolder.getName(), cmisFolder.getName(), subFolder.getName()) + .addDocumentToFolder(webdavFolder, true).assertThat().hasParents(parentFolder.getName(), cmisFolder.getName(), subFolder.getName(), webdavFolder.getName()); + + STEP("9. Using WebDAV verify document is present in all folders"); + FileModel fileAddedInCMISFolder = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); + fileAddedInCMISFolder.setCmisLocation(Utility.buildPath(cmisFolder.getCmisLocation(), testFile1.getName())); + + FileModel fileAddedInSubFolder = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); + fileAddedInSubFolder.setCmisLocation(Utility.buildPath(subFolder.getCmisLocation(), testFile1.getName())); + + FileModel fileAddedInWebDAVFolder = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); + fileAddedInWebDAVFolder.setCmisLocation(Utility.buildPath(webdavFolder.getCmisLocation(), testFile1.getName())); + + webDavProtocol.usingResource(fileAddedInCMISFolder).assertThat().existsInWebdav() + .usingResource(fileAddedInSubFolder).assertThat().existsInWebdav() + .usingResource(fileAddedInWebDAVFolder).assertThat().existsInWebdav(); + + STEP("10. Using CMIS U1 removes document from subFolder"); + cmisAPI.usingResource(testFile1).removeDocumentFromFolder(subFolder) + .assertThat().hasParents(parentFolder.getName(), cmisFolder.getName(), webdavFolder.getName()); + + STEP("11. Using WebDAV verify document is not present in subFolder"); + webDavProtocol.usingResource(testFile1).assertThat().existsInWebdav() + .usingResource(fileAddedInCMISFolder).assertThat().existsInWebdav() + .usingResource(fileAddedInSubFolder).assertThat().doesNotExistInWebdav() + .usingResource(fileAddedInWebDAVFolder).assertThat().existsInWebdav(); + + STEP("12. Using FTP U1 deletes original document from parentFolder"); + ftpProtocol.usingResource(testFile1).delete().assertThat().doesNotExistInFtp(); + + STEP("13. Using CMIS verify document does not exist"); + cmisAPI.usingResource(fileAddedInCMISFolder).assertThat().doesNotExistInRepo() + .usingResource(fileAddedInWebDAVFolder).assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 47 - Delete many documents + * + * 1. Using CMIS create test user: U1 + * 2. Using CMIS U1 creates a public test site + * 3. Using CMIS and WebDAV U1 creates parentFolder1, doc1 and doc2 in document library + * 4. Using WebDAV and FTP U1 creates inside parentFolder1: childDoc1 to childDoc5 + * 5. Using IMAP bulk delete doc1 and doc2 + * 6. Using CMIS verify that doc1 and doc2 are deleted + * 7. Using IMAP delete childDoc1 to childDoc4 + * 8. Using WebDAV and FTP verify if docs are deleted from their folders + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT}, executionType = ExecutionType.REGRESSION, + description = "Verify users can delete many documents in a public site using different protocols.") + public void usersCanDeleteManyDocuments() throws Exception + { + FolderModel parentFolder1 = FolderModel.getRandomFolderModel(); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + testFile2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + FileModel childDoc1, childDoc2, childDoc3, childDoc4, childDoc5; + childDoc1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + childDoc2 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + childDoc3 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + childDoc4 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + childDoc5 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + + STEP("1. Using CMIS create test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a public test site"); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("3. Using CMIS and WebDAV U1 creates parentFolder1, doc1 and doc2 in document library"); + cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic).createFolder(parentFolder1) + .and().assertThat().existsInRepo(); + + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic).createFile(testFile1) + .and().createFile(testFile2); + + STEP("4. Using WebDAV and FTP U1 creates inside parentFolder1: childDoc1 to childDoc5"); + webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder1) + .createFile(childDoc1).and().createFile(childDoc2); + + ftpProtocol.authenticateUser(testUser1).usingResource(parentFolder1) + .createFile(childDoc3).and().createFile(childDoc4).and().createFile(childDoc5); + + STEP("5. Using IMAP bulk delete doc1 and doc2"); + imapProtocol.authenticateUser(testUser1).usingSite(testSitePublic).deleteMessage(testFile1.getName(), testFile2.getName()).assertThat().doesNotContainMessages(testFile1, testFile2); + + STEP("6. Using CMIS verify that doc1 and doc2 are deleted"); + Utility.sleep(500, 10000, () -> + cmisAPI.authenticateUser(testUser1) + .usingResource(testFile1).assertThat().doesNotExistInRepo() + .and().usingResource(testFile2).assertThat().doesNotExistInRepo()); + + STEP("7. Using IMAP delete childDoc1 to childDoc4"); + imapProtocol.authenticateUser(testUser1).usingResource(parentFolder1).deleteMessage(childDoc1.getName(), childDoc2.getName(), childDoc3.getName(), childDoc4.getName()) + .assertThat().doesNotContainMessages(childDoc1, childDoc2, childDoc3, childDoc4); + + STEP("8. Using WebDAV and FTP verify if docs are deleted from their folders"); + Utility.sleep(500, 10000, () -> + webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder1).assertThat().hasFiles(childDoc5) + .and().usingResource(childDoc1).assertThat().doesNotExistInRepo() + .and().usingResource(childDoc2).assertThat().doesNotExistInRepo()); + + ftpProtocol.authenticateUser(testUser1).usingResource(childDoc3) + .assertThat().doesNotExistInRepo() + .and().usingResource(childDoc4).assertThat().doesNotExistInRepo(); + } + + /** + * Scenario 48 - Move folder in another folder + * + * 1. Using CMIS create user u1 and public site + * 2. Using WebDAV U1 creates folder1 and folder2 + * 3. Using WebDAV U1 creates doc1 in folder1 + * 4. Using FTP U1 moves folder1 in folder2 + * 5. Using WebDAV verify that folder1 is not in the original location and is present in folder2 + * 6. Using CMIS verify if doc1 is still present in folder1 + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to move a non empty folder to another folder from the same site.") + public void moveFolderInAnotherFolder() throws Exception + { + testFolder1 = FolderModel.getRandomFolderModel(); + testFolder2 = FolderModel.getRandomFolderModel(); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + + STEP("1. Using CMIS create user u1 and public site"); + testUser1 = dataUser.createRandomTestUser(); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("2. Using WebDAV U1 creates folder1 and folder2"); + webDavProtocol.authenticateUser(testUser1).usingSite(testSitePublic) + .createFolder(testFolder1) + .and().assertThat().existsInRepo().and().assertThat().existsInWebdav() + .then().createFolder(testFolder2) + .and().assertThat().existsInRepo().and().assertThat().existsInWebdav(); + + STEP("3. Using WebDAV U1 creates doc1 in folder1"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).createFile(testFile1) + .and().assertThat().existsInRepo().and().assertThat().existsInWebdav() + .and().usingResource(testFolder1).assertThat().hasFiles(testFile1); + + STEP("4. Using FTP U1 moves folder1 in folder2"); + ftpProtocol.authenticateUser(testUser1) + .usingResource(testFolder1).moveTo(testFolder2) + .assertThat().existsInRepo() + .then().usingResource(testFolder1).assertThat().doesNotExistInRepo(); + + STEP("5. Using WebDAV verify that folder1 is not in the original location and is present in folder2"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).assertThat().doesNotExistInRepo() + .and().usingResource(testFolder2).assertThat().hasFolders(testFolder1); + + STEP("6. Using CMIS verify if doc1 is still present in folder1"); + FolderModel newTestFolder1 = new FolderModel(testFolder1.getName(), testFolder1.getTitle(), testFolder1.getDescription()); + newTestFolder1.setCmisLocation(Utility.buildPath(testFolder2.getCmisLocation(), testFolder1.getName())); + + FileModel newTestFile1 = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); + newTestFile1.setCmisLocation(Utility.buildPath(newTestFolder1.getCmisLocation(), testFile1.getName())); + + cmisAPI.authenticateUser(testUser1).usingResource(newTestFolder1) + .assertThat().existsInRepo() + .assertThat().hasFiles(newTestFile1); + } + + /** + * Scenario 49 - Copy folder in another folder + * + * 1. Using CMIS create user u1 and public site + * 2. Using CMIS U1 creates folder1 and folder2 + * 3. Using WebDAV U1 creates doc1 in folder1 + * 4. Using WebDAV U1 copies folder1 in folder2 + * 5. Using FTP verify that folder1 is in the original location and contains doc1 + * 6. Using WebDAV verify that folder1 is in folder2 and contains doc1 + */ + + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }) + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify user is able to copy non empty folder to another folder in the same site.") + public void copyFolderInAnotherFolder() throws Exception + { + testFolder1 = FolderModel.getRandomFolderModel(); + testFolder2 = FolderModel.getRandomFolderModel(); + testFile1 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); + + STEP("1. Using CMIS create user u1 and public site"); + testUser1 = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20)); + testSitePublic = dataSite.usingUser(testUser1).createPublicRandomSite(); + + STEP("2. Using CMIS U1 creates folder1 and folder2"); + cmisAPI.authenticateUser(testUser1).usingSite(testSitePublic) + .createFolder(testFolder1).and().assertThat().existsInRepo().and() + .createFolder(testFolder2).and().assertThat().existsInRepo(); + + STEP("3. Using WebDAV U1 creates doc1 in folder1"); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1) + .createFile(testFile1).and().assertThat().existsInRepo() + .and().assertThat().existsInWebdav(); + + STEP("4. Using WebDAV U1 copies folder1 in folder2"); + testFolder2.setProtocolLocation(webDavProtocol.getPrefixSpace() + testFolder2.getCmisLocation()); + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder1).copyTo(testFolder2) + .assertThat().existsInRepo() + .then().usingResource(testFolder1).assertThat().existsInRepo(); + + STEP("5. Using FTP verify that folder1 is in the original location and contains doc1"); + ftpProtocol.authenticateUser(testUser1).usingResource(testFolder1) + .assertThat().existsInRepo() + .and().assertThat().existsInFtp() + .and().assertThat().hasFiles(testFile1); + + STEP("6. Using WebDAV verify that folder1 is in folder2 and contains doc1"); + FolderModel newTestFolder1 = new FolderModel(testFolder1.getName(), testFolder1.getTitle(), testFolder1.getDescription()); + newTestFolder1.setCmisLocation(Utility.buildPath(testFolder2.getCmisLocation(), testFolder1.getName())); + + FileModel newTestFile1 = new FileModel(testFile1.getName(), testFile1.getTitle(), testFile1.getDescription(), testFile1.getFileType(), testFile1.getContent()); + newTestFile1.setCmisLocation(Utility.buildPath(newTestFolder1.getCmisLocation(), testFile1.getName())); + + webDavProtocol.authenticateUser(testUser1).usingResource(testFolder2) + .assertThat().hasFolders(newTestFolder1) + .and().usingResource(newTestFolder1) + .assertThat().existsInRepo().and().assertThat().existsInWebdav() + .and().assertThat().hasFiles(newTestFile1); + } + + /** + * Scenario 50 - Rename site + * + * 1. Using CMIS create one test user: U1 + * 2. Using CMIS U1 creates a moderated site + * 3. Using WebDAV U1 creates a folder in the moderated site document library + * 4. Using CMIS U1 tries to rename site + * 5. Verify that a site cannot be renamed + */ + @Test(groups = { TestGroup.INTEGRATION, TestGroup.CORE }, expectedExceptions = CmisRuntimeException.class, expectedExceptionsMessageRegExp = "^.*Sites can not be renamed.$") + @TestRail(section = { TestGroup.INTEGRATION, TestGroup.CONTENT }, executionType = ExecutionType.REGRESSION, description = "Verify sites cannot be renamed using CMIS.") + public void renameSite() throws Exception + { + STEP("1. Using CMIS create one test user: U1"); + testUser1 = dataUser.createRandomTestUser(); + + STEP("2. Using CMIS U1 creates a moderated site"); + testSiteModerated = dataSite.usingUser(testUser1).createModeratedRandomSite(); + + STEP("3. Using WebDAV U1 creates a folder in the moderated site document library"); + testFolder1 = FolderModel.getRandomFolderModel(); + webDavProtocol.authenticateUser(testUser1) + .usingSite(testSiteModerated).createFolder(testFolder1) + .assertThat().existsInWebdav() + .assertThat().existsInRepo(); + + STEP("4. Using CMIS U1 tries to rename site 5. Verify that a site cannot be renamed"); + FolderModel siteFolder = new FolderModel(String.format("/Sites/%s", testSiteModerated.getId())); + cmisAPI.authenticateUser(testUser1).usingResource(siteFolder).rename("renamedSite"); + } +} diff --git a/packaging/tests/tas-restapi/pom.xml b/packaging/tests/tas-restapi/pom.xml index 6096e82274..837683b518 100644 --- a/packaging/tests/tas-restapi/pom.xml +++ b/packaging/tests/tas-restapi/pom.xml @@ -2,16 +2,14 @@ 4.0.0 org.alfresco.tas - content-repository-community-restapi-test - content-repository-community-restapi-test - 6.2.2-SNAPSHOT + alfresco-community-repo-restapi-test + restapi test jar org.alfresco - content-repository-community-tas-tests-parent - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-tests + 7.183.300-TEST1-SNAPSHOT diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/nodes/NodesTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/nodes/NodesTests.java index b122296c60..ccfb76119b 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/nodes/NodesTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/nodes/NodesTests.java @@ -1,56 +1,56 @@ -package org.alfresco.rest.nodes; - -import org.alfresco.rest.RestTest; -import org.alfresco.rest.model.RestNodeBodyMoveCopyModel; -import org.alfresco.rest.model.RestNodeModel; -import org.alfresco.rest.model.builder.NodesBuilder; -import org.alfresco.rest.model.builder.NodesBuilder.NodeDetail; -import org.alfresco.utility.model.ContentModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.testrail.ExecutionType; -import org.alfresco.utility.testrail.annotation.TestRail; -import org.springframework.http.HttpStatus; -import org.testng.annotations.Test; - -/** - * Handles tests related to api-explorer/#!/nodes - */ -public class NodesTests extends RestTest -{ - @TestRail(section = { TestGroup.REST_API,TestGroup.NODES }, executionType = ExecutionType.SANITY, - description = "Verify files can be moved from one folder to another") - @Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.SANITY}) - public void testMoveFile() throws Exception - { - restClient.authenticateUser(dataContent.getAdminUser()); - - /* - * Create the following file structure for preconditions : - * - sourceFolder - * - file - * - destinationFolder - */ - NodesBuilder nodesBuilder = restClient.withCoreAPI().usingNode(ContentModel.my()).defineNodes(); - NodeDetail sourceFolder = nodesBuilder.folder("sourceFolder"); - NodeDetail file = sourceFolder.file("file"); - NodeDetail destinationFolder = nodesBuilder.folder("destinationFolder"); - - // Move file from sourceFolder to destinationFolder - RestNodeBodyMoveCopyModel moveDestinationInfo = new RestNodeBodyMoveCopyModel(); - moveDestinationInfo.setTargetParentId(destinationFolder.getId()); - - ContentModel fileToMove = new ContentModel(); - fileToMove.setNodeRef(file.getId()); - - RestNodeModel response = restClient.withParams("autoRename=true").withCoreAPI().usingNode(fileToMove).move(moveDestinationInfo); - restClient.assertStatusCodeIs(HttpStatus.OK); - - /* - * Check file's parent has changed to destinationFolder - * - sourceFolder - * - destinationFolder - * - file - */ - response.assertThat().field("parentId").is(destinationFolder.getId()); - } -} +package org.alfresco.rest.nodes; + +import org.alfresco.rest.RestTest; +import org.alfresco.rest.model.RestNodeBodyMoveCopyModel; +import org.alfresco.rest.model.RestNodeModel; +import org.alfresco.rest.model.builder.NodesBuilder; +import org.alfresco.rest.model.builder.NodesBuilder.NodeDetail; +import org.alfresco.utility.model.ContentModel; +import org.alfresco.utility.model.TestGroup; +import org.alfresco.utility.testrail.ExecutionType; +import org.alfresco.utility.testrail.annotation.TestRail; +import org.springframework.http.HttpStatus; +import org.testng.annotations.Test; + +/** + * Handles tests related to api-explorer/#!/nodes + */ +public class NodesTests extends RestTest +{ + @TestRail(section = { TestGroup.REST_API,TestGroup.NODES }, executionType = ExecutionType.SANITY, + description = "Verify files can be moved from one folder to another") + @Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.SANITY}) + public void testMoveFile() throws Exception + { + restClient.authenticateUser(dataContent.getAdminUser()); + + /* + * Create the following file structure for preconditions : + * - sourceFolder + * - file + * - destinationFolder + */ + NodesBuilder nodesBuilder = restClient.withCoreAPI().usingNode(ContentModel.my()).defineNodes(); + NodeDetail sourceFolder = nodesBuilder.folder("sourceFolder"); + NodeDetail file = sourceFolder.file("file"); + NodeDetail destinationFolder = nodesBuilder.folder("destinationFolder"); + + // Move file from sourceFolder to destinationFolder + RestNodeBodyMoveCopyModel moveDestinationInfo = new RestNodeBodyMoveCopyModel(); + moveDestinationInfo.setTargetParentId(destinationFolder.getId()); + + ContentModel fileToMove = new ContentModel(); + fileToMove.setNodeRef(file.getId()); + + RestNodeModel response = restClient.withParams("autoRename=true").withCoreAPI().usingNode(fileToMove).move(moveDestinationInfo); + restClient.assertStatusCodeIs(HttpStatus.OK); + + /* + * Check file's parent has changed to destinationFolder + * - sourceFolder + * - destinationFolder + * - file + */ + response.assertThat().field("parentId").is(destinationFolder.getId()); + } +} diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleFullTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleFullTests.java index a447bd1d58..c4f5eafac2 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleFullTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/people/GetPeopleFullTests.java @@ -1,88 +1,88 @@ -package org.alfresco.rest.people; - -import org.alfresco.rest.RestTest; -import org.alfresco.rest.core.RestRequest; -import org.alfresco.rest.model.RestPersonModel; -import org.alfresco.rest.model.RestPersonModelsCollection; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; -import org.alfresco.utility.testrail.ExecutionType; -import org.alfresco.utility.testrail.annotation.TestRail; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class GetPeopleFullTests extends RestTest -{ - UserModel userModel; - SiteModel siteModel; - UserModel searchedUser, managerUser; - UserModel adminUser; - private RestPersonModel personModel; - - @BeforeClass(alwaysRun = true) - public void dataPreparation() throws Exception - { - adminUser = dataUser.getAdminUser(); - userModel = dataUser.createRandomTestUser(); - siteModel = dataSite.usingUser(userModel).createPublicRandomSite(); - searchedUser = dataUser.createRandomTestUser(); - managerUser = dataUser.usingAdmin().createRandomTestUser(); - dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get person response with Rest API") - public void checkResponseSchemaForGetPerson() throws Exception - { - RestPersonModel newUser = RestPersonModel.getRandomPersonModel("aspectNames", "avatarId", "statusUpdatedAt","displayName"); - newUser = restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser().createPerson(newUser); - restClient.assertStatusCodeIs(HttpStatus.CREATED); - - personModel = restClient.authenticateUser(userModel).withCoreAPI().usingUser(new UserModel(newUser.getId(), newUser.getPassword())).getPerson(); - restClient.assertStatusCodeIs(HttpStatus.OK); - - personModel.assertThat().field("id").is(newUser.getId()) - .and().field("firstName").is(newUser.getFirstName()) - .and().field("lastName").is(newUser.getLastName()) - .and().field("description").is(newUser.getDescription()) - .and().field("email").is(newUser.getEmail()) - .and().field("skypeId").is(newUser.getSkypeId()) - .and().field("googleId").is(newUser.getGoogleId()) - .and().field("instantMessageId").is(newUser.getInstantMessageId()) - .and().field("jobTitle").is(newUser.getJobTitle()) - .and().field("location").is(newUser.getLocation()) - .and().field("mobile").is(newUser.getMobile()) - .and().field("telephone").is(newUser.getTelephone()) - .and().field("userStatus").is(newUser.getUserStatus()) - .and().field("enabled").is(newUser.getEnabled()) - .and().field("emailNotificationsEnabled").is(newUser.getEmailNotificationsEnabled()); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user gets a person with empty personId with Rest API and response is successful") - public void userGetPersonWithEmptyPersonId() throws Exception - { - restClient.authenticateUser(managerUser).withCoreAPI(); - RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}?{parameters}", "", restClient.getParameters()); - RestPersonModelsCollection persons = restClient.processModels(RestPersonModelsCollection.class, request); - restClient.assertStatusCodeIs(HttpStatus.OK); - persons.assertThat().entriesListIsNotEmpty(); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user gets admin user with Rest API and response is successful") - public void managerUserGetAdminPerson() throws Exception - { - personModel = restClient.authenticateUser(managerUser).withCoreAPI().usingUser(adminUser).getPerson(); - restClient.assertStatusCodeIs(HttpStatus.OK); - personModel.assertThat().field("id").is(adminUser.getUsername()) - .and().field("firstName").is("Administrator") - .and().field("email").is("admin@alfresco.com") - .and().field("emailNotificationsEnabled").is("true") - .and().field("enabled").is("true"); - } -} +package org.alfresco.rest.people; + +import org.alfresco.rest.RestTest; +import org.alfresco.rest.core.RestRequest; +import org.alfresco.rest.model.RestPersonModel; +import org.alfresco.rest.model.RestPersonModelsCollection; +import org.alfresco.utility.constants.UserRole; +import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.TestGroup; +import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.testrail.ExecutionType; +import org.alfresco.utility.testrail.annotation.TestRail; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +public class GetPeopleFullTests extends RestTest +{ + UserModel userModel; + SiteModel siteModel; + UserModel searchedUser, managerUser; + UserModel adminUser; + private RestPersonModel personModel; + + @BeforeClass(alwaysRun = true) + public void dataPreparation() throws Exception + { + adminUser = dataUser.getAdminUser(); + userModel = dataUser.createRandomTestUser(); + siteModel = dataSite.usingUser(userModel).createPublicRandomSite(); + searchedUser = dataUser.createRandomTestUser(); + managerUser = dataUser.usingAdmin().createRandomTestUser(); + dataUser.usingUser(userModel).addUserToSite(managerUser, siteModel, UserRole.SiteManager); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get person response with Rest API") + public void checkResponseSchemaForGetPerson() throws Exception + { + RestPersonModel newUser = RestPersonModel.getRandomPersonModel("aspectNames", "avatarId", "statusUpdatedAt","displayName", "quota", "quotaUsed"); + newUser = restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser().createPerson(newUser); + restClient.assertStatusCodeIs(HttpStatus.CREATED); + + personModel = restClient.authenticateUser(userModel).withCoreAPI().usingUser(new UserModel(newUser.getId(), newUser.getPassword())).getPerson(); + restClient.assertStatusCodeIs(HttpStatus.OK); + + personModel.assertThat().field("id").is(newUser.getId()) + .and().field("firstName").is(newUser.getFirstName()) + .and().field("lastName").is(newUser.getLastName()) + .and().field("description").is(newUser.getDescription()) + .and().field("email").is(newUser.getEmail()) + .and().field("skypeId").is(newUser.getSkypeId()) + .and().field("googleId").is(newUser.getGoogleId()) + .and().field("instantMessageId").is(newUser.getInstantMessageId()) + .and().field("jobTitle").is(newUser.getJobTitle()) + .and().field("location").is(newUser.getLocation()) + .and().field("mobile").is(newUser.getMobile()) + .and().field("telephone").is(newUser.getTelephone()) + .and().field("userStatus").is(newUser.getUserStatus()) + .and().field("enabled").is(newUser.getEnabled()) + .and().field("emailNotificationsEnabled").is(newUser.getEmailNotificationsEnabled()); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user gets a person with empty personId with Rest API and response is successful") + public void userGetPersonWithEmptyPersonId() throws Exception + { + restClient.authenticateUser(managerUser).withCoreAPI(); + RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}?{parameters}", "", restClient.getParameters()); + RestPersonModelsCollection persons = restClient.processModels(RestPersonModelsCollection.class, request); + restClient.assertStatusCodeIs(HttpStatus.OK); + persons.assertThat().entriesListIsNotEmpty(); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user gets admin user with Rest API and response is successful") + public void managerUserGetAdminPerson() throws Exception + { + personModel = restClient.authenticateUser(managerUser).withCoreAPI().usingUser(adminUser).getPerson(); + restClient.assertStatusCodeIs(HttpStatus.OK); + personModel.assertThat().field("id").is(adminUser.getUsername()) + .and().field("firstName").is("Administrator") + .and().field("email").is("admin@alfresco.com") + .and().field("emailNotificationsEnabled").is("true") + .and().field("enabled").is("true"); + } +} diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMemberTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMemberTests.java index 1b52694554..e0033efb6d 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMemberTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMemberTests.java @@ -1,395 +1,395 @@ -package org.alfresco.rest.sites.members; - -import org.alfresco.rest.RestTest; -import org.alfresco.rest.exception.JsonToModelConversionException; -import org.alfresco.rest.model.RestErrorModel; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.data.DataUser.ListUserWithRoles; -import org.alfresco.utility.exception.DataPreparationException; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; -import org.alfresco.utility.testrail.ExecutionType; -import org.alfresco.utility.testrail.annotation.TestRail; -import org.springframework.http.HttpStatus; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author iulia.cojocea - */ -public class GetSiteMemberTests extends RestTest -{ - private UserModel adminUser; - private SiteModel publicSiteModel, moderatedSiteModel, privateSiteModel; - private ListUserWithRoles usersWithRoles; - private UserModel manager, consumer, collaborator, contributor; - - @BeforeClass(alwaysRun = true) - public void dataPreparation() throws DataPreparationException - { - adminUser = dataUser.getAdminUser(); - publicSiteModel = dataSite.usingUser(adminUser).createPublicRandomSite(); - moderatedSiteModel = dataSite.usingUser(adminUser).createModeratedRandomSite(); - privateSiteModel = dataSite.usingUser(adminUser).createPrivateRandomSite(); - usersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, - UserRole.SiteContributor); - - consumer = dataUser.createRandomTestUser(); - manager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager); - collaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator); - contributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor); - - dataUser.addUserToSite(consumer, publicSiteModel, UserRole.SiteConsumer); - dataUser.addUserToSite(consumer, moderatedSiteModel, UserRole.SiteConsumer); - dataUser.addUserToSite(manager, moderatedSiteModel, UserRole.SiteManager); - dataUser.addUserToSite(consumer, privateSiteModel, UserRole.SiteConsumer); - dataUser.addUserToSite(manager, privateSiteModel, UserRole.SiteManager); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, - description = "Verify user with Manager role gets site member and status code is OK (200)") - public void getSiteMemberWithManagerRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) - .assertThat().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Collaborator role gets site member and gets status code OK (200)") - public void getSiteMemberWithCollaboratorRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) - .and().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Contributor role gets site member and gets status code OK (200)") - public void getSiteMemberWithContributorRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) - .and().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Consumer role gets site member and gets status code OK (200)") - public void getSiteMemberWithConsumerRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) - .and().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with admin user gets site member and gets status code OK (200)") - public void getSiteMemberWithAdminUser() throws Exception - { - restClient.authenticateUser(adminUser); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) - .and().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, - description = "Failed authentication get site member call returns status code 401") -// @Bug(id="MNT-16904", description = "It fails only on environment with tenants") - public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMember() throws JsonToModelConversionException, Exception - { - UserModel inexistentUser = new UserModel("inexistent user", "inexistent password"); - restClient.authenticateUser(inexistentUser); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Manager role doesn't get a site member of inexistent site and status code is Not Found (404)") - public void getSiteMemberOfInexistentSite() throws Exception - { - SiteModel invalidSite = new SiteModel("invalidSite"); - - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); - restClient.withCoreAPI().usingSite(invalidSite).getSiteMember(consumer); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, consumer.getUsername(), invalidSite.getId())); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Manager role doesn't get non site member of inexistent site and status code is Not Found (404)") - public void getSiteMemberForNonSiteMember() throws Exception - { - UserModel nonMember = dataUser.createRandomTestUser(); - - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(nonMember); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, nonMember.getUsername(), publicSiteModel.getId())); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Manager role doesn't get not existing site member and status code is Not Found (404)") - public void getSiteMemberForInexistentSiteMember() throws Exception - { - UserModel inexistentUser = new UserModel("inexistentUser", "password"); - - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(inexistentUser); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername())); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Manager role can get site member using \"-me-\" in place of personId") - public void getSiteMemberUsingMeForPersonId() throws Exception - { - UserModel meUser = new UserModel("-me-", "password"); - - restClient.authenticateUser(manager); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(meUser) - .assertThat().field("id").is(manager.getUsername()) - .and().field("role").is(manager.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Manager role can get site member for empty siteId") - public void getSiteMemberForEmptySiteId() throws Exception - { - SiteModel emptySite = new SiteModel(""); - - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); - restClient.withCoreAPI().usingSite(emptySite).getSiteMember(consumer); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, consumer.getUsername(), emptySite.getId())); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Manager role gets site member with Manager role and status code is OK (200)") - public void getSiteManagerMemberWithManagerRole() throws Exception - { - UserModel anotherManager = dataUser.createRandomTestUser(); - dataUser.addUserToSite(anotherManager, publicSiteModel, UserRole.SiteManager); - - restClient.authenticateUser(manager); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(anotherManager) - .assertThat().field("id").is(anotherManager.getUsername()) - .and().field("role").is(anotherManager.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Collaborator role gets site member with Manager role and status code is OK (200)") - public void getSiteManagerMemberWithCollaboratorRole() throws Exception - { - restClient.authenticateUser(collaborator); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(manager) - .assertThat().field("id").is(manager.getUsername()) - .and().field("role").is(manager.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Consumer role gets site member with Manager role and status code is OK (200)") - public void getSiteManagerMemberWithConsumerRole() throws Exception - { - restClient.authenticateUser(consumer); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(manager) - .assertThat().field("id").is(manager.getUsername()) - .and().field("role").is(manager.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Contributor role gets site member with Manager role and status code is OK (200)") - public void getSiteManagerMemberWithContributorRole() throws Exception - { - restClient.authenticateUser(contributor); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(manager) - .assertThat().field("id").is(manager.getUsername()) - .and().field("role").is(manager.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Contributor role gets admin site member and status code is OK (200)") - public void getSiteAdminManagerMember() throws Exception - { - restClient.authenticateUser(contributor); - restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(adminUser) - .assertThat().field("id").is(adminUser.getUsername()) - .and().field("role").is(UserRole.SiteManager); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Collaborator role gets site member with Contributor role and status code is OK (200)") - public void getSiteContributorMemberWithCollaboratorRole() throws Exception - { - restClient.authenticateUser(collaborator).withCoreAPI().usingSite(publicSiteModel).getSiteMember(contributor) - .assertThat().field("id").is(contributor.getUsername()) - .and().field("role").is(contributor.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Contributor role gets site member with Collaborator role and status code is OK (200)") - public void getSiteCollaboratorMemberWithContributorRole() throws Exception - { - restClient.authenticateUser(contributor).withCoreAPI().usingSite(publicSiteModel).getSiteMember(collaborator) - .assertThat().field("id").is(collaborator.getUsername()) - .and().field("role").is(collaborator.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Collaborator role gets admin role and status code is OK (200)") - public void getAdminWithCollaboratorRole() throws Exception - { - restClient.authenticateUser(collaborator).withCoreAPI().usingSite(publicSiteModel).getSiteMember(adminUser) - .assertThat().field("id").is(adminUser.getUsername()) - .and().field("role").is(UserRole.SiteManager); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Collaborator role gets site member with Consumer role and status code is OK (200)") - public void getSiteConsumerMemberWithCollaboratorRole() throws Exception - { - restClient.authenticateUser(collaborator).withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) - .assertThat().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user gets site member of private site and status code is OK (200)") - public void getSiteMemberOfPrivateSite() throws Exception - { - restClient.authenticateUser(manager).withCoreAPI().usingSite(privateSiteModel).getSiteMember(consumer) - .assertThat().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify not joined user is not is not able to get site member of private site and status code is 404") - public void regularUserIsNotAbleToGetSiteMemberOfPrivateSite() throws Exception { - UserModel regularUser = dataUser.createRandomTestUser(); - - restClient.authenticateUser(regularUser).withCoreAPI().usingSite(privateSiteModel).getSiteMember(consumer); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() - .containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, consumer.getUsername(), privateSiteModel.getTitle())); - } - - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify admin is not able to get from site a user that created a member request that was not accepted yet") - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - public void adminIsNotAbleToGetFromSiteANonExistingMember() throws Exception - { - UserModel newMember = dataUser.createRandomTestUser(); - restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSiteModel); - - restClient.authenticateUser(adminUser).withCoreAPI().usingSite(moderatedSiteModel).getSiteMember(newMember); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() - .containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), moderatedSiteModel.getTitle())) - .containsErrorKey(RestErrorModel.RELATIONSHIP_NOT_FOUND_ERRORKEY) - .descriptionURLIs(RestErrorModel.RESTAPIEXPLORER) - .stackTraceIs(RestErrorModel.STACKTRACE); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user gets site creator and status code is OK (200)") - public void getSiteCreator() throws Exception - { - SiteModel newSiteModel = dataSite.usingUser(collaborator).createModeratedRandomSite(); - dataUser.addUserToSite(consumer, publicSiteModel, UserRole.SiteConsumer); - - restClient.authenticateUser(consumer).withCoreAPI().usingSite(newSiteModel).getSiteMember(collaborator) - .assertThat().field("id").is(collaborator.getUsername()) - .and().field("role").is(UserRole.SiteManager); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Consumer role can get site member using \"-me-\" in place of personId") - public void getSiteMemberOfPrivateSiteUsingMeForPersonId() throws Exception - { - UserModel meUser = new UserModel("-me-", "password"); - - restClient.authenticateUser(consumer).withCoreAPI().usingSite(privateSiteModel).getSiteMember(meUser) - .assertThat().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user gets site member of moderated site and status code is OK (200)") - public void getSiteMemberOfModeratedSite() throws Exception - { - restClient.authenticateUser(manager).withCoreAPI().usingSite(moderatedSiteModel).getSiteMember(consumer) - .assertThat().field("id").is(consumer.getUsername()) - .and().field("role").is(consumer.getUserRole()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify not joined user gets site member of moderated site and status code is OK (200)") - public void regularUserIsAbleToGetSiteMemberOfModeratedSite() throws Exception - { - UserModel regularUser = dataUser.createRandomTestUser(); - - restClient.authenticateUser(regularUser).withCoreAPI().usingSite(moderatedSiteModel).getSiteMember(consumer); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if get site member request with properties parameter returns status code 200 and parameter is applied") - public void getSiteMemberUsingPropertiesParameter() throws Exception - { - restClient.authenticateUser(manager) - .withCoreAPI().usingSite(publicSiteModel).usingParams("properties=id").getSiteMember(consumer) - .assertThat().fieldsCount().is(1) - .and().field("id").isNotEmpty() - .and().field("role").isNull() - .and().field("person").isNull(); - restClient.assertStatusCodeIs(HttpStatus.OK); - } -} +package org.alfresco.rest.sites.members; + +import org.alfresco.rest.RestTest; +import org.alfresco.rest.exception.JsonToModelConversionException; +import org.alfresco.rest.model.RestErrorModel; +import org.alfresco.utility.constants.UserRole; +import org.alfresco.utility.data.DataUser.ListUserWithRoles; +import org.alfresco.utility.exception.DataPreparationException; +import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.TestGroup; +import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.testrail.ExecutionType; +import org.alfresco.utility.testrail.annotation.TestRail; +import org.springframework.http.HttpStatus; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * @author iulia.cojocea + */ +public class GetSiteMemberTests extends RestTest +{ + private UserModel adminUser; + private SiteModel publicSiteModel, moderatedSiteModel, privateSiteModel; + private ListUserWithRoles usersWithRoles; + private UserModel manager, consumer, collaborator, contributor; + + @BeforeClass(alwaysRun = true) + public void dataPreparation() throws DataPreparationException + { + adminUser = dataUser.getAdminUser(); + publicSiteModel = dataSite.usingUser(adminUser).createPublicRandomSite(); + moderatedSiteModel = dataSite.usingUser(adminUser).createModeratedRandomSite(); + privateSiteModel = dataSite.usingUser(adminUser).createPrivateRandomSite(); + usersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, + UserRole.SiteContributor); + + consumer = dataUser.createRandomTestUser(); + manager = usersWithRoles.getOneUserWithRole(UserRole.SiteManager); + collaborator = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator); + contributor = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor); + + dataUser.addUserToSite(consumer, publicSiteModel, UserRole.SiteConsumer); + dataUser.addUserToSite(consumer, moderatedSiteModel, UserRole.SiteConsumer); + dataUser.addUserToSite(manager, moderatedSiteModel, UserRole.SiteManager); + dataUser.addUserToSite(consumer, privateSiteModel, UserRole.SiteConsumer); + dataUser.addUserToSite(manager, privateSiteModel, UserRole.SiteManager); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, + description = "Verify user with Manager role gets site member and status code is OK (200)") + public void getSiteMemberWithManagerRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) + .assertThat().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Collaborator role gets site member and gets status code OK (200)") + public void getSiteMemberWithCollaboratorRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) + .and().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Contributor role gets site member and gets status code OK (200)") + public void getSiteMemberWithContributorRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) + .and().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Consumer role gets site member and gets status code OK (200)") + public void getSiteMemberWithConsumerRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) + .and().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with admin user gets site member and gets status code OK (200)") + public void getSiteMemberWithAdminUser() throws Exception + { + restClient.authenticateUser(adminUser); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) + .and().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, + description = "Failed authentication get site member call returns status code 401") +// @Bug(id="MNT-16904", description = "It fails only on environment with tenants") + public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMember() throws JsonToModelConversionException, Exception + { + UserModel inexistentUser = new UserModel("inexistent user", "inexistent password"); + restClient.authenticateUser(inexistentUser); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Manager role doesn't get a site member of inexistent site and status code is Not Found (404)") + public void getSiteMemberOfInexistentSite() throws Exception + { + SiteModel invalidSite = new SiteModel("invalidSite"); + + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); + restClient.withCoreAPI().usingSite(invalidSite).getSiteMember(consumer); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, consumer.getUsername(), invalidSite.getId())); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Manager role doesn't get non site member of inexistent site and status code is Not Found (404)") + public void getSiteMemberForNonSiteMember() throws Exception + { + UserModel nonMember = dataUser.createRandomTestUser(); + + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(nonMember); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, nonMember.getUsername(), publicSiteModel.getId())); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Manager role doesn't get not existing site member and status code is Not Found (404)") + public void getSiteMemberForInexistentSiteMember() throws Exception + { + UserModel inexistentUser = new UserModel("inexistentUser", "password"); + + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(inexistentUser); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentUser.getUsername())); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Manager role can get site member using \"-me-\" in place of personId") + public void getSiteMemberUsingMeForPersonId() throws Exception + { + UserModel meUser = new UserModel("-me-", "password"); + + restClient.authenticateUser(manager); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(meUser) + .assertThat().field("id").is(manager.getUsername()) + .and().field("role").is(manager.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Manager role can get site member for empty siteId") + public void getSiteMemberForEmptySiteId() throws Exception + { + SiteModel emptySite = new SiteModel(""); + + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); + restClient.withCoreAPI().usingSite(emptySite).getSiteMember(consumer); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, consumer.getUsername(), emptySite.getId())); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Manager role gets site member with Manager role and status code is OK (200)") + public void getSiteManagerMemberWithManagerRole() throws Exception + { + UserModel anotherManager = dataUser.createRandomTestUser(); + dataUser.addUserToSite(anotherManager, publicSiteModel, UserRole.SiteManager); + + restClient.authenticateUser(manager); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(anotherManager) + .assertThat().field("id").is(anotherManager.getUsername()) + .and().field("role").is(anotherManager.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Collaborator role gets site member with Manager role and status code is OK (200)") + public void getSiteManagerMemberWithCollaboratorRole() throws Exception + { + restClient.authenticateUser(collaborator); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(manager) + .assertThat().field("id").is(manager.getUsername()) + .and().field("role").is(manager.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Consumer role gets site member with Manager role and status code is OK (200)") + public void getSiteManagerMemberWithConsumerRole() throws Exception + { + restClient.authenticateUser(consumer); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(manager) + .assertThat().field("id").is(manager.getUsername()) + .and().field("role").is(manager.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Contributor role gets site member with Manager role and status code is OK (200)") + public void getSiteManagerMemberWithContributorRole() throws Exception + { + restClient.authenticateUser(contributor); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(manager) + .assertThat().field("id").is(manager.getUsername()) + .and().field("role").is(manager.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Contributor role gets admin site member and status code is OK (200)") + public void getSiteAdminManagerMember() throws Exception + { + restClient.authenticateUser(contributor); + restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMember(adminUser) + .assertThat().field("id").is(adminUser.getUsername()) + .and().field("role").is(UserRole.SiteManager); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Collaborator role gets site member with Contributor role and status code is OK (200)") + public void getSiteContributorMemberWithCollaboratorRole() throws Exception + { + restClient.authenticateUser(collaborator).withCoreAPI().usingSite(publicSiteModel).getSiteMember(contributor) + .assertThat().field("id").is(contributor.getUsername()) + .and().field("role").is(contributor.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Contributor role gets site member with Collaborator role and status code is OK (200)") + public void getSiteCollaboratorMemberWithContributorRole() throws Exception + { + restClient.authenticateUser(contributor).withCoreAPI().usingSite(publicSiteModel).getSiteMember(collaborator) + .assertThat().field("id").is(collaborator.getUsername()) + .and().field("role").is(collaborator.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Collaborator role gets admin role and status code is OK (200)") + public void getAdminWithCollaboratorRole() throws Exception + { + restClient.authenticateUser(collaborator).withCoreAPI().usingSite(publicSiteModel).getSiteMember(adminUser) + .assertThat().field("id").is(adminUser.getUsername()) + .and().field("role").is(UserRole.SiteManager); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Collaborator role gets site member with Consumer role and status code is OK (200)") + public void getSiteConsumerMemberWithCollaboratorRole() throws Exception + { + restClient.authenticateUser(collaborator).withCoreAPI().usingSite(publicSiteModel).getSiteMember(consumer) + .assertThat().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user gets site member of private site and status code is OK (200)") + public void getSiteMemberOfPrivateSite() throws Exception + { + restClient.authenticateUser(manager).withCoreAPI().usingSite(privateSiteModel).getSiteMember(consumer) + .assertThat().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify not joined user is not is not able to get site member of private site and status code is 404") + public void regularUserIsNotAbleToGetSiteMemberOfPrivateSite() throws Exception { + UserModel regularUser = dataUser.createRandomTestUser(); + + restClient.authenticateUser(regularUser).withCoreAPI().usingSite(privateSiteModel).getSiteMember(consumer); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() + .containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, consumer.getUsername(), privateSiteModel.getTitle())); + } + + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify admin is not able to get from site a user that created a member request that was not accepted yet") + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + public void adminIsNotAbleToGetFromSiteANonExistingMember() throws Exception + { + UserModel newMember = dataUser.createRandomTestUser(); + restClient.authenticateUser(newMember).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSiteModel); + + restClient.authenticateUser(adminUser).withCoreAPI().usingSite(moderatedSiteModel).getSiteMember(newMember); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() + .containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, newMember.getUsername(), moderatedSiteModel.getTitle())) + .containsErrorKey(RestErrorModel.RELATIONSHIP_NOT_FOUND_ERRORKEY) + .descriptionURLIs(RestErrorModel.RESTAPIEXPLORER) + .stackTraceIs(RestErrorModel.STACKTRACE); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user gets site creator and status code is OK (200)") + public void getSiteCreator() throws Exception + { + SiteModel newSiteModel = dataSite.usingUser(collaborator).createModeratedRandomSite(); + dataUser.addUserToSite(consumer, publicSiteModel, UserRole.SiteConsumer); + + restClient.authenticateUser(consumer).withCoreAPI().usingSite(newSiteModel).getSiteMember(collaborator) + .assertThat().field("id").is(collaborator.getUsername()) + .and().field("role").is(UserRole.SiteManager); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Consumer role can get site member using \"-me-\" in place of personId") + public void getSiteMemberOfPrivateSiteUsingMeForPersonId() throws Exception + { + UserModel meUser = new UserModel("-me-", "password"); + + restClient.authenticateUser(consumer).withCoreAPI().usingSite(privateSiteModel).getSiteMember(meUser) + .assertThat().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user gets site member of moderated site and status code is OK (200)") + public void getSiteMemberOfModeratedSite() throws Exception + { + restClient.authenticateUser(manager).withCoreAPI().usingSite(moderatedSiteModel).getSiteMember(consumer) + .assertThat().field("id").is(consumer.getUsername()) + .and().field("role").is(consumer.getUserRole()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify not joined user gets site member of moderated site and status code is OK (200)") + public void regularUserIsAbleToGetSiteMemberOfModeratedSite() throws Exception + { + UserModel regularUser = dataUser.createRandomTestUser(); + + restClient.authenticateUser(regularUser).withCoreAPI().usingSite(moderatedSiteModel).getSiteMember(consumer); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if get site member request with properties parameter returns status code 200 and parameter is applied") + public void getSiteMemberUsingPropertiesParameter() throws Exception + { + restClient.authenticateUser(manager) + .withCoreAPI().usingSite(publicSiteModel).usingParams("properties=id").getSiteMember(consumer) + .assertThat().fieldsCount().is(1) + .and().field("id").isNotEmpty() + .and().field("role").isNull() + .and().field("person").isNull(); + restClient.assertStatusCodeIs(HttpStatus.OK); + } +} diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMembersTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMembersTests.java index 14353694f5..11b749793a 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMembersTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/sites/members/GetSiteMembersTests.java @@ -1,354 +1,354 @@ -package org.alfresco.rest.sites.members; - -import org.alfresco.rest.RestTest; -import org.alfresco.rest.model.RestErrorModel; -import org.alfresco.rest.model.RestSiteMemberModel; -import org.alfresco.rest.model.RestSiteMemberModelsCollection; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.data.DataUser.ListUserWithRoles; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.TestGroup; -import org.alfresco.utility.model.UserModel; -import org.alfresco.utility.testrail.ExecutionType; -import org.alfresco.utility.testrail.annotation.TestRail; -import org.springframework.http.HttpStatus; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author iulia.cojocea - */ -public class GetSiteMembersTests extends RestTest -{ - private SiteModel publicSite, privateSite, moderatedSite, moderatedSite2, moderatedSite3; - private RestSiteMemberModelsCollection siteMembers; - private ListUserWithRoles usersWithRoles, moderatedSiteUsers; - private UserModel regularUser, privateSiteConsumer, siteCreator; - private RestSiteMemberModel firstSiteMember, secondSiteMember, thirdSiteMember, fourthSiteMember; - - @BeforeClass(alwaysRun=true) - public void dataPreparation() throws Exception - { - siteCreator = dataUser.createRandomTestUser(); - regularUser = dataUser.createRandomTestUser(); - privateSiteConsumer = dataUser.createRandomTestUser(); - - publicSite = dataSite.usingUser(siteCreator).createPublicRandomSite(); - privateSite = dataSite.usingUser(siteCreator).createPrivateRandomSite(); - moderatedSite = dataSite.usingUser(siteCreator).createModeratedRandomSite(); - moderatedSite2 = dataSite.usingUser(siteCreator).createModeratedRandomSite(); - moderatedSite3 = dataSite.usingUser(siteCreator).createModeratedRandomSite(); - - dataUser.addUserToSite(privateSiteConsumer, privateSite, UserRole.SiteConsumer); - dataUser.addUserToSite(privateSiteConsumer, moderatedSite3, UserRole.SiteConsumer); - usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor); - moderatedSiteUsers = dataUser.addUsersWithRolesToSite(moderatedSite, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor); - - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite).usingParams("properties=role,id").getSiteMembers(); - firstSiteMember = siteMembers.getEntries().get(0).onModel(); - secondSiteMember = siteMembers.getEntries().get(1).onModel(); - thirdSiteMember = siteMembers.getEntries().get(2).onModel(); - fourthSiteMember = siteMembers.getEntries().get(3).onModel(); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, - description = "Verify user with Manager role gets site members and gets status code OK (200)") - public void getSiteMembersWithManagerRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)) - .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername()) - .and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUserRole().toString()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Collaborator role gets site members and gets status code OK (200)") - public void getSiteMembersWithCollaboratorRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)) - .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty().assertThat() - .entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()).and() - .entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUserRole().toString()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Contributor role gets site members and gets status code OK (200)") - public void getSiteMembersWithContributorRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)) - .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUsername()) - .and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUserRole().toString()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with Consumer role gets site members and gets status code OK (200)") - public void getSiteMembersWithConsumerRole() throws Exception - { - restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)) - .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUsername()) - .and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUserRole().toString()); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, - description = "Verify user with admin usere gets site members and gets status code OK (200)") - public void getSiteMembersWithAdminUser() throws Exception - { - restClient.authenticateUser(dataUser.getAdminUser()) - .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() - .and().entriesListContains("id", siteCreator.getUsername()) - .when().assertThat().entriesListContains("role", "SiteManager"); - restClient.assertStatusCodeIs(HttpStatus.OK); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) - @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, - description = "Failed authentication get site members call returns status code 401") -// @Bug(id="MNT-16904", description = "It fails only on environment with tenants") - public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMembers() throws Exception - { - UserModel userModel = dataUser.createRandomTestUser(); - userModel.setPassword("user wrong password"); - dataUser.addUserToSite(userModel, publicSite, UserRole.SiteManager); - restClient.authenticateUser(userModel) - .withCoreAPI().usingSite(publicSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify get site members call returns status code 404 if siteId does not exist") - public void checkStatusCodeForNonExistentSiteId() throws Exception - { - restClient.authenticateUser(regularUser).withCoreAPI() - .usingSite("NonExistentSiteId").getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "NonExistentSiteId")); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify get site members call returns status code 400 for invalid maxItems") - public void checkStatusCodeForInvalidMaxItems() throws Exception - { - restClient.authenticateUser(regularUser).withParams("maxItems=0") - .withCoreAPI().usingSite(publicSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) - .assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS) - .containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS) - .descriptionURLIs(RestErrorModel.RESTAPIEXPLORER) - .stackTraceIs(RestErrorModel.STACKTRACE); - - restClient.withParams("maxItems=A") - .withCoreAPI().usingSite(publicSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) - .assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "A")); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify get site members call returns status code 400 for invalid skipCount ") - public void checkStatusCodeForInvalidSkipCount() throws Exception - { - restClient.authenticateUser(regularUser).withParams("skipCount=A") - .withCoreAPI().usingSite(publicSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) - .assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "A")); - - restClient.withParams("skipCount=-1") - .withCoreAPI().usingSite(publicSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) - .assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets public site members and status code is 200") - public void getPublicSiteMembers() throws Exception - { - siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() - .usingSite(publicSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUsername()) - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUsername()) - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) - .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername()) - .and().paginationField("count").is("5"); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets moderated site members and status code is 200") - public void getModeratedSiteMembers() throws Exception - { - siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() - .usingSite(moderatedSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) - .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) - .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteContributor).getUsername()) - .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteConsumer).getUsername()) - .and().paginationField("count").is("4"); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if user gets private site members if he is a member of that site and status code is 200") - public void getPrivateSiteMembersByASiteMember() throws Exception - { - siteMembers = restClient.authenticateUser(privateSiteConsumer).withCoreAPI() - .usingSite(privateSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) - .and().entriesListContains("id", privateSiteConsumer.getUsername()) - .and().paginationField("count").is("2"); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if user doesn't get private site members if he is not a member of that site and status code is 404") - public void getPrivateSiteMembersByNotASiteMember() throws Exception - { - restClient.authenticateUser(regularUser).withCoreAPI() - .usingSite(privateSite).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) - .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, privateSite.getTitle())); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if user gets moderated site members after the adding of a new member and status code is 200") - public void getSiteMembersAfterAddingNewMember() throws Exception - { - siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() - .usingSite(moderatedSite2).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) - .and().paginationField("count").is("1"); - - restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite2).addPerson(privateSiteConsumer); - - siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() - .usingSite(moderatedSite2).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) - .and().entriesListContains("id", privateSiteConsumer.getUsername()) - .and().paginationField("count").is("2"); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets moderated site members with properties parameter applied and status code is 200") - public void getModeratedSiteMembersUsingPropertiesParameter() throws Exception - { - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite).usingParams("properties=role,id").getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListCountIs(4) - .and().entriesListDoesNotContain("person") - .and().entriesListContains("role", UserRole.SiteManager.toString()) - .and().entriesListContains("id", siteCreator.getUsername()) - .and().entriesListContains("role", UserRole.SiteContributor.toString()) - .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteContributor).getUsername()) - .and().entriesListContains("role", UserRole.SiteCollaborator.toString()) - .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) - .and().entriesListContains("role", UserRole.SiteConsumer.toString()) - .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteConsumer).getUsername()); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets moderated site members with skipCount parameter applied") - public void getModeratedSiteMembersUsingSkipCountParameter() throws Exception - { - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite).usingParams("skipCount=2").getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().paginationField("count").is("2"); - siteMembers.assertThat().paginationField("skipCount").is("2"); - siteMembers.assertThat().entriesListDoesNotContain("id", firstSiteMember.getId()) - .and().entriesListDoesNotContain("id", secondSiteMember.getId()) - .and().entriesListContains("role", thirdSiteMember.getRole().toString()) - .and().entriesListContains("id", thirdSiteMember.getId()) - .and().entriesListContains("role", fourthSiteMember.getRole().toString()) - .and().entriesListContains("id", fourthSiteMember.getId()); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets moderated site members with high skipCount parameter applied") - public void getModeratedSiteMembersUsingHighSkipCountParameter() throws Exception - { - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite).usingParams("skipCount=100").getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().paginationField("count").is("0"); - siteMembers.assertThat().paginationField("skipCount").is("100"); - siteMembers.assertThat().entriesListIsEmpty(); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets moderated site members with maxItems parameter applied and check all pagination fields") - public void getModeratedSiteMembersUsingMaxItemsParameter() throws Exception - { - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite).usingParams("maxItems=1").getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().paginationField("count").is("1"); - siteMembers.assertThat().paginationField("hasMoreItems").is("true"); - siteMembers.assertThat().paginationField("maxItems").is("1"); - siteMembers.assertThat().paginationField("totalItems").isNotPresent(); - siteMembers.assertThat().entriesListContains("id", firstSiteMember.getId()) - .and().entriesListContains("role", firstSiteMember.getRole().toString()) - .and().entriesListDoesNotContain("id", secondSiteMember.getId()) - .and().entriesListDoesNotContain("id", thirdSiteMember.getId()); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if user gets moderated site members with member not joined yet and status code is 200") - public void getSiteMembersFromNotJoinedModeratedSite() throws Exception - { - UserModel userNotJoined = dataUser.createRandomTestUser(); - restClient.authenticateUser(userNotJoined).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite2); - restClient.assertStatusCodeIs(HttpStatus.CREATED); - - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite2).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) - .and().entriesListDoesNotContain("id", userNotJoined.getUsername()); - } - - @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) - @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, - description= "Verify if any user gets site members after the member was removed from site and status code is 200") - public void getSiteMembersAfterRemovingASiteMember() throws Exception - { - siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() - .usingSite(moderatedSite3).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListCountIs(2); - - restClient.withCoreAPI().usingSite(moderatedSite3).deleteSiteMember(privateSiteConsumer); - - siteMembers = restClient.withCoreAPI().usingSite(moderatedSite3).getSiteMembers(); - restClient.assertStatusCodeIs(HttpStatus.OK); - siteMembers.assertThat().entriesListCountIs(1) - .and().entriesListContains("role", UserRole.SiteManager.toString()) - .and().entriesListContains("id", siteCreator.getUsername()); - } -} +package org.alfresco.rest.sites.members; + +import org.alfresco.rest.RestTest; +import org.alfresco.rest.model.RestErrorModel; +import org.alfresco.rest.model.RestSiteMemberModel; +import org.alfresco.rest.model.RestSiteMemberModelsCollection; +import org.alfresco.utility.constants.UserRole; +import org.alfresco.utility.data.DataUser.ListUserWithRoles; +import org.alfresco.utility.model.SiteModel; +import org.alfresco.utility.model.TestGroup; +import org.alfresco.utility.model.UserModel; +import org.alfresco.utility.testrail.ExecutionType; +import org.alfresco.utility.testrail.annotation.TestRail; +import org.springframework.http.HttpStatus; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * @author iulia.cojocea + */ +public class GetSiteMembersTests extends RestTest +{ + private SiteModel publicSite, privateSite, moderatedSite, moderatedSite2, moderatedSite3; + private RestSiteMemberModelsCollection siteMembers; + private ListUserWithRoles usersWithRoles, moderatedSiteUsers; + private UserModel regularUser, privateSiteConsumer, siteCreator; + private RestSiteMemberModel firstSiteMember, secondSiteMember, thirdSiteMember, fourthSiteMember; + + @BeforeClass(alwaysRun=true) + public void dataPreparation() throws Exception + { + siteCreator = dataUser.createRandomTestUser(); + regularUser = dataUser.createRandomTestUser(); + privateSiteConsumer = dataUser.createRandomTestUser(); + + publicSite = dataSite.usingUser(siteCreator).createPublicRandomSite(); + privateSite = dataSite.usingUser(siteCreator).createPrivateRandomSite(); + moderatedSite = dataSite.usingUser(siteCreator).createModeratedRandomSite(); + moderatedSite2 = dataSite.usingUser(siteCreator).createModeratedRandomSite(); + moderatedSite3 = dataSite.usingUser(siteCreator).createModeratedRandomSite(); + + dataUser.addUserToSite(privateSiteConsumer, privateSite, UserRole.SiteConsumer); + dataUser.addUserToSite(privateSiteConsumer, moderatedSite3, UserRole.SiteConsumer); + usersWithRoles = dataUser.addUsersWithRolesToSite(publicSite,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor); + moderatedSiteUsers = dataUser.addUsersWithRolesToSite(moderatedSite, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor); + + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite).usingParams("properties=role,id").getSiteMembers(); + firstSiteMember = siteMembers.getEntries().get(0).onModel(); + secondSiteMember = siteMembers.getEntries().get(1).onModel(); + thirdSiteMember = siteMembers.getEntries().get(2).onModel(); + fourthSiteMember = siteMembers.getEntries().get(3).onModel(); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, + description = "Verify user with Manager role gets site members and gets status code OK (200)") + public void getSiteMembersWithManagerRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)) + .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername()) + .and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUserRole().toString()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Collaborator role gets site members and gets status code OK (200)") + public void getSiteMembersWithCollaboratorRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)) + .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty().assertThat() + .entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()).and() + .entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUserRole().toString()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Contributor role gets site members and gets status code OK (200)") + public void getSiteMembersWithContributorRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)) + .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUsername()) + .and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUserRole().toString()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with Consumer role gets site members and gets status code OK (200)") + public void getSiteMembersWithConsumerRole() throws Exception + { + restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)) + .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUsername()) + .and().entriesListContains("role", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUserRole().toString()); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, + description = "Verify user with admin usere gets site members and gets status code OK (200)") + public void getSiteMembersWithAdminUser() throws Exception + { + restClient.authenticateUser(dataUser.getAdminUser()) + .withCoreAPI().usingSite(publicSite).getSiteMembers().assertThat().entriesListIsNotEmpty() + .and().entriesListContains("id", siteCreator.getUsername()) + .when().assertThat().entriesListContains("role", "SiteManager"); + restClient.assertStatusCodeIs(HttpStatus.OK); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY }) + @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY, + description = "Failed authentication get site members call returns status code 401") +// @Bug(id="MNT-16904", description = "It fails only on environment with tenants") + public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteMembers() throws Exception + { + UserModel userModel = dataUser.createRandomTestUser(); + userModel.setPassword("user wrong password"); + dataUser.addUserToSite(userModel, publicSite, UserRole.SiteManager); + restClient.authenticateUser(userModel) + .withCoreAPI().usingSite(publicSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify get site members call returns status code 404 if siteId does not exist") + public void checkStatusCodeForNonExistentSiteId() throws Exception + { + restClient.authenticateUser(regularUser).withCoreAPI() + .usingSite("NonExistentSiteId").getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "NonExistentSiteId")); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify get site members call returns status code 400 for invalid maxItems") + public void checkStatusCodeForInvalidMaxItems() throws Exception + { + restClient.authenticateUser(regularUser).withParams("maxItems=0") + .withCoreAPI().usingSite(publicSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) + .assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS) + .containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS) + .descriptionURLIs(RestErrorModel.RESTAPIEXPLORER) + .stackTraceIs(RestErrorModel.STACKTRACE); + + restClient.withParams("maxItems=A") + .withCoreAPI().usingSite(publicSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) + .assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "A")); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify get site members call returns status code 400 for invalid skipCount ") + public void checkStatusCodeForInvalidSkipCount() throws Exception + { + restClient.authenticateUser(regularUser).withParams("skipCount=A") + .withCoreAPI().usingSite(publicSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) + .assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "A")); + + restClient.withParams("skipCount=-1") + .withCoreAPI().usingSite(publicSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST) + .assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets public site members and status code is 200") + public void getPublicSiteMembers() throws Exception + { + siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() + .usingSite(publicSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer).getUsername()) + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteContributor).getUsername()) + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) + .and().entriesListContains("id", usersWithRoles.getOneUserWithRole(UserRole.SiteManager).getUsername()) + .and().paginationField("count").is("5"); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets moderated site members and status code is 200") + public void getModeratedSiteMembers() throws Exception + { + siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() + .usingSite(moderatedSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) + .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) + .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteContributor).getUsername()) + .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteConsumer).getUsername()) + .and().paginationField("count").is("4"); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if user gets private site members if he is a member of that site and status code is 200") + public void getPrivateSiteMembersByASiteMember() throws Exception + { + siteMembers = restClient.authenticateUser(privateSiteConsumer).withCoreAPI() + .usingSite(privateSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) + .and().entriesListContains("id", privateSiteConsumer.getUsername()) + .and().paginationField("count").is("2"); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if user doesn't get private site members if he is not a member of that site and status code is 404") + public void getPrivateSiteMembersByNotASiteMember() throws Exception + { + restClient.authenticateUser(regularUser).withCoreAPI() + .usingSite(privateSite).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) + .assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, privateSite.getTitle())); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if user gets moderated site members after the adding of a new member and status code is 200") + public void getSiteMembersAfterAddingNewMember() throws Exception + { + siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() + .usingSite(moderatedSite2).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) + .and().paginationField("count").is("1"); + + restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite2).addPerson(privateSiteConsumer); + + siteMembers = restClient.authenticateUser(regularUser).withCoreAPI() + .usingSite(moderatedSite2).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) + .and().entriesListContains("id", privateSiteConsumer.getUsername()) + .and().paginationField("count").is("2"); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets moderated site members with properties parameter applied and status code is 200") + public void getModeratedSiteMembersUsingPropertiesParameter() throws Exception + { + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite).usingParams("properties=role,id").getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListCountIs(4) + .and().entriesListDoesNotContain("person") + .and().entriesListContains("role", UserRole.SiteManager.toString()) + .and().entriesListContains("id", siteCreator.getUsername()) + .and().entriesListContains("role", UserRole.SiteContributor.toString()) + .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteContributor).getUsername()) + .and().entriesListContains("role", UserRole.SiteCollaborator.toString()) + .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) + .and().entriesListContains("role", UserRole.SiteConsumer.toString()) + .and().entriesListContains("id", moderatedSiteUsers.getOneUserWithRole(UserRole.SiteConsumer).getUsername()); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets moderated site members with skipCount parameter applied") + public void getModeratedSiteMembersUsingSkipCountParameter() throws Exception + { + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite).usingParams("skipCount=2").getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().paginationField("count").is("2"); + siteMembers.assertThat().paginationField("skipCount").is("2"); + siteMembers.assertThat().entriesListDoesNotContain("id", firstSiteMember.getId()) + .and().entriesListDoesNotContain("id", secondSiteMember.getId()) + .and().entriesListContains("role", thirdSiteMember.getRole().toString()) + .and().entriesListContains("id", thirdSiteMember.getId()) + .and().entriesListContains("role", fourthSiteMember.getRole().toString()) + .and().entriesListContains("id", fourthSiteMember.getId()); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets moderated site members with high skipCount parameter applied") + public void getModeratedSiteMembersUsingHighSkipCountParameter() throws Exception + { + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite).usingParams("skipCount=100").getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().paginationField("count").is("0"); + siteMembers.assertThat().paginationField("skipCount").is("100"); + siteMembers.assertThat().entriesListIsEmpty(); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets moderated site members with maxItems parameter applied and check all pagination fields") + public void getModeratedSiteMembersUsingMaxItemsParameter() throws Exception + { + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite).usingParams("maxItems=1").getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().paginationField("count").is("1"); + siteMembers.assertThat().paginationField("hasMoreItems").is("true"); + siteMembers.assertThat().paginationField("maxItems").is("1"); + siteMembers.assertThat().paginationField("totalItems").isNotPresent(); + siteMembers.assertThat().entriesListContains("id", firstSiteMember.getId()) + .and().entriesListContains("role", firstSiteMember.getRole().toString()) + .and().entriesListDoesNotContain("id", secondSiteMember.getId()) + .and().entriesListDoesNotContain("id", thirdSiteMember.getId()); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if user gets moderated site members with member not joined yet and status code is 200") + public void getSiteMembersFromNotJoinedModeratedSite() throws Exception + { + UserModel userNotJoined = dataUser.createRandomTestUser(); + restClient.authenticateUser(userNotJoined).withCoreAPI().usingAuthUser().addSiteMembershipRequest(moderatedSite2); + restClient.assertStatusCodeIs(HttpStatus.CREATED); + + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite2).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListContains("id", siteCreator.getUsername()) + .and().entriesListDoesNotContain("id", userNotJoined.getUsername()); + } + + @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) + @TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION, + description= "Verify if any user gets site members after the member was removed from site and status code is 200") + public void getSiteMembersAfterRemovingASiteMember() throws Exception + { + siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI() + .usingSite(moderatedSite3).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListCountIs(2); + + restClient.withCoreAPI().usingSite(moderatedSite3).deleteSiteMember(privateSiteConsumer); + + siteMembers = restClient.withCoreAPI().usingSite(moderatedSite3).getSiteMembers(); + restClient.assertStatusCodeIs(HttpStatus.OK); + siteMembers.assertThat().entriesListCountIs(1) + .and().entriesListContains("role", UserRole.SiteManager.toString()) + .and().entriesListContains("id", siteCreator.getUsername()); + } +} diff --git a/packaging/tests/tas-webdav/pom.xml b/packaging/tests/tas-webdav/pom.xml index 1ff8428754..ee3d6993a7 100644 --- a/packaging/tests/tas-webdav/pom.xml +++ b/packaging/tests/tas-webdav/pom.xml @@ -2,16 +2,14 @@ 4.0.0 org.alfresco.tas - content-repository-community-webdav-test - content-repository-community-webdav-test - 6.2.2-SNAPSHOT + alfresco-community-repo-webdav-test + webdav test jar org.alfresco - content-repository-community-tas-tests-parent - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-tests + 7.183.300-TEST1-SNAPSHOT diff --git a/packaging/tests/tas-webdav/src/test/resources/alfresco-webdav-context.xml b/packaging/tests/tas-webdav/src/test/resources/alfresco-webdav-context.xml index f9e3b248ab..c7a280adfd 100644 --- a/packaging/tests/tas-webdav/src/test/resources/alfresco-webdav-context.xml +++ b/packaging/tests/tas-webdav/src/test/resources/alfresco-webdav-context.xml @@ -1,15 +1,14 @@ - - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/packaging/war/pom.xml b/packaging/war/pom.xml index 9e63711f4c..b2476850e2 100644 --- a/packaging/war/pom.xml +++ b/packaging/war/pom.xml @@ -6,26 +6,25 @@ org.alfresco - acs-community-packaging - 6.2.2-SNAPSHOT - ../pom.xml + alfresco-community-repo-packaging + 7.183.300-TEST1-SNAPSHOT local/development/workspace ${buildNumber} - - community org.alfresco alfresco-repository + ${project.version} org.alfresco alfresco-remote-api + ${project.version} org.alfresco @@ -80,18 +79,21 @@ org.alfresco alfresco-core + ${project.version} tests test org.alfresco alfresco-repository + ${project.version} tests test org.alfresco alfresco-remote-api + ${project.version} tests test @@ -269,7 +271,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 ${maven.build.sourceVersion} diff --git a/packaging/war/src/main/resources/alfresco/version.properties b/packaging/war/src/main/resources/alfresco/version.properties index 39f1117e9a..249ced4b9d 100644 --- a/packaging/war/src/main/resources/alfresco/version.properties +++ b/packaging/war/src/main/resources/alfresco/version.properties @@ -4,9 +4,9 @@ # Version label -version.major=@parsedVersion.majorVersion@ -version.minor=@parsedVersion.minorVersion@ -version.revision=@parsedVersion.incrementalVersion@ +version.major=@acs.version.major@ +version.minor=@acs.version.minor@ +version.revision=@acs.version.revision@ version.label= # Edition label diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..3819d439f0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,698 @@ + + + 4.0.0 + alfresco-community-repo + 7.183.300-TEST1-SNAPSHOT + pom + Alfresco Community Repo Parent + + + org.alfresco + alfresco-super-pom + 12 + + + + core + data-model + repository + remote-api + packaging + + + + 6 + 2 + 1 + + + Community + community + + local + latest + quay.io + + 11 + 11 + 11 + 11 + + ${project.build.directory}/alf_data + convert + + 1.0.12 + 6.0 + 1.1 + 2.3 + 7.1 + 6.0.1 + 1.2.15 + 0.2 + 5.23.0 + 5.23.0 + 1.0.2.8 + 6.2 + 6.2 + + 5.1.15.RELEASE + 3.5.2 + 2.10.2 + 2.10.1 + 3.3.5 + 1.0.0 + 2.0.19 + 7.14 + 1.64 + 3.2.4 + 20090211 + 1.4-DBCP330 + 28.2-jre + 2.6 + 2.8.5 + 4.5.11 + 4.4.13 + 3.1-HTTPCLIENT-1265 + 2.12.0-alfresco-patched-20191004 + 1.7.30 + 0.11.3 + 2.3.2 + 2.5.9 + 1.6.2 + 1.21-20190624-alfresco-patched + 5.1.9.RELEASE + 7.7.10 + 4.1.1 + 1.4 + 9.0.3 + 3.4.1.Final + 2.24.2 + 5.15.11 + 1.2.5 + + 3.2.0 + 1.3.1 + + 42.2.12 + 8.0.19 + 2.6.0 + + 3.0.20 + 3.3.0 + 1.1.4 + 1.33 + 1.13 + 1.8 + 1.6 + 1.5 + 2.3 + + + + scm:git:https://github.com/Alfresco/alfresco-community-repo.git + scm:git:https://github.com/Alfresco/alfresco-community-repo.git + https://github.com/Alfresco/alfresco-community-repo + HEAD + + + + + alfresco-public-snapshots + https://artifacts.alfresco.com/nexus/content/repositories/snapshots + + + alfresco-public + https://artifacts.alfresco.com/nexus/content/repositories/releases + + + + + + + org.alfresco + alfresco-jlan-embed + ${dependency.alfresco-jlan.version} + + + org.alfresco + alfresco-trashcan-cleaner + ${dependency.alfresco-trashcan-cleaner.version} + + + org.alfresco + alfresco-heartbeat-data-sender + ${dependency.alfresco-hb-data-sender.version} + + + xalan + xalan + 2.7.2-alfresco + + + org.alfresco.services + alfresco-messaging-repo + ${dependency.alfresco-messaging-repo.version} + + + org.alfresco + alfresco-mmt + ${dependency.alfresco-mmt.version} + + + org.alfresco + alfresco-pdf-renderer + ${dependency.alfresco-pdf-renderer.version} + linux + tgz + + + org.alfresco + alfresco-pdf-renderer + ${dependency.alfresco-pdf-renderer.version} + win64 + tgz + + + org.alfresco + alfresco-pdf-renderer + ${dependency.alfresco-pdf-renderer.version} + + + org.alfresco + alfresco-server-root + ${dependency.alfresco-server-root.version} + war + + + org.alfresco.surf + spring-surf-core-configservice + ${dependency.webscripts.version} + + + org.alfresco.surf + spring-webscripts + ${dependency.webscripts.version} + + + org.alfresco.surf + spring-webscripts + ${dependency.webscripts.version} + tests + test + + + org.alfresco.surf + spring-webscripts-api + ${dependency.webscripts.version} + + + org.quartz-scheduler + quartz + 2.3.2 + + + + + com.mchange + * + + + + + org.apache.httpcomponents + httpcore + ${dependency.httpcore.version} + + + commons-httpclient + commons-httpclient + ${dependency.commons-httpclient.version} + + + commons-logging + commons-logging + 1.2 + + + commons-beanutils + commons-beanutils + 1.9.4 + + + commons-codec + commons-codec + 1.14 + + + commons-io + commons-io + ${dependency.commons-io.version} + + + commons-collections + commons-collections + 3.2.2 + + + commons-digester + commons-digester + 2.1 + + + commons-lang + commons-lang + 2.6 + + + commons-fileupload + commons-fileupload + 1.4 + + + com.sun.xml.bind + jaxb-impl + ${dependency.jaxb.version} + + + org.apache.httpcomponents + httpclient + ${dependency.httpclient.version} + + + org.apache.httpcomponents + httpclient-cache + ${dependency.httpclient.version} + + + org.apache.xmlbeans + xmlbeans + 3.0.2 + + + org.json + json + ${dependency.org-json.version} + + + org.springframework + spring-aop + ${dependency.spring.version} + + + org.springframework + spring-beans + ${dependency.spring.version} + + + org.springframework + spring-context + ${dependency.spring.version} + + + org.springframework + spring-context-support + ${dependency.spring.version} + + + org.springframework + spring-core + ${dependency.spring.version} + + + + + org.springframework + spring-jcl + + + + + org.springframework + spring-expression + ${dependency.spring.version} + + + org.springframework + spring-jdbc + ${dependency.spring.version} + + + org.springframework + spring-jms + ${dependency.spring.version} + + + org.springframework + spring-test + ${dependency.spring.version} + test + + + org.springframework + spring-orm + ${dependency.spring.version} + + + + + org.springframework + spring-jcl + + + + + org.springframework + spring-tx + ${dependency.spring.version} + + + org.springframework + spring-web + ${dependency.spring.version} + + + org.springframework + spring-webmvc + ${dependency.spring.version} + + + com.fasterxml.jackson.core + jackson-core + ${dependency.jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${dependency.jackson-databind.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${dependency.jackson.version} + + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + ${dependency.jackson.version} + + + org.codehaus.woodstox + woodstox-core-asl + 4.4.1 + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${dependency.cxf.version} + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${dependency.cxf.version} + + + org.apache.cxf + cxf-rt-rs-client + ${dependency.cxf.version} + + + org.apache.cxf + cxf-rt-transports-http + ${dependency.cxf.version} + + + org.apache.cxf + cxf-rt-ws-policy + ${dependency.cxf.version} + + + + org.apache.commons + commons-email + 1.5 + + + org.alfresco + alfresco-log-sanitizer + ${dependency.alfresco-log-sanitizer.version} + + + org.alfresco.aos-module + alfresco-aos-module + ${alfresco.aos-module.version} + amp + + + org.alfresco.aos-module + alfresco-aos-module-distributionzip + ${alfresco.aos-module.version} + zip + + + org.alfresco.aos-module + alfresco-vti-bin + ${alfresco.aos-module.version} + war + + + org.alfresco.integrations + alfresco-googledrive-repo-community + ${alfresco.googledrive.version} + amp + + + + org.bouncycastle + bcprov-jdk15on + ${dependency.bouncycastle.version} + + + org.bouncycastle + bcmail-jdk15on + ${dependency.bouncycastle.version} + + + org.slf4j + slf4j-api + ${dependency.slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${dependency.slf4j.version} + + + xerces + xercesImpl + ${dependency.xercesImpl.version} + + + + com.drewnoakes + metadata-extractor + 2.11.0 + + + + com.github.junrar + junrar + 4.0.0 + + + + org.jsoup + jsoup + 1.12.2 + + + + com.google.guava + guava + ${dependency.guava.version} + + + + org.apache.commons + commons-compress + 1.19 + + + + org.apache.pdfbox + pdfbox + ${dependency.pdfbox.version} + + + org.apache.commons + commons-csv + 1.8 + + + + org.postgresql + postgresql + ${dependency.postgresql.version} + test + + + mysql + mysql-connector-java + ${dependency.mysql.version} + test + + + org.mariadb.jdbc + mariadb-java-client + ${dependency.mariadb.version} + test + + + + org.alfresco.tas + utility + ${dependency.tas-utility.version} + test + + + io.rest-assured + rest-assured + ${dependency.rest-assured.version} + test + + + org.glassfish + javax.json + ${dependency.javax.json.version} + test + + + org.alfresco.tas + restapi + ${dependency.tas-restapi.version} + test + + + org.alfresco.tas + cmis + ${dependency.tas-cmis.version} + test + + + org.alfresco.tas + email + ${dependency.tas-email.version} + test + + + org.alfresco.tas + webdav + ${dependency.tas-webdav.version} + test + + + org.alfresco.tas + ftp + ${dependency.tas-ftp.version} + test + + + org.alfresco.test + dataprep + ${dependency.tas-dataprep.version} + test + + + jakarta.transaction + jakarta.transaction-api + 1.3.3 + + + joda-time + joda-time + 2.10.5 + + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + + junit + junit + 4.13 + test + + + org.antlr + gunit + ${dependency.antlr.version} + test + + + org.mockito + mockito-core + ${dependency.mockito-core.version} + test + + + commons-dbcp + commons-dbcp + ${dependency.commons-dbcp.version} + + + com.google.code.gson + gson + ${dependency.gson.version} + + + + + + + + + + maven-release-plugin + 2.5.3 + + + @{project.version} + + + + io.fabric8 + fabric8-maven-plugin + 4.4.0 + + + maven-jar-plugin + 3.2.0 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.2 + + + + + + + diff --git a/remote-api/.gitbugtraq b/remote-api/.gitbugtraq deleted file mode 100644 index bacffb702d..0000000000 --- a/remote-api/.gitbugtraq +++ /dev/null @@ -1,4 +0,0 @@ -# For SmartGit -[bugtraq "jira"] - url = https://issues.alfresco.com/jira/browse/%BUGID% - logRegex = ([A-Z]+-\\d+) diff --git a/remote-api/.gitignore b/remote-api/.gitignore deleted file mode 100644 index 756a7325d2..0000000000 --- a/remote-api/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -*.class - -# Eclipse -.classpath -.settings -.project - -# Intellij -.idea/ -*.iml -*.iws - -# Mac -.DS_Store - -# Maven -target -*.log -*.log.* - -# Mobile Tools for Java (J2ME) - -.mtj -.tmp/ - -# Package Files # - -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml - -hs_err_pid* - -# Development -alf_data/ -/src/main/resources/alfresco-global.properties -/src/main/resources/alfresco/extension/custom-log4j.properties \ No newline at end of file diff --git a/remote-api/.travis.settings.xml b/remote-api/.travis.settings.xml deleted file mode 100644 index e8f1196935..0000000000 --- a/remote-api/.travis.settings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - alfresco-public - ${env.MAVEN_USERNAME} - ${env.MAVEN_PASSWORD} - - - diff --git a/remote-api/.travis.yml b/remote-api/.travis.yml deleted file mode 100644 index d00f0c84ea..0000000000 --- a/remote-api/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -dist: xenial -sudo: required -language: java -jdk: - - openjdk11 -services: - - docker - -cache: - directories: - - $HOME/.m2 -# the cache can grow constantly -before_cache: - - rm -rf $HOME/.m2/repository/org/alfresco/alfresco-remote-api - - rm -rf $HOME/.m2/repository/org/alfresco/alfresco-repository - -branches: - only: - - master - - /support\/.*/ - -stages: - - test - - release - -before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - -install: travis_retry mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V - -jobs: - include: - - stage: test - name: "WhiteSource scan" - # only on support branches or master and if it is not a PR - if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request - script: - # Download the latest version of WhiteSource Unified Agent - - curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar - # Run WhiteSource Unified Agent - - java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config - - name: "AppContext01TestSuite" - script: travis_wait 20 mvn test -B -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContext02TestSuite" - script: travis_wait 20 mvn test -B -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContext03TestSuite" - script: travis_wait 20 mvn test -B -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContext04TestSuite" - script: travis_wait 20 mvn test -B -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContextExtraTestSuite" - script: travis_wait 20 mvn test -B -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - stage: release - name: "Push to Nexus" - if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/ - before_install: - - "cp .travis.settings.xml $HOME/.m2/settings.xml" - script: - # Use full history for release - - git checkout -B "${TRAVIS_BRANCH}" - # Add email to link commits to user - - git config user.email "${GIT_EMAIL}" - # Skip building of release commits - - mvn --batch-mode -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform diff --git a/remote-api/.whitesource b/remote-api/.whitesource deleted file mode 100644 index f056952141..0000000000 --- a/remote-api/.whitesource +++ /dev/null @@ -1,8 +0,0 @@ -{ - "generalSettings": { - "shouldScanRepo": true - }, - "checkRunSettings": { - "vulnerableCheckRunConclusionLevel": "failure" - } -} \ No newline at end of file diff --git a/remote-api/.wss-unified-agent.config b/remote-api/.wss-unified-agent.config deleted file mode 100644 index 15c0b368aa..0000000000 --- a/remote-api/.wss-unified-agent.config +++ /dev/null @@ -1,228 +0,0 @@ -#################################################################### -# WhiteSource Unified-Agent configuration file -#################################################################### -########################################## -# GENERAL SCAN MODE: Files and Package Managers -########################################## - -checkPolicies=true -forceCheckAllDependencies=true -forceUpdate=true -forceUpdate.failBuildOnPolicyViolation=true -offline=false -#ignoreSourceFiles=true -#scanComment= -#updateInventory=false -#resolveAllDependencies=false -#failErrorLevel=ALL -#requireKnownSha1=false -#generateScanReport=true -#scanReportTimeoutMinutes=10 -#excludeDependenciesFromNodes=.*commons-io.*,.*maven-model - -#projectPerFolder=true -#projectPerFolderIncludes= -#projectPerFolderExcludes= - -#wss.connectionTimeoutMinutes=60 -# Change the below URL to your WhiteSource server. -# Use the 'WhiteSource Server URL' which can be retrieved -# from your 'Profile' page on the 'Server URLs' panel. -# Then, add the '/agent' path to it. -wss.url=https://saas.whitesourcesoftware.com/agent - -#npm.resolveDependencies=false -#npm.ignoreSourceFiles=false -#npm.includeDevDependencies=true -#npm.runPreStep=true -#npm.ignoreNpmLsErrors=true -#npm.ignoreScripts=true -#npm.yarnProject=true -#npm.accessToken= -#npm.identifyByNameAndVersion=true - -#bower.resolveDependencies=false -#bower.ignoreSourceFiles=true -#bower.runPreStep=true - -#nuget.resolvePackagesConfigFiles=false -#nuget.resolveCsProjFiles=false -#nuget.resolveDependencies=false -#nuget.restoreDependencies=true -#nuget.ignoreSourceFiles=true -#nuget.runPreStep=true -#nuget.resolveNuspecFiles=false - -#python.resolveDependencies=false -#python.ignoreSourceFiles=false -#python.ignorePipInstallErrors=true -#python.installVirtualenv=true -#python.resolveHierarchyTree=false -#python.requirementsFileIncludes=requirements.txt -#python.resolveSetupPyFiles=true -#python.runPipenvPreStep=true -#python.pipenvDevDependencies=true -#python.IgnorePipenvInstallErrors=true - -#maven.ignoredScopes=test provided -maven.resolveDependencies=true -#maven.ignoreSourceFiles=true -#maven.aggregateModules=true -maven.ignorePomModules=false -#maven.runPreStep=true -#maven.ignoreMvnTreeErrors=true -#maven.environmentPath= -#maven.m2RepositoryPath= - -#gradle.ignoredScopes= -#gradle.resolveDependencies=false -#gradle.runAssembleCommand=false -#gradle.runPreStep=true -#gradle.ignoreSourceFiles=true -#gradle.aggregateModules=true -#gradle.preferredEnvironment=wrapper -#gradle.localRepositoryPath= - -#paket.resolveDependencies=false -#paket.ignoredGroups= -#paket.ignoreSourceFiles=false -#paket.runPreStep=true -#paket.exePath= - -#go.resolveDependencies=false -#go.collectDependenciesAtRuntime=true -#go.dependencyManager= -#go.ignoreSourceFiles=true -#go.glide.ignoreTestPackages=false -#go.gogradle.enableTaskAlias=true - -#ruby.resolveDependencies = false -#ruby.ignoreSourceFiles = false -#ruby.installMissingGems = true -#ruby.runBundleInstall = true -#ruby.overwriteGemFile = true - -#sbt.resolveDependencies=false -#sbt.ignoreSourceFiles=true -#sbt.aggregateModules=true -#sbt.runPreStep=true -#sbt.targetFolder= - -#php.resolveDependencies=false -#php.runPreStep=true -#php.includeDevDependencies=true - -#html.resolveDependencies=false - -#cocoapods.resolveDependencies=false -#cocoapods.runPreStep=true -#cocoapods.ignoreSourceFiles=false - -#hex.resolveDependencies=false -#hex.runPreStep=true -#hex.ignoreSourceFiles=false -#hex.aggregateModules=true - -################################## -# Organization tokens: -################################## -apiKey= - -#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option -#userKey= - -projectName=alfresco-remote-api -projectVersion=7.N -projectToken= - -productName=ACS Community -productVersion= -productToken= -#updateType=APPEND -#requesterEmail=user@provider.com - -######################################################################################### -# Includes/Excludes Glob patterns - PLEASE USE ONLY ONE EXCLUDE LINE AND ONE INCLUDE LINE -######################################################################################### -#includes=**/*.c **/*.cc **/*.cp **/*.cpp **/*.cxx **/*.c++ **/*.h **/*.hpp **/*.hxx - -#includes=**/*.m **/*.mm **/*.js **/*.php -includes=**/*.jar -#includes=**/*.gem **/*.rb -#includes=**/*.dll **/*.cs **/*.nupkg -#includes=**/*.tgz **/*.deb **/*.gzip **/*.rpm **/*.tar.bz2 -#includes=**/*.zip **/*.tar.gz **/*.egg **/*.whl **/*.py - -## Exclude file extensions or specific directories by adding **/*. or **/** -excludes=**/*sources.jar **/*javadoc.jar - -case.sensitive.glob=false -followSymbolicLinks=true - -################################## -# Archive properties -################################## -#archiveExtractionDepth=2 -#archiveIncludes=**/*.war **/*.ear -#archiveExcludes=**/*sources.jar - -################################## -# Proxy settings -################################## -#proxy.host= -#proxy.port= -#proxy.user= -#proxy.pass= - -################################## -# SCM settings -################################## -#scm.type= -#scm.user= -#scm.pass= -#scm.ppk= -#scm.url= -#scm.branch= -#scm.tag= -#scm.npmInstall= -#scm.npmInstallTimeoutMinutes= -#scm.repositoriesFile= - -############################################## -# SCAN MODE: Linux package manager settings -############################################## -#scanPackageManager=true - -################################## -# SCAN MODE: Docker images -################################## -#docker.scanImages=true -#docker.includes=.*.* -#docker.excludes= -#docker.pull.enable=true -#docker.pull.images=.*.* -#docker.pull.maxImages=10 -#docker.pull.tags=.*.* -#docker.pull.digest= -#docker.delete.force=true -#docker.login.sudo=false - -#docker.aws.enable=true -#docker.aws.registryIds= - -################################## -# SCAN MODE: Docker containers -################################## -#docker.scanContainers=true -#docker.containerIncludes=.*.* -#docker.containerExcludes= - -################################ -# Serverless settings -################################ -#serverless.provider= -#serverless.scanFunctions=true -#serverless.includes= -#serverless.excludes= -#serverless.region= -#serverless.maxFunctions=10 diff --git a/remote-api/CONTRIBUTING.md b/remote-api/CONTRIBUTING.md deleted file mode 100644 index 8d059e27ca..0000000000 --- a/remote-api/CONTRIBUTING.md +++ /dev/null @@ -1,16 +0,0 @@ -### Contributing -Thanks for your interest in contributing to this project! - -The following is a set of guidelines for contributing to this library. Most of them will make the life of the reviewer easier and therefore decrease the time required for the patch be included in the next version. - -Because this project forms a part of Alfresco Content Services, the guidelines are hosted in the [Alfresco Social Community](http://community.alfresco.com/community/ecm) where they can be referenced from multiple projects. - -Read an [overview on how this project is goverened](https://community.alfresco.com/docs/DOC-6385-project-overview-repository). - -You can report an issue in the ALF project of the [Alfresco issue tracker](http://issues.alfresco.com). - -Read [instructions for a good issue report](https://community.alfresco.com/docs/DOC-6263-reporting-an-issue). - -Read [instructions for making a contribution](https://community.alfresco.com/docs/DOC-6269-submitting-contributions). - -Please follow [the coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards). diff --git a/remote-api/LICENSE b/remote-api/LICENSE deleted file mode 100644 index 65c5ca88a6..0000000000 --- a/remote-api/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/remote-api/pom.xml b/remote-api/pom.xml index f6d9c587bf..cc2459d189 100644 --- a/remote-api/pom.xml +++ b/remote-api/pom.xml @@ -2,126 +2,24 @@ 4.0.0 alfresco-remote-api Alfresco Remote API - 7.133.1-SNAPSHOT jar org.alfresco - alfresco-super-pom - 12 + alfresco-community-repo + 7.183.300-TEST1-SNAPSHOT - - scm:git:https://github.com/Alfresco/alfresco-remote-api.git - scm:git:https://github.com/Alfresco/alfresco-remote-api.git - https://github.com/Alfresco/alfresco-remote-api - HEAD - - - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/repositories/releases - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/repositories/snapshots - - - - - community - - 11 - - ${project.build.directory}/alf_data - convert - - 7.183.0 - 8.50.14 - 7.33 - - 1.1 - 2.10.2 - 2.10.1 - - 7.14 - 1.0.0 - 5.1.15.RELEASE - 42.2.12 - 3.3.5 - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-rs-client - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-transports-http - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-ws-policy - ${dependency.cxf.version} - - - - com.github.junrar - junrar - 4.0.0 - - - - org.jsoup - jsoup - 1.12.2 - - - - commons-httpclient - commons-httpclient - 3.1-HTTPCLIENT-1265 - - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${dependency.jackson.version} - - - commons-logging - commons-logging - 1.2 - - - - org.alfresco alfresco-repository - ${dependency.alfresco-repository.version} + ${project.version} org.alfresco alfresco-data-model - ${dependency.alfresco-data-model.version} + ${project.version} com.fasterxml.jackson.core @@ -198,14 +96,14 @@ org.alfresco alfresco-repository - ${dependency.alfresco-repository.version} + ${project.version} tests test org.alfresco alfresco-core - ${dependency.alfresco-core.version} + ${project.version} tests test @@ -238,14 +136,14 @@ org.eclipse.jetty jetty-webapp 8.2.0.v20160908 - test + test org.alfresco.cmis.client alfresco-opencmis-extension 2.0 - test - + test + diff --git a/repository/.gitbugtraq b/repository/.gitbugtraq deleted file mode 100644 index bacffb702d..0000000000 --- a/repository/.gitbugtraq +++ /dev/null @@ -1,4 +0,0 @@ -# For SmartGit -[bugtraq "jira"] - url = https://issues.alfresco.com/jira/browse/%BUGID% - logRegex = ([A-Z]+-\\d+) diff --git a/repository/.gitignore b/repository/.gitignore deleted file mode 100644 index 1578e425e0..0000000000 --- a/repository/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -*.class - -# Eclipse -.classpath -.settings -.project - -# Intellij -.idea/ -*.iml -*.iws - -#VSCode -/.vscode - -# Mac -.DS_Store - -# Maven -target -*.log -*.log.* - -# Mobile Tools for Java (J2ME) - -.mtj -.tmp/ - -# Package Files # - -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml - -hs_err_pid* -alf_data -/src/main/resources/alfresco-global.properties -/src/main/resources/alfresco/extension/custom-log4j.properties diff --git a/repository/.travis.settings.xml b/repository/.travis.settings.xml deleted file mode 100644 index 7eecd77df2..0000000000 --- a/repository/.travis.settings.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - alfresco-public - ${env.MAVEN_USERNAME} - ${env.MAVEN_PASSWORD} - - - quay.io - ${env.QUAY_USERNAME} - ${env.QUAY_PASSWORD} - - - diff --git a/repository/.travis.yml b/repository/.travis.yml deleted file mode 100644 index 90d25a222e..0000000000 --- a/repository/.travis.yml +++ /dev/null @@ -1,122 +0,0 @@ -dist: xenial -sudo: required -language: java -jdk: - - openjdk11 - -services: - - docker - -cache: - directories: - - $HOME/.m2 -# the cache can grow constantly -before_cache: - - rm -rf $HOME/.m2/repository/org/alfresco/alfresco-repository - -branches: - only: - - master - - /support\/.*/ - -stages: - - test - - release - -install: travis_retry mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V - -jobs: - include: - - stage: test - name: "AllUnitTestsSuite" - script: mvn test -B -Dtest=AllUnitTestsSuite - - name: "WhiteSource scan" - # only on support branches or master and if it is not a PR - if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request - script: - # Download the latest version of WhiteSource Unified Agent - - curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar - # Run WhiteSource Unified Agent - - java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config - - name: "AppContext01TestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContext02TestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContext03TestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.2.1 - script: travis_wait 20 mvn test -B -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ - - name: "AppContext04TestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.2.1 - script: travis_wait 20 mvn test -B -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "AppContext05TestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - - "mkdir -p $HOME/tmp" - - "cp src/test/resources/realms/alfresco-realm.json $HOME/tmp" - - docker login quay.io -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} - - "export HOST_IP=$(ip address show | grep -E \"([0-9]{1,3}\\.){3}[0-9]{1,3}\" | grep -v 127.0.0.1 | awk '{ print $2 }' | head -n 1 )" - - "export HOST_IP=$(echo ${HOST_IP%/*})" - - docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json quay.io/alfresco/alfresco-identity-service:1.2 - script: travis_wait 20 mvn test -B -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth" - - name: "AppContext06TestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.2.1 - script: travis_wait 20 mvn test -B -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ - - name: "AppContextExtraTestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "MiscContextTestSuite" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.2.1 - script: travis_wait 20 mvn test -B -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/ - - name: "MySQL tests" - before_install: - - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "PostgreSQL 10 tests" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "PostgreSQL 11 tests" - before_install: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - name: "MariaDB tests" - before_install: - - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8 - script: travis_wait 20 mvn test -B -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - - stage: release - name: "Push to Nexus" - if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/ - before_install: - - "cp .travis.settings.xml $HOME/.m2/settings.xml" - script: - # Use full history for release - - git checkout -B "${TRAVIS_BRANCH}" - # Add email to link commits to user - - git config user.email "${GIT_EMAIL}" - # Skip building of release commits - - mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform diff --git a/repository/.whitesource b/repository/.whitesource deleted file mode 100644 index f056952141..0000000000 --- a/repository/.whitesource +++ /dev/null @@ -1,8 +0,0 @@ -{ - "generalSettings": { - "shouldScanRepo": true - }, - "checkRunSettings": { - "vulnerableCheckRunConclusionLevel": "failure" - } -} \ No newline at end of file diff --git a/repository/CONTRIBUTING.md b/repository/CONTRIBUTING.md deleted file mode 100644 index 8d059e27ca..0000000000 --- a/repository/CONTRIBUTING.md +++ /dev/null @@ -1,16 +0,0 @@ -### Contributing -Thanks for your interest in contributing to this project! - -The following is a set of guidelines for contributing to this library. Most of them will make the life of the reviewer easier and therefore decrease the time required for the patch be included in the next version. - -Because this project forms a part of Alfresco Content Services, the guidelines are hosted in the [Alfresco Social Community](http://community.alfresco.com/community/ecm) where they can be referenced from multiple projects. - -Read an [overview on how this project is goverened](https://community.alfresco.com/docs/DOC-6385-project-overview-repository). - -You can report an issue in the ALF project of the [Alfresco issue tracker](http://issues.alfresco.com). - -Read [instructions for a good issue report](https://community.alfresco.com/docs/DOC-6263-reporting-an-issue). - -Read [instructions for making a contribution](https://community.alfresco.com/docs/DOC-6269-submitting-contributions). - -Please follow [the coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards). diff --git a/repository/LICENSE b/repository/LICENSE deleted file mode 100644 index 65c5ca88a6..0000000000 --- a/repository/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/repository/pom.xml b/repository/pom.xml index 1b8e7d17b7..7b09b614be 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -2,150 +2,14 @@ 4.0.0 alfresco-repository Alfresco Repository - 7.183.3-SNAPSHOT jar + org.alfresco - alfresco-super-pom - 12 + alfresco-community-repo + 7.183.300-TEST1-SNAPSHOT - - scm:git:https://github.com/Alfresco/alfresco-repository.git - scm:git:https://github.com/Alfresco/alfresco-repository.git - https://github.com/Alfresco/alfresco-repository - HEAD - - - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/repositories/releases - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/repositories/snapshots - - - - - community - - ${project.build.directory}/alf_data - convert - - 11 - - 8.50.14 - 7.33 - - 6.2 - 6.2 - 7.1 - 1.1 - 1.0.12 - 1.0.2.8 - - 5.1.15.RELEASE - 5.1.9.RELEASE - 4.5.10 - 7.7.10 - 4.1.1 - 1.4 - 7.14 - 1.0.0 - 5.23.0 - 5.23.0 - 42.2.12 - 8.0.19 - 2.6.0 - 3.5.2 - 9.0.3 - 3.4.1.Final - 2.24.2 - 5.15.11 - 2.0.19 - 3.3.5 - 2.10.2 - 2.10.2 - 1.2.5 - - - - - - org.apache.commons - commons-email - 1.5 - - - - com.github.junrar - junrar - 4.0.0 - - - - org.jsoup - jsoup - 1.12.2 - - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-rs-client - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-transports-http - ${dependency.cxf.version} - - - org.apache.cxf - cxf-rt-ws-policy - ${dependency.cxf.version} - - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${dependency.jackson.version} - - - - com.fasterxml.jackson.core - jackson-core - ${dependency.jackson.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${dependency.jackson.version} - - - org.apache.httpcomponents - httpclient - 4.5.11 - - - org.apache.httpcomponents - httpcore - 4.4.13 - - - - org.alfresco @@ -166,7 +30,7 @@ org.alfresco alfresco-core - ${dependency.alfresco-core.version} + ${project.version} org.alfresco @@ -201,7 +65,6 @@ org.apache.commons commons-compress - 1.19 org.apache.commons @@ -211,17 +74,14 @@ commons-codec commons-codec - 1.14 commons-beanutils commons-beanutils - 1.9.4 commons-collections commons-collections - 3.2.2 commons-io @@ -241,7 +101,6 @@ org.json json - 20090211 com.ibm.icu @@ -428,7 +287,6 @@ org.bouncycastle bcprov-jdk15on - 1.64 net.sf @@ -968,21 +826,21 @@ org.alfresco alfresco-core - ${dependency.alfresco-core.version} + ${project.version} tests test org.alfresco alfresco-data-model - ${dependency.alfresco-data-model.version} + ${project.version} tests test org.alfresco alfresco-data-model - ${dependency.alfresco-data-model.version} + ${project.version} org.alfresco diff --git a/repository/src/test/resources/alfresco/keystore/keystore b/repository/src/test/resources/alfresco/keystore/keystore new file mode 100644 index 0000000000000000000000000000000000000000..22d2b69a4125591ab9a9a64175644d3e129e81d7 GIT binary patch literal 645 zcmX?i?%X*B1_mY|W&~np29Dg+lEjq6l0=|@!Q72M9<6!Hz*=0yV4R$vt5;l_rP?TQ+xNzE%MWT<0c@?qdC0IPD$NiSg#@&Q?(pOcuEt{+@dl$n=q?Zd!c40Ik)8l;}N zqM)=0WZs(3;y>6pLLPwJRRHugzX2}`2fK1w)a_2z3MNL8Qjls^U;rp2RaaL(Ex#G= zYLIcsrttHD??FrQGnN-NEZrwH=kPV7%;P#IBrX`Q*)m)IQ{cyce^$?M6!!a*!uy$J z!J6zCqt`J%UjE>@`}am{yRxv!$1oAb3&+0SoOn3xY>2H@iEi#u`|eKLcT*hxr7Enl z+(GIhD632^8){040?KfKDYMO*G$4|wmdS6(`cTt(c|$=(&AC zXodf6IkwVBC*7VsUN@HCkrXvd-skc8c|fE1&XwvK%YRL-zq7MWPVkBB@J)~$Aa)H&PZv(ha6_Wk5K{!ZnX-7oe!Vb$Aj*3VzJq&Upto+*=V&XlJQR@f*$ zPTwb*b7+FVfx3VDCf_hDs9*9;gfF8w#wRhdro(++$SoG-5(cpVC)e=Ik_=xLQ^&lN kkfO|joKzRrV4M=WgY)7Vxi@TF-`^#{lDqfG/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>/p' pom.xml \ + | sed -n '//,/<\/version>/p' \ + | tr -d '\n' \ + | grep -oP '(?<=).*(?=)' \ + | xargs + + popd >/dev/null +} + +function retrievePomProperty() { + local KEY="${1}" + + pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null + + sed -n '//,/<\/properties>/p' pom.xml \ + | sed -n "/<${KEY}>/,/<\/${KEY}>/p" \ + | tr -d '\n' \ + | grep -oP "(?<=<${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}" +} + +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="$(isBranchBuild && echo "${TRAVIS_BRANCH}" || echo "${TRAVIS_PULL_REQUEST_BRANCH}")" + + if ! remoteBranchExists "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" ; then + printf "Branch \"%s\" not found on the %s repository\n" "${SOURCE_BRANCH}" "${UPSTREAM_REPO}" + #exit 1 + fi + + local SOURCE_BRANCH="${TRAVIS_BRANCH}" + if ! remoteBranchExists "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" ; then + printf "Branch \"%s\" not found on the %s repository\n" "${SOURCE_BRANCH}" "${UPSTREAM_REPO}" + #exit 1 + fi + # TODO remove this line and enable the previous "exit" commands: + local SOURCE_BRANCH="master" + + 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 +} + diff --git a/scripts/travis/cleanup_cache.sh b/scripts/travis/cleanup_cache.sh new file mode 100644 index 0000000000..33b940e2cd --- /dev/null +++ b/scripts/travis/cleanup_cache.sh @@ -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" + diff --git a/scripts/travis/init.sh b/scripts/travis/init.sh new file mode 100644 index 0000000000..d6dd516c28 --- /dev/null +++ b/scripts/travis/init.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -ev +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 "${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' ') + diff --git a/scripts/travis/maven_release.sh b/scripts/travis/maven_release.sh new file mode 100755 index 0000000000..990b45b7f9 --- /dev/null +++ b/scripts/travis/maven_release.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -ev + +# Use full history for release +git checkout -B "${TRAVIS_BRANCH}" +# Add email to link commits to user +git config user.email "${GIT_EMAIL}" + +# Run the release plugin - with "[skip ci]" in the release commit message +mvn -B \ + -PfullBuild,all-tas-tests \ + "-Darguments=-PfullBuild,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}" + diff --git a/scripts/travis/trigger_travis.sh b/scripts/travis/trigger_travis.sh new file mode 100755 index 0000000000..f180f412dd --- /dev/null +++ b/scripts/travis/trigger_travis.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -ev + +USER=${1} +REPO=${2} +BRANCH=${3} + +if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + echo "Downstream projects shouldn't be triggered from PR builds" + exit 1 +fi + +if ! git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${USER}/${REPO}.git" "${BRANCH}" ; then + echo "Branch \"${BRANCH}\" not found on the downstream repository ${USER}/${REPO}. Exiting..." + exit 0 +fi + + +URL="https://api.travis-ci.com/repo/${USER}%2F${REPO}/requests" +BODY="{ +\"request\": { + \"branch\":\"${BRANCH}\" +}}" + +printf "Travis API call:\n URL: %s\n Body: %s\n\n" "${URL}" "${BODY}" + +curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -H "Travis-API-Version: 3" \ + -H "Authorization: token ${TRAVIS_ACCESS_TOKEN_TEMP}" \ + -d "${BODY}" \ + "${URL}" \ + | tee /tmp/travis-request-output.txt + +cat /tmp/travis-request-output.txt + +if grep -q '"@type": "error"' /tmp/travis-request-output.txt; then + echo "Error when triggering build..." + exit 2 +fi +if grep -q 'access denied' /tmp/travis-request-output.txt; then + echo "Access denied when triggering build..." + exit 3 +fi + +exit 0 + diff --git a/scripts/travis/update_downstream.sh b/scripts/travis/update_downstream.sh new file mode 100644 index 0000000000..8868656124 --- /dev/null +++ b/scripts/travis/update_downstream.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +echo "=========================== Starting Update Downstream Script ===========================" +PS4="\[\e[35m\]+ \[\e[m\]" +set -vex +pushd "$(dirname "${BASH_SOURCE[0]}")/../../" + +source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh" + +DOWNSTREAM_REPO="github.com/Alfresco/alfresco-enterprise-repo.git" + +cloneRepo "${DOWNSTREAM_REPO}" "${TRAVIS_BRANCH}" + +cd "$(dirname "${BASH_SOURCE[0]}")/../../../$(basename "${DOWNSTREAM_REPO%.git}")" + +# Update parent +mvn -B versions:update-parent versions:commit + +VERSION="$(sed -n '//,/<\/parent>/p' pom.xml \ + | sed -n '//,/<\/version>/p' \ + | tr -d '\n' \ + | grep -oP '(?<=).*(?=)' \ + | xargs)" + +# Update dependency version +mvn -B versions:set-property versions:commit \ + -Dproperty=dependency.alfresco-community-repo.version \ + "-DnewVersion=${VERSION}" + +# Commit changes +git status +git --no-pager diff pom.xml +git add pom.xml + +if git status --untracked-files=no --porcelain | grep -q '^' ; then + git commit -m "Update upstream version to ${VERSION}" + git push +else + echo "Dependencies are already up to date." + git status +fi + + +popd +set +vex +echo "=========================== Finishing Update Downstream Script ==========================" + diff --git a/scripts/travis/verify_release_tag.sh b/scripts/travis/verify_release_tag.sh new file mode 100755 index 0000000000..daaaa280f7 --- /dev/null +++ b/scripts/travis/verify_release_tag.sh @@ -0,0 +1,24 @@ +#!/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 git tag. +# + +POM_VERSION=$(mvn -B -q help:evaluate -Dexpression=project.version -DforceStdout) +printf "POM version: %s\n" "${POM_VERSION}" + +TAG="${POM_VERSION%-SNAPSHOT}" + +if git rev-parse "${TAG}^{tag}" &>/dev/null ; then + echo "The next tag \"${TAG}\" already exists in the git project" + exit 1 +fi + +popd +set +vex +echo "=========================== Finishing Verify Release Tag Script ==========================" +