Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 9a013b0

Browse files
committed
Merge branch 'azure-load-tests' of https://github.com/CDCgov/trusted-intermediary into azure-load-tests
2 parents be3a898 + fcd9c16 commit 9a013b0

File tree

56 files changed

+1529
-757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1529
-757
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ dependencies {
2323
implementation project(':etor')
2424
testImplementation testFixtures(project(':shared'))
2525

26-
implementation 'io.javalin:javalin:6.3.0'
26+
implementation 'io.javalin:javalin:6.4.0'
2727

2828
testImplementation 'org.apache.groovy:groovy:4.0.24'
2929
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
3030
testImplementation 'com.openpojo:openpojo:0.9.1'
31-
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.17.5'
31+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.18'
3232
}
3333

3434
jacocoTestCoverageVerification {

app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/App.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public static void main(String[] args) {
4848

4949
// apply this security header to all responses, but allow it to be overwritten by a specific
5050
// endpoint by using `before` if needed
51-
app.before(ctx -> ctx.header("X-Content-Type-Options", "nosniff"));
51+
app.before(
52+
ctx -> {
53+
ctx.header("X-Content-Type-Options", "nosniff");
54+
// Fix for https://www.zaproxy.org/docs/alerts/90004
55+
ctx.header("Cross-Origin-Resource-Policy", "cross-origin");
56+
});
5257

5358
try {
5459
app.get(HEALTH_API_ENDPOINT, ctx -> ctx.result("Operational"));

app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ static DomainConnector constructNewDomainConnector(Class<? extends DomainConnect
122122
static Handler createHandler(
123123
Function<DomainRequest, DomainResponse> handler, boolean isProtected) {
124124
return (Context ctx) -> {
125-
ApplicationContext.clearThreadRegistrations();
125+
ApplicationContext
126+
.clearThreadRegistrations(); // clear this thread's specific registrations from
127+
// its previous use
126128

127129
LOGGER.logInfo(ctx.method().name() + " " + ctx.url());
128130

e2e/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies {
1919
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
2020

2121
//fhir
22-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-base:7.6.0'
23-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:7.6.0'
24-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-caching-caffeine:7.6.0'
25-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:7.6.0'
22+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-base:7.6.1'
23+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:7.6.1'
24+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-caching-caffeine:7.6.1'
25+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:7.6.1'
2626
implementation 'org.fhir:ucum:1.0.9'
2727

2828
testImplementation 'org.apache.groovy:groovy:4.0.24'

etor/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies {
1919
testImplementation 'org.apache.groovy:groovy:4.0.24'
2020
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
2121
testImplementation 'com.openpojo:openpojo:0.9.1'
22-
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.17.5'
22+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.18'
2323
}
2424

2525
jacocoTestCoverageVerification {

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ public Map<HttpEndpoint, Function<DomainRequest, DomainResponse>> domainRegistra
134134
MessageLinkStorage.class, FileMessageLinkStorage.getInstance());
135135
}
136136

137-
// these are default implementations
138137
if (ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) {
139138
ApplicationContext.register(
140139
RSEndpointClient.class, ReportStreamEndpointClient.getInstance());
@@ -174,6 +173,14 @@ DomainResponse handleResults(DomainRequest request) {
174173
}
175174

176175
DomainResponse handleMetadata(DomainRequest request) {
176+
if (Boolean.parseBoolean(request.getHeaders().get("load-test"))
177+
&& ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) {
178+
// register the mock RS endpoint for this HTTP request because we don't want to call RS
179+
// for real when doing a load test.
180+
ApplicationContext.registerForThread(
181+
RSEndpointClient.class, MockRSEndpointClient.getInstance());
182+
}
183+
177184
try {
178185
String metadataId = request.getPathParams().get("id");
179186
Optional<PartnerMetadata> metadataOptional =
@@ -227,8 +234,10 @@ protected DomainResponse handleMessageRequest(
227234
boolean markMetadataAsFailed = false;
228235
String errorMessage = "";
229236

230-
if ("True".equals(request.getHeaders().get("load-test"))
237+
if (Boolean.parseBoolean(request.getHeaders().get("load-test"))
231238
&& ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) {
239+
// register the mock RS endpoint for this HTTP request because we don't want to call RS
240+
// for real when doing a load test.
232241
ApplicationContext.registerForThread(
233242
RSEndpointClient.class, MockRSEndpointClient.getInstance());
234243
}

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public class PartnerMetadataOrchestrator {
3232

3333
@Inject PartnerMetadataStorage partnerMetadataStorage;
3434
@Inject MessageLinkStorage messageLinkStorage;
35-
// @Inject RSEndpointClient rsclient;
3635
@Inject Formatter formatter;
3736
@Inject Logger logger;
3837

@@ -45,6 +44,7 @@ private PartnerMetadataOrchestrator() {}
4544
public void updateMetadataForInboundMessage(PartnerMetadata partnerMetadata)
4645
throws PartnerMetadataException {
4746

47+
// can't @Inject because the implementation can be different for this specific thread
4848
RSEndpointClient rsclient = ApplicationContext.getImplementation(RSEndpointClient.class);
4949

5050
logger.logInfo(
@@ -134,6 +134,7 @@ public Optional<PartnerMetadata> getMetadata(String inboundReportId)
134134
var outboundReportId = partnerMetadata.outboundReportId();
135135
if (metadataIsStale(partnerMetadata) && outboundReportId != null) {
136136

137+
// can't @Inject because the implementation can be different for this specific thread
137138
RSEndpointClient rsclient =
138139
ApplicationContext.getImplementation(RSEndpointClient.class);
139140

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/CopyOrcOrderProviderToObrOrderProvider.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,8 @@ public void transform(HealthData<?> resource, Map<String, Object> args) {
2828
return;
2929
}
3030

31-
// Extract or create the OBR-16 extension from the ServiceRequest
3231
Extension obrExtension =
3332
HapiHelper.ensureExtensionExists(serviceRequest, HapiHelper.EXTENSION_OBR_URL);
34-
35-
// Extract or create the OBR-16 data type extension
36-
Extension obr16Extension =
37-
HapiHelper.ensureSubExtensionExists(
38-
obrExtension, HapiHelper.EXTENSION_OBR16_DATA_TYPE.toString());
39-
40-
// Set the ORC-12 Practitioner in the OBR-16 extension
41-
HapiHelper.setOBR16WithPractitioner(obr16Extension, practitionerRole);
33+
HapiHelper.setOBR16WithPractitioner(obrExtension, practitionerRole);
4234
}
4335
}

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemovePatientIdentifiers.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class RemovePatientIdentifiers implements CustomFhirTransformation {
1515
@Override
1616
public void transform(HealthData<?> resource, Map<String, Object> args) {
1717
Bundle bundle = (Bundle) resource.getUnderlyingData();
18-
HapiHelper.setPID3_4Value(bundle, ""); // remove PID.3-4
19-
HapiHelper.setPID3_5Value(bundle, ""); // remove PID.3-5
18+
19+
HapiHelper.setPID3_4Value(bundle, null);
20+
HapiHelper.removePID3_5Value(bundle);
2021
}
2122
}

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemovePatientNameTypeCode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ public class RemovePatientNameTypeCode implements CustomFhirTransformation {
1212
@Override
1313
public void transform(final HealthData<?> resource, final Map<String, Object> args) {
1414
Bundle bundle = (Bundle) resource.getUnderlyingData();
15-
// Need to set the value for extension to empty instead of removing the extension,
16-
// otherwise RS will set its own value in its place
17-
HapiHelper.setPID5_7ExtensionValue(bundle, null);
15+
HapiHelper.removePID5_7Value(bundle);
1816
}
1917
}

0 commit comments

Comments
 (0)