Skip to content

Commit

Permalink
Addition of unit tests and correction of parameters names in requests…
Browse files Browse the repository at this point in the history
… (#827)

Signed-off-by: NOIR Nicolas ext <[email protected]>
  • Loading branch information
niconoir committed Nov 13, 2019
1 parent 3a822e2 commit 498180f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public void test() throws IOException, InterruptedException {
assertEquals("", storage.getNodeInfo(testFolderInfo.getId()).getDescription());
assertTrue(storage.getNodeInfo(testFolderInfo.getId()).getCreationTime() > 0);
assertTrue(storage.getNodeInfo(testFolderInfo.getId()).getModificationTime() > 0);
assertEquals(testFolderInfo.getAccessRights(), storage.getNodeInfo(testFolderInfo.getId()).getAccessRights());
assertEquals(Collections.singletonMap("user1", 6), storage.getNodeInfo(testFolderInfo.getId()).getAccessRights().getUsersRights());
assertTrue(storage.getNodeInfo(testFolderInfo.getId()).getAccessRights().getGroupsRights().isEmpty());
assertNull(storage.getNodeInfo(testFolderInfo.getId()).getAccessRights().getOthersRights());

// check test folder is empty
assertTrue(storage.getChildNodes(testFolderInfo.getId()).isEmpty());
Expand Down Expand Up @@ -294,6 +298,8 @@ public void test() throws IOException, InterruptedException {
assertEquals(ImmutableMap.of("d1", 1d), testData2Info.getGenericMetadata().getDoubles());
assertEquals(ImmutableMap.of("i1", 2), testData2Info.getGenericMetadata().getInts());
assertEquals(ImmutableMap.of("b1", false), testData2Info.getGenericMetadata().getBooleans());
assertEquals(ImmutableMap.of("user1", 2, "user2", 4), testData2Info.getAccessRights().getUsersRights());
assertEquals(ImmutableMap.of("group1", 6), testData2Info.getAccessRights().getGroupsRights());

// 10) check data node 2 binary data write
try (OutputStream os = storage.writeBinaryData(testData2Info.getId(), "blob")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Response getInconsistentChildrenNodes(@ApiParam(value = "File system name
public Response createNode(@ApiParam(value = "File system name") @PathParam("fileSystemName") String fileSystemName,
@ApiParam(value = "Node ID") @PathParam("nodeId") String nodeId,
@ApiParam(value = "Child Name") @PathParam("childName") String childName,
@ApiParam(value = "Node Meta Data") NodeInfo nodeInfo) {
@ApiParam(value = "Node Data") NodeInfo nodeInfo) {
AppStorage storage = appDataBean.getStorage(fileSystemName);
NodeInfo newNodeInfo = storage.createNode(nodeId, childName, nodeInfo.getPseudoClass(), nodeInfo.getDescription(), nodeInfo.getVersion(), nodeInfo.getGenericMetadata(), nodeInfo.getAccessRights());
return Response.ok().entity(newNodeInfo).build();
Expand Down Expand Up @@ -188,7 +188,7 @@ public Response deleteNode(@ApiParam(value = "File system name") @PathParam("fil
@ApiOperation (value = "")
@ApiResponses (value = {@ApiResponse(code = 200, message = ""), @ApiResponse(code = 500, message = "Error")})
public Response setDescription(@ApiParam(value = "File system name") @PathParam("fileSystemName") String fileSystemName,
@ApiParam(value = "File system name") @PathParam("nodeId") String nodeId,
@ApiParam(value = "Node ID") @PathParam("nodeId") String nodeId,
@ApiParam(value = "Description") String description) {
AppStorage storage = appDataBean.getStorage(fileSystemName);
storage.setDescription(nodeId, description);
Expand All @@ -201,7 +201,7 @@ public Response setDescription(@ApiParam(value = "File system name") @PathParam(
@ApiOperation (value = "")
@ApiResponses (value = {@ApiResponse(code = 200, message = ""), @ApiResponse(code = 500, message = "Error")})
public Response setConsistent(@ApiParam(value = "File system name") @PathParam("fileSystemName") String fileSystemName,
@ApiParam(value = "File system name") @PathParam("nodeId") String nodeId) {
@ApiParam(value = "Node ID") @PathParam("nodeId") String nodeId) {
AppStorage storage = appDataBean.getStorage(fileSystemName);
storage.setConsistent(nodeId);
return Response.ok().build();
Expand All @@ -213,7 +213,7 @@ public Response setConsistent(@ApiParam(value = "File system name") @PathParam("
@ApiOperation (value = "")
@ApiResponses (value = {@ApiResponse(code = 200, message = ""), @ApiResponse(code = 500, message = "Error")})
public Response renameNode(@ApiParam(value = "File system name") @PathParam("fileSystemName") String fileSystemName,
@ApiParam(value = "File system name") @PathParam("nodeId") String nodeId,
@ApiParam(value = "Node ID") @PathParam("nodeId") String nodeId,
@ApiParam(value = "Name") String name) {
AppStorage storage = appDataBean.getStorage(fileSystemName);
storage.renameNode(nodeId, name);
Expand Down

0 comments on commit 498180f

Please sign in to comment.