REPO-4785 Performance improvements to REST API TAS tests (#466)

This commit is contained in:
Alex Mukha
2019-12-13 20:05:42 +00:00
committed by GitHub
parent 9b413c8261
commit 2c723eaf57
32 changed files with 333 additions and 212 deletions

View File

@@ -32,14 +32,30 @@ matrix:
- curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.jar - curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.jar
# Run WhiteSource Unified Agent # Run WhiteSource Unified Agent
- java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config -d ./war - java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config -d ./war
- name: "REST API TAS tests" - name: "REST API TAS tests part1"
jdk: openjdk11 jdk: openjdk11
install: install:
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker - travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml - ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script: script:
- travis_wait 60 mvn install -q -f tests/tas-restapi/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - travis_wait 60 mvn install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
- name: "REST API TAS tests part2"
jdk: openjdk11
install:
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 60 mvn install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
- name: "REST API TAS tests part3"
jdk: openjdk11
install:
- travis_retry travis_wait 40 mvn install -q "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -PcommunityDocker
- ./tests/scripts/start-compose.sh ./tests/environment/docker-compose-minimal+transforms.yml
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 60 mvn install -f tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
- name: "CMIS TAS tests" - name: "CMIS TAS tests"
jdk: openjdk11 jdk: openjdk11
install: install:

View File

@@ -110,7 +110,7 @@
<dependency.tas-utility.version>3.0.16</dependency.tas-utility.version> <dependency.tas-utility.version>3.0.16</dependency.tas-utility.version>
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version> <dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
<dependency.javax.json.version>1.1.4</dependency.javax.json.version> <dependency.javax.json.version>1.1.4</dependency.javax.json.version>
<dependency.tas-restapi.version>1.15</dependency.tas-restapi.version> <dependency.tas-restapi.version>1.16</dependency.tas-restapi.version>
<dependency.tas-cmis.version>1.6</dependency.tas-cmis.version> <dependency.tas-cmis.version>1.6</dependency.tas-cmis.version>
<dependency.tas-email.version>1.1</dependency.tas-email.version> <dependency.tas-email.version>1.1</dependency.tas-email.version>
<dependency.tas-webdav.version>1.3</dependency.tas-webdav.version> <dependency.tas-webdav.version>1.3</dependency.tas-webdav.version>

View File

@@ -0,0 +1,17 @@
FROM alfresco/alfresco-content-repository-community:latest
ARG TOMCAT_DIR=/usr/local/tomcat
ARG GROUPNAME=Alfresco
ARG GROUPID=1000
ARG USERNAME=alfresco
ARG USERID=33000
USER root
RUN echo -e '\n\
# every second \n\
activities.feed.generator.cronExpression=* * * ? * * \n\
activities.post.lookup.cronExpression=* * * ? * * \n\
' >> ${TOMCAT_DIR}/shared/classes/alfresco-global.properties
USER ${USERID}

View File

@@ -7,9 +7,11 @@ version: "3"
services: services:
alfresco: alfresco:
image: alfresco/alfresco-content-repository-community:latest build:
context: ./alfresco
environment: environment:
CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n" 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 : JAVA_OPTS :
" "
-Ddb.driver=org.postgresql.Driver -Ddb.driver=org.postgresql.Driver
@@ -64,7 +66,10 @@ services:
- POSTGRES_DB=alfresco - POSTGRES_DB=alfresco
solr6: solr6:
image: alfresco/alfresco-search-services:${SOLR6_TAG} build:
context: ./search
args:
- TAG=${SOLR6_TAG}
environment: environment:
#Solr needs to know how to register itself with Alfresco #Solr needs to know how to register itself with Alfresco
- SOLR_ALFRESCO_HOST=alfresco - SOLR_ALFRESCO_HOST=alfresco

View File

@@ -0,0 +1,10 @@
ARG TAG
FROM alfresco/alfresco-search-services:${TAG}
ENV DIST_DIR /opt/alfresco-search-services
COPY extra-config.sh .
# add config script in 3rd line
RUN sed -i "3isource $PWD/extra-config.sh" \
/opt/alfresco-search-services/solr/bin/search_config_setup.sh

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
# Runs trackers once a second by modifying the template config of cores
sed -i 's|alfresco.cron=0/10 \* \* \* \* ? \*|alfresco.cron=\* \* \* ? \* \*|' \
/opt/alfresco-search-services/solrhome/templates/rerank/conf/solrcore.properties
sed -i 's/alfresco.commitInterval=2000/alfresco.commitInterval=200/' \
/opt/alfresco-search-services/solrhome/templates/rerank/conf/solrcore.properties
sed -i 's/alfresco.newSearcherInterval=3000/alfresco.newSearcherInterval=300/' \
/opt/alfresco-search-services/solrhome/templates/rerank/conf/solrcore.properties

View File

@@ -111,8 +111,8 @@ public class CheckInTests extends CmisTest
.checkIn().refreshResource() .checkIn().refreshResource()
.and().assertThat().documentIsNotCheckedOut() .and().assertThat().documentIsNotCheckedOut()
.then().assertThat().documentHasVersion(2.0); .then().assertThat().documentHasVersion(2.0);
Utility.waitToLoopTime(5); Utility.sleep(100, 5000, () ->
cmisApi.assertThat().contentIs(newContent); cmisApi.assertThat().contentIs(newContent));
} }
@TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION, @TestRail(section = {"cmis-api"}, executionType= ExecutionType.REGRESSION,

View File

@@ -146,7 +146,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = new FileModel(""); newFile = new FileModel("");
cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(newFile, sourceFile).then() cmisApi.authenticateUser(siteManager).usingSite(publicSite).createFileFromSource(newFile, sourceFile).then()
.usingSite(publicSite).assertThat().doesNotHaveFile(newFile); .usingSite(publicSite).assertThat().doesNotHaveFile(newFile);
Utility.sleep(500, 10000, () -> Utility.sleep(100, 10000, () ->
{ {
cmisApi.usingSite(publicSite).assertThat().doesNotHaveFile(newFile); cmisApi.usingSite(publicSite).assertThat().doesNotHaveFile(newFile);
}); });
@@ -160,7 +160,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(publicSite) cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)).usingSite(publicSite)
.createFileFromSource(newFile, sourceFile); .createFileFromSource(newFile, sourceFile);
Utility.sleep(500, 10000, () -> Utility.sleep(100, 10000, () ->
{ {
cmisApi.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent); cmisApi.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent);
}); });
@@ -175,7 +175,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite) cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor)).usingSite(publicSite)
.createFileFromSource(newFile, sourceFile); .createFileFromSource(newFile, sourceFile);
Utility.sleep(500, 10000, () -> Utility.sleep(100, 10000, () ->
{ {
cmisApi.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent); cmisApi.refreshResource().then().assertThat().existsInRepo().and().assertThat().contentIs(sourceContent);
}); });
@@ -189,7 +189,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite) cmisApi.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator)).usingSite(publicSite)
.createFileFromSource(newFile, sourceFile); .createFileFromSource(newFile, sourceFile);
Utility.sleep(500, 10000, () -> Utility.sleep(100, 10000, () ->
{ {
cmisApi.refreshResource().then().assertThat().existsInRepo().and() cmisApi.refreshResource().then().assertThat().existsInRepo().and()
.assertThat().contentIs(sourceContent); .assertThat().contentIs(sourceContent);
@@ -215,7 +215,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
cmisApi.authenticateUser(siteManager).usingSite(publicSite) cmisApi.authenticateUser(siteManager).usingSite(publicSite)
.createFileFromSource(newFile, sourceFile, VersioningState.MINOR); .createFileFromSource(newFile, sourceFile, VersioningState.MINOR);
Utility.sleep(500, 10000, () -> Utility.sleep(100, 10000, () ->
{ {
cmisApi.refreshResource().then().assertThat().existsInRepo().and() cmisApi.refreshResource().then().assertThat().existsInRepo().and()
.assertThat().contentIs(sourceContent).and() .assertThat().contentIs(sourceContent).and()
@@ -232,7 +232,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
cmisApi.authenticateUser(siteManager).usingSite(publicSite) cmisApi.authenticateUser(siteManager).usingSite(publicSite)
.createFileFromSource(newFile, sourceFile, VersioningState.NONE); .createFileFromSource(newFile, sourceFile, VersioningState.NONE);
Utility.sleep(1000, 35000, () -> Utility.sleep(100, 35000, () ->
{ {
cmisApi.refreshResource().then().assertThat().existsInRepo().and() cmisApi.refreshResource().then().assertThat().existsInRepo().and()
.assertThat().contentIs(sourceContent).and() .assertThat().contentIs(sourceContent).and()
@@ -248,7 +248,7 @@ public class CreateDocumentFromSourceTests extends CmisTest
newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN); newFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
cmisApi.authenticateUser(siteManager).usingSite(publicSite) cmisApi.authenticateUser(siteManager).usingSite(publicSite)
.createFileFromSource(newFile, sourceFile, VersioningState.CHECKEDOUT); .createFileFromSource(newFile, sourceFile, VersioningState.CHECKEDOUT);
Utility.sleep(1000, 35000, () -> Utility.sleep(100, 35000, () ->
{ {
cmisApi.refreshResource().then().assertThat().existsInRepo().and() cmisApi.refreshResource().then().assertThat().existsInRepo().and()
.assertThat().contentIs(sourceContent).and() .assertThat().contentIs(sourceContent).and()

View File

@@ -439,12 +439,11 @@ public class IntegrationSanityTests extends IntegrationTest
.assertThat().field("tag").is("integration_tag3"); .assertThat().field("tag").is("integration_tag3");
STEP("* 8. U1 gets tags and verify all tags are listed"); STEP("* 8. U1 gets tags and verify all tags are listed");
Utility.waitToLoopTime(30); Utility.sleep(500, 30000, () ->
restAPI.withParams("maxItems=10000").withCoreAPI().getTags() restAPI.withParams("maxItems=10000").withCoreAPI().getTags()
.assertThat().entriesListContains("tag", "integration_tag1") .assertThat().entriesListContains("tag", "integration_tag1")
.and().entriesListContains("tag", "integration_tag2") .and().entriesListContains("tag", "integration_tag2")
.and().entriesListContains("tag", "integration_tag3"); .and().entriesListContains("tag", "integration_tag3"));
STEP("* 9. U1 gets file1 tags and verify only tag1 and tag2 are listed"); STEP("* 9. U1 gets file1 tags and verify only tag1 and tag2 are listed");
restAPI.withCoreAPI() restAPI.withCoreAPI()
.usingResource(testFile1).getNodeTags() .usingResource(testFile1).getNodeTags()

View File

@@ -27,6 +27,27 @@
<suiteXmlFile>${project.basedir}/src/test/resources/restapi-suite.xml</suiteXmlFile> <suiteXmlFile>${project.basedir}/src/test/resources/restapi-suite.xml</suiteXmlFile>
</properties> </properties>
<profiles>
<profile>
<id>run-restapi-part1</id>
<properties>
<suiteXmlFile>${project.basedir}/src/test/resources/test-suites/part1-suite.xml</suiteXmlFile>
</properties>
</profile>
<profile>
<id>run-restapi-part2</id>
<properties>
<suiteXmlFile>${project.basedir}/src/test/resources/test-suites/part2-suite.xml</suiteXmlFile>
</properties>
</profile>
<profile>
<id>run-restapi-part3</id>
<properties>
<suiteXmlFile>${project.basedir}/src/test/resources/test-suites/part3-suite.xml</suiteXmlFile>
</properties>
</profile>
</profiles>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.alfresco.tas</groupId> <groupId>org.alfresco.tas</groupId>

View File

@@ -153,6 +153,6 @@ public class GroupsTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
} }
}; };
Utility.sleep(1000, 35000, op);// Allow indexing to complete. Utility.sleep(500, 35000, op);// Allow indexing to complete.
} }
} }

View File

@@ -1,4 +1,4 @@
package org.alfresco.rest.cors; package org.alfresco.rest.misc;
import io.restassured.RestAssured; import io.restassured.RestAssured;
import org.alfresco.rest.RestTest; import org.alfresco.rest.RestTest;

View File

@@ -1,8 +1,9 @@
package org.alfresco.rest; package org.alfresco.rest.misc;
import org.alfresco.dataprep.CMISUtil; import org.alfresco.dataprep.CMISUtil;
import org.alfresco.dataprep.CMISUtil.DocumentType; import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.dataprep.SiteService.Visibility; import org.alfresco.dataprep.SiteService.Visibility;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestActivityModelsCollection; import org.alfresco.rest.model.RestActivityModelsCollection;
import org.alfresco.rest.model.RestCommentModel; import org.alfresco.rest.model.RestCommentModel;
import org.alfresco.rest.model.RestCommentModelsCollection; import org.alfresco.rest.model.RestCommentModelsCollection;
@@ -14,6 +15,7 @@ import org.alfresco.rest.model.RestSiteMemberModel;
import org.alfresco.rest.model.RestSiteMembershipRequestModelsCollection; import org.alfresco.rest.model.RestSiteMembershipRequestModelsCollection;
import org.alfresco.rest.model.RestTagModel; import org.alfresco.rest.model.RestTagModel;
import org.alfresco.rest.model.RestTaskModel; import org.alfresco.rest.model.RestTaskModel;
import org.alfresco.utility.Utility;
import org.alfresco.utility.constants.ActivityType; import org.alfresco.utility.constants.ActivityType;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileModel;
@@ -24,33 +26,15 @@ import org.alfresco.utility.report.Bug;
import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
public class FunctionalCasesTests extends RestTest public class FunctionalCasesTests extends RestTest
{ {
private UserModel adminUser, manager;
private SiteModel publicSite, moderatedSite, privateSite;
private RestSiteMemberModel updatedMember; private RestSiteMemberModel updatedMember;
private RestSiteMembershipRequestModelsCollection returnedCollection; private RestSiteMembershipRequestModelsCollection returnedCollection;
private RestFavoriteSiteModel restFavoriteSiteModel; private RestFavoriteSiteModel restFavoriteSiteModel;
private RestActivityModelsCollection activities; private RestActivityModelsCollection activities;
private FileModel file; private FileModel file;
private RestActivityModelsCollection restActivityModelsCollection;
private FileModel fileInSite;
private RestCommentModel commentModel;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
adminUser = dataUser.getAdminUser();
manager = dataUser.createRandomTestUser();
publicSite = dataSite.usingUser(adminUser).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
moderatedSite = dataSite.usingUser(adminUser).createModeratedRandomSite();
privateSite = dataSite.usingUser(adminUser).createPrivateRandomSite();
}
/** /**
* Scenario: * Scenario:
@@ -62,11 +46,12 @@ public class FunctionalCasesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
description = "Verify that manager is able to update manager with different roles and gets status code CREATED (201)") description = "Verify that manager is able to update manager with different roles and gets status code CREATED (201)")
public void managerIsAbleToUpdateManagerWithDifferentRoles() throws Exception public void managerIsAbleToUpdateManagerWithDifferentRoles()
{ {
UserModel testUser = dataUser.createRandomTestUser("testUser"); UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteManager); testUser.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).addPerson(testUser) SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(publicSite).addPerson(testUser)
.assertThat().field("id").is(testUser.getUsername()) .assertThat().field("id").is(testUser.getUsername())
.and().field("role").is(testUser.getUserRole()); .and().field("role").is(testUser.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -100,11 +85,12 @@ public class FunctionalCasesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
description = "Verify that manager is able to update consumer with different roles and gets status code CREATED (201)") description = "Verify that manager is able to update consumer with different roles and gets status code CREATED (201)")
public void managerIsAbleToUpdateConsumerWithDifferentRoles() throws Exception public void managerIsAbleToUpdateConsumerWithDifferentRoles()
{ {
UserModel testUser = dataUser.createRandomTestUser("testUser"); UserModel testUser = dataUser.createRandomTestUser("testUser");
testUser.setUserRole(UserRole.SiteConsumer); testUser.setUserRole(UserRole.SiteConsumer);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).addPerson(testUser) SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(publicSite).addPerson(testUser)
.assertThat().field("id").is(testUser.getUsername()) .assertThat().field("id").is(testUser.getUsername())
.and().field("role").is(testUser.getUserRole()); .and().field("role").is(testUser.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -141,12 +127,12 @@ public class FunctionalCasesTests extends RestTest
public void approveRequestAddAndDeleteSiteFromFavorites() throws Exception public void approveRequestAddAndDeleteSiteFromFavorites() throws Exception
{ {
UserModel newMember = dataUser.createRandomTestUser(); UserModel newMember = dataUser.createRandomTestUser();
SiteModel moderatedSite = dataSite.usingUser(dataUser.getAdminUser()).createModeratedRandomSite();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite); restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
RestTaskModel taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite); RestTaskModel taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite);
workflow.approveSiteMembershipRequest(adminUser.getUsername(), adminUser.getPassword(), taskModel.getId(), true, "Approve"); workflow.approveSiteMembershipRequest(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), taskModel.getId(), true, "Approve");
returnedCollection = restClient.authenticateUser(newMember).withCoreAPI().usingMe().getSiteMembershipRequests(); returnedCollection = restClient.authenticateUser(newMember).withCoreAPI().usingMe().getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat().entriesListDoesNotContain("id", moderatedSite.getId()); returnedCollection.assertThat().entriesListDoesNotContain("id", moderatedSite.getId());
@@ -174,12 +160,12 @@ public class FunctionalCasesTests extends RestTest
public void rejectRequestAddModeratedSiteToFavorites() throws Exception public void rejectRequestAddModeratedSiteToFavorites() throws Exception
{ {
UserModel newMember = dataUser.createRandomTestUser(); UserModel newMember = dataUser.createRandomTestUser();
SiteModel moderatedSite = dataSite.usingUser(dataUser.getAdminUser()).createModeratedRandomSite();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite); restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
RestTaskModel taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite); RestTaskModel taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite);
workflow.approveSiteMembershipRequest(adminUser.getUsername(), adminUser.getPassword(), taskModel.getId(), false, "Rejected"); workflow.approveSiteMembershipRequest(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), taskModel.getId(), false, "Rejected");
returnedCollection = restClient.authenticateUser(newMember).withCoreAPI().usingMe().getSiteMembershipRequests(); returnedCollection = restClient.authenticateUser(newMember).withCoreAPI().usingMe().getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat().entriesListDoesNotContain("id", moderatedSite.getId()); returnedCollection.assertThat().entriesListDoesNotContain("id", moderatedSite.getId());
@@ -192,9 +178,9 @@ public class FunctionalCasesTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite); taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite);
workflow.approveSiteMembershipRequest(adminUser.getUsername(), adminUser.getPassword(), taskModel.getId(), true, "Accept"); workflow.approveSiteMembershipRequest(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), taskModel.getId(), true, "Accept");
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).deleteSiteMember(moderatedSite); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(newMember).deleteSiteMember(moderatedSite);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(moderatedSite).getSiteMembers().assertThat().entriesListDoesNotContain("id", newMember.getUsername()); restClient.withCoreAPI().usingSite(moderatedSite).getSiteMembers().assertThat().entriesListDoesNotContain("id", newMember.getUsername());
@@ -210,8 +196,11 @@ public class FunctionalCasesTests extends RestTest
description = "Add a file and check that activity is included in person activities") description = "Add a file and check that activity is included in person activities")
public void addFileThenGetPersonActivities() throws Exception public void addFileThenGetPersonActivities() throws Exception
{ {
UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN); file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN);
activities = restClient.authenticateUser(manager).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(2); activities = restClient.authenticateUser(manager).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(3);
activities.assertThat().entriesListIsNotEmpty() activities.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", publicSite.getId()) .and().entriesListContains("siteId", publicSite.getId())
.and().entriesListContains("activityType", "org.alfresco.documentlibrary.file-added") .and().entriesListContains("activityType", "org.alfresco.documentlibrary.file-added")
@@ -228,9 +217,12 @@ public class FunctionalCasesTests extends RestTest
description = "Add a comment to a file and check that activity is included in person activities") description = "Add a comment to a file and check that activity is included in person activities")
public void addCommentThenGetPersonActivities() throws Exception public void addCommentThenGetPersonActivities() throws Exception
{ {
UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN); file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN);
restClient.authenticateUser(manager).withCoreAPI().usingResource(file).addComment("new comment"); restClient.authenticateUser(manager).withCoreAPI().usingResource(file).addComment("new comment");
activities = restClient.authenticateUser(manager).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(3); activities = restClient.authenticateUser(manager).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(4);
activities.assertThat().entriesListIsNotEmpty() activities.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", publicSite.getId()) .and().entriesListContains("siteId", publicSite.getId())
.and().entriesListContains("activityType", "org.alfresco.comments.comment-created") .and().entriesListContains("activityType", "org.alfresco.comments.comment-created")
@@ -247,9 +239,12 @@ public class FunctionalCasesTests extends RestTest
description = "Add a file, delete it and check that activity is included in person activities") description = "Add a file, delete it and check that activity is included in person activities")
public void addFileDeleteItThenGetPersonActivities() throws Exception public void addFileDeleteItThenGetPersonActivities() throws Exception
{ {
UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN); file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN);
dataContent.usingUser(manager).usingResource(file).deleteContent(); dataContent.usingUser(manager).usingResource(file).deleteContent();
activities = restClient.authenticateUser(manager).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(2); activities = restClient.authenticateUser(manager).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(4);
activities.assertThat().entriesListIsNotEmpty() activities.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", publicSite.getId()) .and().entriesListContains("siteId", publicSite.getId())
.and().entriesListContains("activityType", "org.alfresco.documentlibrary.file-deleted") .and().entriesListContains("activityType", "org.alfresco.documentlibrary.file-deleted")
@@ -269,6 +264,9 @@ public class FunctionalCasesTests extends RestTest
description = "Add comment to a file, then get comment details. Update it and check that get comment returns updated details. Delete comment then check that file has no comments.") description = "Add comment to a file, then get comment details. Update it and check that get comment returns updated details. Delete comment then check that file has no comments.")
public void addUpdateDeleteCommentThenGetCommentDetails() throws Exception public void addUpdateDeleteCommentThenGetCommentDetails() throws Exception
{ {
UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN); file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN);
RestCommentModel newComment = restClient.authenticateUser(manager).withCoreAPI().usingResource(file).addComment("new comment"); RestCommentModel newComment = restClient.authenticateUser(manager).withCoreAPI().usingResource(file).addComment("new comment");
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -303,6 +301,9 @@ public class FunctionalCasesTests extends RestTest
description = "Add a comment to a file, delete it, then added the same comment again.") description = "Add a comment to a file, delete it, then added the same comment again.")
public void checkThatADeletedCommentCanBePostedAgain() throws Exception public void checkThatADeletedCommentCanBePostedAgain() throws Exception
{ {
UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN); file = dataContent.usingUser(manager).usingSite(publicSite).createContent(DocumentType.TEXT_PLAIN);
RestCommentModel newComment = restClient.authenticateUser(manager).withCoreAPI().usingResource(file).addComment("new comment"); RestCommentModel newComment = restClient.authenticateUser(manager).withCoreAPI().usingResource(file).addComment("new comment");
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -330,8 +331,6 @@ public class FunctionalCasesTests extends RestTest
* Scenario: * Scenario:
* 1. join an user to a site * 1. join an user to a site
* 2. Check action is included in person activities list * 2. Check action is included in person activities list
*
* @throws Exception
*/ */
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@@ -340,9 +339,9 @@ public class FunctionalCasesTests extends RestTest
public void joinUserToSiteThenGetPersonActivities() throws Exception public void joinUserToSiteThenGetPersonActivities() throws Exception
{ {
UserModel userJoinSite = dataUser.createRandomTestUser(); UserModel userJoinSite = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
restClient.authenticateUser(userJoinSite).withCoreAPI().usingMe().addSiteMembershipRequest(publicSite); restClient.authenticateUser(userJoinSite).withCoreAPI().usingMe().addSiteMembershipRequest(publicSite);
activities = restClient.withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(2); activities = restClient.withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(1);
activities.assertThat().entriesListIsNotEmpty().and() activities.assertThat().entriesListIsNotEmpty().and()
.entriesListContains("siteId", publicSite.getId()).and() .entriesListContains("siteId", publicSite.getId()).and()
.entriesListContains("activityType", "org.alfresco.site.user-joined").and() .entriesListContains("activityType", "org.alfresco.site.user-joined").and()
@@ -362,12 +361,12 @@ public class FunctionalCasesTests extends RestTest
{ {
UserModel newMember = dataUser.createRandomTestUser(); UserModel newMember = dataUser.createRandomTestUser();
newMember.setUserRole(UserRole.SiteCollaborator); newMember.setUserRole(UserRole.SiteCollaborator);
SiteModel privateSite = dataSite.usingUser(dataUser.getAdminUser()).createPrivateRandomSite();
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(privateSite).addPerson(newMember) restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(privateSite).addPerson(newMember)
.assertThat().field("id").is(newMember.getUsername()); .assertThat().field("id").is(newMember.getUsername());
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).deleteSiteMember(privateSite); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(newMember).deleteSiteMember(privateSite);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(privateSite); restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(privateSite);
@@ -389,18 +388,18 @@ public class FunctionalCasesTests extends RestTest
{ {
UserModel newMember = dataUser.createRandomTestUser(); UserModel newMember = dataUser.createRandomTestUser();
newMember.setUserRole(UserRole.SiteCollaborator); newMember.setUserRole(UserRole.SiteCollaborator);
SiteModel moderatedSite = dataSite.usingUser(dataUser.getAdminUser()).createModeratedRandomSite();
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite); restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
RestTaskModel taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite); RestTaskModel taskModel = restClient.authenticateUser(newMember).withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite);
workflow.approveSiteMembershipRequest(adminUser.getUsername(), adminUser.getPassword(), taskModel.getId(), true, "Accept"); workflow.approveSiteMembershipRequest(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), taskModel.getId(), true, "Accept");
restClient.authenticateUser(adminUser).withCoreAPI().usingUser(newMember).deleteSiteMember(moderatedSite); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(newMember).deleteSiteMember(moderatedSite);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(moderatedSite).getSiteMembers().assertThat().entriesListDoesNotContain("id", newMember.getUsername()); restClient.withCoreAPI().usingSite(moderatedSite).getSiteMembers().assertThat().entriesListDoesNotContain("id", newMember.getUsername());
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(moderatedSite).addPerson(newMember) restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(moderatedSite).addPerson(newMember)
.assertThat().field("id").is(newMember.getUsername()); .assertThat().field("id").is(newMember.getUsername());
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.withCoreAPI().usingSite(moderatedSite).getSiteMembers().assertThat().entriesListContains("id", newMember.getUsername()); restClient.withCoreAPI().usingSite(moderatedSite).getSiteMembers().assertThat().entriesListContains("id", newMember.getUsername());
@@ -418,17 +417,18 @@ public class FunctionalCasesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION })
public void checkTheCommentOfADocumentThatWasDeletedDoesNotExist() throws Exception public void checkTheCommentOfADocumentThatWasDeletedDoesNotExist() throws Exception
{ {
file = dataContent.usingSite(publicSite).usingUser(adminUser).createContent(CMISUtil.DocumentType.TEXT_PLAIN); SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
String newContent = "This is a new comment added by " + adminUser.getUsername(); file = dataContent.usingSite(publicSite).usingUser(dataUser.getAdminUser()).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
String newContent = "This is a new comment added by " + dataUser.getAdminUser().getUsername();
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(file).addComment(newContent) restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingResource(file).addComment(newContent)
.assertThat().field("content").isNotEmpty() .assertThat().field("content").isNotEmpty()
.and().field("content").is(newContent); .and().field("content").is(newContent);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
dataContent.usingUser(adminUser).usingResource(file).deleteContent(); dataContent.usingUser(dataUser.getAdminUser()).usingResource(file).deleteContent();
restClient.authenticateUser(adminUser).withCoreAPI().usingResource(file).getNodeComments(); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingResource(file).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND) restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsSummary((String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, file.getNodeRefWithoutVersion()))); .assertLastError().containsSummary((String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, file.getNodeRefWithoutVersion())));
} }
@@ -440,6 +440,7 @@ public class FunctionalCasesTests extends RestTest
* 3. Remove user from site * 3. Remove user from site
* 4. Get comments and check if the above comment was deleted * 4. Get comments and check if the above comment was deleted
*/ */
@Bug(id="REPO-4854")
@TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS }, @TestRail(section = { TestGroup.REST_API, TestGroup.COMMENTS },
executionType = ExecutionType.REGRESSION, description = "Check that a comment of a document from a private site is not deleted after user is removed") executionType = ExecutionType.REGRESSION, description = "Check that a comment of a document from a private site is not deleted after user is removed")
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION })
@@ -447,9 +448,10 @@ public class FunctionalCasesTests extends RestTest
{ {
UserModel newUser = dataUser.createRandomTestUser(); UserModel newUser = dataUser.createRandomTestUser();
newUser.setUserRole(UserRole.SiteManager); newUser.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(privateSite).addPerson(newUser); SiteModel privateSite = dataSite.usingUser(dataUser.getAdminUser()).createPrivateRandomSite();
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(privateSite).addPerson(newUser);
file = dataContent.usingSite(privateSite).usingUser(adminUser).createContent(CMISUtil.DocumentType.TEXT_PLAIN); file = dataContent.usingSite(privateSite).usingUser(dataUser.getAdminUser()).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
String newContent = "This is a new comment added by " + newUser.getUsername(); String newContent = "This is a new comment added by " + newUser.getUsername();
restClient.authenticateUser(newUser).withCoreAPI().usingResource(file).addComment(newContent) restClient.authenticateUser(newUser).withCoreAPI().usingResource(file).addComment(newContent)
@@ -457,11 +459,13 @@ public class FunctionalCasesTests extends RestTest
.and().field("content").is(newContent); .and().field("content").is(newContent);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(privateSite).deleteSiteMember(newUser); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(privateSite).deleteSiteMember(newUser);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(privateSite).getSiteMembers().assertThat().entriesListDoesNotContain("id", newUser.getUsername()); Utility.sleep(200, 10000, () ->
restClient.withCoreAPI().usingSite(privateSite).getSiteMembers()
.assertThat().entriesListDoesNotContain("id", newUser.getUsername()));
RestCommentModelsCollection comments = restClient.authenticateUser(adminUser).withCoreAPI().usingResource(file).getNodeComments(); RestCommentModelsCollection comments = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingResource(file).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
comments.assertThat().entriesListContains("content", newContent) comments.assertThat().entriesListContains("content", newContent)
.and().entriesListContains("createdBy.id", newUser.getUsername()); .and().entriesListContains("createdBy.id", newUser.getUsername());
@@ -477,7 +481,10 @@ public class FunctionalCasesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION })
public void commentAFavoriteFile() throws Exception public void commentAFavoriteFile() throws Exception
{ {
file = dataContent.usingSite(publicSite).usingUser(adminUser).createContent(CMISUtil.DocumentType.TEXT_PLAIN); UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingSite(publicSite).usingUser(dataUser.getAdminUser()).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
restClient.authenticateUser(manager).withCoreAPI().usingMe().addFileToFavorites(file); restClient.authenticateUser(manager).withCoreAPI().usingMe().addFileToFavorites(file);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -499,7 +506,10 @@ public class FunctionalCasesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.COMMENTS, TestGroup.REGRESSION })
public void commentFileRemovedFromFavorites() throws Exception public void commentFileRemovedFromFavorites() throws Exception
{ {
file = dataContent.usingSite(publicSite).usingUser(adminUser).createContent(CMISUtil.DocumentType.TEXT_PLAIN); UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
file = dataContent.usingSite(publicSite).usingUser(dataUser.getAdminUser()).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
restClient.authenticateUser(manager).withCoreAPI().usingMe().addFileToFavorites(file); restClient.authenticateUser(manager).withCoreAPI().usingMe().addFileToFavorites(file);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
@@ -528,6 +538,9 @@ public class FunctionalCasesTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void changeFavoriteSiteVisibilityThenCheckFavorites() throws Exception public void changeFavoriteSiteVisibilityThenCheckFavorites() throws Exception
{ {
UserModel manager = dataUser.createRandomTestUser();
SiteModel publicSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(manager, publicSite, UserRole.SiteManager);
SiteModel favoriteSite = dataSite.usingUser(manager).createPublicRandomSite(); SiteModel favoriteSite = dataSite.usingUser(manager).createPublicRandomSite();
UserModel regularUser = dataUser.createRandomTestUser(); UserModel regularUser = dataUser.createRandomTestUser();
@@ -581,19 +594,20 @@ public class FunctionalCasesTests extends RestTest
public void checkNewManagerActions() throws Exception public void checkNewManagerActions() throws Exception
{ {
UserModel newMember = dataUser.createRandomTestUser(); UserModel newMember = dataUser.createRandomTestUser();
file = dataContent.usingSite(moderatedSite).usingUser(adminUser).createContent(CMISUtil.DocumentType.TEXT_PLAIN); SiteModel moderatedSite = dataSite.usingUser(dataUser.getAdminUser()).createModeratedRandomSite();
file = dataContent.usingSite(moderatedSite).usingUser(dataUser.getAdminUser()).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite); restClient.authenticateUser(newMember).withCoreAPI().usingMe().addSiteMembershipRequest(moderatedSite);
restClient.assertStatusCodeIs(HttpStatus.CREATED); restClient.assertStatusCodeIs(HttpStatus.CREATED);
RestTaskModel taskModel = restClient.withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite); RestTaskModel taskModel = restClient.withWorkflowAPI().getTasks().getTaskModelByDescription(moderatedSite);
workflow.approveSiteMembershipRequest(adminUser.getUsername(), adminUser.getPassword(), taskModel.getId(), true, "Approve"); workflow.approveSiteMembershipRequest(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), taskModel.getId(), true, "Approve");
returnedCollection = restClient.withCoreAPI().usingMe().getSiteMembershipRequests(); returnedCollection = restClient.withCoreAPI().usingMe().getSiteMembershipRequests();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat().entriesListDoesNotContain("id", moderatedSite.getId()); returnedCollection.assertThat().entriesListDoesNotContain("id", moderatedSite.getId());
newMember.setUserRole(UserRole.SiteManager); newMember.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(moderatedSite).updateSiteMember(newMember) restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(moderatedSite).updateSiteMember(newMember)
.assertThat().field("id").is(newMember.getUsername()) .assertThat().field("id").is(newMember.getUsername())
.and().field("role").is(newMember.getUserRole()); .and().field("role").is(newMember.getUserRole());
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -651,8 +665,7 @@ public class FunctionalCasesTests extends RestTest
* 9. Delete site member * 9. Delete site member
* 10. Delete comment * 10. Delete comment
* 11. Get Activities * 11. Get Activities
* *
* @throws Exception
*/ */
@Bug(id="REPO-1830") @Bug(id="REPO-1830")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.REGRESSION })
@@ -660,26 +673,26 @@ public class FunctionalCasesTests extends RestTest
public void userGetsItsPeopleActivities() throws Exception public void userGetsItsPeopleActivities() throws Exception
{ {
UserModel newUser = dataUser.createRandomTestUser(); UserModel newUser = dataUser.createRandomTestUser();
SiteModel userSiteModel = dataSite.usingUser(adminUser).createPublicRandomSite(); SiteModel userSiteModel = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
dataUser.addUserToSite(newUser, userSiteModel, UserRole.SiteCollaborator); dataUser.addUserToSite(newUser, userSiteModel, UserRole.SiteCollaborator);
dataContent.usingUser(newUser).usingSite(userSiteModel).createFolder(); dataContent.usingUser(newUser).usingSite(userSiteModel).createFolder();
fileInSite = dataContent.usingUser(newUser).usingSite(userSiteModel).createContent(DocumentType.TEXT_PLAIN); FileModel fileInSite = dataContent.usingUser(newUser).usingSite(userSiteModel).createContent(DocumentType.TEXT_PLAIN);
String newContent = "This is a new comment added by " + newUser.getUsername(); String newContent = "This is a new comment added by " + newUser.getUsername();
commentModel = restClient.authenticateUser(newUser).withCoreAPI().usingResource(fileInSite).addComment(newContent); RestCommentModel commentModel = restClient.authenticateUser(newUser).withCoreAPI().usingResource(fileInSite).addComment(newContent);
restClient.authenticateUser(newUser).withCoreAPI().usingResource(fileInSite).likeDocument(); restClient.authenticateUser(newUser).withCoreAPI().usingResource(fileInSite).likeDocument();
restClient.withCoreAPI().usingResource(fileInSite).updateComment(commentModel, "new Content"); restClient.withCoreAPI().usingResource(fileInSite).updateComment(commentModel, "new Content");
newUser.setUserRole(UserRole.SiteManager); newUser.setUserRole(UserRole.SiteManager);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(userSiteModel).updateSiteMember(newUser); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(userSiteModel).updateSiteMember(newUser);
restClient.authenticateUser(newUser).withCoreAPI().usingResource(fileInSite).deleteLikeRating(); restClient.authenticateUser(newUser).withCoreAPI().usingResource(fileInSite).deleteLikeRating();
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingResource(fileInSite).deleteComment(commentModel); restClient.withCoreAPI().usingResource(fileInSite).deleteComment(commentModel);
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(userSiteModel).deleteSiteMember(newUser); restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(userSiteModel).deleteSiteMember(newUser);
restActivityModelsCollection = restClient.authenticateUser(newUser).withCoreAPI().usingMe().getPersonActivitiesUntilEntriesCountIs(10); RestActivityModelsCollection restActivityModelsCollection = restClient.authenticateUser(newUser).withCoreAPI().usingMe().getPersonActivitiesUntilEntriesCountIs(10);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
restActivityModelsCollection.assertThat().paginationField("count").is("10"); restActivityModelsCollection.assertThat().paginationField("count").is("10");

View File

@@ -262,7 +262,7 @@ public class NodesContentAndVersioningTests extends RestTest
// verify the content is the same as the uploaded file and check in headers for // verify the content is the same as the uploaded file and check in headers for
// Content-Disposition to validate the download as attachment and fileName. // Content-Disposition to validate the download as attachment and fileName.
// wait for content to be picked up on AWS QS stacks // wait for content to be picked up on AWS QS stacks
Utility.sleep(1000, 60000, () -> { Utility.sleep(500, 60000, () -> {
RestResponse versionContent = restClient.withCoreAPI().usingNode(file2).getVersionContent("2.0"); RestResponse versionContent = restClient.withCoreAPI().usingNode(file2).getVersionContent("2.0");
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);

View File

@@ -730,7 +730,7 @@ public class NodesLockTests extends RestTest
query.setIncludeRequest(false); query.setIncludeRequest(false);
// Allow indexing to complete. // Allow indexing to complete.
Utility.sleep(1000, 60000, () -> Utility.sleep(500, 60000, () ->
{ {
SearchResponse response = query(query); SearchResponse response = query(query);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -747,7 +747,7 @@ public class NodesLockTests extends RestTest
STEP("7. Verify that childNode1 and childNode2 are not found in the query results."); STEP("7. Verify that childNode1 and childNode2 are not found in the query results.");
// Allow indexing to complete. // Allow indexing to complete.
Utility.sleep(1000, 60000, () -> Utility.sleep(500, 60000, () ->
{ {
SearchResponse response = query(query); SearchResponse response = query(query);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);

View File

@@ -2,6 +2,7 @@ package org.alfresco.rest.people;
import org.alfresco.rest.RestTest; import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel; import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.utility.Utility;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.SiteModel;
@@ -159,9 +160,12 @@ public class DeleteSiteMemberFullTests extends RestTest
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator)).deleteSiteMember(publicSiteModel); restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator)).deleteSiteMember(publicSiteModel);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(RestErrorModel.ENTITY_NOT_FOUND); restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(RestErrorModel.ENTITY_NOT_FOUND);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator)); restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addPerson(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator));
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers().assertThat().entriesListContains("id", usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.when().getSiteMember(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator).getUsername()) .getSiteMembers().assertThat()
.assertSiteMemberHasRole(UserRole.SiteCollaborator); .entriesListContains("id",
usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator).getUsername())
.when().getSiteMember(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteCollaborator).getUsername())
.assertSiteMemberHasRole(UserRole.SiteCollaborator));
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@@ -178,8 +182,9 @@ public class DeleteSiteMemberFullTests extends RestTest
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER).stackTraceIs(RestErrorModel.STACKTRACE); .descriptionURLIs(RestErrorModel.RESTAPIEXPLORER).stackTraceIs(RestErrorModel.STACKTRACE);
restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteManager)); restClient.withCoreAPI().usingSite(publicSiteModel).addPerson(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListContains("id", usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteManager).getUsername()); .getSiteMembers().assertThat()
.entriesListContains("id", usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteManager).getUsername()));
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@@ -189,7 +194,8 @@ public class DeleteSiteMemberFullTests extends RestTest
restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(publicSiteModel); restClient.authenticateUser(adminUserModel).withCoreAPI().usingUser(adminUserModel).deleteSiteMember(publicSiteModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.authenticateUser(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingSite(publicSiteModel).addPerson(adminUserModel); restClient.authenticateUser(usersWithRolesPublicSite.getOneUserWithRole(UserRole.SiteManager)).withCoreAPI().usingSite(publicSiteModel).addPerson(adminUserModel);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers().assertThat().entriesListContains("id", adminUserModel.getUsername()); Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.getSiteMembers().assertThat().entriesListContains("id", adminUserModel.getUsername()));
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })

