mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-09-10 04:19:54 +00:00
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:
+6
-8
@@ -41,10 +41,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* journey.
|
||||
*
|
||||
* <p>This implementation demonstrates distributed tracing in a microservices architecture for an
|
||||
* e-commerce platform. When a customer places an order, the OrderService interacts with
|
||||
* both the PaymentService to process the payment and the ProductService to check the
|
||||
* product inventory. Tracing logs are generated for each interaction, and these logs can be
|
||||
* visualized using Zipkin.
|
||||
* e-commerce platform. When a customer places an order, the OrderService interacts with both the
|
||||
* PaymentService to process the payment and the ProductService to check the product inventory.
|
||||
* Tracing logs are generated for each interaction, and these logs can be visualized using Zipkin.
|
||||
*
|
||||
* <p>To run Zipkin and view the tracing logs, you can use the following Docker command:
|
||||
*
|
||||
@@ -52,9 +51,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* {@code docker run -d -p 9411:9411 --name zipkin openzipkin/zipkin }
|
||||
* </pre>
|
||||
*
|
||||
* <p>Start Zipkin with the command above. Once Zipkin is running, you can
|
||||
* access the Zipkin UI at <a href="http://localhost:9411">http://localhost:9411</a>
|
||||
* to view the tracing logs and analyze the request flows across your microservices.
|
||||
* <p>Start Zipkin with the command above. Once Zipkin is running, you can access the Zipkin UI at
|
||||
* <a href="http://localhost:9411">http://localhost:9411</a> to view the tracing logs and analyze
|
||||
* the request flows across your microservices.
|
||||
*
|
||||
* <p>To place an order and generate tracing data, you can use the following curl command:
|
||||
*
|
||||
@@ -64,7 +63,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
*
|
||||
* <p>This command sends a POST request to create an order, which will trigger interactions with the
|
||||
* payment and product microservices, generating tracing logs that can be viewed in Zipkin.
|
||||
*
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class Main {
|
||||
|
||||
+1
-3
@@ -30,9 +30,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Controller for handling product validation requests.
|
||||
*/
|
||||
/** Controller for handling product validation requests. */
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class ProductController {
|
||||
|
||||
+4
-6
@@ -24,17 +24,15 @@
|
||||
*/
|
||||
package com.iluwatar.product.microservice;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import com.iluwatar.product.microservice.microservice.Main;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
/** Application test */
|
||||
class MainTest {
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> Main.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-9
@@ -24,14 +24,13 @@
|
||||
*/
|
||||
package com.iluwatar.product.microservice;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.iluwatar.product.microservice.microservice.ProductController;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
class ProductControllerTest {
|
||||
|
||||
private ProductController productController;
|
||||
@@ -41,9 +40,7 @@ class ProductControllerTest {
|
||||
productController = new ProductController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to validate the product.
|
||||
*/
|
||||
/** Test to validate the product. */
|
||||
@Test
|
||||
void testValidateProduct() {
|
||||
// Arrange
|
||||
@@ -54,9 +51,7 @@ class ProductControllerTest {
|
||||
assertEquals(ResponseEntity.ok(true), response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to validate the product with null request.
|
||||
*/
|
||||
/** Test to validate the product with null request. */
|
||||
@Test
|
||||
void testValidateProductWithNullRequest() {
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user