mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
9 Commits
tas-restap
...
tas-restap
Author | SHA1 | Date | |
---|---|---|---|
|
3883fd22e3 | ||
|
183ac4c7cd | ||
|
fa1b8d46dd | ||
|
df35137d12 | ||
|
1d1b454978 | ||
|
deaee78d09 | ||
|
9e3c144a7d | ||
|
d0b100a88b | ||
|
9d807242ee |
@@ -2,18 +2,12 @@ dist: focal
|
||||
sudo: required
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk11
|
||||
- openjdk17
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2/repository
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
install: travis_retry mvn install -DskipTests=true -B -V
|
||||
|
||||
stages:
|
||||
- test
|
||||
- release
|
||||
@@ -22,7 +16,7 @@ jobs:
|
||||
include:
|
||||
- stage: test
|
||||
name: "Build and test"
|
||||
script: travis_retry mvn test -Dtest=ModelAssertionTest
|
||||
script: travis_retry mvn -B -V -ntp test
|
||||
- stage: release
|
||||
name: "Push to Nexus"
|
||||
if: fork = false AND branch = master AND type != pull_request AND commit_message !~ /\[no-release\]/
|
||||
@@ -33,5 +27,5 @@ jobs:
|
||||
- git checkout -B "${TRAVIS_BRANCH}"
|
||||
# Add email to link commits to user
|
||||
- git config user.email "${GIT_EMAIL}"
|
||||
# Skip building of release commits
|
||||
- mvn --batch-mode -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform
|
||||
# Make release
|
||||
- mvn --batch-mode -ntp -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -Darguments=-DskipTests release:clean release:prepare release:perform
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>restapi</artifactId>
|
||||
<name>alfresco-tas-restapi</name>
|
||||
<version>1.103</version>
|
||||
<version>1.106</version>
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-super-pom</artifactId>
|
||||
@@ -67,7 +67,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-tas-restapi.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-tas-restapi.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-tas-restapi</url>
|
||||
<tag>v1.103</tag>
|
||||
<tag>v1.106</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
|
@@ -66,6 +66,8 @@ public class RestRuleSetModel extends TestModel implements IRestModel<RestRuleSe
|
||||
private String id;
|
||||
/** The node id of the folder that owns this rule set */
|
||||
private String owningFolder;
|
||||
/** The reason why the rule set is included for the folder. */
|
||||
private String inclusionType;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
@@ -86,4 +88,14 @@ public class RestRuleSetModel extends TestModel implements IRestModel<RestRuleSe
|
||||
{
|
||||
this.owningFolder = owningFolder;
|
||||
}
|
||||
|
||||
public String getInclusionType()
|
||||
{
|
||||
return inclusionType;
|
||||
}
|
||||
|
||||
public void setInclusionType(String inclusionType)
|
||||
{
|
||||
this.inclusionType = inclusionType;
|
||||
}
|
||||
}
|
||||
|
@@ -1,128 +0,0 @@
|
||||
/*-
|
||||
* #%L
|
||||
* alfresco-tas-restapi
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.demo;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.dataprep.SiteService.Visibility;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RestDemoTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
restClient.authenticateUser(userModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data preparation – create site with custom details <br/>
|
||||
* Perform GET sites call using admin user<br/>
|
||||
* Check that created site is included in response <br/>
|
||||
* Perform GET site call, validate that site title, description and visibility are correct <br/>
|
||||
*
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
@Test(groups = { "demo" })
|
||||
public void adminRetrievesCorrectSiteDetails() throws JsonToModelConversionException
|
||||
{
|
||||
restClient.withCoreAPI().getSites().assertThat()
|
||||
.entriesListContains("id", siteModel.getId());
|
||||
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSite()
|
||||
.assertThat().field("id").isNotNull()
|
||||
.assertThat().field("description").is(siteModel.getDescription())
|
||||
.assertThat().field("title").is(siteModel.getTitle())
|
||||
.assertThat().field("visibility").is(Visibility.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data preparation – create site and document on server <br/>
|
||||
* POST one comment to file using admin user <br/>
|
||||
* Perform GET comments, check the new one is listed <br/>
|
||||
* Update existing comment using PUT call, check that comment content is updated <br/>
|
||||
*/
|
||||
//Opened DESKTOPAPP-475 for fixing the failing test
|
||||
// @Test(groups = { "demo" })
|
||||
public void adminCanPostAndUpdateComments()
|
||||
{
|
||||
FileModel fileModel = dataContent.usingUser(userModel)
|
||||
.usingResource(FolderModel.getSharedFolderModel())
|
||||
.createContent(DocumentType.TEXT_PLAIN);
|
||||
// add new comment
|
||||
restClient.withCoreAPI().usingResource(fileModel).addComment("This is a new comment");
|
||||
restClient.withCoreAPI().usingResource(fileModel).getNodeComments()
|
||||
.assertThat().entriesListIsNotEmpty().and()
|
||||
.entriesListContains("content", "This is a new comment");
|
||||
}
|
||||
|
||||
/**
|
||||
* Data preparation – create site and a new user <br/>
|
||||
* As admin, add user as Consumer to site as a new site member using POST call <br/>
|
||||
* Update site member role to Manager using PUT call <br/>
|
||||
* Delete site member using DELETE call <br/>
|
||||
*
|
||||
* @throws DataPreparationException
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
@Test(groups = { "demo" })
|
||||
public void adminCanAddAndUpdateSiteMemberDetails()
|
||||
{
|
||||
UserModel testUser = dataUser.createRandomTestUser("testUser");
|
||||
testUser.setUserRole(UserRole.SiteConsumer);
|
||||
|
||||
// add user as Consumer to site
|
||||
restClient.withCoreAPI().usingSite(siteModel).addPerson(testUser);
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSiteMembers().assertThat().entriesListContains("id", testUser.getUsername())
|
||||
.when().getSiteMember(testUser.getUsername())
|
||||
.assertSiteMemberHasRole(UserRole.SiteConsumer);
|
||||
|
||||
// update site member to Manager
|
||||
testUser.setUserRole(UserRole.SiteCollaborator);
|
||||
restClient.withCoreAPI().usingSite(siteModel).updateSiteMember(testUser);
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSiteMembers().and()
|
||||
.entriesListContains("id", testUser.getUsername())
|
||||
.when().getSiteMember(testUser.getUsername())
|
||||
.assertSiteMemberHasRole(UserRole.SiteCollaborator);
|
||||
|
||||
restClient.withCoreAPI().usingSite(siteModel).deleteSiteMember(testUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
/*-
|
||||
* #%L
|
||||
* alfresco-tas-restapi
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.demo;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestCommentModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class SampleCommentsTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
private FolderModel folderModel;
|
||||
private SiteModel siteModel;
|
||||
private FileModel document;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation()
|
||||
{
|
||||
userModel = dataUser.getAdminUser();
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
folderModel = dataContent.usingUser(userModel).usingSite(siteModel).createFolder();
|
||||
restClient.authenticateUser(userModel);
|
||||
document = dataContent.usingUser(userModel).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void admiShouldAddComment() throws JsonToModelConversionException
|
||||
{
|
||||
restClient.withCoreAPI().usingResource(document).addComment("This is a new comment");
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void admiShouldRetrieveComments()
|
||||
{
|
||||
restClient.withCoreAPI().usingResource(document).getNodeComments();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldUpdateComment() throws JsonToModelConversionException
|
||||
{
|
||||
RestCommentModel commentModel = restClient.withCoreAPI().usingResource(document).addComment("This is a new comment");
|
||||
|
||||
restClient.withCoreAPI().usingResource(document).updateComment(commentModel, "This is the updated comment with Collaborator user")
|
||||
.assertThat().field("content").is("This is the updated comment with Collaborator user");
|
||||
}
|
||||
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
/*-
|
||||
* #%L
|
||||
* alfresco-tas-restapi
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.demo;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class SamplePeopleTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
private UserModel adminUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20));
|
||||
adminUser = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(adminUser);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldRetrievePerson()
|
||||
{
|
||||
restClient.withCoreAPI().usingUser(userModel).getPerson().assertThat().field("id").isNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
@@ -1,104 +0,0 @@
|
||||
/*-
|
||||
* #%L
|
||||
* alfresco-tas-restapi
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.demo;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class SampleSitesTests extends RestTest
|
||||
{
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.getAdminUser();
|
||||
restClient.authenticateUser(userModel);
|
||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldGetSiteDetails() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSite()
|
||||
.assertThat().field("id").isNotNull();
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldGetSites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSite();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldAccessSites() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.withCoreAPI().getSites().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldAccessResponsePagination() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.withCoreAPI().getSites().assertThat().paginationExist();
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldAddNewSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
|
||||
{
|
||||
UserModel testUser = dataUser.createRandomTestUser("testUser");
|
||||
testUser.setUserRole(UserRole.SiteConsumer);
|
||||
restClient.withCoreAPI().usingSite(siteModel).addPerson(testUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldGetSiteFromSitesList() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", siteModel.getId());
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void adminShouldAccessSiteDetails() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
restClient.withCoreAPI().usingSite(siteModel).getSite()
|
||||
.assertThat().field("id").isNotNull()
|
||||
.and().field("description").is(siteModel.getDescription())
|
||||
.and().field("title").is(siteModel.getTitle())
|
||||
.and().field("visibility").is(siteModel.getVisibility());
|
||||
}
|
||||
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
/*-
|
||||
* #%L
|
||||
* alfresco-tas-restapi
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.demo.workshop;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RestApiDemoTests extends RestTest
|
||||
{
|
||||
/*
|
||||
* Test steps:
|
||||
* 1. create a user
|
||||
* 2. create a site
|
||||
* 3. create a second user
|
||||
* 4. add the second user to site with a user role
|
||||
* 5. call rest api call " GET sites/{siteId}/members" with first user authenticated
|
||||
* Expected: the response contains the user added as a member to the site
|
||||
*/
|
||||
@Test(groups = { "demo" })
|
||||
public void verifyGetSiteMembersRestApiCall()
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
|
||||
UserModel member = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(user).addUserToSite(member, site, UserRole.SiteCollaborator);
|
||||
|
||||
//add here code for step 5
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Test steps:
|
||||
* 1. create a user
|
||||
* 2. create a site
|
||||
* 3. create a second user
|
||||
* 4. add the second user to site with a user role
|
||||
* 5. call rest api call " GET sites/{siteId}/members/{personId}" with first user authenticated
|
||||
* Expected: the response contains the user added as a member to the site
|
||||
*/
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void verifyGetASiteMemberApiCall()
|
||||
{
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
SiteModel site = dataSite.usingUser(user).createPublicRandomSite();
|
||||
UserModel member = dataUser.createRandomTestUser();
|
||||
dataUser.usingUser(user).addUserToSite(member, site, UserRole.SiteCollaborator);
|
||||
|
||||
//add here code for step 5
|
||||
}
|
||||
}
|
@@ -1,63 +0,0 @@
|
||||
/*-
|
||||
* #%L
|
||||
* alfresco-tas-restapi
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.demo.workshop;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* Demo workshop for RestAPI test
|
||||
*
|
||||
*/
|
||||
public class RestApiWorkshopTests extends RestTest
|
||||
{
|
||||
@Test(groups = { "demo" })
|
||||
public void verifyGetSitesRestApiCall()
|
||||
{
|
||||
// creating a random user in repository
|
||||
|
||||
// create a new random site using your UserModel from above
|
||||
|
||||
// using "siteApi", call get "/sites" Rest API and verify created site is present
|
||||
|
||||
// verify status is OK
|
||||
|
||||
}
|
||||
|
||||
@Test(groups = { "demo" })
|
||||
public void verifyGetASiteRestApiCall()
|
||||
{
|
||||
// creating a random user in repository
|
||||
|
||||
// create a new random site using your UserModel from above
|
||||
|
||||
// using "siteApi", call get "/sites/{siteId}" Rest API
|
||||
// using "siteApi", verify created site is present
|
||||
|
||||
// verify status is OK
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user