diff --git a/.github/workflows/gaps-java-ci.yml b/.github/workflows/gaps-java-ci.yml index d2bf106..dc83387 100644 --- a/.github/workflows/gaps-java-ci.yml +++ b/.github/workflows/gaps-java-ci.yml @@ -25,12 +25,4 @@ jobs: - name: Run Docker Compose uses: isbang/compose-action@v0.1 with: - compose-file: 'docker-compose-dev.yaml' - - name: Start Mocked Plex - run: mvn -f MockedPlex/pom.xml spring-boot:run - - name: Cypress Tests - uses: cypress-io/github-action@v2 - with: - browser: chrome - headless: true - wait-on: 'http://localhost:8484' \ No newline at end of file + compose-file: 'docker-compose-dev.yaml' \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev index c834d2a..711b45b 100755 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -5,12 +5,8 @@ ENV gapsVersion=* ENV springProfile=no-ssl-no-login ENV javaInitialHeapSize=150M - EXPOSE 32400 -## Update image ## -## RUN apt-get update -y && apt-get upgrade -y - ## Create data directory ## RUN mkdir -p /usr/data && chmod 777 /usr/data COPY movieIds.json /usr/data diff --git a/MockedPlex/pom.xml b/MockedPlex/pom.xml deleted file mode 100755 index 653149a..0000000 --- a/MockedPlex/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - Gaps - com.jasonhhouse - 0.8.10 - - 4.0.0 - - MockedPlex - - - com.jasonhhouse.mocked_plex.MockedPlexApplication - - - - - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - org.springframework.boot - spring-boot-starter-web - - - - org.jetbrains - annotations - - - - - \ No newline at end of file diff --git a/MockedPlex/src/main/java/com/jasonhhouse/mocked_plex/MockedPlexApplication.java b/MockedPlex/src/main/java/com/jasonhhouse/mocked_plex/MockedPlexApplication.java deleted file mode 100755 index 1d3e2c0..0000000 --- a/MockedPlex/src/main/java/com/jasonhhouse/mocked_plex/MockedPlexApplication.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2019 Jason H House - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package com.jasonhhouse.mocked_plex; - -import java.util.concurrent.Executor; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.boot.context.properties.ConfigurationPropertiesScan; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; - -/** - * Mocked Plex Main Application for Testing - */ -@SpringBootApplication -@EntityScan("com.jasonhhouse") -@EnableAsync -@EnableConfigurationProperties -@ConfigurationPropertiesScan -public class MockedPlexApplication { - - public static void main(String[] args) { - SpringApplication.run(MockedPlexApplication.class, args); - } - - @Bean - public Executor taskExecutor() { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(1); - executor.setMaxPoolSize(1); - executor.setQueueCapacity(50); - executor.setThreadNamePrefix("MockedPlex-"); - executor.initialize(); - return executor; - } - -} diff --git a/MockedPlex/src/main/java/com/jasonhhouse/mocked_plex/controller/MockedPlexController.java b/MockedPlex/src/main/java/com/jasonhhouse/mocked_plex/controller/MockedPlexController.java deleted file mode 100755 index 152476d..0000000 --- a/MockedPlex/src/main/java/com/jasonhhouse/mocked_plex/controller/MockedPlexController.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2020 Jason H House - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package com.jasonhhouse.mocked_plex.controller; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.util.ResourceUtils; -import org.springframework.util.StreamUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class MockedPlexController { - - private static final Logger LOGGER = LoggerFactory.getLogger(MockedPlexController.class); - - @GetMapping(path = "/", - produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getPlex(@RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getPlex( {} )", xPlexToken); - return ResponseEntity.ok(getPlexXmlFile("plex.xml")); - } - - @GetMapping(path = "/library/sections", - produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getPlexLibrarySections(@RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getPlexLibrarySections( {} )", xPlexToken); - return ResponseEntity.ok(getPlexXmlFile("sections.xml")); - } - - @GetMapping(path = "/library/sections/5/all", - produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getSaw(@RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getSaw( {} )", xPlexToken); - return ResponseEntity.ok(getPlexXmlFile("saw.xml")); - } - - @GetMapping(path = "/library/sections/4/all", - produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getBestMovies(@RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getBestMovies( {} )", xPlexToken); - return ResponseEntity.ok(getPlexXmlFile("bestMovies.xml")); - } - - @GetMapping(path = "/library/sections/6/all", - produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getNewMetadata(@RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getNewMetadata( {} )", xPlexToken); - return ResponseEntity.ok(getPlexXmlFile("newMetadata.xml")); - } - - @GetMapping(path = "/library/metadata/{movieId}", - produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getMovie(@PathVariable(value = "movieId") final Integer movieId, @RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getMovie( {} )", xPlexToken); - return ResponseEntity.ok(getPlexXmlFile(movieId + ".xml")); - } - - @GetMapping(path = "/library/metadata/{movieId}/thumb/{thumbId}", - produces = MediaType.IMAGE_JPEG_VALUE) - public ResponseEntity getThumb(@PathVariable(value = "movieId") final Integer movieId, - @PathVariable(value = "thumbId") final Integer thumbId, - @RequestParam(value = "X-Plex-Token", required = false) final String xPlexToken) { - LOGGER.info("getThumb( {}, {}, {})", movieId, thumbId, xPlexToken); - - ClassPathResource imgFile = new ClassPathResource("sawImage.jpg"); - try { - byte[] bytes = StreamUtils.copyToByteArray(imgFile.getInputStream()); - return ResponseEntity.ok(bytes); - } catch (IOException e) { - LOGGER.error("Can't find saw image", e); - return ResponseEntity.noContent().build(); - } - } - - private @NotNull String getPlexXmlFile(@NotNull String fileName) { - final File file; - try { - file = ResourceUtils.getFile("classpath:" + fileName); - - try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { - StringBuilder fullFile = new StringBuilder(); - String line; - while ((line = br.readLine()) != null) { - fullFile.append(line); - } - - return fullFile.toString(); - } catch (IOException e) { - LOGGER.error(String.format("Failed to read file %s", fileName)); - return ""; - } - } catch (FileNotFoundException e) { - LOGGER.error(String.format("Failed to find file %s", fileName)); - return ""; - } - } -} diff --git a/MockedPlex/src/main/resources/48756.xml b/MockedPlex/src/main/resources/48756.xml deleted file mode 100644 index 61ad421..0000000 --- a/MockedPlex/src/main/resources/48756.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - diff --git a/MockedPlex/src/main/resources/application.yaml b/MockedPlex/src/main/resources/application.yaml deleted file mode 100755 index fd46605..0000000 --- a/MockedPlex/src/main/resources/application.yaml +++ /dev/null @@ -1,17 +0,0 @@ -#Copyright 2019 Jason H House -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# Maximum time the response should be cached (in seconds) -# The cache must re-validate stale resources with the server. Any expired resources must not be used without re-validating. -# The resources are public and any cache may store the response. - -logging: - level: - root: INFO -server: - port: 32400 \ No newline at end of file diff --git a/MockedPlex/src/main/resources/bestMovies.xml b/MockedPlex/src/main/resources/bestMovies.xml deleted file mode 100644 index a228281..0000000 --- a/MockedPlex/src/main/resources/bestMovies.xml +++ /dev/null @@ -1,691 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MockedPlex/src/main/resources/newMetadata.xml b/MockedPlex/src/main/resources/newMetadata.xml deleted file mode 100644 index fc54e76..0000000 --- a/MockedPlex/src/main/resources/newMetadata.xml +++ /dev/null @@ -1,592 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MockedPlex/src/main/resources/plex.xml b/MockedPlex/src/main/resources/plex.xml deleted file mode 100644 index 92f2fa6..0000000 --- a/MockedPlex/src/main/resources/plex.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MockedPlex/src/main/resources/saw.xml b/MockedPlex/src/main/resources/saw.xml deleted file mode 100644 index 9fba7ef..0000000 --- a/MockedPlex/src/main/resources/saw.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - diff --git a/MockedPlex/src/main/resources/sawImage.jpg b/MockedPlex/src/main/resources/sawImage.jpg deleted file mode 100644 index 298d145..0000000 Binary files a/MockedPlex/src/main/resources/sawImage.jpg and /dev/null differ diff --git a/MockedPlex/src/main/resources/sections.xml b/MockedPlex/src/main/resources/sections.xml deleted file mode 100644 index 094b2aa..0000000 --- a/MockedPlex/src/main/resources/sections.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - diff --git a/MockedPlex/src/test/resources/gaps-test.json b/MockedPlex/src/test/resources/gaps-test.json deleted file mode 100644 index c266330..0000000 --- a/MockedPlex/src/test/resources/gaps-test.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "telegramProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "botId": "", - "chatId": "" - }, - "pushBulletProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "channel_tag": "", - "accessToken": "" - }, - "emailProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "username": "", - "password": "", - "mailTo": "", - "mailFrom": "", - "mailServer": "", - "mailPort": 0, - "mailTransportProtocol": "", - "mailSmtpAuth": "", - "mailSmtpTlsEnabled": false - }, - "gotifyProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "address": "", - "token": "" - }, - "slackProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "webHookUrl": "" - }, - "pushOverProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "token": "", - "user": "", - "priority": 1, - "sound": "", - "retry": 1, - "expire": 2 - }, - "discordProperties": { - "enabled": false, - "notificationTypes": [ - "TEST", - "PLEX_SERVER_CONNECTION" - ], - "webHookUrl": "" - } -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index e07916b..6d04d65 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,6 @@ Core GapsWeb - MockedPlex Plex RadarrV3