deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä authored and GitHub committed 2025-03-29 19:34:27 +02:00
1 parent 371439aeaa
commit 0ca162a55c
1863 files changed
+14403 -17632

No files matched your search

+9 -1
View File
@@ -38,9 +38,17 @@
<artifactId>service-stub</artifactId>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -38,11 +38,9 @@ import lombok.extern.slf4j.Slf4j;
*
* <p>The "real" sentiment analysis class simulates the processing time for the request by pausing
* the execution of the thread for 5 seconds. In the stub sentiment analysis class the response is
* immediate. In addition, the stub returns a deterministic output with regard to the input. This
* is extra useful for testing purposes.
* immediate. In addition, the stub returns a deterministic output with regard to the input. This is
* extra useful for testing purposes.
*/
@Slf4j
public class App {
/**
@@ -64,6 +62,5 @@ public class App {
LOGGER.info("Analyzing input: {}", text);
sentiment = stubSentimentAnalysisServer.analyzeSentiment(text);
LOGGER.info("The sentiment is: {}", sentiment);
}
}
@@ -28,21 +28,19 @@ import java.util.Random;
import java.util.function.Supplier;
/**
* Real implementation of SentimentAnalysisServer.
* Simulates random sentiment classification with processing delay.
* Real implementation of SentimentAnalysisServer. Simulates random sentiment classification with
* processing delay.
*/
public class RealSentimentAnalysisServer implements SentimentAnalysisServer {
/**
* A real sentiment analysis implementation would analyze the input string using, e.g., NLP and
* determine whether the sentiment is positive, negative or neutral. Here we simply choose a random
* number to simulate this. The "model" may take some time to process the input and we simulate
* this by delaying the execution 5 seconds.
* determine whether the sentiment is positive, negative or neutral. Here we simply choose a
* random number to simulate this. The "model" may take some time to process the input and we
* simulate this by delaying the execution 5 seconds.
*
* @param text the input string to analyze
* @return sentiment classification result (Positive, Negative, or Neutral)
*/
private final Supplier<Integer> sentimentSupplier;
// Constructor
@@ -66,4 +64,3 @@ public class RealSentimentAnalysisServer implements SentimentAnalysisServer {
return sentiment == 0 ? "Positive" : sentiment == 1 ? "Negative" : "Neutral";
}
}
@@ -24,10 +24,7 @@
*/
package com.iluwatar.servicestub;
/**
* Sentiment analysis server interface to be implemented by sentiment analysis services.
*/
/** Sentiment analysis server interface to be implemented by sentiment analysis services. */
public interface SentimentAnalysisServer {
/**
* Analyzes the sentiment of the input text and returns the result.
@@ -25,10 +25,9 @@
package com.iluwatar.servicestub;
/**
* Stub implementation of SentimentAnalysisServer.
* Returns deterministic sentiment based on input keywords.
* Stub implementation of SentimentAnalysisServer. Returns deterministic sentiment based on input
* keywords.
*/
public class StubSentimentAnalysisServer implements SentimentAnalysisServer {
/**
@@ -24,9 +24,10 @@
*/
package com.iluwatar.servicestub;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import org.junit.jupiter.api.Test;
public class AppTest {
@Test
void shouldExecuteWithoutException() {
@@ -24,9 +24,10 @@
*/
package com.iluwatar.servicestub;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class RealSentimentAnalysisServerTest {
@Test
@@ -46,5 +47,4 @@ class RealSentimentAnalysisServerTest {
RealSentimentAnalysisServer server = new RealSentimentAnalysisServer(() -> 2);
assertEquals("Neutral", server.analyzeSentiment("Test"));
}
}
@@ -24,9 +24,10 @@
*/
package com.iluwatar.servicestub;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class StubSentimentAnalysisServerTest {
private final StubSentimentAnalysisServer stub = new StubSentimentAnalysisServer();