From 8becdb03c221d5d55883e8e104a9c08e7a7f4e1e Mon Sep 17 00:00:00 2001 From: iakunin Date: Mon, 20 Apr 2020 21:24:41 +0300 Subject: [PATCH] #10 - Puzzles left --- .../github/controller/GithubController.java | 43 ------------------- .../cron/CodexiaParserIntegrationTest.java | 33 ++++++++++++++ .../cron/MissingFillerIntegrationTest.java | 33 ++++++++++++++ ...ResendErroneousReviewsIntegrationTest.java | 33 ++++++++++++++ .../cron/stat/GithubIntegrationTest.java | 13 ++++++ .../cron/stat/LinesOfCodeIntegrationTest.java | 13 ++++++ .../cron/GapsFillerIntegrationTest.java | 13 ++++++ .../IncrementedParserIntegrationTest.java | 13 ++++++ .../cron/ItemsHealthCheckIntegrationTest.java | 13 ++++++ .../cron/RetryErroneousIntegrationTest.java | 13 ++++++ .../reddit/cron/ParserIntegrationTest.java | 13 ++++++ 11 files changed, 190 insertions(+), 43 deletions(-) delete mode 100644 src/main/java/dev/iakunin/codexiabot/github/controller/GithubController.java create mode 100644 src/test/java/dev/iakunin/codexiabot/codexia/cron/CodexiaParserIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/codexia/cron/MissingFillerIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/codexia/cron/ResendErroneousReviewsIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/github/cron/stat/GithubIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/github/cron/stat/LinesOfCodeIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/hackernews/cron/GapsFillerIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/hackernews/cron/IncrementedParserIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/hackernews/cron/ItemsHealthCheckIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/hackernews/cron/RetryErroneousIntegrationTest.java create mode 100644 src/test/java/dev/iakunin/codexiabot/reddit/cron/ParserIntegrationTest.java diff --git a/src/main/java/dev/iakunin/codexiabot/github/controller/GithubController.java b/src/main/java/dev/iakunin/codexiabot/github/controller/GithubController.java deleted file mode 100644 index e07bda73..00000000 --- a/src/main/java/dev/iakunin/codexiabot/github/controller/GithubController.java +++ /dev/null @@ -1,43 +0,0 @@ -package dev.iakunin.codexiabot.github.controller; - -import dev.iakunin.codexiabot.github.GithubModule; -import java.io.IOException; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -@AllArgsConstructor(onConstructor_={@Autowired}) -@Slf4j -public final class GithubController { - - private GithubModule githubModule; - - @PostMapping("/api/v1/github/createRepo") - @ResponseBody - public ResponseEntity createRepo( - @NotNull @Valid @RequestBody CreateRepoRequest body - ) throws IOException { - - this.githubModule.createRepo( - new GithubModule.CreateArguments() - .setUrl(body.getUrl()) - ); - - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Data - private static class CreateRepoRequest { - private String url; - } -} diff --git a/src/test/java/dev/iakunin/codexiabot/codexia/cron/CodexiaParserIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/codexia/cron/CodexiaParserIntegrationTest.java new file mode 100644 index 00000000..368d596b --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/codexia/cron/CodexiaParserIntegrationTest.java @@ -0,0 +1,33 @@ +package dev.iakunin.codexiabot.codexia.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import dev.iakunin.codexiabot.util.WireMockServer; +import org.junit.jupiter.api.AfterEach; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ContextConfiguration; + +@ContextConfiguration(initializers = CodexiaParserIntegrationTest.Initializer.class) +public class CodexiaParserIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private CodexiaParser codexiaParser; + + // @todo #10 Implement CodexiaParserIntegrationTest + + @AfterEach + void after() { + WireMockServer.getInstance().resetAll(); + } + + static class Initializer implements ApplicationContextInitializer { + @Override + public void initialize(ConfigurableApplicationContext applicationContext) { + TestPropertyValues.of( + "app.codexia.base-url=" + WireMockServer.getInstance().baseUrl() + ).applyTo(applicationContext.getEnvironment()); + } + } +} diff --git a/src/test/java/dev/iakunin/codexiabot/codexia/cron/MissingFillerIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/codexia/cron/MissingFillerIntegrationTest.java new file mode 100644 index 00000000..4d927085 --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/codexia/cron/MissingFillerIntegrationTest.java @@ -0,0 +1,33 @@ +package dev.iakunin.codexiabot.codexia.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import dev.iakunin.codexiabot.util.WireMockServer; +import org.junit.jupiter.api.AfterEach; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ContextConfiguration; + +@ContextConfiguration(initializers = MissingFillerIntegrationTest.Initializer.class) +public class MissingFillerIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private MissingFiller missingFiller; + + // @todo #10 Implement MissingFillerIntegrationTest + + @AfterEach + void after() { + WireMockServer.getInstance().resetAll(); + } + + static class Initializer implements ApplicationContextInitializer { + @Override + public void initialize(ConfigurableApplicationContext applicationContext) { + TestPropertyValues.of( + "app.codexia.base-url=" + WireMockServer.getInstance().baseUrl() + ).applyTo(applicationContext.getEnvironment()); + } + } +} diff --git a/src/test/java/dev/iakunin/codexiabot/codexia/cron/ResendErroneousReviewsIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/codexia/cron/ResendErroneousReviewsIntegrationTest.java new file mode 100644 index 00000000..aca7d472 --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/codexia/cron/ResendErroneousReviewsIntegrationTest.java @@ -0,0 +1,33 @@ +package dev.iakunin.codexiabot.codexia.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import dev.iakunin.codexiabot.util.WireMockServer; +import org.junit.jupiter.api.AfterEach; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ContextConfiguration; + +@ContextConfiguration(initializers = ResendErroneousReviewsIntegrationTest.Initializer.class) +public class ResendErroneousReviewsIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private ResendErroneousReviews resendErroneousReviews; + + // @todo #10 Implement ResendErroneousReviewsIntegrationTest + + @AfterEach + void after() { + WireMockServer.getInstance().resetAll(); + } + + static class Initializer implements ApplicationContextInitializer { + @Override + public void initialize(ConfigurableApplicationContext applicationContext) { + TestPropertyValues.of( + "app.codexia.base-url=" + WireMockServer.getInstance().baseUrl() + ).applyTo(applicationContext.getEnvironment()); + } + } +} diff --git a/src/test/java/dev/iakunin/codexiabot/github/cron/stat/GithubIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/github/cron/stat/GithubIntegrationTest.java new file mode 100644 index 00000000..12b8152a --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/github/cron/stat/GithubIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.github.cron.stat; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class GithubIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private Github github; + + // @todo #10 Implement GithubIntegrationTest + +} diff --git a/src/test/java/dev/iakunin/codexiabot/github/cron/stat/LinesOfCodeIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/github/cron/stat/LinesOfCodeIntegrationTest.java new file mode 100644 index 00000000..341d3aa1 --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/github/cron/stat/LinesOfCodeIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.github.cron.stat; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class LinesOfCodeIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private LinesOfCode linesOfCode; + + // @todo #10 Implement LinesOfCodeIntegrationTest + +} diff --git a/src/test/java/dev/iakunin/codexiabot/hackernews/cron/GapsFillerIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/GapsFillerIntegrationTest.java new file mode 100644 index 00000000..7189c6bd --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/GapsFillerIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.hackernews.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class GapsFillerIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private GapsFiller gapsFiller; + + // @todo #10 Implement GapsFillerIntegrationTest + +} diff --git a/src/test/java/dev/iakunin/codexiabot/hackernews/cron/IncrementedParserIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/IncrementedParserIntegrationTest.java new file mode 100644 index 00000000..3743d518 --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/IncrementedParserIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.hackernews.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class IncrementedParserIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private IncrementedParser incrementedParser; + + // @todo #10 Implement IncrementedParserIntegrationTest + +} diff --git a/src/test/java/dev/iakunin/codexiabot/hackernews/cron/ItemsHealthCheckIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/ItemsHealthCheckIntegrationTest.java new file mode 100644 index 00000000..7017401c --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/ItemsHealthCheckIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.hackernews.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class ItemsHealthCheckIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private ItemsHealthCheck itemsHealthCheck; + + // @todo #10 Implement ItemsHealthCheckIntegrationTest + +} diff --git a/src/test/java/dev/iakunin/codexiabot/hackernews/cron/RetryErroneousIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/RetryErroneousIntegrationTest.java new file mode 100644 index 00000000..a4f22c80 --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/hackernews/cron/RetryErroneousIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.hackernews.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class RetryErroneousIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private RetryErroneous retryErroneous; + + // @todo #10 Implement RetryErroneousIntegrationTest + +} diff --git a/src/test/java/dev/iakunin/codexiabot/reddit/cron/ParserIntegrationTest.java b/src/test/java/dev/iakunin/codexiabot/reddit/cron/ParserIntegrationTest.java new file mode 100644 index 00000000..6a50a2aa --- /dev/null +++ b/src/test/java/dev/iakunin/codexiabot/reddit/cron/ParserIntegrationTest.java @@ -0,0 +1,13 @@ +package dev.iakunin.codexiabot.reddit.cron; + +import dev.iakunin.codexiabot.AbstractIntegrationTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class ParserIntegrationTest extends AbstractIntegrationTest { + + @Autowired + private Parser parser; + + // @todo #10 Implement ParserIntegrationTest + +}