View File

@@ -38,7 +38,7 @@ public class GetPeopleActivitiesSanityTests extends RestTest
unauthenticatedUser.setPassword("newpassword"); unauthenticatedUser.setPassword("newpassword");
// only once the activity list is checked with retry in order not to wait the entire list in each test // only once the activity list is checked with retry in order not to wait the entire list in each test
restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(5); restActivityModelsCollection = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().getPersonActivitiesUntilEntriesCountIs(6);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
} }
@@ -49,9 +49,11 @@ public class GetPeopleActivitiesSanityTests extends RestTest
UserModel managerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteManager); UserModel managerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteManager);
dataContent.usingUser(managerUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN); dataContent.usingUser(managerUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restActivityModelsCollection = restClient.authenticateUser(managerUser).withCoreAPI().usingAuthUser().getPersonActivities(); restActivityModelsCollection = restClient.authenticateUser(managerUser).withCoreAPI()
.usingAuthUser().getPersonActivitiesUntilEntriesCountIs(6);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist(); restActivityModelsCollection.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
@@ -61,9 +63,11 @@ public class GetPeopleActivitiesSanityTests extends RestTest
UserModel collaboratorUser = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator); UserModel collaboratorUser = usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator);
dataContent.usingUser(collaboratorUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN); dataContent.usingUser(collaboratorUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restActivityModelsCollection = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser().getPersonActivities(); restActivityModelsCollection = restClient.authenticateUser(collaboratorUser).withCoreAPI()
.usingAuthUser().getPersonActivitiesUntilEntriesCountIs(6);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist(); restActivityModelsCollection.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
@@ -73,9 +77,11 @@ public class GetPeopleActivitiesSanityTests extends RestTest
UserModel contributorUser = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor); UserModel contributorUser = usersWithRoles.getOneUserWithRole(UserRole.SiteContributor);
dataContent.usingUser(contributorUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN); dataContent.usingUser(contributorUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
restActivityModelsCollection = restClient.authenticateUser(contributorUser).withCoreAPI().usingAuthUser().getPersonActivities(); restActivityModelsCollection = restClient.authenticateUser(contributorUser).withCoreAPI()
.usingAuthUser().getPersonActivitiesUntilEntriesCountIs(6);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist(); restActivityModelsCollection.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
@@ -84,18 +90,22 @@ public class GetPeopleActivitiesSanityTests extends RestTest
{ {
UserModel consumerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer); UserModel consumerUser = usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
restActivityModelsCollection = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser().getPersonActivities(); restActivityModelsCollection = restClient.authenticateUser(consumerUser).withCoreAPI()
.usingAuthUser().getPersonActivitiesUntilEntriesCountIs(6);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist(); restActivityModelsCollection.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify admin user gets another user activities with Rest API and response is successful") @TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.ACTIVITIES }, executionType = ExecutionType.SANITY, description = "Verify admin user gets another user activities with Rest API and response is successful")
public void adminUserShouldGetPeopleActivitiesList() throws Exception public void adminUserShouldGetPeopleActivitiesList() throws Exception
{ {
restActivityModelsCollection = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(userModel).getPersonActivities(); restActivityModelsCollection = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI()
.usingUser(userModel).getPersonActivitiesUntilEntriesCountIs(6);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
restActivityModelsCollection.assertThat().entriesListIsNotEmpty().and().entriesListContains("siteId", siteModel.getId()).and().paginationExist(); restActivityModelsCollection.assertThat().entriesListIsNotEmpty()
.and().entriesListContains("siteId", siteModel.getId()).and().paginationExist();
} }
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY }) @Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.ACTIVITIES, TestGroup.SANITY })

