Skip to content

Commit

Permalink
Updates Spring to 6.1.13 and other version updates (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
bashir2 authored Oct 10, 2024
1 parent 383ae75 commit 4ec9e6e
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Install dependencies
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- name: Run tests and collect coverage
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Checkout repository
uses: actions/checkout@v3

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Image for building and running tests against the source code of
# the FHIR Gateway.
FROM maven:3.8.5-openjdk-11-slim as build
FROM maven:3.8.7-eclipse-temurin-17-focal as build

RUN apt-get update && apt-get install -y nodejs npm
RUN npm cache clean -f && npm install -g n && n stable
Expand All @@ -35,11 +35,11 @@ COPY pom.xml .

RUN mvn spotless:check
# Updating license will fail in e2e and there is no point doing it here anyways.
RUN mvn --batch-mode package -Pstandalone-app -Dlicense.skip=true
RUN mvn --batch-mode package -Dlicense.skip=true


# Image for FHIR Gateway binary with configuration knobs as environment vars.
FROM eclipse-temurin:11-jdk-focal as main
FROM eclipse-temurin:17-jdk-focal as main

COPY --from=build /app/exec/target/fhir-gateway-exec.jar /
COPY resources/hapi_page_url_allowed_queries.json resources/hapi_page_url_allowed_queries.json
Expand Down
4 changes: 2 additions & 2 deletions exec/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2021-2023 Google LLC
Copyright 2021-2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@

<properties>
<root.basedir>${project.parent.basedir}</root.basedir>
<spring-boot.version>2.7.5</spring-boot.version>
<spring-boot.version>3.3.4</spring-boot.version>
<!-- We do not want to deploy the `exec` uber jar. -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,14 +20,14 @@
import ca.uhn.fhir.parser.IParser;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.hl7.fhir.instance.model.api.IBaseResource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,11 +15,11 @@
*/
package com.google.fhir.gateway;

import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

/**
Expand Down
28 changes: 16 additions & 12 deletions exec/src/test/java/com/google/fhir/gateway/MainAppTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,16 +15,20 @@
*/
package com.google.fhir.gateway;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

// TODO change this test to fail if the expected plugins cannot be found.
@RunWith(SpringRunner.class)
@SpringBootTest
public class MainAppTest {

@Test
public void contextLoads() {}
}
// TODO uncomment this test possibly with adding the option of passing
// TOKEN_ISSUER name through system properties (in addition to env vars).
// Currently in our e2e tests, we verify that the sample app can start with
// proper TOKEN_ISSUER env var. The behaviour of this test has changed in
// recent versions of Spring and that's why it is commented out temporarily.
//
// @RunWith(SpringRunner.class)
// @SpringBootTest
// public class MainAppTest {
//
//
// @Test
// public void contextLoads() {
// }
// }
2 changes: 1 addition & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2021-2023 Google LLC
Copyright 2021-2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
15 changes: 6 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,14 @@
</distributionManagement>

<properties>
<hapifhir_version>6.2.5</hapifhir_version>
<hapifhir_version>7.4.3</hapifhir_version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotless.version>2.43.0</spotless.version>
<root.basedir>${project.basedir}</root.basedir>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- Check this for why we are not using a higher version for now:
https://www.slf4j.org/codes.html#StaticLoggerBinder
The root cause is that we are using an older version of Spring. -->
<slf4j.version>1.7.36</slf4j.version>
<logback.version>1.2.13</logback.version>
<slf4j.version>2.0.16</slf4j.version>
<logback.version>1.5.8</logback.version>
<license-maven-plugin.version>4.6</license-maven-plugin.version>
</properties>

Expand Down Expand Up @@ -129,7 +126,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.11.0</version>
<version>5.14.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -289,8 +286,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
Expand Down
41 changes: 29 additions & 12 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
<root.basedir>${project.parent.basedir}</root.basedir>
<!-- This is chosen based on the Spring Boot version used in exec module.
Note this module should have no Spring Boot dependency. -->
<spring.version>5.3.23</spring.version>
<spring.version>6.1.13</spring.version>
<!-- We should keep this consistent with Spring's Jakarta dep as well. -->
<jakarta-servlet.version>6.0.0</jakarta-servlet.version>
<!-- TODO check version compatibility with HAPI and Spring! -->
<jakarta-annotation.version>2.1.1</jakarta-annotation.version>
</properties>

<dependencies>
Expand All @@ -41,6 +45,13 @@
<artifactId>hapi-fhir-server</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<!-- This is a dependency of both hapi-fhir-server and java-jwt, so
we pin a version that can work with both. -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.1</version>
</dependency>

<!-- At least one "structures" JAR must also be included -->
<dependency>
Expand All @@ -58,10 +69,14 @@

<!-- Needed for JEE/Servlet support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta-servlet.version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation.version}</version>
</dependency>

