Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pay 6022 java17 #530

Merged
merged 35 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b809c28
java 17
chrisworthcgi Aug 2, 2023
12f9c61
java 17
chrisworthcgi Aug 2, 2023
f71989a
java 17
chrisworthcgi Aug 2, 2023
95cc1d3
lombok 1.18.28
chrisworthcgi Aug 2, 2023
2c66b7b
gradle 7.6.2
chrisworthcgi Aug 2, 2023
3e3d5db
spring
chrisworthcgi Aug 3, 2023
d2e96b7
remove all spring references
chrisworthcgi Aug 3, 2023
85dcecf
logging and logback
chrisworthcgi Aug 3, 2023
7360182
remove logback
chrisworthcgi Aug 3, 2023
34a5734
mockito package structure
chrisworthcgi Aug 3, 2023
059bb2d
remove jackson
chrisworthcgi Aug 3, 2023
dbd09c3
jackson databind
chrisworthcgi Aug 3, 2023
2afac79
springdoc for swagger
chrisworthcgi Aug 4, 2023
6dbbb2d
remove springfox
chrisworthcgi Aug 4, 2023
0b07309
remove micrometer, junit
chrisworthcgi Aug 4, 2023
f6c0b0b
swagger 3
chrisworthcgi Aug 4, 2023
20f32b5
MockMvc used to strip trailing zeros from BigDecimals, which was wron…
chrisworthcgi Aug 4, 2023
1d43f49
java.toolchain.languageVersion
chrisworthcgi Aug 7, 2023
e6f9c2b
assertThrows needs importing
chrisworthcgi Aug 7, 2023
671ccac
remove commented out lines
chrisworthcgi Aug 7, 2023
1e4172c
mount for secrets
chrisworthcgi Aug 7, 2023
037f57e
remove commented out lines
chrisworthcgi Aug 7, 2023
3cd9fe0
add secrets and aliases
chrisworthcgi Aug 7, 2023
acf14d4
Bumping chart version/ fixing aliases
hmcts-jenkins-a-to-c[bot] Aug 7, 2023
4422df3
serenity upgrade
chrisworthcgi Aug 7, 2023
8b7637c
owasp suppressions
chrisworthcgi Aug 8, 2023
cacd591
owasp suppressions
chrisworthcgi Aug 8, 2023
da4768c
upgrade jackson
chrisworthcgi Aug 8, 2023
e1e4f80
use ccpay keyvault
chrisworthcgi Aug 8, 2023
4a0a298
remove rest-assured version
chrisworthcgi Aug 8, 2023
23397de
fix conflicts
chrisworthcgi Aug 10, 2023
b5cc5b7
remove serenity
chrisworthcgi Aug 14, 2023
26bd99c
upgrade serenity to 3.2.3
chrisworthcgi Aug 14, 2023
b4b2c8e
objenesis and jsr305
chrisworthcgi Aug 14, 2023
aa797f7
smoke tests also need rest-assured
chrisworthcgi Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle packages
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG APP_INSIGHTS_AGENT_VERSION=2.5.1
FROM hmctspublic.azurecr.io/base/java:11-distroless
FROM hmctspublic.azurecr.io/base/java:17-distroless

EXPOSE 8080

Expand Down
4 changes: 2 additions & 2 deletions api-contract/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = ''

dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.9.9'
compile group: 'org.hibernate', name: 'hibernate-validator', version:'7.0.1.Final'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.13.5'
implementation group: 'org.hibernate', name: 'hibernate-validator', version:'7.0.1.Final'

}
40 changes: 18 additions & 22 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
dependencies {
classpath "net.serenity-bdd:serenity-gradle-plugin:2.1.4"
classpath "net.serenity-bdd:serenity-single-page-report:2.1.4"
classpath "net.serenity-bdd:serenity-gradle-plugin:3.2.3"
classpath "net.serenity-bdd:serenity-single-page-report:3.2.3"
}
}

Expand Down Expand Up @@ -54,9 +54,7 @@ def versions = [
pitest: '1.5.1',
gradlePitest: '1.3.0',
sonarPitest: '0.5',
serenity : '2.2.12',
serenityreporter : '2.1.4',
serenityCucumber : '1.9.51'
serenity: '3.2.3',
]

sonarqube {
Expand All @@ -67,7 +65,7 @@ sonarqube {
}
}

