Skip to content

Commit

Permalink
feat : apply best practices (#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli authored Aug 31, 2024
1 parent ea329f0 commit 3bcc0fe
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
6 changes: 6 additions & 0 deletions catalog-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static Order getOrder() {
}

public static OrderRequest getOrderRequest(Order order) {
OrderItem orderItem = order.getItems().get(0);
OrderItem orderItem = order.getItems().getFirst();
OrderItem orderItem1 = order.getItems().get(1);
return new OrderRequest(
order.getCustomerId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void shouldDeleteOrder() throws Exception {

@Test
void shouldFindOrdersByCustomersId() throws Exception {
OrderItem orderItem = orderList.getFirst().getItems().get(0);
OrderItem orderItem = orderList.getFirst().getItems().getFirst();
mockMvc.perform(
get("/api/orders/customer/{id}", orderList.getFirst().getCustomerId())
.queryParam("page", "0")
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<name>spring-boot-microservices-series-v2</name>

<properties>
<maven.compiler.release>21</maven.compiler.release>
<sonar.organization>rajadilipkolli</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public InventoryController(InventoryServiceClient inventoryServiceClient) {
}

@GetMapping("/inventory")
String showInventoriesPage(@RequestParam(name = "page", defaultValue = "0") int page, Model model) {
String showInventoriesPage(@RequestParam(defaultValue = "0") int page, Model model) {
model.addAttribute("pageNo", page);
return "inventory";
}

@GetMapping("/api/inventory")
@ResponseBody
PagedResult<InventoryResponse> inventories(@RequestParam(name = "page", defaultValue = "0") int page, Model model) {
PagedResult<InventoryResponse> inventories(@RequestParam(defaultValue = "0") int page, Model model) {
log.info("Fetching inventories for page: {}", page);
return inventoryServiceClient.getInventories(page);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ String index() {
}

@GetMapping("/products")
String showProductsPage(@RequestParam(name = "page", defaultValue = "0") int page, Model model) {
String showProductsPage(@RequestParam(defaultValue = "0") int page, Model model) {
model.addAttribute("pageNo", page);
return "products";
}
Expand All @@ -43,7 +43,7 @@ ProductResponse createProduct(@RequestBody ProductRequest productRequest) {

@GetMapping("/api/products")
@ResponseBody
PagedResult<ProductResponse> products(@RequestParam(name = "page", defaultValue = "0") int page, Model model) {
PagedResult<ProductResponse> products(@RequestParam(defaultValue = "0") int page, Model model) {
log.info("Fetching products for page: {}", page);
return catalogService.getProducts(page);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ REALM_URL=${OAUTH2_SERVER_URL}/realms/retailstore
spring.security.oauth2.client.registration.retailstore-webapp.client-id=retailstore-webapp
spring.security.oauth2.client.registration.retailstore-webapp.client-secret=P1sibsIrELBhmvK18BOzw1bUl96DcP2z
spring.security.oauth2.client.registration.retailstore-webapp.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.retailstore-webapp.scope=openid, profile
spring.security.oauth2.client.registration.retailstore-webapp.scope=openid, profile
spring.threads.virtual.enabled=true
spring.security.oauth2.client.registration.retailstore-webapp.redirect-uri={baseUrl}/login/oauth2/code/retailstore-webapp

spring.security.oauth2.client.provider.retailstore-webapp.issuer-uri=${REALM_URL}
Expand Down
6 changes: 0 additions & 6 deletions service-registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-testcontainers</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Expand Down

0 comments on commit 3bcc0fe

Please sign in to comment.