This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @JsonFilter("userFilter") | |
| public class User { | |
| private Integer id; | |
| private String name; | |
| private Date dob; | |
| private String city; | |
| // constructors, getters & setters are ignored | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class User { | |
| private Integer id; | |
| private String name; | |
| private Date dob; | |
| private String city; | |
| // constructors, getters & setters are ignored | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How to ignore fields in Java Object while serializing | |
| // Approach 1 - @JsonIgnoreProperties | |
| @JsonIgnoreProperties(value = {"id", "dob"}) | |
| public class User { | |
| private Integer id; | |
| private String name; | |
| private Date dob; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @GetMapping(value = "/mockService/{serviceName}") | |
| ResponseEntity fetchMockValue(@PathVariable("serviceName") String serviceName) throws IOException { | |
| LOGGER.info("fetchMockValue called for serviceName={}", serviceName); | |
| ResponseEntity responseEntity; | |
| File mockServiceJsonFile = getFile(serviceName); | |
| if(mockServiceJsonFile.exists()) { | |
| String timeoutValue = environment.getProperty(serviceName + ".delay"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM openjdk:8-jre-slim | |
| WORKDIR /home | |
| COPY /target/UserManagement-1.0.jar UserManagement.jar | |
| EXPOSE 8080 | |
| ENTRYPOINT ["java", "-jar", "UserManagement.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM gradle:jdk11 as gradleimage | |
| COPY . /home/gradle/source | |
| WORKDIR /home/gradle/source | |
| RUN gradle build | |
| FROM openjdk:11-jre-slim | |
| COPY --from=gradleimage /home/gradle/source/build/libs/demo.jar /app/ | |
| WORKDIR /app | |
| ENTRYPOINT ["java", "-jar", "demo.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'jacoco' | |
| jacoco { | |
| toolVersion = '0.8.5' | |
| } | |
| test { | |
| finalizedBy jacocoTestReport | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import org.springframework.http.MediaType; | |
| import org.springframework.util.ResourceUtils; | |
| import org.springframework.web.bind.annotation.GetMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| import java.io.File; | |
| import java.io.IOException; | |
| import java.util.Map; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| app: | |
| build: . | |
| image: test-img | |
| ports: | |
| - 8080:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<T> performRequest(ParameterizedTypeReference<List<T>> responseType) { | |
| return restTemplate.exchange("http://www.mocky.io/v2/5e4d66ff2d0000309ec0df14", | |
| HttpMethod.GET, null, responseType).getBody(); | |
| } | |
| performRequest(new ParameterizedTypeReference<List<User>>() {}); |