Skip to content

Commit ce3b6ec

Browse files
authored
Merge branch 'main' into NIAD-3393
2 parents c57dd42 + 75f491d commit ce3b6ec

19 files changed

+848
-58
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
* Prevent duplicate processing: after a medication request is processed, the system no longer pulls a subsequent non‑consultation item based on the same request.
1212

1313
### Added
14+
* The GP2GP Adaptor now validates references inside condition objects to test whether they actually exist. Otherwise, the bundle is rejected.
1415
* The GP2GP Adaptor now adds the EhrComposition / confidentialityCode field when Encounter.meta.security contains NOPAT security entry
1516
* The GP2GP Adaptor now populates the ObservationStatement / confidentialityCode field when the .meta.security field of an Uncategorized Data Observation contains NOPAT
1617
* When List.meta.security field contains NOPAT, the GP2GP Adaptor will now populate the CompoundStatement.confidentialityCode

e2e-tests/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'java'
3-
id "io.freefair.lombok" version "8.14"
3+
id "io.freefair.lombok" version "8.14.2"
44
}
55

66
apply plugin: 'java'
@@ -13,18 +13,18 @@ repositories {
1313
}
1414

1515
dependencies {
16-
implementation 'org.apache.qpid:qpid-jms-client:2.7.0'
16+
implementation 'org.apache.qpid:qpid-jms-client:2.9.0'
1717
implementation "org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1"
1818
implementation 'org.mongodb:mongo-java-driver:3.12.14'
1919
testImplementation(platform('org.junit:junit-bom:5.13.4'))
2020
testImplementation 'org.junit.jupiter:junit-jupiter'
21-
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.19.2'
22-
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.2'
21+
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.20.0'
22+
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.20.0'
2323
testImplementation 'commons-io:commons-io:2.20.0'
2424
testImplementation 'org.awaitility:awaitility:4.3.0'
25-
testImplementation "org.assertj:assertj-core:3.27.4"
25+
testImplementation "org.assertj:assertj-core:3.27.5"
2626
testImplementation 'ch.qos.logback:logback-classic:1.5.18'
27-
testImplementation 'org.xmlunit:xmlunit-assertj3:2.10.3'
27+
testImplementation 'org.xmlunit:xmlunit-assertj3:2.10.4'
2828
testImplementation 'org.apache.httpcomponents.client5:httpclient5:5.5'
2929

3030
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

mock-mhs-adaptor/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
2-
id 'org.springframework.boot' version '3.5.4'
2+
id 'org.springframework.boot' version '3.5.6'
33
id 'io.spring.dependency-management' version '1.1.7'
44
id 'java'
5-
id "io.freefair.lombok" version "8.14"
5+
id "io.freefair.lombok" version "8.14.2"
66
}
77

88
apply plugin: 'java'
@@ -19,7 +19,7 @@ dependencies {
1919
implementation 'org.springframework.boot:spring-boot-starter-actuator'
2020
implementation 'org.springframework.boot:spring-boot-starter-web'
2121
implementation 'org.springframework:spring-jms'
22-
implementation 'org.apache.qpid:qpid-jms-client:2.7.0'
22+
implementation 'org.apache.qpid:qpid-jms-client:2.8.0'
2323
implementation 'org.apache.commons:commons-lang3:3.18.0'
2424
testImplementation 'org.springframework.boot:spring-boot-starter-test'
2525
}

