Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
swafit committed Oct 23, 2023
1 parent 6039d58 commit 56a7cc8
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 55 deletions.
4 changes: 2 additions & 2 deletions api-gateway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ dependencies {
'org.springframework.boot:spring-boot-starter-actuator',
'org.springframework.boot:spring-boot-starter-validation',
'io.jsonwebtoken:jjwt-api:0.11.2',
'org.webjars:jquery:3.6.0', // https://mvnrepository.com/artifact/org.webjars/jquery
'org.webjars:jquery:3.7.1', // https://mvnrepository.com/artifact/org.webjars/jquery
'org.webjars:angularjs:2.0.0-alpha.22', // https://mvnrepository.com/artifact/org.webjars/angularjs
'org.webjars.bower:angular-ui-router:1.0.28', // https://mvnrepository.com/artifact/org.webjars.bower/angular-ui-router
'org.webjars.bower:angular-ui-router:1.0.29', // https://mvnrepository.com/artifact/org.webjars.bower/angular-ui-router
'org.webjars:webjars-locator-core:0.47', // https://mvnrepository.com/artifact/org.webjars/webjars-locator-core
'ro.isdc.wro4j:wro4j-core:1.10.1', // https://mvnrepository.com/artifact/ro.isdc.wro4j/wro4j-core
'com.github.houbie:lesscss-gradle-plugin:1.0.3-less-1.7.0', // https://mvnrepository.com/artifact/com.github.houbie/lesscss-gradle-plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import reactor.core.publisher.Mono;

import java.util.Map;
import java.util.List;
import java.util.Optional;

/**
Expand Down Expand Up @@ -263,7 +262,7 @@ public Mono<VisitResponseDTO> getVisitByVisitId(@PathVariable String visitId){
return visitsServiceClient.getVisitByVisitId(visitId);
}
@PostMapping(value = "visit/owners/{ownerId}/pets/{petId}/visits", consumes = "application/json", produces = "application/json")
Mono<ResponseEntity<VisitResponseDTO>> addVisit(@RequestBody VisitRequestDTO visit, @PathVariable String ownerId, @PathVariable String petId, @CookieValue("Bearer") String auth) {
Mono<ResponseEntity<VisitResponseDTO>> addVisit(@RequestBody VisitRequestDTO visit, @PathVariable String ownerId, /*@PathVariable String petId,*/ @CookieValue("Bearer") String auth) {
visit.setOwnerId(ownerId);
visit.setJwtToken(auth);
return visitsServiceClient.createVisitForPet(visit).map(ResponseEntity.status(HttpStatus.CREATED)::body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

@SpringBootTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private Mail generateVisitRequestEmail(UserDetails user, String petName, LocalDa
<body>
<div class="container">
<h1>Dear %s,</h1>
<h3>We have received a request to schedule a visit for one of your pet: %s at the following date and time: %s.</h3>
<h3>We have received a request to schedule a visit for your pet with id: %s on the following date and time: %s.</h3>
\s
<p>If you do not wish to create an account, please disregard this email.</p>
\s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@RequiredArgsConstructor
@Component
public class Rethrower {

private final ObjectMapper objectMapper;
public Mono<? extends Throwable> rethrow(ClientResponse clientResponse, Function<Map, ? extends Throwable> exceptionProvider) {
return clientResponse.createException().flatMap(n ->
Expand All @@ -23,7 +22,7 @@ public Mono<? extends Throwable> rethrow(ClientResponse clientResponse, Function
objectMapper.readValue(n.getResponseBodyAsString(), Map.class);
return Mono.error(exceptionProvider.apply(map));
} catch (JsonProcessingException e) {
e.printStackTrace();
// e.printStackTrace();
return Mono.error(e);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,11 @@
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* Created by IntelliJ IDEA.
*
* User: @Fube
* Date: 2021-10-15
* Ticket: feat(APIG-CPC-354)
*/

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder(toBuilder = true)
public class Role {

private int id;
private String name;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.petclinic.visits.visitsservicenew.DomainClientLayer.Mailing;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpClientErrorException;
import retrofit2.Response;

import java.io.IOException;

import lombok.extern.slf4j.Slf4j;
@Slf4j //uncomment for debugging
@Service
@Slf4j
@RequiredArgsConstructor
public class MailServiceImpl implements MailService {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

import java.util.Objects;

@Service
public class VetsClient {

Expand All @@ -26,23 +28,19 @@ public VetsClient(@Value("${app.vet-service.host}") String vetServiceHost,


public Mono<VetDTO> getVetByVetId(String vetId) {
Mono<VetDTO> vetDTOMono =
webClient
return webClient
.get()
.uri(vetClientServiceBaseURL + "/{vetId}", vetId)
.retrieve()
.onStatus(HttpStatusCode::is4xxClientError, error -> {
HttpStatusCode statusCode = error.statusCode();
if (statusCode.equals(HttpStatus.NOT_FOUND))
if (Objects.equals(statusCode, HttpStatus.NOT_FOUND))
return Mono.error(new NotFoundException("No veterinarian was found with vetId: " + vetId));
return Mono.error(new IllegalArgumentException("Something went wrong"));
})
.onStatus(HttpStatusCode::is5xxServerError, error ->
Mono.error(new IllegalArgumentException("Something went wrong"))
)
.bodyToMono(VetDTO.class);

return vetDTOMono;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import com.fasterxml.jackson.annotation.JsonFormat;
import com.petclinic.visits.visitsservicenew.DataLayer.Status;
import com.petclinic.visits.visitsservicenew.DomainClientLayer.Auth.UserDetails;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ void deleteAllCancelledVisits () {
Mockito.verify(visitRepo, Mockito.times(1)).deleteAll(cancelledVisits);
}


@Test
void deleteAllCanceledVisits_shouldThrowRuntimeException () {
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.petclinic.visits.visitsservicenew.DomainClientLayer.Auth.AuthServiceClient;
import com.petclinic.visits.visitsservicenew.DomainClientLayer.Auth.Rethrower;
import com.petclinic.visits.visitsservicenew.DomainClientLayer.Auth.UserDetails;
import lombok.RequiredArgsConstructor;
import okhttp3.mockwebserver.MockResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void deleteAllCancelledVisits_shouldSucceed(){
Mockito.when(visitService.deleteAllCancelledVisits()).thenReturn(Mono.empty());

// Act & Assert
webTestClient
webTestClient
.delete()
.uri("/visits/cancelled")
.exchange()
Expand Down

0 comments on commit 56a7cc8

Please sign in to comment.