From 5aba6ce0baf8de490ae988b5471d0ded34dcdbb6 Mon Sep 17 00:00:00 2001 From: nfcalabria <nfcalabria@localhost> Date: Thu, 30 Sep 2021 20:27:45 +0200 Subject: [PATCH] Fixed GetFileControllerTest --- .../controller/GetFileControllerTest.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/test/java/it/inaf/ia2/transfer/controller/GetFileControllerTest.java b/src/test/java/it/inaf/ia2/transfer/controller/GetFileControllerTest.java index 2f8f627..60b90b5 100644 --- a/src/test/java/it/inaf/ia2/transfer/controller/GetFileControllerTest.java +++ b/src/test/java/it/inaf/ia2/transfer/controller/GetFileControllerTest.java @@ -71,7 +71,8 @@ public class GetFileControllerTest { public void getPublicFile() throws Exception { FileInfo fileInfo = new FileInfo(); - fileInfo.setOsPath(tempFile.getAbsolutePath()); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath(tempFile.getAbsolutePath()); fileInfo.setVirtualPath("/path/to/myfile"); fileInfo.setPublic(true); @@ -86,7 +87,8 @@ public class GetFileControllerTest { public void testContextPathIsRemoved() throws Exception { FileInfo fileInfo = new FileInfo(); - fileInfo.setOsPath(tempFile.getAbsolutePath()); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath(tempFile.getAbsolutePath()); fileInfo.setVirtualPath("/path/to/myfile"); fileInfo.setPublic(true); @@ -108,7 +110,8 @@ public class GetFileControllerTest { public void testFileNotFoundOnDisk() throws Exception { FileInfo fileInfo = new FileInfo(); - fileInfo.setOsPath("/this/doesnt/exists"); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath("/this/doesnt/exist"); fileInfo.setPublic(true); when(fileDao.getFileInfo(any())).thenReturn(Optional.of(fileInfo)); @@ -153,7 +156,8 @@ public class GetFileControllerTest { FileInfo fileInfo = new FileInfo(); fileInfo.setVirtualPath("/path/to/myfile"); - fileInfo.setOsPath(tempFile.getAbsolutePath()); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath(tempFile.getAbsolutePath()); fileInfo.setOwnerId("123"); when(fileDao.getFileInfo(any())).thenReturn(Optional.of(fileInfo)); @@ -181,7 +185,8 @@ public class GetFileControllerTest { public void testGetFileWithJobId() throws Exception { FileInfo fileInfo = new FileInfo(); - fileInfo.setOsPath(tempFile.getAbsolutePath()); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath(tempFile.getAbsolutePath()); fileInfo.setVirtualPath("/path/to/myfile"); fileInfo.setPublic(true); @@ -216,7 +221,8 @@ public class GetFileControllerTest { unreadableFile.setReadable(false); FileInfo fileInfo = new FileInfo(); - fileInfo.setOsPath(unreadableFile.getAbsolutePath()); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath(unreadableFile.getAbsolutePath()); fileInfo.setVirtualPath("/path/to/myfile"); fileInfo.setPublic(true); @@ -246,7 +252,8 @@ public class GetFileControllerTest { when(gmsClient.isMemberOf(any(), any())).thenReturn(true); FileInfo fileInfo = new FileInfo(); - fileInfo.setOsPath(tempFile.getAbsolutePath()); + fileInfo.setActualBasePath("/"); + fileInfo.setFsPath(tempFile.getAbsolutePath()); fileInfo.setVirtualPath("/path/to/myfile"); fileInfo.setGroupRead(Collections.singletonList("group1")); -- GitLab