Merge branch 'master' into ja_20240628_combo_permutations

This commit is contained in:
James Agnew 2024-07-03 15:53:48 -04:00
commit 6ed919de22
11 changed files with 58 additions and 61 deletions

View File

@ -36,8 +36,8 @@ public enum BundleEntryTransactionMethodEnum {
GET("GET", "http://hl7.org/fhir/http-verb"),
POST("POST", "http://hl7.org/fhir/http-verb"),
PUT("PUT", "http://hl7.org/fhir/http-verb"),
DELETE("DELETE", "http://hl7.org/fhir/http-verb"),
;
PATCH("PATCH", "http://hl7.org/fhir/http-verb"),
DELETE("DELETE", "http://hl7.org/fhir/http-verb");
/**
* Identifier for this Value Set:

View File

@ -0,0 +1,26 @@
package ca.uhn.fhir.model.valueset;
import org.apache.jena.riot.web.HttpMethod;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class BundleEntryTransactionMethodEnumTest {
/**
* HEAD is not supported either; but won't show up in transaction bundles
*/
@ParameterizedTest
@EnumSource(value = HttpMethod.class,
mode = EnumSource.Mode.EXCLUDE,
names = {"METHOD_TRACE", "METHOD_OPTIONS", "METHOD_QUERY", "METHOD_HEAD"}
)
public void parseAllHTTPVerbs(HttpMethod theMethod) {
// test
BundleEntryTransactionMethodEnum val = BundleEntryTransactionMethodEnum.valueOf(theMethod.method());
// verify
assertEquals(theMethod.method(), val.getCode());
}
}

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 6021
title: "The updated Spring Boot was not compatible with jetty version 12.0.3.
Jetty has been updated to 12.0.9, fixing this issue."

View File

@ -0,0 +1,6 @@
---
type: fix
issue: 6058
title: "Added `PATCH` operation to `BundleEntryTransactionMethodEnumTest`
in order to fully support transaction bundle operations.
"

View File

@ -0,0 +1,6 @@
---
type: fix
issue: 6061
title: "The latest migration for HFJ_RES_SEARCH_URL introduced in [6033](https://github.com/hapifhir/hapi-fhir/issues/6033)
does not fully respect dry-run.
This has been fixed."

View File

