diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 40fcb7c..30e9471 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -45,16 +45,6 @@ jobs: name: Test runs-on: ubuntu-latest needs: build - services: - postgres: - image: postgres:latest - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: snackscription_review - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout Repository uses: actions/checkout@v4 diff --git a/src/main/java/snackscription/review/ReviewApplication.java b/src/main/java/snackscription/review/ReviewApplication.java index 4898e1d..ec64e1c 100644 --- a/src/main/java/snackscription/review/ReviewApplication.java +++ b/src/main/java/snackscription/review/ReviewApplication.java @@ -2,28 +2,14 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import java.util.concurrent.Executor; - -@EnableAsync @SpringBootApplication public class ReviewApplication { public static void main(String[] args) { SpringApplication.run(ReviewApplication.class, args); - } - @Bean - public Executor taskExecutor () { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(1); - executor.setMaxPoolSize(1); - executor.setQueueCapacity(500); - executor.setThreadNamePrefix("GithubLookup-"); - executor.initialize(); - return executor; + } + } diff --git a/src/main/java/snackscription/review/service/ReviewService.java b/src/main/java/snackscription/review/service/ReviewService.java index 44883b9..31a94c5 100644 --- a/src/main/java/snackscription/review/service/ReviewService.java +++ b/src/main/java/snackscription/review/service/ReviewService.java @@ -2,9 +2,6 @@ import java.util.List; import java.util.Optional; -import java.util.concurrent.CompletableFuture; - -import org.springframework.scheduling.annotation.Async; import java.util.concurrent.atomic.AtomicInteger; import io.micrometer.core.instrument.composite.CompositeMeterRegistry; @@ -22,7 +19,6 @@ @Component public class ReviewService { private ReviewRepository reviewRepository; - private SentimentAnalysisService sentimentAnalysisService; public ReviewService (ReviewRepository reviewRepository) { this.reviewRepository = reviewRepository; @@ -80,12 +76,6 @@ public Review rejectReview(String subsbox, String user) throws Exception { return reviewRepository.save(review); } - @Async - public CompletableFuture analyzeSentimentAsync(String reviewText) { - String sentiment = sentimentAnalysisService.analyze(reviewText); - return CompletableFuture.completedFuture(sentiment); - } - public void deleteReview(String subsbox, String user) throws Exception { Review review = reviewRepository.findByIdSubsboxAndIdAuthor(subsbox, user); diff --git a/src/main/java/snackscription/review/service/SentimentAnalysisService.java b/src/main/java/snackscription/review/service/SentimentAnalysisService.java deleted file mode 100644 index b9610a8..0000000 --- a/src/main/java/snackscription/review/service/SentimentAnalysisService.java +++ /dev/null @@ -1,8 +0,0 @@ -package snackscription.review.service; - -public class SentimentAnalysisService { - public String analyze(String reviewText) { - return "positive"; - } - -} diff --git a/src/test/java/snackscription/review/service/ReviewServiceTest.java b/src/test/java/snackscription/review/service/ReviewServiceTest.java index 4fdf16d..6350528 100644 --- a/src/test/java/snackscription/review/service/ReviewServiceTest.java +++ b/src/test/java/snackscription/review/service/ReviewServiceTest.java @@ -179,10 +179,5 @@ public void assertEqualReview(Review review1, Review review2) { assertEquals(review1.getAuthor(), review2.getAuthor()); assertEquals(review1.getSubsbox(), review2.getSubsbox()); } - - @Test - public void analyzeSentimentAsyncTest() { - - } }