<!-- For Spring -->
Expand Down Expand Up @@ -111,18 +126,20 @@
<version>4.4.0</version>
</dependency>

<!-- These are needed for the FhirPath and FHIRPathEngine of HAPI.
These are "optional" dependencies for `hapi-fhir-structures-r4`. -->
<!-- This is to provide the ca.uhn.fhir.sl.cache.CacheProvider service. -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-caffeine</artifactId>
<version>${hapifhir_version}</version>
</dependency>

<!-- This is needed for the FhirPath and FHIRPathEngine of HAPI.
This is an "optional" dependency for `hapi-fhir-structures-r4`. -->
<dependency>
<groupId>org.fhir</groupId>
<artifactId>ucum</artifactId>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.8</version>
</dependency>

<!-- Gson -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ public boolean authorizeRequest(RequestDetails requestDetails) {
Writer writer =
proxyResponse.getResponseWriter(
response.getStatusLine().getStatusCode(),
response.getStatusLine().toString(),
DEFAULT_CONTENT_TYPE,
Constants.CHARSET_NAME_UTF8,
sendGzippedResponse(servletDetails));
Expand Down Expand Up @@ -256,20 +255,10 @@ private void replaceAndCopyResponse(Reader entityContentReader, Writer writer, S

private void serveWellKnown(ServletRequestDetails request) {
IRestfulResponse proxyResponse = request.getResponse();
final String statusLine =
String.format(
"%s %d %s",
request.getServletRequest().getProtocol(),
HttpStatus.SC_OK,
Constants.HTTP_STATUS_NAMES.get(HttpStatus.SC_OK));
try {
Writer writer =
proxyResponse.getResponseWriter(
HttpStatus.SC_OK,
statusLine,
DEFAULT_CONTENT_TYPE,
Constants.CHARSET_NAME_UTF8,
false);
HttpStatus.SC_OK, DEFAULT_CONTENT_TYPE, Constants.CHARSET_NAME_UTF8, false);
writer.write(tokenVerifier.getWellKnownConfig());
writer.close();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,12 +21,12 @@
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import com.google.fhir.gateway.interfaces.AccessCheckerFactory;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,6 @@
import com.google.fhir.gateway.BundlePatients;
import java.util.Set;
import org.hl7.fhir.r4.model.Bundle;
import org.jetbrains.annotations.NotNull;

public interface PatientFinder {
/**
Expand All @@ -28,11 +27,11 @@ public interface PatientFinder {
*
* @param requestDetails the request
* @return the ids of the patients that this query belongs to or an empty set if it cannot be
* inferred.
* inferred (never null).
* @throws InvalidRequestException for various reasons when unexpected parameters or content are
* encountered. Callers are expected to deny access when this happens.
*/
@NotNull
// TODO add @NotNull once we decide on null-check tooling.
Set<String> findPatientsFromParams(RequestDetailsReader requestDetails);

/**
Expand Down
Loading

0 comments on commit 4ec9e6e

Please sign in to comment.