@ -96,6 +96,7 @@ public class Batch2JobHelper {
try {
await()
.atMost(theSecondsToWait, TimeUnit.SECONDS)
.pollDelay(100, TimeUnit.MILLISECONDS)
.until(() -> {
checkCount.getAndIncrement();
boolean inFinalStatus = false;

View File

@ -26,7 +26,6 @@ import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;

View File

@ -25,7 +25,6 @@ import ca.uhn.fhir.jpa.migrate.HapiMigrationException;
import ca.uhn.fhir.jpa.migrate.tasks.api.TaskFlagEnum;
import ca.uhn.fhir.system.HapiSystemProperties;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@ -37,7 +36,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.transaction.support.TransactionTemplate;
import java.sql.SQLException;
@ -176,17 +174,6 @@ public abstract class BaseTask {
captureExecutedStatement(theTableName, theSql, theArguments);
}
protected <T> T executeSqlWithResult(
@Language("SQL") String theSql, ResultSetExtractor<T> theResultSetExtractor, Object... theArguments) {
if (myTransactional) {
return getConnectionProperties()
.getTxTemplate()
.execute(t -> doExecuteSqlWithResult(theSql, theResultSetExtractor, theArguments));
}
return doExecuteSqlWithResult(theSql, theResultSetExtractor, theArguments);
}
protected void executeSqlListInTransaction(String theTableName, List<String> theSqlStatements) {
if (!isDryRun()) {
Integer changes;
@ -232,32 +219,6 @@ public abstract class BaseTask {
}
}
@Nullable
private <T> T doExecuteSqlWithResult(
@Language("SQL") String theSql, ResultSetExtractor<T> theResultSetExtractor, Object... theArguments) {
final JdbcTemplate jdbcTemplate = getConnectionProperties().newJdbcTemplate();
// 0 means no timeout -- we use this for index rebuilds that may take time.
jdbcTemplate.setQueryTimeout(0);
try {
T result = jdbcTemplate.query(theSql, theResultSetExtractor, theArguments);
if (!HapiSystemProperties.isUnitTestModeEnabled()) {
logInfo(ourLog, "SQL \"{}\" returned result {}", theSql, result);
}
return result;
} catch (DataAccessException e) {
if (myFlags.contains(TaskFlagEnum.FAILURE_ALLOWED)) {
ourLog.info(
"Task {} did not exit successfully on doExecuteSqlWithResult(), but task is allowed to fail",
getMigrationVersion());
ourLog.debug("Error was: {}", e.getMessage(), e);
return null;
} else {
throw new HapiMigrationException(
Msg.code(2532) + "Failed during task " + getMigrationVersion() + ": " + e, e);
}
}
}
protected void captureExecutedStatement(
String theTableName, @Language("SQL") String theSql, Object... theArguments) {
myExecutedStatements.add(new ExecutedStatement(mySchemaVersion, theTableName, theSql, theArguments));

View File

@ -26,7 +26,6 @@ import jakarta.annotation.Nullable;
import org.intellij.lang.annotations.Language;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.ResultSetExtractor;
import java.sql.SQLException;
@ -51,28 +50,14 @@ public class DropPrimaryKeyTask extends BaseTableTask {
private String generateSql() {
ourLog.debug("DropPrimaryKeyTask.generateSql()");
final ResultSetExtractor<String> resultSetExtractor = rs -> {
if (rs.next()) {
final String singleResult = rs.getString(1);
if (rs.next()) {
throw new IllegalArgumentException(Msg.code(2533)
+ "Expecting only a single result for the table primary but got multiple for task: "
+ getMigrationVersion());
}
return singleResult;
}
return null;
};
@Nullable
@Language("SQL")
final String primaryKeyNameSql = generatePrimaryKeyNameSql();
@Nullable
final String primaryKeyName = primaryKeyNameSql != null
? executeSqlWithResult(primaryKeyNameSql, resultSetExtractor, getTableNameWithDatabaseExpectedCase())
? newJdbcTemplate()
.queryForObject(primaryKeyNameSql, String.class, getTableNameWithDatabaseExpectedCase())
: null;
ourLog.debug("primaryKeyName: {} for driver: {}", primaryKeyName, getDriverType());

View File

@ -18,6 +18,9 @@ import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.PathResourceFactory;
import org.eclipse.jetty.util.resource.Resource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Composition;
@ -59,6 +62,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.List;
import java.util.Optional;
@ -110,7 +114,11 @@ public class WebTest {
ServletContextHandler contextHandler = new MyServletContextHandler();
contextHandler.setAllowNullPathInContext(true);
contextHandler.setServletHandler(servletHandler);
contextHandler.setBaseResourceAsString("hapi-fhir-testpage-overlay/src/main/webapp");
Resource base = new PathResourceFactory().newResource("hapi-fhir-testpage-overlay/src/main/webapp");
if (!base.exists()) {
base = new PathResourceFactory().newResource("src/main/webapp");
}
contextHandler.setBaseResource(base);
ourOverlayServer = new Server(0);
ourOverlayServer.setHandler(contextHandler);

View File

@ -982,7 +982,7 @@
<jaxb_runtime_version>4.0.4</jaxb_runtime_version>
<jena_version>4.9.0</jena_version>
<jersey_version>3.0.3</jersey_version>
<jetty_version>12.0.3</jetty_version>
<jetty_version>12.0.9</jetty_version>
<jsr305_version>3.0.2</jsr305_version>
<junit_version>5.10.1</junit_version>
<flexmark_version>0.64.8</flexmark_version>