View File

@@ -145,7 +145,7 @@ public class GetRenditionTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.ACCEPTED); restClient.assertStatusCodeIs(HttpStatus.ACCEPTED);
STEP("2. Make GET rendition content using content-range header"); STEP("2. Make GET rendition content using content-range header");
Utility.sleep(1000, 30000, () -> { Utility.sleep(500, 30000, () -> {
restClient.configureRequestSpec().addHeader("content-range", "bytes=1-10"); restClient.configureRequestSpec().addHeader("content-range", "bytes=1-10");
restClient.authenticateUser(user).withCoreAPI().usingNode(file1).getNodeRenditionContent("pdf"); restClient.authenticateUser(user).withCoreAPI().usingNode(file1).getNodeRenditionContent("pdf");
restClient.assertStatusCodeIs(HttpStatus.PARTIAL_CONTENT); restClient.assertStatusCodeIs(HttpStatus.PARTIAL_CONTENT);

View File

@@ -115,7 +115,7 @@ public class SharedLinksSanityTests extends RestTest
* Get all shared-links while allowing indexing to complete and check * Get all shared-links while allowing indexing to complete and check
* that the created shared-link is displayed * that the created shared-link is displayed
*/ */
Utility.sleep(1000, 30000, () -> Utility.sleep(500, 30000, () ->
{ {
sharedLinksCollection = restClient.withCoreAPI().usingSharedLinks().getSharedLinks(); sharedLinksCollection = restClient.withCoreAPI().usingSharedLinks().getSharedLinks();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -223,7 +223,7 @@ public class SharedLinksSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.ACCEPTED); restClient.assertStatusCodeIs(HttpStatus.ACCEPTED);
// GET /renditions: wait until all renditions are created and GET all entries // GET /renditions: wait until all renditions are created and GET all entries
Utility.sleep(1000, 50000, () -> Utility.sleep(500, 50000, () ->
{ {
nodeRenditionInfoCollection = restClient.authenticateUser(testUser1).withCoreAPI().usingSharedLinks().getSharedLinkRenditions(sharedLink7); nodeRenditionInfoCollection = restClient.authenticateUser(testUser1).withCoreAPI().usingSharedLinks().getSharedLinkRenditions(sharedLink7);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -258,7 +258,7 @@ public class SharedLinksSanityTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.ACCEPTED); restClient.assertStatusCodeIs(HttpStatus.ACCEPTED);
// GET /renditions/{renditionId}/content: get the Range request header for file with shared links endpoints. // GET /renditions/{renditionId}/content: get the Range request header for file with shared links endpoints.
Utility.sleep(1000, 30000, () -> Utility.sleep(500, 30000, () ->
{ {
restClient.configureRequestSpec().addHeader("content-range", "bytes=1-10"); restClient.configureRequestSpec().addHeader("content-range", "bytes=1-10");
restClient.authenticateUser(testUser1).withCoreAPI().usingSharedLinks().getSharedLinkRenditionContent(sharedLink8, "pdf"); restClient.authenticateUser(testUser1).withCoreAPI().usingSharedLinks().getSharedLinkRenditionContent(sharedLink8, "pdf");

View File

@@ -2,6 +2,7 @@ package org.alfresco.rest.sites.members;
import org.alfresco.rest.RestTest; import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestErrorModel; import org.alfresco.rest.model.RestErrorModel;
import org.alfresco.utility.Utility;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser.ListUserWithRoles; import org.alfresco.utility.data.DataUser.ListUserWithRoles;
import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.exception.DataPreparationException;
@@ -47,8 +48,8 @@ public class RemoveSiteMemberTests extends RestTest
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)); restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(testUserModel); restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListDoesNotContain("id", testUserModel.getUsername()); .getSiteMembers().assertThat().entriesListDoesNotContain("id", testUserModel.getUsername()));
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
} }
@@ -64,8 +65,9 @@ public class RemoveSiteMemberTests extends RestTest
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(testUserModel); restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY); restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI()
.assertThat().entriesListContains("id", testUserModel.getUsername()); .usingSite(publicSiteModel).getSiteMembers()
.assertThat().entriesListContains("id", testUserModel.getUsername()));
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
} }
@@ -81,8 +83,8 @@ public class RemoveSiteMemberTests extends RestTest
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(testUserModel); restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY); restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListContains("id", testUserModel.getUsername()); .getSiteMembers().assertThat().entriesListContains("id", testUserModel.getUsername()));
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
} }
@@ -98,8 +100,8 @@ public class RemoveSiteMemberTests extends RestTest
.deleteSiteMember(testUserModel); .deleteSiteMember(testUserModel);
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY); restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListContains("id", testUserModel.getUsername()); .getSiteMembers().assertThat().entriesListContains("id", testUserModel.getUsername()));
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
} }
@@ -171,8 +173,8 @@ public class RemoveSiteMemberTests extends RestTest
.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(anothermanager); .withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(anothermanager);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListDoesNotContain("id", anothermanager.getUsername()); .getSiteMembers().assertThat().entriesListDoesNotContain("id", anothermanager.getUsername()));
} }
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
@@ -188,8 +190,8 @@ public class RemoveSiteMemberTests extends RestTest
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(meUser); restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(meUser);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListDoesNotContain("id", manager.getUsername()); .getSiteMembers().assertThat().entriesListDoesNotContain("id", manager.getUsername()));
} }
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
@@ -288,8 +290,8 @@ public class RemoveSiteMemberTests extends RestTest
.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(contributorForDelete); .withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(contributorForDelete);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListDoesNotContain("id", contributorForDelete.getUsername()); .getSiteMembers().assertThat().entriesListDoesNotContain("id", contributorForDelete.getUsername()));
} }
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
@@ -346,8 +348,8 @@ public class RemoveSiteMemberTests extends RestTest
.withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(collaboratorForDelete); .withCoreAPI().usingSite(publicSiteModel).deleteSiteMember(collaboratorForDelete);
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT); restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteMembers() Utility.sleep(300, 10000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
.assertThat().entriesListDoesNotContain("id", collaboratorForDelete.getUsername()); .getSiteMembers().assertThat().entriesListDoesNotContain("id", collaboratorForDelete.getUsername()));
} }
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION, @TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,