def javaLoggingVersion = '5.1.1'
def javaLoggingVersion = '6.0.1'
dependencies {
implementation project(':fees-register-model')
implementation project(':fees-register-api-contract')
Expand All @@ -84,40 +82,38 @@ dependencies {
exclude(module: 'slf4j-simple')
}
implementation group: 'org.liquibase', name: 'liquibase-core', version: '4.2.1'
implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: javaLoggingVersion
implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: javaLoggingVersion
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.0'
implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.0'
implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: javaLoggingVersion
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version:'5.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-devtools'
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude(module: 'commons-logging')
}
testImplementation group: 'org.springframework.security', name: 'spring-security-test', version: '5.2.1.RELEASE'
testImplementation group: 'org.hsqldb', name: 'hsqldb', version: '2.3.5'
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '3.0.7'
testImplementation group: 'org.projectlombok', name: 'lombok', version: '1.18.12'
//testImplementation group: 'io.rest-assured', name: 'rest-assured'
testImplementation group: 'org.projectlombok', name: 'lombok', version: '1.18.28'


annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.12'
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.12'
smokeTestImplementation group: 'org.projectlombok', name: 'lombok', version: '1.18.12'
smokeTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.12'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.28'
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.28'
smokeTestImplementation group: 'org.projectlombok', name: 'lombok', version: '1.18.28'
smokeTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.28'

integrationTestImplementation project(':fees-register-model')
integrationTestImplementation project(':fees-register-api-contract')
integrationTestImplementation sourceSets.test.runtimeClasspath


testCompile 'io.github.openfeign:feign-jackson:9.7.0'
testImplementation 'io.github.openfeign:feign-jackson:9.7.0'
// smoke
smokeTestImplementation sourceSets.test.runtimeClasspath
// functional
functionalTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-cucumber', version: versions.serenityCucumber
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-cucumber', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
implementation group: 'org.pitest', name: 'pitest', version: versions.pitest
implementation 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.6'
implementation 'org.codehaus.sonar-plugins:sonar-pitest-plugin:0.5'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,58 @@
import com.google.common.base.Predicate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.RequestHandler;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.Parameter;
import org.springdoc.core.customizers.OperationCustomizer;
import org.springdoc.core.GroupedOpenApi;
import static java.util.Collections.singletonList;


@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
private static final String HEADER = "header";

@Bean
public Docket oldFeesRegister() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("fees-register")
.globalOperationParameters(singletonList(
new ParameterBuilder()
.name("Authorization")
.description("User authorization header")
.required(false)
.parameterType("header")
.modelRef(new ModelRef("string"))
.build()
))
.apiInfo(oldFeesApiInfo()).select()
.apis(packagesLike("uk.gov.hmcts.fees.register.api.controllers"))
.paths(PathSelectors.any())
public GroupedOpenApi oldFeesRegister() {

return GroupedOpenApi.builder()
.group("fees-register")
.packagesToScan("uk.gov.hmcts.fees.register.api.controllers")
.pathsToMatch("/**")
.addOperationCustomizer(authorizationHeaders())
.build();
}

