From 8116c2ac6f31a5c3fffd3cd331ab25f27489f81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 10:23:27 +0800 Subject: [PATCH 01/37] build(POM): update version to 1.2.2-SNAPSHOT feature/travis-ci-enhancement-oct-26-2020 --- media-streaming-sample-app/pom.xml | 2 +- media-streaming-spring-boot-autoconfigure/pom.xml | 2 +- media-streaming-spring-boot-starter/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/media-streaming-sample-app/pom.xml b/media-streaming-sample-app/pom.xml index f0471d9..b1d1901 100644 --- a/media-streaming-sample-app/pom.xml +++ b/media-streaming-sample-app/pom.xml @@ -5,7 +5,7 @@ com.github.johnnymillergh.boot media-streaming - 1.2.0 + 1.2.2-SNAPSHOT media-streaming-sample-app Media Streaming :: Sample App diff --git a/media-streaming-spring-boot-autoconfigure/pom.xml b/media-streaming-spring-boot-autoconfigure/pom.xml index ba3bfb6..5fe9c66 100644 --- a/media-streaming-spring-boot-autoconfigure/pom.xml +++ b/media-streaming-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ com.github.johnnymillergh.boot media-streaming - 1.2.0 + 1.2.2-SNAPSHOT media-streaming-spring-boot-autoconfigure Media Streaming :: Spring Boot Autoconfigure diff --git a/media-streaming-spring-boot-starter/pom.xml b/media-streaming-spring-boot-starter/pom.xml index 19dd05d..ae59d09 100644 --- a/media-streaming-spring-boot-starter/pom.xml +++ b/media-streaming-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.github.johnnymillergh.boot media-streaming - 1.2.0 + 1.2.2-SNAPSHOT media-streaming-spring-boot-starter Media Streaming :: Spring Boot Starter diff --git a/pom.xml b/pom.xml index d5fbbf7..4b5aaf6 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github.johnnymillergh.boot media-streaming - 1.2.0 + 1.2.2-SNAPSHOT Media Steaming Media Streaming for Java pom From 2a8cfe3ea9430b37f6cf52efa923742d926aa2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 11:12:43 +0800 Subject: [PATCH 02/37] build(Travis): update Travis deploy condition --- .travis.yml | 8 +++----- README.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28deca1..038515f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ jdk: oraclejdk11 # https://docs.travis-ci.com/user/job-lifecycle#skipping-the-installation-phase install: skip -# To prevent error like: +# Grant execute permission to prevent error like: # xxx.sh: Permission denied before_script: - chmod +x .travis/install.sh @@ -35,10 +35,8 @@ deploy: provider: script script: ./.travis/deploy.sh on: - branch: - - feature/** - - release/** - - hotfix/** + all_branches: true + condition: $TRAVIS_BRANCH =~ ^(feature|release|hotfix)\/.$ - skip_cleanup: true provider: script script: ./.travis/deploy.sh diff --git a/README.md b/README.md index d3a5c84..b6b5ada 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The easiest way is to install the library via [Nexus Repository Manager](https:/ com.github.johnnymillergh.boot media-streaming-spring-boot-starter - 1.2.0-SNAPSHOT + 1.2.1 ``` @@ -59,6 +59,47 @@ Alternatively, download it from the [releases page](https://github.com/johnnymil 3. Click the green triangle to Run. +## Useful Commands + +### Maven + +1. Set project version: + + ```shell + mvn versions:set -DgenerateBackupPoms=false -f pom.xml + ``` + +2. Build project: + + ```shell + mvn clean validate compile -f pom.xml + ``` + +### Conventional Changelog CLI + +1. Install global dependencies (optional if installed): + + ```shell + npm install -g conventional-changelog-cli + ``` + +2. This will *not* overwrite any previous changelogs. The above generates a changelog based on commits since the last semver tag that matches the pattern of "Feature", "Fix", "Performance Improvement" or "Breaking Changes". + + ```shell + conventional-changelog -p angular -i CHANGELOG.md -s + ``` + +3. If this is your first time using this tool and you want to generate all previous changelogs, you could do: + + ``` + conventional-changelog -p angular -i CHANGELOG.md -s -r 0 + ``` + +## CI (Continuous Integration) + +- [Travis CI](https://travis-ci.com/github/johnnymillergh/media-streaming) is for deploying SNAPSHOT and RELEASE on Nexus Central Repository. +- [GitHub Actions](https://github.com/johnnymillergh/media-streaming/actions) is for checking dependency updates and tests. + ## Maintainers [@johnnymillergh](https://github.com/johnnymillergh). From b83035a24767410bd316068f073f3d19a06f969e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 11:20:01 +0800 Subject: [PATCH 03/37] test(Travis): update install.sh --- .travis/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis/install.sh b/.travis/install.sh index 7eaa75a..dd68453 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,4 +1,8 @@ #!/bin/bash +CURRENT_DIR=$(pwd) + +echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" + # Run the maven install ./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version From d6f812e8a2e5ad26f6d50a9391cd7c9d21f258eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 12:47:40 +0800 Subject: [PATCH 04/37] build(Travis): correct deploy condition --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 038515f..1fb7846 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ install: skip # Grant execute permission to prevent error like: # xxx.sh: Permission denied before_script: + - "echo [INSTALL] INFO Grant execute permission" - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw @@ -28,6 +29,8 @@ script: # Decrypt file `gpg.asc.enc` before deployment # https://docs.travis-ci.com/user/encrypting-files/ before_deploy: + - "echo [DEPLOYMENT] INFO TRAVIS_BRANCH: $TRAVIS_BRANCH" + - "echo [DEPLOYMENT] INFO TRAVIS_TAG: $TRAVIS_TAG" - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d deploy: @@ -36,7 +39,7 @@ deploy: script: ./.travis/deploy.sh on: all_branches: true - condition: $TRAVIS_BRANCH =~ ^(feature|release|hotfix)\/.$ + condition: $TRAVIS_BRANCH =~ ^(feature|release|hotfix)\/.*$ - skip_cleanup: true provider: script script: ./.travis/deploy.sh From d0f467cadad142baa9ec47a9f04ba3cfce214f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 12:49:09 +0800 Subject: [PATCH 05/37] build(Travis): make message friendly --- .travis/deploy.sh | 2 ++ .travis/install.sh | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 69e60e7..ffed617 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -7,6 +7,8 @@ # expects file to exist: # - .travis/gpg.asc +# Exit immediately if a command exits with a non-zero status. +# https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e # Check the variables are set diff --git a/.travis/install.sh b/.travis/install.sh index dd68453..5a7d854 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,8 +1,18 @@ #!/bin/bash +# Exit immediately if a command exits with a non-zero status. +# https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script +set -e + CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" -# Run the maven install -./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version +INSTALL_COMMAND_RESULT=$(./../mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) + +if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then + echo "[INSTALL] INFO Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" +else + echo "[INSTALL] INFO Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 + exit 1 +fi From 533457cc4114f07921fe94a2e2b3d9d44cb81609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 12:54:06 +0800 Subject: [PATCH 06/37] build(Travis): display directory --- .travis/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 5a7d854..d976e85 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -5,9 +5,11 @@ set -e CURRENT_DIR=$(pwd) - echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" +command "ls" +command "ls ../" + INSTALL_COMMAND_RESULT=$(./../mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then From 8682f5cdd91f54ce242fa05d13605a5593816db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:00:16 +0800 Subject: [PATCH 07/37] build(Travis): correct command --- .travis/install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index d976e85..a65969a 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -6,11 +6,9 @@ set -e CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" +command "ll" -command "ls" -command "ls ../" - -INSTALL_COMMAND_RESULT=$(./../mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) +INSTALL_COMMAND_RESULT=$(./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then echo "[INSTALL] INFO Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" From 70c16e99ee5bb1fb23f62088d543929e90d8ac1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:05:16 +0800 Subject: [PATCH 08/37] build(Travis): ll -> ls -Flg --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index a65969a..6c6ee96 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -6,7 +6,7 @@ set -e CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" -command "ll" +command "ls -Flg" INSTALL_COMMAND_RESULT=$(./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) From 8dc61838e7368f9b558d0f8cb2a6ac3f11c25ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:07:02 +0800 Subject: [PATCH 09/37] build(Travis): ls -Flg -> ls -l --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 6c6ee96..7bb9006 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -6,7 +6,7 @@ set -e CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" -command "ls -Flg" +command "ls -l" INSTALL_COMMAND_RESULT=$(./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) From 42725e8dde6c8eb7ef1eeb7cfe9c07d9c3a509a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:08:39 +0800 Subject: [PATCH 10/37] build(Travis): ls -l -> ls --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 7bb9006..8bb81d8 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -6,7 +6,7 @@ set -e CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" -command "ls -l" +command "ls" INSTALL_COMMAND_RESULT=$(./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) From 618a4b5be7631aeb5724452703076b0225c2b41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:13:05 +0800 Subject: [PATCH 11/37] build(Travis): comment 'set -e' --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 8bb81d8..0a60f7a 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -2,7 +2,7 @@ # Exit immediately if a command exits with a non-zero status. # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script -set -e +# set -e CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" From cc9e2a17d586ebf5d7acc890509a5ed71432a5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:30:51 +0800 Subject: [PATCH 12/37] build(Travis): capture result --- .travis/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 0a60f7a..8783e09 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -8,7 +8,10 @@ CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" command "ls" -INSTALL_COMMAND_RESULT=$(./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version) +# Run the Maven clean install +./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version + +INSTALL_COMMAND_RESULT=$? if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then echo "[INSTALL] INFO Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" From b4da62552d98d641887e7b4028b85cc56b5a7df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 13:32:38 +0800 Subject: [PATCH 13/37] revert(Travis): uncomment 'set -e' Revert "build(Travis): comment 'set -e'" This reverts commit 618a4b5b --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 8783e09..cd44ad7 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -2,7 +2,7 @@ # Exit immediately if a command exits with a non-zero status. # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script -# set -e +set -e CURRENT_DIR=$(pwd) echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" From 2e285961e1f136b860f1b1b8bbb53707243e2ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 14:00:09 +0800 Subject: [PATCH 14/37] perf(FileWatcher): close WatchService synchronously --- .../MediaStreamingBootstrap.java | 3 +- .../filewatch/FileWatcher.java | 1 + .../filewatch/WatchServiceSingleton.java | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingBootstrap.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingBootstrap.java index dbe1ed6..99ff529 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingBootstrap.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingBootstrap.java @@ -13,6 +13,7 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import java.nio.file.Path; +import java.util.Optional; /** * Description: MediaStreamingBootstrap, change description here. @@ -85,6 +86,6 @@ public void run(String... args) { @PreDestroy private void preDestroy() { log.debug("Destroying {}, fileWatcher: {}", this.getClass().getSimpleName(), fileWatcher); - fileWatcher.destroy(); + Optional.ofNullable(fileWatcher).ifPresent(FileWatcher::destroy); } } diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java index 3e425c1..ab35934 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java @@ -90,6 +90,7 @@ private void monitor() { @SneakyThrows public void destroy() { + WatchServiceSingleton.close(); THREAD_POOL.awaitTermination(5, TimeUnit.SECONDS); log.debug("THREAD_POOL for FileWatcher was terminated."); } diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/WatchServiceSingleton.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/WatchServiceSingleton.java index 1d1bc99..3cf4333 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/WatchServiceSingleton.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/WatchServiceSingleton.java @@ -1,21 +1,38 @@ package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.filewatch; import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.WatchService; +import java.util.Optional; /** * Description: WatchServiceSingleton, change description here. * * @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 10/20/2020 4:52 PM **/ +@Slf4j public class WatchServiceSingleton { private static volatile WatchService singletonInstance; + /** + * Private constructors are required for Singleton classes so that objects of such classes cannot be instantiated + * from outside the class. If Singleton classes do not have private constructors, objects of such classes can be + * created from outside too and hence the class will no longer be Singleton class. + * + * @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 10/26/2020 1:57 PM + */ private WatchServiceSingleton() { } + /** + * Gets WatchService instance. Minimize synchronized range, with double null check. + * + * @return the WatchService instance + * @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 10/26/2020 1:51 PM + */ @SneakyThrows public static WatchService getInstance() { if (singletonInstance == null) { @@ -27,4 +44,19 @@ public static WatchService getInstance() { } return singletonInstance; } + + /** + * Close WatchService synchronously. + * + * @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 10/26/2020 1:49 PM + */ + public static synchronized void close() { + Optional.ofNullable(singletonInstance).ifPresent(watchService -> { + try { + watchService.close(); + } catch (IOException e) { + log.error("Exception occurred when closing WatchService.", e); + } + }); + } } From cf8f4caea0e92ab9a68470023d9e37fed16f1962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 14:44:34 +0800 Subject: [PATCH 15/37] perf(FileWatcher): capture ClosedWatchServiceException to stop followup file watch service --- .../filewatch/FileWatcher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java index ab35934..1b1a1a0 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/filewatch/FileWatcher.java @@ -48,7 +48,13 @@ private void monitor() { log.debug("Started watching: {}", this.monitoredPath); while (true) { // wait for key to be signaled - Optional optionalWatchKey = Optional.ofNullable(WatchServiceSingleton.getInstance().poll()); + Optional optionalWatchKey; + try { + optionalWatchKey = Optional.ofNullable(WatchServiceSingleton.getInstance().poll()); + } catch (ClosedWatchServiceException e) { + log.error("Detected closed WatchService.", e); + return; + } if (optionalWatchKey.isPresent()) { var watchKey = optionalWatchKey.get(); for (var watchEvent : watchKey.pollEvents()) { From 037e9b1ce663cc54080a98fa8c9365ed9a5e51ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 18:05:01 +0800 Subject: [PATCH 16/37] perf(Travis): display timestamp --- .travis/install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index cd44ad7..f9c21f2 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -4,8 +4,13 @@ # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e +function now() { + echo date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23 + return 0 +} + CURRENT_DIR=$(pwd) -echo "[INSTALL] INFO CURRENT_DIR: $CURRENT_DIR" +echo "$(now) INFO --- [INSTALL] CURRENT_DIR: $CURRENT_DIR" command "ls" # Run the Maven clean install @@ -14,8 +19,8 @@ command "ls" INSTALL_COMMAND_RESULT=$? if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then - echo "[INSTALL] INFO Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" + echo "$(now) INFO --- [INSTALL] Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" else - echo "[INSTALL] INFO Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 + echo "$(now) INFO --- [INSTALL] Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 exit 1 fi From 5750e06e4624146c112ce6ebc2e983d2c1b8220a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 20:22:12 +0800 Subject: [PATCH 17/37] perf(Travis): beautify bash command --- .travis.yml | 3 ++- .travis/deploy.sh | 29 ++++++++++++++++++++--------- .travis/install.sh | 11 ++++------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1fb7846..9c0a58c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,8 @@ install: skip # Grant execute permission to prevent error like: # xxx.sh: Permission denied before_script: - - "echo [INSTALL] INFO Grant execute permission" + - NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) + - echo "$NOW INFO --- [INSTALL] Grant execute permission" - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw diff --git a/.travis/deploy.sh b/.travis/deploy.sh index ffed617..3f41b7d 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -11,35 +11,37 @@ # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e +NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) + # Check the variables are set if [ -z "$OSSRH_USERNAME" ]; then - echo "[Deployment] ERROR - Missing environment value: OSSRH_USERNAME" >&2 + echo "$NOW ERROR --- [DEPLOY] Missing environment value: OSSRH_USERNAME" >&2 exit 1 fi if [ -z "$OSSRH_PASSWORD" ]; then - echo "[Deployment] ERROR - Missing environment value: OSSRH_PASSWORD" >&2 + echo "$NOW ERROR --- [DEPLOY] Missing environment value: OSSRH_PASSWORD" >&2 exit 1 fi if [ -z "$GPG_KEY_NAME" ]; then - echo "[Deployment] ERROR - Missing environment value: GPG_KEY_NAME" >&2 + echo "$NOW ERROR --- [DEPLOY] Missing environment value: GPG_KEY_NAME" >&2 exit 1 fi if [ -z "$GPG_PASSPHRASE" ]; then - echo "[Deployment] ERROR - Missing environment value: GPG_PASSPHRASE" >&2 + echo "$NOW ERROR --- [DEPLOY] Missing environment value: GPG_PASSPHRASE" >&2 exit 1 fi -echo "[Deployment] INFO - All expected variables are set. OSSRH_USERNAME, OSSRH_PASSWORD, GPG_KEY_NAME and GPG_PASSPHRASE" +echo "$NOW INFO --- [DEPLOY] All expected variables are set. OSSRH_USERNAME, OSSRH_PASSWORD, GPG_KEY_NAME and GPG_PASSPHRASE" >&2 # If decrypted file .travis/gpg.asc not exists if [ ! -f "${TRAVIS_BUILD_DIR}/.travis/gpg.asc" ]; then - echo "[Deployment] ERROR - Missing decrypted file: .travis/gpg.asc" >&2 + echo "$NOW ERROR --- [DEPLOY] Missing decrypted file: .travis/gpg.asc" >&2 exit 1 else - echo "[Deployment] INFO - Found decrypted file: .travis/gpg.asc" + echo "$NOW INFO --- [DEPLOY] Found decrypted file: .travis/gpg.asc" fi # Prepare the local keyring (requires travis to have decrypted the file beforehand) @@ -47,11 +49,20 @@ gpg --fast-import .travis/gpg.asc # If `TRAVIS_TAG` string is not empty if [ -n "$TRAVIS_TAG" ]; then - echo "[Deployment] INFO - Maven deploy on a tag -> set pom.xml to TRAVIS_TAG: $TRAVIS_TAG" + echo "$NOW WARN --- [DEPLOY] Maven deploy on a tag -> set pom.xml to TRAVIS_TAG: $TRAVIS_TAG" mvn --settings "${TRAVIS_BUILD_DIR}/.travis/maven-settings.xml" org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=$TRAVIS_TAG 1>/dev/null 2>/dev/null else - echo "[Deployment] INFO - Maven deploy not on a tag -> keep snapshot version in pom.xml" + echo "$NOW WARN --- [DEPLOY] Maven deploy not on a tag -> keep snapshot version in pom.xml" fi # Run the maven deploy steps mvn deploy -P publish -DskipTests=true --quiet --settings "${TRAVIS_BUILD_DIR}/.travis/maven-settings.xml" + +DEPLOY_COMMAND_RESULT=$? + +if [ "$DEPLOY_COMMAND_RESULT" -eq 0 ]; then + echo "$NOW INFO --- [DEPLOY] Deployment succeed. DEPLOY_COMMAND_RESULT: $DEPLOY_COMMAND_RESULT" +else + echo "$NOW ERROR --- [DEPLOY] Deployment failed. DEPLOY_COMMAND_RESULT: $DEPLOY_COMMAND_RESULT" >&2 + exit 1 +fi diff --git a/.travis/install.sh b/.travis/install.sh index f9c21f2..6071e00 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -4,13 +4,10 @@ # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e -function now() { - echo date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23 - return 0 -} +NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) CURRENT_DIR=$(pwd) -echo "$(now) INFO --- [INSTALL] CURRENT_DIR: $CURRENT_DIR" +echo "$NOW INFO --- [INSTALL] CURRENT_DIR: $CURRENT_DIR" command "ls" # Run the Maven clean install @@ -19,8 +16,8 @@ command "ls" INSTALL_COMMAND_RESULT=$? if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then - echo "$(now) INFO --- [INSTALL] Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" + echo "$NOW INFO --- [INSTALL] Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" else - echo "$(now) INFO --- [INSTALL] Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 + echo "$NOW ERROR --- [INSTALL] Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 exit 1 fi From b6bd88d8904f265f9696a3111af6375583036ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 21:06:26 +0800 Subject: [PATCH 18/37] perf(Travis): colorize bash command --- .travis/common.sh | 23 +++++++++++++++++++++++ .travis/deploy.sh | 41 ++++++++++++++++++++++++++++++----------- .travis/install.sh | 27 ++++++++++++++++++++++++--- 3 files changed, 77 insertions(+), 14 deletions(-) create mode 100644 .travis/common.sh diff --git a/.travis/common.sh b/.travis/common.sh new file mode 100644 index 0000000..9083abc --- /dev/null +++ b/.travis/common.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +########################## Functions Declaration ########################## +# Bash tips: Colors and formatting (ANSI/VT100 Control sequences) +# https://misc.flogisoft.com/bash/tip_colors_and_formatting +# Pass arguments into a function +# https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function +function printInfo() { + echo -e "$NOW \e[32m INFO --- $1\e[0m" + return 0 +} + +function printWarn() { + echo -e "$NOW \e[33m WARN --- $1\e[0m" + return 0 +} + +function printError() { + echo -e "$NOW \e[31mERROR --- $1\e[0m" + return 0 +} + +export -f printInfo diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 3f41b7d..a997ecd 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -13,35 +13,54 @@ set -e NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) +# Bash tips: Colors and formatting (ANSI/VT100 Control sequences) +# https://misc.flogisoft.com/bash/tip_colors_and_formatting +# Pass arguments into a function +# https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function +function printInfo() { + echo -e "$NOW \e[32m INFO --- $1\e[0m" + return 0 +} + +function printWarn() { + echo -e "$NOW \e[33m WARN --- $1\e[0m" + return 0 +} + +function printError() { + echo -e "$NOW \e[31mERROR --- $1\e[0m" + return 0 +} + # Check the variables are set if [ -z "$OSSRH_USERNAME" ]; then - echo "$NOW ERROR --- [DEPLOY] Missing environment value: OSSRH_USERNAME" >&2 + printError "[DEPLOY] Missing environment value: OSSRH_USERNAME" >&2 exit 1 fi if [ -z "$OSSRH_PASSWORD" ]; then - echo "$NOW ERROR --- [DEPLOY] Missing environment value: OSSRH_PASSWORD" >&2 + printError "[DEPLOY] Missing environment value: OSSRH_PASSWORD" >&2 exit 1 fi if [ -z "$GPG_KEY_NAME" ]; then - echo "$NOW ERROR --- [DEPLOY] Missing environment value: GPG_KEY_NAME" >&2 + printError "[DEPLOY] Missing environment value: GPG_KEY_NAME" >&2 exit 1 fi if [ -z "$GPG_PASSPHRASE" ]; then - echo "$NOW ERROR --- [DEPLOY] Missing environment value: GPG_PASSPHRASE" >&2 + printError "[DEPLOY] Missing environment value: GPG_PASSPHRASE" >&2 exit 1 fi -echo "$NOW INFO --- [DEPLOY] All expected variables are set. OSSRH_USERNAME, OSSRH_PASSWORD, GPG_KEY_NAME and GPG_PASSPHRASE" >&2 +printInfo "[DEPLOY] All expected variables are set. OSSRH_USERNAME, OSSRH_PASSWORD, GPG_KEY_NAME and GPG_PASSPHRASE" # If decrypted file .travis/gpg.asc not exists if [ ! -f "${TRAVIS_BUILD_DIR}/.travis/gpg.asc" ]; then - echo "$NOW ERROR --- [DEPLOY] Missing decrypted file: .travis/gpg.asc" >&2 + printError "[DEPLOY] Missing decrypted file: .travis/gpg.asc" >&2 exit 1 else - echo "$NOW INFO --- [DEPLOY] Found decrypted file: .travis/gpg.asc" + printInfo "[DEPLOY] Found decrypted file: .travis/gpg.asc" fi # Prepare the local keyring (requires travis to have decrypted the file beforehand) @@ -49,10 +68,10 @@ gpg --fast-import .travis/gpg.asc # If `TRAVIS_TAG` string is not empty if [ -n "$TRAVIS_TAG" ]; then - echo "$NOW WARN --- [DEPLOY] Maven deploy on a tag -> set pom.xml to TRAVIS_TAG: $TRAVIS_TAG" + printWarn "[DEPLOY] Maven deploy on a tag -> set pom.xml to TRAVIS_TAG: $TRAVIS_TAG" mvn --settings "${TRAVIS_BUILD_DIR}/.travis/maven-settings.xml" org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=$TRAVIS_TAG 1>/dev/null 2>/dev/null else - echo "$NOW WARN --- [DEPLOY] Maven deploy not on a tag -> keep snapshot version in pom.xml" + printWarn "[DEPLOY] Maven deploy not on a tag -> keep snapshot version in pom.xml" fi # Run the maven deploy steps @@ -61,8 +80,8 @@ mvn deploy -P publish -DskipTests=true --quiet --settings "${TRAVIS_BUILD_DIR}/. DEPLOY_COMMAND_RESULT=$? if [ "$DEPLOY_COMMAND_RESULT" -eq 0 ]; then - echo "$NOW INFO --- [DEPLOY] Deployment succeed. DEPLOY_COMMAND_RESULT: $DEPLOY_COMMAND_RESULT" + printInfo "[DEPLOY] Deployment succeed. DEPLOY_COMMAND_RESULT: $DEPLOY_COMMAND_RESULT" else - echo "$NOW ERROR --- [DEPLOY] Deployment failed. DEPLOY_COMMAND_RESULT: $DEPLOY_COMMAND_RESULT" >&2 + printError "[DEPLOY] Deployment failed. DEPLOY_COMMAND_RESULT: $DEPLOY_COMMAND_RESULT" >&2 exit 1 fi diff --git a/.travis/install.sh b/.travis/install.sh index 6071e00..9a67e10 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -6,8 +6,29 @@ set -e NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) +########################## Functions Declaration ########################## +# Bash tips: Colors and formatting (ANSI/VT100 Control sequences) +# https://misc.flogisoft.com/bash/tip_colors_and_formatting +# Pass arguments into a function +# https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function +function printInfo() { + echo -e "$NOW \e[32m INFO --- $1\e[0m" + return 0 +} + +function printWarn() { + echo -e "$NOW \e[33m WARN --- $1\e[0m" + return 0 +} + +function printError() { + echo -e "$NOW \e[31mERROR --- $1\e[0m" + return 0 +} + +########################## Functions Declaration ########################## CURRENT_DIR=$(pwd) -echo "$NOW INFO --- [INSTALL] CURRENT_DIR: $CURRENT_DIR" +printInfo "[INSTALL] CURRENT_DIR: $CURRENT_DIR" command "ls" # Run the Maven clean install @@ -16,8 +37,8 @@ command "ls" INSTALL_COMMAND_RESULT=$? if [ "$INSTALL_COMMAND_RESULT" -eq 0 ]; then - echo "$NOW INFO --- [INSTALL] Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" + printInfo "[INSTALL] Installation succeed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" else - echo "$NOW ERROR --- [INSTALL] Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 + printError "[INSTALL] Installation failed. INSTALL_COMMAND_RESULT: $INSTALL_COMMAND_RESULT" >&2 exit 1 fi From c7e2c2a3756b6aa4801cf3fad09dd1a873c7f2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 21:25:37 +0800 Subject: [PATCH 19/37] refactor(Bash): abstract now() function --- .travis/common.sh | 13 +++++++++---- .travis/deploy.sh | 14 +++++++++----- .travis/install.sh | 11 ++++++++--- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.travis/common.sh b/.travis/common.sh index 9083abc..a50d0dd 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -5,19 +5,24 @@ # https://misc.flogisoft.com/bash/tip_colors_and_formatting # Pass arguments into a function # https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function +function now() { + nowVariable=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) + echo "$nowVariable" +} + function printInfo() { - echo -e "$NOW \e[32m INFO --- $1\e[0m" + echo -e "$(now) \e[32m INFO --- $1\e[0m" return 0 } function printWarn() { - echo -e "$NOW \e[33m WARN --- $1\e[0m" + echo -e "$(now) \e[33m WARN --- $1\e[0m" return 0 } function printError() { - echo -e "$NOW \e[31mERROR --- $1\e[0m" + echo -e "$(now) \e[31mERROR --- $1\e[0m" return 0 } -export -f printInfo +export -f printInfo printWarn printError diff --git a/.travis/deploy.sh b/.travis/deploy.sh index a997ecd..7ba3cd0 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -11,24 +11,28 @@ # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e -NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) - +########################## Functions Declaration ########################## # Bash tips: Colors and formatting (ANSI/VT100 Control sequences) # https://misc.flogisoft.com/bash/tip_colors_and_formatting # Pass arguments into a function # https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function +function now() { + nowVariable=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) + echo "$nowVariable" +} + function printInfo() { - echo -e "$NOW \e[32m INFO --- $1\e[0m" + echo -e "$(now) \e[32m INFO --- $1\e[0m" return 0 } function printWarn() { - echo -e "$NOW \e[33m WARN --- $1\e[0m" + echo -e "$(now) \e[33m WARN --- $1\e[0m" return 0 } function printError() { - echo -e "$NOW \e[31mERROR --- $1\e[0m" + echo -e "$(now) \e[31mERROR --- $1\e[0m" return 0 } diff --git a/.travis/install.sh b/.travis/install.sh index 9a67e10..c35ad10 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -11,18 +11,23 @@ NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) # https://misc.flogisoft.com/bash/tip_colors_and_formatting # Pass arguments into a function # https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function +function now() { + nowVariable=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) + echo "$nowVariable" +} + function printInfo() { - echo -e "$NOW \e[32m INFO --- $1\e[0m" + echo -e "$(now) \e[32m INFO --- $1\e[0m" return 0 } function printWarn() { - echo -e "$NOW \e[33m WARN --- $1\e[0m" + echo -e "$(now) \e[33m WARN --- $1\e[0m" return 0 } function printError() { - echo -e "$NOW \e[31mERROR --- $1\e[0m" + echo -e "$(now) \e[31mERROR --- $1\e[0m" return 0 } From 5e3fc6f8d3e78d4b0e253010309b00731424ce85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 21:34:00 +0800 Subject: [PATCH 20/37] perf(Bash): abstract functions into common.sh --- .travis.yml | 1 + .travis/deploy.sh | 26 ++------------------------ .travis/install.sh | 29 ++--------------------------- 3 files changed, 5 insertions(+), 51 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c0a58c..4dede44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ install: skip before_script: - NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) - echo "$NOW INFO --- [INSTALL] Grant execute permission" + - chmod +x .travis/common.sh - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 7ba3cd0..a732783 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -11,30 +11,8 @@ # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e -########################## Functions Declaration ########################## -# Bash tips: Colors and formatting (ANSI/VT100 Control sequences) -# https://misc.flogisoft.com/bash/tip_colors_and_formatting -# Pass arguments into a function -# https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function -function now() { - nowVariable=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) - echo "$nowVariable" -} - -function printInfo() { - echo -e "$(now) \e[32m INFO --- $1\e[0m" - return 0 -} - -function printWarn() { - echo -e "$(now) \e[33m WARN --- $1\e[0m" - return 0 -} - -function printError() { - echo -e "$(now) \e[31mERROR --- $1\e[0m" - return 0 -} +########################## Functions Import ########################## +source commond.sh # Check the variables are set if [ -z "$OSSRH_USERNAME" ]; then diff --git a/.travis/install.sh b/.travis/install.sh index c35ad10..05fb70c 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -4,34 +4,9 @@ # https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script set -e -NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) +########################## Functions Import ########################## +source commond.sh -########################## Functions Declaration ########################## -# Bash tips: Colors and formatting (ANSI/VT100 Control sequences) -# https://misc.flogisoft.com/bash/tip_colors_and_formatting -# Pass arguments into a function -# https://bash.cyberciti.biz/guide/Pass_arguments_into_a_function -function now() { - nowVariable=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) - echo "$nowVariable" -} - -function printInfo() { - echo -e "$(now) \e[32m INFO --- $1\e[0m" - return 0 -} - -function printWarn() { - echo -e "$(now) \e[33m WARN --- $1\e[0m" - return 0 -} - -function printError() { - echo -e "$(now) \e[31mERROR --- $1\e[0m" - return 0 -} - -########################## Functions Declaration ########################## CURRENT_DIR=$(pwd) printInfo "[INSTALL] CURRENT_DIR: $CURRENT_DIR" command "ls" From 51211bd65638b717f3a19b494cecb6c360ff5336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:03:29 +0800 Subject: [PATCH 21/37] refactor(Bash): correct source --- .travis/deploy.sh | 2 +- .travis/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis/deploy.sh b/.travis/deploy.sh index a732783..7c90b3b 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -12,7 +12,7 @@ set -e ########################## Functions Import ########################## -source commond.sh +source ./commond.sh # Check the variables are set if [ -z "$OSSRH_USERNAME" ]; then diff --git a/.travis/install.sh b/.travis/install.sh index 05fb70c..8a12988 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -5,7 +5,7 @@ set -e ########################## Functions Import ########################## -source commond.sh +source ./commond.sh CURRENT_DIR=$(pwd) printInfo "[INSTALL] CURRENT_DIR: $CURRENT_DIR" From 7cb3dd8d79a5d4d7b48672fec93ab11f41bc8f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:07:28 +0800 Subject: [PATCH 22/37] refactor(Bash): correct source 2 --- .travis/deploy.sh | 2 +- .travis/install.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 7c90b3b..717f8e4 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -12,7 +12,7 @@ set -e ########################## Functions Import ########################## -source ./commond.sh +source common.sh # Check the variables are set if [ -z "$OSSRH_USERNAME" ]; then diff --git a/.travis/install.sh b/.travis/install.sh index 8a12988..c677d52 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -5,14 +5,14 @@ set -e ########################## Functions Import ########################## -source ./commond.sh +source ./.travis/common.sh CURRENT_DIR=$(pwd) printInfo "[INSTALL] CURRENT_DIR: $CURRENT_DIR" command "ls" # Run the Maven clean install -./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version +.mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version INSTALL_COMMAND_RESULT=$? From ad6a418705d0ff6ea9c12ace1911833ea8c1fe70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:10:15 +0800 Subject: [PATCH 23/37] refactor(Bash): correct ./mvnw --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index c677d52..4d7c287 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -12,7 +12,7 @@ printInfo "[INSTALL] CURRENT_DIR: $CURRENT_DIR" command "ls" # Run the Maven clean install -.mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version +./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version INSTALL_COMMAND_RESULT=$? From d09c89b95d806f59b7403e66cba4d305701a28c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:17:52 +0800 Subject: [PATCH 24/37] refactor(Bash): correct common.sh path --- .travis/common.sh | 2 -- .travis/deploy.sh | 2 +- .travis/install.sh | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis/common.sh b/.travis/common.sh index a50d0dd..9eeaa4d 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -24,5 +24,3 @@ function printError() { echo -e "$(now) \e[31mERROR --- $1\e[0m" return 0 } - -export -f printInfo printWarn printError diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 717f8e4..1b1d6be 100644 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -12,7 +12,7 @@ set -e ########################## Functions Import ########################## -source common.sh +source ./.travis/common.sh # Check the variables are set if [ -z "$OSSRH_USERNAME" ]; then diff --git a/.travis/install.sh b/.travis/install.sh index 4d7c287..3a17008 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -9,6 +9,7 @@ source ./.travis/common.sh CURRENT_DIR=$(pwd) printInfo "[INSTALL] CURRENT_DIR: $CURRENT_DIR" +printInfo "[INSTALL] List of CURRENT_DIR:" command "ls" # Run the Maven clean install From 73b7d9798d15b3168b8b70b83d0fa3dd0b33ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:28:41 +0800 Subject: [PATCH 25/37] perf(Travis): make bash message bold --- .travis/common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis/common.sh b/.travis/common.sh index 9eeaa4d..69dc313 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -11,16 +11,16 @@ function now() { } function printInfo() { - echo -e "$(now) \e[32m INFO --- $1\e[0m" + echo -e "$(now) \e[32m\e[1mINFO\e[0m\e[32m --- $1\e[0m" return 0 } function printWarn() { - echo -e "$(now) \e[33m WARN --- $1\e[0m" + echo -e "$(now) \e[32m\e[1mWARN\e[0m\e[32m --- $1\e[0m" return 0 } function printError() { - echo -e "$(now) \e[31mERROR --- $1\e[0m" + echo -e "$(now) \e[32m\e[1mERROR\e[0m\e[32m --- $1\e[0m" return 0 } From 4d7edee358a9a2d1afd08b0e5c1554f76c6ef4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:39:06 +0800 Subject: [PATCH 26/37] refactor(Travis): beautify bash message --- .travis.yml | 5 +++-- .travis/common.sh | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4dede44..6238917 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ before_script: - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw + - source ./.travis/common.sh # Custom Maven install script: # https://docs.travis-ci.com/user/job-lifecycle/ @@ -31,8 +32,8 @@ script: # Decrypt file `gpg.asc.enc` before deployment # https://docs.travis-ci.com/user/encrypting-files/ before_deploy: - - "echo [DEPLOYMENT] INFO TRAVIS_BRANCH: $TRAVIS_BRANCH" - - "echo [DEPLOYMENT] INFO TRAVIS_TAG: $TRAVIS_TAG" + - "printWarn [DEPLOY] TRAVIS_BRANCH: $TRAVIS_BRANCH" + - "printWarn [DEPLOY] TRAVIS_TAG: $TRAVIS_TAG" - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d deploy: diff --git a/.travis/common.sh b/.travis/common.sh index 69dc313..b930b2f 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -11,16 +11,16 @@ function now() { } function printInfo() { - echo -e "$(now) \e[32m\e[1mINFO\e[0m\e[32m --- $1\e[0m" + echo -e "$(now) \e[32mINFO --- $1\e[0m" return 0 } function printWarn() { - echo -e "$(now) \e[32m\e[1mWARN\e[0m\e[32m --- $1\e[0m" + echo -e "$(now) \e[32mWARN --- $1\e[0m" return 0 } function printError() { - echo -e "$(now) \e[32m\e[1mERROR\e[0m\e[32m --- $1\e[0m" + echo -e "$(now) \e[32mERROR --- $1\e[0m" return 0 } From 16bab323f53607974446b58ce746189c093d31e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:44:14 +0800 Subject: [PATCH 27/37] refactor(Travis): correct color --- .travis.yml | 4 ++-- .travis/common.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6238917..e79b810 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ script: # Decrypt file `gpg.asc.enc` before deployment # https://docs.travis-ci.com/user/encrypting-files/ before_deploy: - - "printWarn [DEPLOY] TRAVIS_BRANCH: $TRAVIS_BRANCH" - - "printWarn [DEPLOY] TRAVIS_TAG: $TRAVIS_TAG" + - "printWarn '[DEPLOY] TRAVIS_BRANCH: $TRAVIS_BRANCH'" + - "printWarn '[DEPLOY] TRAVIS_TAG: $TRAVIS_TAG'" - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d deploy: diff --git a/.travis/common.sh b/.travis/common.sh index b930b2f..54712c2 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -16,11 +16,11 @@ function printInfo() { } function printWarn() { - echo -e "$(now) \e[32mWARN --- $1\e[0m" + echo -e "$(now) \e[33mWARN --- $1\e[0m" return 0 } function printError() { - echo -e "$(now) \e[32mERROR --- $1\e[0m" + echo -e "$(now) \e[31mERROR --- $1\e[0m" return 0 } From 8adc510077950fd4fb0f2be9d70929b19ab4b6d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:54:01 +0800 Subject: [PATCH 28/37] refactor(Travis): adjust command sequence --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e79b810..8b3e49a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,13 +15,12 @@ install: skip # Grant execute permission to prevent error like: # xxx.sh: Permission denied before_script: - - NOW=$(date +%Y-%m-%d' '%H:%M:%S.%N | cut -b 1-23) - - echo "$NOW INFO --- [INSTALL] Grant execute permission" - chmod +x .travis/common.sh + - source ./.travis/common.sh + - "printInfo "[ INSTALL ] Grant execute permission"" - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw - - source ./.travis/common.sh # Custom Maven install script: # https://docs.travis-ci.com/user/job-lifecycle/ @@ -32,8 +31,8 @@ script: # Decrypt file `gpg.asc.enc` before deployment # https://docs.travis-ci.com/user/encrypting-files/ before_deploy: - - "printWarn '[DEPLOY] TRAVIS_BRANCH: $TRAVIS_BRANCH'" - - "printWarn '[DEPLOY] TRAVIS_TAG: $TRAVIS_TAG'" + - "printWarn "[ DEPLOY ] TRAVIS_BRANCH: $TRAVIS_BRANCH"" + - "printWarn "[ DEPLOY ] TRAVIS_TAG: $TRAVIS_TAG"" - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d deploy: From e03f9d3e17bc605db906d46995e6c957c8cad348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Mon, 26 Oct 2020 23:58:37 +0800 Subject: [PATCH 29/37] refactor(Travis): escape quotes --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b3e49a..95f1f94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: skip before_script: - chmod +x .travis/common.sh - source ./.travis/common.sh - - "printInfo "[ INSTALL ] Grant execute permission"" + - 'printInfo "[ INSTALL ] Grant execute permission"' - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw @@ -31,8 +31,8 @@ script: # Decrypt file `gpg.asc.enc` before deployment # https://docs.travis-ci.com/user/encrypting-files/ before_deploy: - - "printWarn "[ DEPLOY ] TRAVIS_BRANCH: $TRAVIS_BRANCH"" - - "printWarn "[ DEPLOY ] TRAVIS_TAG: $TRAVIS_TAG"" + - 'printWarn "[ DEPLOY ] TRAVIS_BRANCH: $TRAVIS_BRANCH"' + - 'printWarn "[ DEPLOY ] TRAVIS_TAG: $TRAVIS_TAG"' - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d deploy: From c92eeba931739303c72c3de31643273ffb360a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Tue, 27 Oct 2020 00:03:37 +0800 Subject: [PATCH 30/37] refactor(Travis): remove space --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95f1f94..0024986 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: skip before_script: - chmod +x .travis/common.sh - source ./.travis/common.sh - - 'printInfo "[ INSTALL ] Grant execute permission"' + - 'printInfo "[INSTALL] Grant execute permission"' - chmod +x .travis/install.sh - chmod +x .travis/deploy.sh - chmod +x mvnw @@ -31,8 +31,8 @@ script: # Decrypt file `gpg.asc.enc` before deployment # https://docs.travis-ci.com/user/encrypting-files/ before_deploy: - - 'printWarn "[ DEPLOY ] TRAVIS_BRANCH: $TRAVIS_BRANCH"' - - 'printWarn "[ DEPLOY ] TRAVIS_TAG: $TRAVIS_TAG"' + - 'printWarn "[DEPLOY] TRAVIS_BRANCH: $TRAVIS_BRANCH"' + - 'printWarn "[DEPLOY] TRAVIS_TAG: $TRAVIS_TAG"' - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d deploy: From 65b2dbf3636be215ff83e8f0d1ce8a254444693c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Miller=20=28=E9=94=BA=E4=BF=8A=29?= Date: Tue, 27 Oct 2020 00:10:46 +0800 Subject: [PATCH 31/37] feat(Webflux): migrate to annotation based Webflux migrate to annotation based Webflux BREAKING CHANGE: migrate to annotation based Webflux --- .../MediaStreamingAutoConfiguration.java | 12 ++++++-- .../controller/VideoController.java | 28 +++++++++++++++++++ .../handler/VideoRouteHandler.java | 2 -- .../repository/VideoRepository.java | 8 ++++++ .../InMemoryVideoOnFileSystemRepository.java | 7 +++++ 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/controller/VideoController.java diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingAutoConfiguration.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingAutoConfiguration.java index c2d51c4..6902c54 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingAutoConfiguration.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/configuration/MediaStreamingAutoConfiguration.java @@ -1,5 +1,6 @@ package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.configuration; +import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.controller.VideoController; import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.handler.MediaStreamingExceptionHandler; import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.handler.VideoRouteHandler; import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository; @@ -62,7 +63,7 @@ public MediaStreamingExceptionHandler mediaStreamingExceptionHandler() { @Bean @ConditionalOnMissingBean public VideoRouteHandler videoRouteHandler(VideoService videoService, FileService fileService) { - return new VideoRouteHandler(videoService, fileService); + return new VideoRouteHandler(videoService); } /** @@ -74,17 +75,24 @@ public VideoRouteHandler videoRouteHandler(VideoService videoService, FileServic * @return the router function */ @Bean + @Deprecated @SuppressWarnings("NullableProblems") public RouterFunction videoEndPoint(VideoRouteHandler videoRouteHandler) { log.info("videoEndPoint"); return route() .nest(path("/videos"), builder -> builder.GET("", videoRouteHandler::listVideos) .nest(path("/{name}"), videoBuilder -> videoBuilder.GET("", param("partial"), - videoRouteHandler::getPartialContent).GET("", videoRouteHandler::getFullContent) + videoRouteHandler::getPartialContent).GET( + "", videoRouteHandler::getFullContent) ) ).build(); } + @Bean + public VideoController videoController(VideoRepository videoRepository) { + return new VideoController(videoRepository); + } + @Bean @ConditionalOnMissingBean public VideoService videoService(VideoRepository videoRepository) { diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/controller/VideoController.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/controller/VideoController.java new file mode 100644 index 0000000..2ef70c3 --- /dev/null +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/controller/VideoController.java @@ -0,0 +1,28 @@ +package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.controller; + +import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.model.Video; +import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Flux; + +import java.time.Duration; +import java.util.List; + +/** + * Description: VideoController, change description here. + * + * @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 10/26/2020 4:17 PM + **/ +@RestController +@RequiredArgsConstructor +public class VideoController { + private final VideoRepository videoRepository; + + @GetMapping(value = "/video-annotation", produces = MediaType.APPLICATION_STREAM_JSON_VALUE) + public Flux> getVideo() { + return Flux.interval(Duration.ofSeconds(2)).map(aLong -> videoRepository.getAllVideoList()); + } +} diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/handler/VideoRouteHandler.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/handler/VideoRouteHandler.java index b71c4c6..df56cf2 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/handler/VideoRouteHandler.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/handler/VideoRouteHandler.java @@ -1,7 +1,6 @@ package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.handler; import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.model.Video; -import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.FileService; import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.VideoService; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -24,7 +23,6 @@ @RequiredArgsConstructor public class VideoRouteHandler { private final VideoService videoService; - private final FileService fileService; /** * List videos mono. diff --git a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/repository/VideoRepository.java b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/repository/VideoRepository.java index 97b8c6b..bd09ac6 100644 --- a/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/repository/VideoRepository.java +++ b/media-streaming-spring-boot-autoconfigure/src/main/java/com/github/johnnymillergh/boot/mediastreamingspringbootautoconfigure/repository/VideoRepository.java @@ -5,6 +5,7 @@ import reactor.core.publisher.Mono; import java.nio.file.Path; +import java.util.List; /** * Description: VideoRepository, change description here. @@ -27,6 +28,13 @@ public interface VideoRepository { */ Flux