View File

@@ -8,19 +8,12 @@ import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR}) @Test(groups = {TestGroup.REQUIRE_SOLR})
public class GetTagTests extends TagsDataPrep public class GetTagTests extends TagsDataPrep
{ {
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
init();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, description = "Verify admin user gets tag using REST API and status code is OK (200)") @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, description = "Verify admin user gets tag using REST API and status code is OK (200)")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
public void adminIsAbleToGetTag() throws Exception public void adminIsAbleToGetTag() throws Exception

View File

@@ -1,5 +1,6 @@
package org.alfresco.rest.tags; package org.alfresco.rest.tags;
import java.util.Date;
import org.alfresco.dataprep.CMISUtil; import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestTest; import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestTagModel; import org.alfresco.rest.model.RestTagModel;
@@ -13,6 +14,7 @@ import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR}) @Test(groups = {TestGroup.REQUIRE_SOLR})
@@ -28,18 +30,9 @@ public class TagsDataPrep extends RestTest
protected static String documentTagValue, documentTagValue2, folderTagValue; protected static String documentTagValue, documentTagValue2, folderTagValue;
protected static RestTagModel documentTag, documentTag2, folderTag, returnedModel; protected static RestTagModel documentTag, documentTag2, folderTag, returnedModel;
protected static RestTagModelsCollection returnedCollection; protected static RestTagModelsCollection returnedCollection;
private static boolean isInitialized = false;
@BeforeClass
public void init() throws Exception public void init() throws Exception
{
if(!isInitialized)
{
isInitialized = true;
initialization();
}
}
public void initialization() throws Exception
{ {
adminUserModel = dataUser.getAdminUser(); adminUserModel = dataUser.getAdminUser();
//Create public site //Create public site
@@ -58,7 +51,7 @@ public class TagsDataPrep extends RestTest
folderTag = restClient.withCoreAPI().usingResource(folder).addTag(folderTagValue); folderTag = restClient.withCoreAPI().usingResource(folder).addTag(folderTagValue);
// Allow indexing to complete. // Allow indexing to complete.
Utility.sleep(1000, 60000, () -> Utility.sleep(500, 60000, () ->
{ {
returnedCollection = restClient.withParams("maxItems=10000").withCoreAPI().getTags(); returnedCollection = restClient.withParams("maxItems=10000").withCoreAPI().getTags();
returnedCollection.assertThat().entriesListContains("tag", documentTagValue.toLowerCase()) returnedCollection.assertThat().entriesListContains("tag", documentTagValue.toLowerCase())

View File

@@ -12,7 +12,6 @@ import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@@ -25,12 +24,6 @@ public class UpdateTagTests extends TagsDataPrep
private RestTagModel oldTag; private RestTagModel oldTag;
private String randomTag = ""; private String randomTag = "";
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
init();
}
@BeforeMethod(alwaysRun=true) @BeforeMethod(alwaysRun=true)
public void addTagToDocument() throws Exception public void addTagToDocument() throws Exception
{ {

View File

@@ -16,7 +16,6 @@ import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@@ -31,12 +30,6 @@ public class AddTagTests extends TagsDataPrep
private RestCommentModel returnedModelComment; private RestCommentModel returnedModelComment;
private RestTagModelsCollection returnedModelTags; private RestTagModelsCollection returnedModelTags;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
init();
}
@BeforeMethod(alwaysRun = true) @BeforeMethod(alwaysRun = true)
public void generateRandomTag() public void generateRandomTag()
{ {

View File

@@ -14,7 +14,6 @@ import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@@ -28,12 +27,6 @@ public class AddTagsTests extends TagsDataPrep
private String tag1, tag2; private String tag1, tag2;
private RestTagModelsCollection returnedCollection; private RestTagModelsCollection returnedCollection;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
init();
}
@BeforeMethod(alwaysRun = true) @BeforeMethod(alwaysRun = true)
public void generateRandomTagsList() public void generateRandomTagsList()
{ {

View File

@@ -15,7 +15,6 @@ import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@@ -27,12 +26,6 @@ public class DeleteTagTests extends TagsDataPrep
private RestTagModel tag; private RestTagModel tag;
private FileModel contributorDoc; private FileModel contributorDoc;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
init();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
description = "Verify Admin user deletes tags with Rest API and status code is 204") description = "Verify Admin user deletes tags with Rest API and status code is 204")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION }) @Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })

View File

@@ -13,23 +13,11 @@ import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail; import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR}) @Test(groups = {TestGroup.REQUIRE_SOLR})
public class GetNodeTagsTests extends TagsDataPrep public class GetNodeTagsTests extends TagsDataPrep
{ {
private String tagValue;
private String tagValue2;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
init();
tagValue = documentTagValue;
tagValue2 = documentTagValue2;
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
executionType = ExecutionType.SANITY, description = "Verify site Manager is able to get node tags") executionType = ExecutionType.SANITY, description = "Verify site Manager is able to get node tags")
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY }) @Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.SANITY })
@@ -40,8 +28,8 @@ public class GetNodeTagsTests extends TagsDataPrep
returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags(); returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat() returnedCollection.assertThat()
.entriesListContains("tag", tagValue.toLowerCase()) .entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()); .and().entriesListContains("tag", documentTagValue2.toLowerCase());
} }
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
@@ -54,8 +42,8 @@ public class GetNodeTagsTests extends TagsDataPrep
returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags(); returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat() returnedCollection.assertThat()
.entriesListContains("tag", tagValue.toLowerCase()) .entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()); .and().entriesListContains("tag", documentTagValue2.toLowerCase());
} }
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
@@ -68,8 +56,8 @@ public class GetNodeTagsTests extends TagsDataPrep
returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags(); returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat() returnedCollection.assertThat()
.entriesListContains("tag", tagValue.toLowerCase()) .entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()); .and().entriesListContains("tag", documentTagValue2.toLowerCase());
} }
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
@@ -82,8 +70,8 @@ public class GetNodeTagsTests extends TagsDataPrep
returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags(); returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat() returnedCollection.assertThat()
.entriesListContains("tag", tagValue.toLowerCase()) .entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()); .and().entriesListContains("tag", documentTagValue2.toLowerCase());
} }
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
@@ -95,8 +83,8 @@ public class GetNodeTagsTests extends TagsDataPrep
returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags(); returnedCollection = restClient.withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat() returnedCollection.assertThat()
.entriesListContains("tag", tagValue.toLowerCase()) .entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()); .and().entriesListContains("tag", documentTagValue2.toLowerCase());
} }
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS },
@@ -181,13 +169,13 @@ public class GetNodeTagsTests extends TagsDataPrep
{ {
FolderModel folder = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder(); FolderModel folder = dataContent.usingUser(adminUserModel).usingSite(siteModel).createFolder();
restClient.withCoreAPI().usingResource(folder).addTag(tagValue); restClient.withCoreAPI().usingResource(folder).addTag(documentTagValue);
restClient.withCoreAPI().usingResource(folder).addTag(tagValue2); restClient.withCoreAPI().usingResource(folder).addTag(documentTagValue2);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getNodeTags() restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(folder).getNodeTags()
.assertThat() .assertThat()
.entriesListContains("tag", tagValue.toLowerCase()) .entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()); .and().entriesListContains("tag", documentTagValue2.toLowerCase());
} }
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, @TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION,
@@ -198,8 +186,8 @@ public class GetNodeTagsTests extends TagsDataPrep
returnedCollection = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)) returnedCollection = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.withParams("properties=tag").withCoreAPI().usingResource(document).getNodeTags(); .withParams("properties=tag").withCoreAPI().usingResource(document).getNodeTags();
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
returnedCollection.assertThat().entriesListContains("tag", tagValue.toLowerCase()) returnedCollection.assertThat().entriesListContains("tag", documentTagValue.toLowerCase())
.and().entriesListContains("tag", tagValue2.toLowerCase()) .and().entriesListContains("tag", documentTagValue2.toLowerCase())
.and().entriesListDoesNotContain("id"); .and().entriesListDoesNotContain("id");
} }
@@ -251,7 +239,7 @@ public class GetNodeTagsTests extends TagsDataPrep
{ {
FileModel file = dataContent.usingAdmin().usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN); FileModel file = dataContent.usingAdmin().usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addTag(tagValue); restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).addTag(documentTagValue);
returnedCollection = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager)) returnedCollection = restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager))
.withCoreAPI().usingResource(file).getNodeTags(); .withCoreAPI().usingResource(file).getNodeTags();