@Bean
public Docket newFeesRegister() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("fees2-register")
.globalOperationParameters(singletonList(
new ParameterBuilder()
.name("Authorization")
.description("User authorization header")
.required(false)
.parameterType("header")
.modelRef(new ModelRef("string"))
.build()
))
.useDefaultResponseMessages(false)
.apiInfo(newFeesApiInfo()).select()
.apis(packagesLike("uk.gov.hmcts.fees2.register.api.controllers"))
.paths(PathSelectors.any())
.build();
}
public GroupedOpenApi newFeesRegister() {

private static Predicate<RequestHandler> packagesLike(final String pkg) {
return input -> input.declaringClass().getPackage().getName().startsWith(pkg);
return GroupedOpenApi.builder()
.group("fees2-register")
.packagesToScan("uk.gov.hmcts.fees2.register.api.controllers")
.pathsToMatch("/**")
.addOperationCustomizer(authorizationHeaders())
.build();
}

private ApiInfo oldFeesApiInfo() {
return new ApiInfoBuilder()
.title("FeeOld Register API")
.description("FeeOld Register API to retrieve the correct fee.")
.contact(new Contact("Yashar Rahvar", "", "[email protected]"))
.version("1.0")
.build();
@Bean
public OperationCustomizer authorizationHeaders() {
return (operation, handlerMethod) ->
operation
.addParametersItem(
mandatoryStringParameter("Authorization", "User authorization header"))
.addParametersItem(
mandatoryStringParameter("ServiceAuthorization", "Service authorization header"));
}

private ApiInfo newFeesApiInfo() {
return new ApiInfoBuilder()
.title("New Fee API")
.description("New Fee API to retrieve the correct fee.")
.contact(new Contact("Yashar Rahvar", "", "[email protected]"))
.version("1.0")
.build();
private Parameter mandatoryStringParameter(String name, String description) {
return new Parameter()
.name(name)
.description(description)
.required(true)
.in(HEADER)
.schema(new StringSchema());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package uk.gov.hmcts.fees.register.api.controllers;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -46,12 +46,11 @@ public Category getCategory(@PathVariable(value = "id") String categoryId) {
.orElseThrow(() -> new EntityNotFoundException("Category not found, id: " + categoryId));
}

@ApiOperation(value = "Find appropriate fees amount for given claim.",
notes = "This endpoint returns appropriate fee for given category(e.g. onlinefees or hearingfees). All input and output amounts are in pence. ", response = Fee.class)
@Operation(summary = "Find appropriate fees amount for given claim. This endpoint returns appropriate fee for given category(e.g. onlinefees or hearingfees). All input and output amounts are in pence. ")
@GetMapping("/categories/{id}/ranges/{amount}/fees")
public ChargeableFeeWrapperDto getCategoryRange(
@ApiParam(value = "This is fee category. potential values can be onlinefees or hearingfees", required = true) @PathVariable(value = "id") String id,
@ApiParam(value = "This is claim amount in pence", required = true) @PathVariable(value = "amount") int amount) {
@Parameter(description = "This is fee category. potential values can be onlinefees or hearingfees", required = true) @PathVariable(value = "id") String id,
@Parameter(description = "This is claim amount in pence", required = true) @PathVariable(value = "amount") int amount) {

Fee fee = getCategory(id)
.findRange(amount)
Expand All @@ -62,23 +61,21 @@ public ChargeableFeeWrapperDto getCategoryRange(
}


@ApiOperation(value = "Find appropriate flat fees for given fee id.",
notes = "This endpoint returns appropriate fee for given category(e.g. onlinefees or hearingfees) and flat fee id. ", response = Fee.class)
@Operation(summary = "Find appropriate flat fees for given fee id. This endpoint returns appropriate fee for given category(e.g. onlinefees or hearingfees) and flat fee id. ")
@GetMapping("/categories/{id}/flat/{feeId}")
public Fee getFlatFeeInACategory(
@ApiParam(value = "This is fee category. potential values can be onlinefees or hearingfees", required = true) @PathVariable(value = "id") String id,
@ApiParam(value = "This is flat fee in a category", required = true) @PathVariable(value = "feeId") String feeId) {
@Parameter(description = "This is fee category. potential values can be onlinefees or hearingfees", required = true) @PathVariable(value = "id") String id,
@Parameter(description = "This is flat fee in a category", required = true) @PathVariable(value = "feeId") String feeId) {

return getCategory(id)
.findFlatFee(feeId)
.orElseThrow(() -> new EntityNotFoundException("Flat fees not found, feeId: " + feeId));
}

@ApiOperation(value = "Find all flat fees for given category.",
notes = "This endpoint returns all flat fees for given category(e.g. onlinefees or hearingfees). ", response = Fee.class)
@Operation(summary = "Find all flat fees for given category. This endpoint returns all flat fees for given category(e.g. onlinefees or hearingfees). ")
@GetMapping("/categories/{id}/flat")
public List<Fee> getAllFlatFeesInACategory(
@ApiParam(value = "This is fee category. potential values can be onlinefees or hearingfees", required = true) @PathVariable(value = "id") String id) {
@Parameter(description = "This is fee category. potential values can be onlinefees or hearingfees", required = true) @PathVariable(value = "id") String id) {

List<Fee> flatFees = getCategory(id).getFlatFees();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package uk.gov.hmcts.fees.register.api.controllers.rangegroups;

import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -63,8 +63,7 @@ public RangeGroupDto createOrUpdateRangeGroup(@Length(max = 50) @PathVariable("c
return rangeGroupsDtoMapper.toRangeGroupDto(existingRangeGroup);
}

@ApiOperation(value = "Find appropriate fees amount for given claim.",
notes="The endpoint returns the fee for specified amount", response = CalculationDto.class)
@Operation(summary = "Find appropriate fees amount for given claim. The endpoint returns the fee for specified amount")
@GetMapping("/range-groups/{code}/calculations")
public CalculationDto getCategoryRange(@PathVariable("code") String code, @RequestParam(value = "value") int value) {
RangeGroup rangeGroup = rangeGroupRepository.findByCodeOrThrow(code);
Expand All @@ -73,8 +72,7 @@ public CalculationDto getCategoryRange(@PathVariable("code") String code, @Reque
return new CalculationDto(fee.calculate(value), feesDtoMapper.toFeeDto(fee));
}

@ApiOperation(value = "Find max fees amount for an unspecified value.",
notes="The endpoint returns the max fee for the unspecified amount", response = CalculationDto.class)
@Operation(summary = "Find max fees amount for an unspecified value. The endpoint returns the max fee for the unspecified amount")
@GetMapping("/range-groups/cmc-paper/calculations/unspecified")
public CalculationDto getMaxFeeForUnspecifiedRange() {
RangeGroup rangeGroup = rangeGroupRepository.findByCodeOrThrow(CMC_PAPER);
Expand Down
Loading
Loading