Merge branch 'master' into TAS-2608

This commit is contained in:
Cristina Axinte
2017-01-09 11:17:18 +02:00
14 changed files with 105 additions and 42 deletions
@@ -12,7 +12,7 @@ import org.testng.annotations.Test;
public class AuthTests extends RestTest
{
@TestRail(section = { TestGroup.REST_API }, executionType = ExecutionType.SANITY, description = "Verify TICKET is returned on admin user")
@TestRail(section = { TestGroup.REST_API, TestGroup.AUTH }, executionType = ExecutionType.SANITY, description = "Verify TICKET is returned on admin user")
@Test(groups = { TestGroup.REST_API, TestGroup.SANITY })
public void adminShouldGetTicketBody() throws JsonToModelConversionException, Exception
{
@@ -20,7 +20,7 @@ public class AuthTests extends RestTest
ticketBody.setUserId("admin");
ticketBody.setPassword("admin");
RestTicketModel ticketReturned = restClient.withAuthAPI().createTicket(ticketBody);
RestTicketModel ticketReturned = restClient.authenticateUser(dataContent.getAdminUser()).withAuthAPI().createTicket(ticketBody);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
ticketReturned.assertThat().field("id").contains("TICKET_");
@@ -15,7 +15,7 @@ import org.springframework.social.alfresco.api.entities.Site.Visibility;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = { "demo" })
public class RestDemoTests extends RestTest
{
private UserModel userModel;
@@ -38,7 +38,7 @@ public class RestDemoTests extends RestTest
* @throws JsonToModelConversionException
* @throws Exception
*/
@Test
@Test(groups = { "demo" })
public void adminRetrievesCorrectSiteDetails() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().getSites().assertThat()
@@ -58,7 +58,7 @@ public class RestDemoTests extends RestTest
* Update existing comment using PUT call, check that comment content is updated <br/>
* @throws Exception
*/
@Test
@Test(groups = { "demo" })
public void adminCanPostAndUpdateComments() throws Exception
{
FileModel fileModel = dataContent.usingUser(userModel)
@@ -80,7 +80,7 @@ public class RestDemoTests extends RestTest
* @throws DataPreparationException
* @throws JsonToModelConversionException
*/
@Test
@Test(groups = { "demo" })
public void adminCanAddAndUpdateSiteMemberDetails() throws Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
@@ -12,7 +12,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = { "demo" })
public class SampleCommentsTests extends RestTest
{
private UserModel userModel;
@@ -30,21 +30,21 @@ public class SampleCommentsTests extends RestTest
document = dataContent.usingUser(userModel).usingResource(folderModel).createContent(DocumentType.TEXT_PLAIN);
}
@Test
@Test(groups = { "demo" })
public void admiShouldAddComment() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().usingResource(document).addComment("This is a new comment");
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@Test
@Test(groups = { "demo" })
public void admiShouldRetrieveComments() throws Exception
{
restClient.withCoreAPI().usingResource(document).getNodeComments();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test
@Test(groups = { "demo" })
public void adminShouldUpdateComment() throws JsonToModelConversionException, Exception
{
RestCommentModel commentModel = restClient.withCoreAPI().usingResource(document).addComment("This is a new comment");
@@ -8,7 +8,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = { "demo" })
public class SamplePeopleTests extends RestTest
{
private UserModel userModel;
@@ -22,7 +22,7 @@ public class SamplePeopleTests extends RestTest
restClient.authenticateUser(adminUser);
}
@Test
@Test(groups = { "demo" })
public void adminShouldRetrievePerson() throws Exception
{
restClient.withCoreAPI().usingUser(userModel).getPerson().assertThat().field("id").isNotEmpty();
@@ -10,7 +10,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = { "demo" })
public class SampleSitesTests extends RestTest
{
private UserModel userModel;
@@ -24,34 +24,34 @@ public class SampleSitesTests extends RestTest
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
}
@Test
@Test(groups = { "demo" })
public void adminShouldGetSiteDetails() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().usingSite(siteModel).getSite()
.assertThat().field("id").isNotNull();
}
@Test
@Test(groups = { "demo" })
public void adminShouldGetSites() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().usingSite(siteModel).getSite();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test
@Test(groups = { "demo" })
public void adminShouldAccessSites() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().getSites().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@Test
@Test(groups = { "demo" })
public void adminShouldAccessResponsePagination() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().getSites().assertThat().paginationExist();
}
@Test
@Test(groups = { "demo" })
public void adminShouldAddNewSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{
UserModel testUser = dataUser.createRandomTestUser("testUser");
@@ -60,13 +60,13 @@ public class SampleSitesTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.CREATED);
}
@Test
@Test(groups = { "demo" })
public void adminShouldGetSiteFromSitesList() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().getSites().assertThat().entriesListContains("id", siteModel.getId());
}
@Test
@Test(groups = { "demo" })
public void adminShouldAccessSiteDetails() throws JsonToModelConversionException, Exception
{
restClient.withCoreAPI().usingSite(siteModel).getSite()
@@ -17,7 +17,7 @@ public class RestApiDemoTests extends RestTest
* 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
@Test(groups = { "demo" })
public void verifyGetSiteMembersRestApiCall() throws Exception
{
UserModel user = dataUser.createRandomTestUser();
@@ -38,7 +38,8 @@ public class RestApiDemoTests extends RestTest
* 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
@Test(groups = { "demo" })
public void verifyGetASiteMemberApiCall() throws Exception
{
UserModel user = dataUser.createRandomTestUser();
@@ -10,7 +10,7 @@ import org.testng.annotations.Test;
*/
public class RestApiWorkshopTests extends RestTest
{
@Test
@Test(groups = { "demo" })
public void verifyGetSitesRestApiCall() throws Exception
{
// creating a random user in repository
@@ -23,7 +23,7 @@ public class RestApiWorkshopTests extends RestTest
}
@Test
@Test(groups = { "demo" })
public void verifyGetASiteRestApiCall() throws Exception
{
// creating a random user in repository
@@ -0,0 +1,58 @@
package org.alfresco.rest.nodes;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestNodeBodyModel;
import org.alfresco.rest.model.RestNodeModel;
import org.alfresco.utility.Utility;
import org.alfresco.utility.model.ContentModel;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
import org.testng.annotations.Test;
/**
* Handles tests related to api-explorer/#!/nodes/children
*/
public class NodesChildrenTests extends RestTest
{
@TestRail(section = { TestGroup.REST_API,TestGroup.NODES }, executionType = ExecutionType.SANITY,
description = "Verify new folder node is created as children on -my- posting as JSON content type")
@Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.SANITY})
public void createNewFolderNodeViaJason() throws Exception
{
restClient.authenticateUser(dataContent.getAdminUser());
RestNodeBodyModel node = new RestNodeBodyModel();
node.setName("My Folder");
node.setNodeType("cm:folder");
RestNodeModel newNode = restClient.withParams("autoRename=true").withCoreAPI().usingNode(ContentModel.my()).createNode(node);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
newNode.assertThat().field("aspectNames").contains("cm:auditable")
.assertThat().field("isFolder").is(true)
.assertThat().field("isFile").is(false)
.assertThat().field("name").contains(node.getName());
}
@TestRail(section = { TestGroup.REST_API,TestGroup.NODES }, executionType = ExecutionType.SANITY,
description = "Verify new folder node is created as children on -my- posting as MultiPart content type")
@Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.SANITY})
public void createNewFolderNodeWithMultiPartForms() throws Exception
{
//configuring multipart form
restClient.authenticateUser(dataContent.getAdminUser())
.configureRequestSpec()
.addMultiPart("filedata", Utility.getResourceTestDataFile("restapi-resource"))
.addFormParam("renditions", "doclib")
.addFormParam("autoRename", true);
RestNodeModel newNode = restClient.withCoreAPI().usingNode(ContentModel.my()).createNode();
restClient.assertStatusCodeIs(HttpStatus.CREATED);
newNode.assertThat().field("aspectNames").contains("cm:auditable")
.assertThat().field("isFolder").is(false)
.assertThat().field("isFile").is(true)
.assertThat().field("name").contains("restapi-resource");
}
}
@@ -1,5 +1,7 @@
package org.alfresco.rest.workflow.deployments;
import java.util.List;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestDeploymentModel;
import org.alfresco.rest.model.RestDeploymentModelsCollection;
@@ -13,8 +15,6 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.List;
/**
* Created by Claudia Agache on 12/7/2016.
*/
@@ -29,7 +29,7 @@ public class GetDeploymentsCoreTests extends RestTest
adminUser = dataUser.getAdminUser();
}
@TestRail(section = { TestGroup.REST_API, TestGroup.DEPLOYMENTS },
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
executionType = ExecutionType.REGRESSION,
description = "Verify non admin user is not able to get non-network deployments using REST API and status code is Forbidden")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS, TestGroup.CORE})
@@ -41,7 +41,7 @@ public class GetDeploymentsCoreTests extends RestTest
.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.DEPLOYMENTS },
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
executionType = ExecutionType.REGRESSION,
description = "Verify non admin user is not able to get network deployments using REST API and status code is Forbidden")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS, TestGroup.CORE, TestGroup.NETWORKS})
@@ -58,7 +58,7 @@ public class GetDeploymentsCoreTests extends RestTest
}
@Bug(id = "MNT-16996")
@TestRail(section = { TestGroup.REST_API, TestGroup.DEPLOYMENTS },
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS },
executionType = ExecutionType.REGRESSION,
description = "Verify get deployments returns an empty list after deleting all network deployments.")
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.DEPLOYMENTS, TestGroup.CORE, TestGroup.NETWORKS})
@@ -28,7 +28,7 @@ public class GetProcessCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
description = "Verify that using invalid process ID returns status code 404")
@Test(groups = { TestGroup.WORKFLOW, TestGroup.CORE})
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.CORE})
public void invalidProcessIdTest() throws Exception
{
RestProcessModel newProcess = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
@@ -41,7 +41,7 @@ public class GetProcessCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES, TestGroup.NETWORKS}, executionType = ExecutionType.REGRESSION,
description = "Verify that tenant user cannot get process from another network")
@Test(groups = { TestGroup.WORKFLOW, TestGroup.CORE, TestGroup.NETWORKS })
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.CORE, TestGroup.NETWORKS })
@Bug(id = "MNT-17238")
public void tenantUserCannotGetProcessFromAnotherNetwork() throws Exception
{
@@ -62,7 +62,7 @@ public class GetProcessCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
description = "Verify that tenant user can get process from the same network")
@Test(groups = { TestGroup.WORKFLOW, TestGroup.CORE, TestGroup.NETWORKS })
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.CORE, TestGroup.NETWORKS })
public void tenantUserCanGetProcessFromTheSameNetwork() throws Exception
{
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
@@ -79,7 +79,7 @@ public class GetProcessCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES, TestGroup.NETWORKS}, executionType = ExecutionType.REGRESSION,
description = "Verify that non network user cannot get process from a network")
@Test(groups = { TestGroup.WORKFLOW, TestGroup.CORE, TestGroup.NETWORKS })
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.CORE, TestGroup.NETWORKS })
@Bug(id = "MNT-17238")
public void nonNetworkUserCannotAccessNetworkprocess() throws Exception
{
@@ -37,8 +37,10 @@ public class GetProcessItemsCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE })
public void getProcessItemsAsAdminReturnsAnything() throws Exception
{
processModel = restClient.authenticateUser(adminUser).withParams("maxItems=2").withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.withWorkflowAPI().usingProcess(processModel).getProcessItems().assertThat().entriesListIsNotEmpty();
processModel = restClient.authenticateUser(userWhoStartsTask).withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(document);
restClient.authenticateUser(adminUser).withWorkflowAPI().usingProcess(processModel).getProcessItems().assertThat().entriesListIsNotEmpty();
restClient.assertStatusCodeIs(HttpStatus.OK);
}
@@ -67,7 +67,7 @@ public class GetTaskCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,
TestGroup.TASKS }, executionType = ExecutionType.REGRESSION, description = "Verify that in a network only tasks inside network are returned.")
@Test(groups = { TestGroup.NETWORKS })
@Test(groups = {TestGroup.NETWORKS,TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
public void tasksInsideNetworkReturned() throws Exception
{
restClient.authenticateUser(adminUser);
@@ -102,7 +102,7 @@ public class GetTasksCoreTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,
TestGroup.TASKS }, executionType = ExecutionType.REGRESSION, description = "Check that for network enabled only that network tasks are returned.")
@Test(groups = { TestGroup.NETWORKS })
@Test(groups = { TestGroup.REST_API, TestGroup.NETWORKS, TestGroup.CORE })
public void networkEnabledTasksReturned() throws Exception
{
restClient.authenticateUser(adminUser);