View File

@@ -197,7 +197,7 @@ public class GetDeletedNodesTests extends RestTest
dataContent.usingUser(adminUserModel).usingResource(file3).deleteContent(); dataContent.usingUser(adminUserModel).usingResource(file3).deleteContent();
// GET /deleted-nodes/{nodeId}/renditions // GET /deleted-nodes/{nodeId}/renditions
Utility.sleep(1000, 30000, () -> Utility.sleep(500, 60000, () ->
{ {
nodeRenditionInfoCollection = restClient.authenticateUser(adminUserModel).withCoreAPI().usingTrashcan().getDeletedNodeRenditions(file3); nodeRenditionInfoCollection = restClient.authenticateUser(adminUserModel).withCoreAPI().usingTrashcan().getDeletedNodeRenditions(file3);
restClient.assertStatusCodeIs(HttpStatus.OK); restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -236,7 +236,7 @@ public class GetDeletedNodesTests extends RestTest
dataContent.usingUser(adminUserModel).usingResource(file4).deleteContent(); dataContent.usingUser(adminUserModel).usingResource(file4).deleteContent();
// GET /deleted-nodes/{nodeId}/renditions/{id}/content and verify range request header // GET /deleted-nodes/{nodeId}/renditions/{id}/content and verify range request header
Utility.sleep(1000, 30000, () -> Utility.sleep(500, 60000, () ->
{ {
restClient.configureRequestSpec().addHeader("content-range", "bytes=1-10"); restClient.configureRequestSpec().addHeader("content-range", "bytes=1-10");
restClient.authenticateUser(adminUserModel).withCoreAPI().usingTrashcan().getDeletedNodeRenditionContent(file4, "pdf"); restClient.authenticateUser(adminUserModel).withCoreAPI().usingTrashcan().getDeletedNodeRenditionContent(file4, "pdf");

View File

@@ -7,9 +7,16 @@
<listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"/> <listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"/>
</listeners> </listeners>
<test name="Rest API Tests"> <!--
<packages> The suites in "test-suites" folder are balanced according to execution time to make the CI/CD efficient.
<package name="org.alfresco.rest.*"/> Any new test should be allocated inside the existing package or a new package should be created and
</packages> added to the test suit. Currently the packages are created according to API groupings plus "misc" folder
</test> with tests testing several APIs.
-->
<suite-files>
<suite-file path="test-suites/part1-suite.xml"/>
<suite-file path="test-suites/part2-suite.xml"/>
<suite-file path="test-suites/part3-suite.xml"/>
</suite-files>
</suite> </suite>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="REST API tests part1" preserve-order="true">
<listeners>
<listener class-name="org.alfresco.utility.report.HtmlReportListener"/>
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener"/>
<listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"/>
</listeners>
<test name="Part1">
<packages>
<package name="org.alfresco.rest.actions.*"/>
<package name="org.alfresco.rest.auth.*"/>
<package name="org.alfresco.rest.comments.*"/>
<package name="org.alfresco.rest.downloads.*"/>
<package name="org.alfresco.rest.favorites.*"/>
</packages>
</test>
</suite>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="REST API tests part2" preserve-order="true">
<listeners>
<listener class-name="org.alfresco.utility.report.HtmlReportListener"/>
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener"/>
<listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"/>
</listeners>
<test name="Part2">
<packages>
<package name="org.alfresco.rest.groups.*"/>
<package name="org.alfresco.rest.misc.*"/>
<package name="org.alfresco.rest.nodes.*"/>
<package name="org.alfresco.rest.people.*"/>
<package name="org.alfresco.rest.queries.*"/>
<package name="org.alfresco.rest.ratings.*"/>
</packages>
</test>
</suite>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="REST API tests part3" preserve-order="true">
<listeners>
<listener class-name="org.alfresco.utility.report.HtmlReportListener"/>
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener"/>
<listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"/>
</listeners>
<test name="Part3">
<packages>
<package name="org.alfresco.rest.renditions.*"/>
<package name="org.alfresco.rest.sharedLinks.*"/>
<package name="org.alfresco.rest.sites.*"/>
<package name="org.alfresco.rest.tags.*"/>
<package name="org.alfresco.rest.trashcan.*"/>
<package name="org.alfresco.rest.workflow.*"/>
</packages>
</test>
</suite>