service/build.gradle

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ plugins {
33
id 'io.spring.dependency-management' version '1.1.7'
44
id 'java'
55
id "checkstyle"
6-
id "com.github.spotbugs" version "6.1.13"
7-
id "io.freefair.lombok" version "8.14"
6+
id "com.github.spotbugs" version "6.4.2"
7+
id "io.freefair.lombok" version "8.14.2"
88
id 'jacoco'
99
id 'org.sonarqube' version '6.2.0.5505'
1010

@@ -13,16 +13,27 @@ plugins {
1313
id 'com.arcmutate.github' version '2.2.3'
1414
}
1515

16+
spotbugs {
17+
toolVersion = '4.9.5'
18+
}
19+
1620
apply plugin: 'java'
1721
apply plugin: 'org.springframework.boot'
1822
apply plugin: 'checkstyle'
1923
apply plugin: "com.github.spotbugs"
2024
apply plugin: 'application'
2125

22-
mainClassName = ' uk.nhs.adaptors.gp2gp.Gp2gpApplication'
26+
application {
27+
mainClassName = 'uk.nhs.adaptors.gp2gp.Gp2gpApplication'
28+
}
2329

2430
group = 'uk.nhs.adaptors'
25-
sourceCompatibility = '21'
31+
32+
java {
33+
toolchain {
34+
languageVersion = JavaLanguageVersion.of(21)
35+
}
36+
}
2637

2738
checkstyle {
2839
toolVersion '10.18.2'
@@ -50,9 +61,9 @@ dependencies {
5061
implementation 'org.springframework.boot:spring-boot-starter-logging'
5162

5263
// Infrastructure
53-
implementation 'software.amazon.awssdk:s3:2.32.14'
64+
implementation 'software.amazon.awssdk:s3:2.33.9'
5465
implementation ('com.azure:azure-storage-blob:12.30.0')
55-
implementation 'org.apache.qpid:qpid-jms-client:2.7.0'
66+
implementation 'org.apache.qpid:qpid-jms-client:2.8.0'
5667

5768
// Utils
5869
implementation 'org.apache.commons:commons-lang3:3.18.0'
@@ -75,8 +86,11 @@ dependencies {
7586
testImplementation 'com.squareup.okhttp3:mockwebserver3:5.1.0'
7687
testImplementation 'com.adobe.testing:s3mock-testcontainers:4.7.0'
7788

78-
pitest 'com.arcmutate:base:1.3.2'
79-
pitest 'com.arcmutate:pitest-git-plugin:2.1.0'
89+
spotbugs 'com.github.spotbugs:spotbugs:4.9.5'
90+
spotbugs 'com.github.spotbugs:spotbugs-annotations:4.9.5'
91+
92+
pitest 'com.arcmutate:base:1.3.2'
93+
pitest 'com.arcmutate:pitest-git-plugin:2.1.0'
8094
}
8195

8296
test {
@@ -104,9 +118,10 @@ sourceSets {
104118
}
105119
}
106120

107-
task(interoperabilityTestingToolJsonToXml, dependsOn: 'classes', type: JavaExec) {
108-
mainClass.set('uk.nhs.adaptors.gp2gp.transformjsontoxmltool.TransformJsonToXml')
109-
classpath = sourceSets.main.runtimeClasspath
121+
tasks.register('interoperabilityTestingToolJsonToXml', JavaExec) {
122+
dependsOn 'classes'
123+
mainClass.set('uk.nhs.adaptors.gp2gp.transformjsontoxmltool.TransformJsonToXml')
124+
classpath = sourceSets.main.runtimeClasspath
110125
}
111126

112127
configurations {
@@ -116,21 +131,21 @@ configurations {
116131
integrationTestAnnotationProcessor.extendsFrom testAnnotationProcessor
117132
}
118133

119-
task integrationTest(type: Test) {
120-
useJUnitPlatform() {
121-
description = 'Runs integration tests.'
122-
group = 'verification'
134+
tasks.register('integrationTest', Test) {
135+
useJUnitPlatform() {
136+
description = 'Runs integration tests.'
137+
group = 'verification'
123138

124-
testClassesDirs = sourceSets.integrationTest.output.classesDirs
125-
classpath = sourceSets.integrationTest.runtimeClasspath
126-
shouldRunAfter test
127-
}
139+
testClassesDirs = sourceSets.integrationTest.output.classesDirs
140+
classpath = sourceSets.integrationTest.runtimeClasspath
141+
shouldRunAfter test
142+
}
128143
}
129144

130-
tasks.withType(Test) {
131-
testLogging {
132-
events "passed", "skipped", "failed"
133-
}
145+
tasks.withType(Test).configureEach {
146+
testLogging {
147+
events "passed", "skipped", "failed"
148+
}
134149
}
135150

136151
check.dependsOn integrationTest
@@ -140,13 +155,13 @@ spotbugsIntegrationTest.enabled = false
140155
spotbugsMain {
141156
reports {
142157
html {
143-
enabled = true
158+
enabled(true)
144159
}
145160
xml {
146-
enabled = true
161+
enabled(true)
147162
}
148-
excludeFilter.set(file("spotbugs/exclude.xml"))
149163
}
164+
excludeFilter.set(file("spotbugs/exclude.xml"))
150165
}
151166

152167
pitest {

service/src/main/java/uk/nhs/adaptors/gp2gp/common/configuration/CustomTrustStore.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ private X509TrustManager getDefaultTrustManager() {
5757
}
5858

5959
@SneakyThrows
60-
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE")
6160
protected X509TrustManager getCustomDbTrustManager(S3Uri s3Uri, String trustStorePassword) {
6261
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
6362
trustManagerFactory.init((KeyStore) null);

service/src/main/java/uk/nhs/adaptors/gp2gp/common/mongo/ttl/CosmosTtlCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void create(Class<? extends TimeToLive> clazz) {
2525
String indexName = findTtlIndex().map(IndexInfo::getName).orElseThrow();
2626
getIndexOperations().dropIndex(indexName);
2727
}
28-
getIndexOperations().ensureIndex(new Index()
28+
getIndexOperations().createIndex(new Index()
2929
.expire(getDuration())
3030
.on(INDEX_FIELD_KEY, Sort.Direction.ASC)
3131
);

service/src/main/java/uk/nhs/adaptors/gp2gp/common/mongo/ttl/MongoTtlCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void create(Class<? extends TimeToLive> clazz) {
2525
clazz.getSimpleName(), getDuration());
2626
getIndexOperations().dropIndex(TTL_INDEX_NAME);
2727
}
28-
getIndexOperations().ensureIndex(new Index()
28+
getIndexOperations().createIndex(new Index()
2929
.expire(getDuration())
3030
.named(TTL_INDEX_NAME)
3131
.on(FIELD_KEY, Sort.Direction.ASC)

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/ConditionLinkSetMapper.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public String mapConditionToLinkSet(Condition condition, boolean isNested) {
6565
.isNested(isNested)
6666
.linkSetId(idMapper.getOrNew(ResourceType.Condition, condition.getIdElement()));
6767

68+
testForValidReferences(condition);
69+
6870
buildEffectiveTimeLow(condition).ifPresent(builder::effectiveTimeLow);
6971
buildEffectiveTimeHigh(condition).ifPresent(builder::effectiveTimeHigh);
7072
buildAvailabilityTime(condition).ifPresent(builder::availabilityTime);
@@ -104,6 +106,21 @@ public String mapConditionToLinkSet(Condition condition, boolean isNested) {
104106
return TemplateUtils.fillTemplate(OBSERVATION_STATEMENT_TEMPLATE, builder.build());
105107
}
106108

109+
public void testForValidReferences(Condition condition) {
110+
for (Extension extension : condition.getExtension()) {
111+
if (!(extension.getValue() instanceof Reference)) {
112+
return;
113+
}
114+
IdType idType = (IdType) ((Reference) extension.getValue()).getReferenceElement();
115+
try {
116+
messageContext.getInputBundleHolder().getResource(idType);
117+
} catch (Exception e) {
118+
LOGGER.warn("Bundle mapping aborted. Reason: " + e.getMessage());
119+
throw e;
120+
}
121+
}
122+
}
123+
107124
private void setQualifierProperties(ConditionLinkSetMapperParameters.ConditionLinkSetMapperParametersBuilder builder,
108125
String qualifier) {
109126
builder.qualifierDisplay(qualifier);

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/EncounterMapper.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
import com.github.mustachejava.Mustache;
2525

26-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
2726
import lombok.RequiredArgsConstructor;
2827
import lombok.SneakyThrows;
2928
import lombok.extern.slf4j.Slf4j;
@@ -171,8 +170,6 @@ private String buildOriginalText(Encounter encounter) {
171170
}
172171

173172
@SneakyThrows
174-
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
175-
justification = "https://github.com/spotbugs/spotbugs/issues/1338")
176173
private static Set<String> getEhrCompositionNameVocabularyCodes() {
177174
try (InputStream is = EncounterMapper.class.getClassLoader().getResourceAsStream("ehr_composition_name_vocabulary_codes.txt");
178175
BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8))) {

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/SupportedContentTypes.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.springframework.beans.factory.annotation.Autowired;
1313
import org.springframework.stereotype.Component;
1414

15-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1615
import lombok.AllArgsConstructor;
1716
import lombok.SneakyThrows;
1817

@@ -27,8 +26,6 @@ public boolean isContentTypeSupported(String attachmentContentType) {
2726
}
2827

2928
@SneakyThrows
30-
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
31-
justification = "https://github.com/spotbugs/spotbugs/issues/1338")
3229
private static Set<String> loadSupportedContentTypes() {
3330
try (InputStream is = SupportedContentTypes.class.getClassLoader().getResourceAsStream(SUPPORTED_CONTENT_TYPES_PATH);
3431
BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8))) {

0 commit comments

Comments
 (0)