Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1074 from hmcts/revert-1073-revert-1
Browse files Browse the repository at this point in the history
Revert "revert - java 17"
  • Loading branch information
AndreiTrushkov committed Nov 16, 2023
2 parents 4845079 + d9911e4 commit 4778b98
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 80 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG APP_INSIGHTS_AGENT_VERSION=2.5.1
FROM hmctspublic.azurecr.io/base/java:11-distroless
COPY lib/AI-Agent.xml /opt/app/
ARG APP_INSIGHTS_AGENT_VERSION=3.4.13
FROM hmctspublic.azurecr.io/base/java:17-distroless-debug
COPY lib/applicationinsights.json /opt/app/
COPY build/libs/sscs-ccd-callback-orchestrator.jar /opt/app/

CMD ["sscs-ccd-callback-orchestrator.jar"]
Expand Down
43 changes: 29 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ plugins {
id 'application'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'uk.gov.hmcts.java' version '0.12.12'
id 'org.springframework.boot' version '2.3.5.RELEASE'
id 'io.spring.dependency-management' version '1.1.0'
id 'uk.gov.hmcts.java' version '0.12.43'
id 'org.springframework.boot' version '2.7.12'
id 'com.github.ben-manes.versions' version '0.46.0'
id 'org.owasp.dependencycheck' version '8.3.1'
id 'org.sonarqube' version '4.3.0.3225'
Expand All @@ -14,8 +14,11 @@ plugins {
group = 'uk.gov.hmcts.reform'
version = '0.0.1'

sourceCompatibility = 11
targetCompatibility = 11
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

sourceSets {
functionalTest {
Expand Down Expand Up @@ -202,7 +205,7 @@ repositories {

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR12"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.4"
}
dependencies {
dependency group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
Expand All @@ -221,6 +224,8 @@ dependencyManagement {
entry 'netty-transport-native-epoll'
entry 'netty-transport-native-kqueue'
entry 'netty-transport-native-unix-common'
entry 'netty-transport-classes-epoll'
entry 'netty-transport-classes-kqueue'
}

// CVE-2022-23181 - CVE-2022-23181
Expand All @@ -240,7 +245,7 @@ dependencyManagement {
}

//CVE-2021-22118
dependencySet(group: 'org.springframework', version: '5.2.24.RELEASE') {
dependencySet(group: 'org.springframework', version: '5.3.28') {
entry 'spring-aop'
entry 'spring-aspects'
entry 'spring-beans'
Expand Down Expand Up @@ -285,6 +290,12 @@ dependencyManagement {

//CVE-2021-28170
dependency group: 'org.glassfish', name: 'jakarta.el', version: '4.0.2'

dependencySet(group: 'org.springframework.cloud', version: '3.0.5') {
entry 'spring-cloud-starter-openfeign'
entry 'spring-cloud-openfeign-core'
}

}
}

Expand All @@ -301,17 +312,16 @@ dependencies {
implementation group: 'org.springframework.retry', name: 'spring-retry', version: '1.3.1'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.2.10.RELEASE'

implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.7.0'
implementation group: 'org.apache.qpid', name: 'qpid-jms-client', version: '1.5.0'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'
implementation group: 'io.github.openfeign', name: 'feign-jackson', version: '10.1.0'
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'

implementation group: 'com.github.hmcts', name: 'properties-volume-spring-boot-starter', version: '0.1.0'
implementation group: 'com.github.hmcts', name: 'java-logging', version: '5.1.9'
implementation group: 'com.github.hmcts', name: 'java-logging', version: '6.0.1'
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '7.4'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '4.0.3'

implementation group: 'com.microsoft.azure', name: 'applicationinsights-logging-logback', version: '2.6.3'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-spring-boot-starter', version: '2.6.3'

implementation group: 'org.pitest', name: 'pitest', version: '1.14.2'
implementation group:'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.9.11'
implementation group:'org.codehaus.sonar-plugins', name:'sonar-pitest-plugin', version: '0.5'
Expand All @@ -322,16 +332,21 @@ dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.9.1'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.9.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.1'
implementation group: 'org.apiguardian', name: 'apiguardian-api', version: '1.1.2'

testImplementation group: 'com.github.hmcts', name: 'sscs-common', version: '4.26.2'
testImplementation group: 'com.github.hmcts', name: 'sscs-common', version: '4.26.4'
testImplementation group: 'com.github.hmcts', name: 'fortify-client', version: '1.2.2', classifier: 'all'

testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.6.2') {
exclude group: "com.vaadin.external.google", module:"android-json"
}

testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.0.0'
testImplementation group: 'pl.pragmatists', name: 'JUnitParams', version: '1.1.1'
testImplementation group: 'org.apache.qpid', name: 'qpid-broker-core', version: '8.0.6'
testImplementation group: 'org.apache.qpid', name: 'qpid-broker-plugins-amqp-1-0-protocol', version: '8.0.6'
testImplementation group: 'org.apache.qpid', name: 'qpid-broker-plugins-memory-store', version: '8.0.6'
testImplementation group: 'com.h2database', name: 'h2', version: '2.1.214'

integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
Expand Down
4 changes: 2 additions & 2 deletions charts/sscs-ccd-callback-orchestrator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: v2
name: sscs-ccd-callback-orchestrator
home: https://github.com/hmcts/sscs-ccd-callback-orchestrator
version: 0.0.29
version: 0.0.31
description: SSCS CCD Callback Orchestrator
maintainers:
- name: HMCTS SSCS Team
dependencies:
- name: java
version: 4.1.5
version: 5.0.0
repository: https://hmctspublic.azurecr.io/helm/v1/repo/
27 changes: 16 additions & 11 deletions charts/sscs-ccd-callback-orchestrator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ java:
ingressHost: sscs-ccd-callback-orchestrator-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
keyVaults:
sscs:
resourceGroup: sscs
secrets:
- idam-api
- idam-oauth-user
- idam-redirect
- idam-sscs-systemupdate-user
- idam-sscs-systemupdate-password
- idam-sscs-oauth2-client-secret
- sscs-s2s-secret
- s2s-micro
- evidence-share-topic-shared-access-key
- AppInsightsInstrumentationKey
- name: idam-api
alias: IDAM_URL
- name: idam-sscs-systemupdate-user
alias: IDAM_SSCS_SYSTEMUPDATE_USER
- name: idam-sscs-systemupdate-password
alias: IDAM_SSCS_SYSTEMUPDATE_PASSWORD
- name: idam-sscs-oauth2-client-secret
alias: IDAM_OAUTH2_CLIENT_SECRET
- name: sscs-s2s-secret
alias: IDAM_S2S_AUTH_TOTP_SECRET
- name: s2s-micro
alias: IDAM_S2S_AUTH_MICROSERVICE
- name: app-insights-connection-string
alias: app_insights_connection_string
- name: evidence-share-topic-shared-access-key
alias: AMQP_PASSWORD
environment:
REFORM_TEAM: sscs
REFORM_SERVICE_NAME: sscs-ccd-callback-orchestrator
Expand Down
13 changes: 0 additions & 13 deletions lib/AI-Agent.xml

This file was deleted.

6 changes: 6 additions & 0 deletions lib/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"connectionString": "${file:/mnt/secrets/sscs/app_insights_connection_string}",
"role": {
"name": "Ccd Callback Orchestrator"
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
package uk.gov.hmcts.reform.sscs.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import uk.gov.hmcts.reform.sscs.Application;

@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.select()
.apis(RequestHandlerSelectors.basePackage(Application.class.getPackage().getName() + ".controllers"))
.paths(PathSelectors.any())
.build();
public OpenAPI ccdCallbackOrchestrator() {
return new OpenAPI()
.info(new Info().title("CCD Callback Orchestrator")
.description("CCD Callback Orchestrator")
.version("v0.0.1")
.license(new License().name("Apache 2.0").url("http://springdoc.org")));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public ConnectionFactory jmsConnectionFactory(@Value("${spring.application.name}
@Value("${amqp.password}") final String password,
@Autowired final String jmsUrlString,
@Autowired(required = false) final SSLContext jmsSslContext) {
String connection = password + " ";
log.info("Attempting to connect to jms with {}", connection);
JmsConnectionFactory jmsConnectionFactory = new JmsConnectionFactory(jmsUrlString);
jmsConnectionFactory.setUsername(username);
jmsConnectionFactory.setPassword(password);
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ management:
spring:
application:
name: Ccd Callback Orchestrator
config:
import: "optional:configtree:/mnt/secrets/sscs/"

amqp:
host: ${AMQP_HOST:localhost}
Expand All @@ -26,7 +28,7 @@ idam:
url: ${IDAM_URL:http://localhost:5000}
s2s-auth:
totp_secret: ${IDAM_S2S_AUTH_TOTP_SECRET:AAAAAAAAAAAAAAAC}
microservice: ${IDAM_S2S_AUTH_MICROSERVICE:sscs}
microservice: ${IDAM_S2S_AUTH_MICROSERVICE:sscstest}
url: ${IDAM_S2S_AUTH:http://localhost:4502}
oauth2:
user:
Expand All @@ -50,3 +52,6 @@ feign:
config:
core-case-data-api:
decode404: true

springdoc:
packagesToScan: "uk.gov.hmcts.sscs.controllers"
17 changes: 0 additions & 17 deletions src/main/resources/bootstrap.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,29 @@ public void authoriseClientRequest() {
@Test(expected = ClientAuthorisationException.class)
public void shouldHandleAnAuthorisationException() {
when(serviceAuthorisationApi.getServiceName(ArgumentMatchers.any()))
.thenThrow(new CustomFeignException(400, ""));
.thenThrow(new CustomFeignException(400, "", new RuntimeException("ClientAuthorisationException")));
service.authorise(SERVICE_NAME);
}

@Test(expected = AuthorisationException.class)
public void shouldHandleAnUnknownFeignException() {
when(serviceAuthorisationApi.getServiceName(ArgumentMatchers.any()))
.thenThrow(new CustomFeignException(501, ""));
.thenThrow(new CustomFeignException(501, "", new RuntimeException("AuthorisationException")));
service.authorise(SERVICE_NAME);
}

@Test(expected = AuthorisationException.class)
public void shouldHandleAnUnknownFeignException2() {
when(serviceAuthorisationApi.getServiceName(ArgumentMatchers.any()))
.thenThrow(new CustomFeignException(399, ""));
.thenThrow(new CustomFeignException(399, "", new RuntimeException("AuthorisationException")));
service.authorise(SERVICE_NAME);
}

private class CustomFeignException extends FeignException {
public static final long serialVersionUID = 7309337492649637392L;

CustomFeignException(int status, String message) {
super(status, message);
CustomFeignException(int status, String message, Throwable throwable) {
super(status, message, throwable);
}
}

Expand Down

0 comments on commit 4778b98

Please sign in to comment.