From 9538443de13905314a490b2e46b65152c360e456 Mon Sep 17 00:00:00 2001 From: open-schnick Date: Thu, 29 Oct 2020 11:51:00 +0100 Subject: [PATCH 1/3] FileSystemRestController.java offers getContentsOfFolder with Path instead of id. --- .../domain/filesystem/rest/FileSystemRestController.java | 8 ++++---- .../domain/filesystem/rest/FileSystemRestService.java | 2 +- .../filesystem/rest/FileSystemRestServiceInterface.java | 2 +- .../filesystem/rest/FileSystemRestControllerUnitTest.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestController.java b/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestController.java index 683c36db..ca4341b4 100644 --- a/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestController.java +++ b/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestController.java @@ -25,14 +25,14 @@ public FileSystemRestController(FileSystemRestServiceInterface fileSystemRestSer this.fileSystemRestService = fileSystemRestService; } - @GetMapping(FS_BASE_URI + "{fsItemId}/contents") + @GetMapping(FS_BASE_URI + "contents") public EntityModel getContentsOfFolder( - @PathVariable long fsItemId, + @RequestHeader(value = "X-FF-PATH", defaultValue = "/") String path, @RequestHeader(value = "Authorization", defaultValue = AUTHORIZATION_BEARER_PREFIX + "token") String accessToken ) { - LOG.info("Requested Folder contents of id {}.", fsItemId); - return fileSystemRestService.getContentsOfFolderByIdAndAccessToken(fsItemId, accessToken); + LOG.info("Requested Folder contents of folder with path {}.", path); + return fileSystemRestService.getContentsOfFolderByIdAndAccessToken(path, accessToken); } @GetMapping(FS_BASE_URI + "{fsItemId}/info") diff --git a/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestService.java b/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestService.java index ce9f8a8b..67a1e4ec 100644 --- a/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestService.java +++ b/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestService.java @@ -11,7 +11,7 @@ public class FileSystemRestService implements FileSystemRestServiceInterface { @Override - public EntityModel getContentsOfFolderByIdAndAccessToken(long fsItemId, String accessToken) { + public EntityModel getContentsOfFolderByIdAndAccessToken(String path, String accessToken) { return null; } diff --git a/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestServiceInterface.java b/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestServiceInterface.java index f6e5bd46..f38ec0bb 100644 --- a/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestServiceInterface.java +++ b/src/main/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestServiceInterface.java @@ -7,7 +7,7 @@ import org.springframework.hateoas.EntityModel; public interface FileSystemRestServiceInterface { - EntityModel getContentsOfFolderByIdAndAccessToken(long fsItemId, String accessToken); + EntityModel getContentsOfFolderByIdAndAccessToken(String path, String accessToken); EntityModel getInfoAboutFileOrFolderByIdAndAccessToken(long fsItemId, String accessToken); EntityModel findFileOrFolderByNameAndAccessToken(String name, String accessToken); EntityModel uploadFileSystemItemWithAccessToken(FileSystemItemUpdate fileSystemItemUpdate, String accessToken); diff --git a/src/test/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestControllerUnitTest.java b/src/test/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestControllerUnitTest.java index b34a51e4..2ec70316 100644 --- a/src/test/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestControllerUnitTest.java +++ b/src/test/java/de/filefighter/rest/domain/filesystem/rest/FileSystemRestControllerUnitTest.java @@ -28,12 +28,12 @@ void getContentsOfFolder() { .files(new File[]{dummyFile}) .folders(new Folder[]{dummyFolder}).create()); - long id = 420; + String path= "/root/data.txt"; String token = "token"; - when(fileSystemRestServiceMock.getContentsOfFolderByIdAndAccessToken(id, token)).thenReturn(expectedModel); + when(fileSystemRestServiceMock.getContentsOfFolderByIdAndAccessToken(path, token)).thenReturn(expectedModel); - EntityModel actualModel = fileSystemRestController.getContentsOfFolder(id, token); + EntityModel actualModel = fileSystemRestController.getContentsOfFolder(path, token); assertEquals(expectedModel, actualModel); } From 1e3b8a1984b352acdc54cacd06f0a05f32e460b5 Mon Sep 17 00:00:00 2001 From: open-schnick Date: Thu, 29 Oct 2020 12:00:13 +0100 Subject: [PATCH 2/3] I think -P is setting maven profiles not spring boot profiles. --- .github/workflows/feature_branch_tests.yml | 2 +- .github/workflows/latestRelease.yml | 2 +- .github/workflows/stableRelease.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/feature_branch_tests.yml b/.github/workflows/feature_branch_tests.yml index 5ccd99d6..e978f42a 100644 --- a/.github/workflows/feature_branch_tests.yml +++ b/.github/workflows/feature_branch_tests.yml @@ -34,7 +34,7 @@ jobs: run: bash <(curl -s https://codecov.io/bash) -Z - name: Build Docker Image - run: mvn spring-boot:build-image -f pom.xml -P prod + run: mvn spring-boot:build-image -f pom.xml - name: Login to DockerHub uses: docker/login-action@v1 diff --git a/.github/workflows/latestRelease.yml b/.github/workflows/latestRelease.yml index 58157cf2..1d645ff6 100644 --- a/.github/workflows/latestRelease.yml +++ b/.github/workflows/latestRelease.yml @@ -32,7 +32,7 @@ jobs: run: mvn clean test -f pom.xml - name: Build Docker Image - run: mvn spring-boot:build-image -f pom.xml -P prod + run: mvn spring-boot:build-image -f pom.xml - name: Upload CodeCov. run: bash <(curl -s https://codecov.io/bash) -Z diff --git a/.github/workflows/stableRelease.yml b/.github/workflows/stableRelease.yml index b3a9bdf8..225b2438 100644 --- a/.github/workflows/stableRelease.yml +++ b/.github/workflows/stableRelease.yml @@ -26,7 +26,7 @@ jobs: run: mvn clean test -f pom.xml - name: Build Docker Image - run: mvn spring-boot:build-image -f pom.xml -P prod + run: mvn spring-boot:build-image -f pom.xml - name: Login to DockerHub uses: docker/login-action@v1 From d413741f67c57229c707929613a355bc78afc852 Mon Sep 17 00:00:00 2001 From: open-schnick Date: Thu, 29 Oct 2020 12:02:58 +0100 Subject: [PATCH 3/3] fixed naming of feature_branch_tests.yml --- .../workflows/{feature_branch_tests.yml => featureRelease.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{feature_branch_tests.yml => featureRelease.yml} (100%) diff --git a/.github/workflows/feature_branch_tests.yml b/.github/workflows/featureRelease.yml similarity index 100% rename from .github/workflows/feature_branch_tests.yml rename to .github/workflows/featureRelease.yml