mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
REPO-2301 : RestAPI: Implement TAS tests for 'Nodes' RestApi endpoint - part 2
REPO-2299 : RestAPI: Implement TAS tests for 'Nodes' RestApi endpoint - part 1
- code formatting
This commit is contained in:
@@ -22,19 +22,16 @@ import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.TestRailExecutorListener;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Listeners;
|
||||
import org.testng.annotations.Test;
|
||||
/**
|
||||
*
|
||||
* @author mpopa
|
||||
*
|
||||
*/
|
||||
@Listeners(value=TestRailExecutorListener.class)
|
||||
public class NodesContentTests extends RestTest
|
||||
{
|
||||
private UserModel user1, user2;
|
||||
@@ -126,7 +123,7 @@ public class NodesContentTests extends RestTest
|
||||
|
||||
String initialNodeVersion = new JSONObject(initialNode.toJson()).getJSONObject("properties").getString("cm:versionLabel");
|
||||
String updatedBodyNodeVersion = new JSONObject(updatedBodyNode.toJson()).getJSONObject("properties").getString("cm:versionLabel");
|
||||
assertTrue(updatedBodyNodeVersion.charAt(0)>initialNodeVersion.charAt(0));
|
||||
assertTrue(updatedBodyNodeVersion.charAt(0) > initialNodeVersion.charAt(0));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.CORE })
|
||||
@@ -148,14 +145,14 @@ public class NodesContentTests extends RestTest
|
||||
.copyNode(postBody);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
STEP("3. parentId, createdAt, path and lock are different, but the nodes have the same contentSize.");
|
||||
STEP("3. ParentId, createdAt, path and lock are different, but the nodes have the same contentSize.");
|
||||
assertNotSame(copiedNode.getParentId(), initialNode.getParentId());
|
||||
assertNotSame(copiedNode.getCreatedAt(), initialNode.getCreatedAt());
|
||||
assertNotSame(copiedNode.getPath(), initialNode.getPath());
|
||||
assertTrue(initialNode.getIsLocked());
|
||||
assertSame(copiedNode.getContent().getSizeInBytes(), initialNode.getContent().getSizeInBytes());
|
||||
assertFalse(copiedNode.getIsLocked());
|
||||
|
||||
|
||||
STEP("4. Unlock the node (this node may be used in the next tests).");
|
||||
initialNode = restClient.authenticateUser(user1).withCoreAPI().usingNode(file1).usingParams("include=isLocked").unlockNode();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
@@ -36,16 +36,16 @@ public class NodesParentChildrenTests extends RestTest
|
||||
RestNodeBodyModel node = new RestNodeBodyModel();
|
||||
node.setName("My Folder");
|
||||
node.setNodeType("cm:folder");
|
||||
|
||||
RestNodeModel newNode = restClient.withParams("autoRename=true").withCoreAPI().usingNode(ContentModel.my()).createNode(node);
|
||||
|
||||
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());
|
||||
.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})
|
||||
@@ -53,17 +53,17 @@ public class NodesParentChildrenTests extends RestTest
|
||||
{
|
||||
//configuring multipart form
|
||||
restClient.authenticateUser(dataContent.getAdminUser())
|
||||
.configureRequestSpec()
|
||||
.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");
|
||||
.assertThat().field("name").contains("restapi-resource");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NODES }, executionType = ExecutionType.SANITY,
|
||||
@@ -76,18 +76,18 @@ public class NodesParentChildrenTests extends RestTest
|
||||
*/
|
||||
NodesBuilder nodesBuilder = restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.withCoreAPI().usingNode(ContentModel.my())
|
||||
.defineNodes();
|
||||
.defineNodes();
|
||||
nodesBuilder
|
||||
.folder("F1")
|
||||
.folder("F2")
|
||||
.folder("F3")
|
||||
.folder("F3")
|
||||
.file("f1")
|
||||
.file("f2")
|
||||
.file("f3");
|
||||
|
||||
RestNodeModelsCollection returnedFiles = restClient.withParams("maxItems=2",
|
||||
"skipCount=1",
|
||||
String.format("relativePath=%s/%s", nodesBuilder.getNode("F2").getName(), nodesBuilder.getNode("F3").getName()))
|
||||
String.format("relativePath=%s/%s", nodesBuilder.getNode("F2").getName(), nodesBuilder.getNode("F3").getName()))
|
||||
.withCoreAPI().usingNode(nodesBuilder.getNode("F1").toContentModel()).listChildren();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class NodesParentChildrenTests extends RestTest
|
||||
*/
|
||||
returnedFiles.assertThat().entriesListCountIs(2);
|
||||
returnedFiles.getEntries().get(0).onModel().assertThat().field("id").is(nodesBuilder.getNode("f2").getId());
|
||||
returnedFiles.getEntries().get(1).onModel().assertThat().field("id").is(nodesBuilder.getNode("f3").getId());
|
||||
returnedFiles.getEntries().get(1).onModel().assertThat().field("id").is(nodesBuilder.getNode("f3").getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user