Merge remote-tracking branch 'origin/master'

This commit is contained in:
Grahame Grieve 2023-02-24 06:52:56 +11:00
commit 17eaff9995
15 changed files with 134 additions and 58 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -87,7 +87,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>

View File

@ -60,7 +60,7 @@ public class TerminologyClientFactory {
private static String checkEndsWith(String term, String url) {
if (url.endsWith(term))
return url;
if (url.startsWith("http://tx.fhir.org"))
if (url.startsWith("http://tx.fhir.org") || url.startsWith("https://tx.fhir.org"))
return Utilities.pathURL(url, term);
if (url.equals("http://local.fhir.org:8080"))
return Utilities.pathURL(url, term);

View File

@ -0,0 +1,74 @@
package org.hl7.fhir.convertors.txClient;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
import org.hl7.fhir.utilities.FhirPublication;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class TerminologyClientFactoryTest {
public static Stream<Arguments> data() throws ParserConfigurationException, SAXException, IOException {
List<Arguments> objects = new ArrayList<>();
objects.addAll(getDefaultServerArgs("tx.fhir.org/r4", "tx.fhir.org", FhirPublication.R4));
objects.addAll(getHttpAndHttpsArgs("tx.fhir.org", null, "tx.fhir.org/r4"));
objects.addAll(getHttpAndHttpsArgs("tx.fhir.org/r4", null, "tx.fhir.org/r4"));
objects.addAll(getDefaultServerArgs("tx.fhir.org/r2", "tx.fhir.org", FhirPublication.DSTU2));
objects.addAll(getDefaultServerArgs("tx.fhir.org/r3", "tx.fhir.org", FhirPublication.DSTU2016May));
objects.addAll(getDefaultServerArgs("tx.fhir.org/r4", "tx.fhir.org", FhirPublication.R4B));
objects.addAll(getDefaultServerArgs("tx.fhir.org/r4", "tx.fhir.org", FhirPublication.R5));
objects.addAll(getDefaultServerArgs("tx.fhir.org/r3", "tx.fhir.org", FhirPublication.STU3));
objects.addAll(getHttpAndHttpsArgs("someserver.org", FhirPublication.R4, "someserver.org"));
objects.addAll(getHttpAndHttpsArgs("someserver.org", null, "someserver.org"));
return objects.stream();
}
private static List<Arguments> getDefaultServerArgs(String explicitUrl, String baseUrl, FhirPublication fhirPublication) {
List<Arguments> objects = new ArrayList<>();
objects.addAll(getHttpAndHttpsArgs(baseUrl, fhirPublication, explicitUrl));
objects.addAll(getHttpAndHttpsArgs(explicitUrl, fhirPublication, explicitUrl));
return objects;
}
private static List<Arguments> getHttpAndHttpsArgs(String baseUrl, FhirPublication fhirPublication, String baseExpectedAddress) {
return List.of(
Arguments.of("https://" + baseUrl, fhirPublication, "https://" + baseExpectedAddress),
Arguments.of("http://" + baseUrl, fhirPublication, "http://" + baseExpectedAddress)
);
}
@ParameterizedTest
@MethodSource("data")
public void testMakeClient(String url, FhirPublication fhirPublication, String expectedAddress) throws URISyntaxException {
TerminologyClient terminologyClient = TerminologyClientFactory.makeClient(url, "dummyUserAgent", fhirPublication);
assertEquals(expectedAddress, terminologyClient.getAddress());
}
@Test
public void testMakeClientDstu1Fails() throws URISyntaxException {
assertThrows(Error.class, () -> {
TerminologyClient terminologyClient = TerminologyClientFactory.makeClient("urldoesnotmatter", "dummyUserAgent", FhirPublication.DSTU1);
}
);
}
@Test
public void testMakeClientNullFails() throws URISyntaxException {
assertThrows(Error.class, () -> {
TerminologyClient terminologyClient = TerminologyClientFactory.makeClient("urldoesnotmatter", "dummyUserAgent", FhirPublication.NULL);
}
);
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -55,7 +55,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -67,7 +67,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -61,19 +61,19 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>

View File

@ -58,7 +58,7 @@ public abstract class BaseResource extends Base implements IAnyResource, IElemen
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
return FhirVersionEnum.R5; // to: change to R5
return FhirVersionEnum.R4B;
}
@Override

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -104,13 +104,13 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>
@ -141,7 +141,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -45,7 +45,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>
@ -159,7 +159,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<scope>compile</scope>
</dependency>
-->

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -225,7 +225,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>false</optional>
<scope>compile</scope>
</dependency>
@ -273,7 +273,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>com.atlassian.commonmark</groupId>
@ -310,7 +310,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<manifest>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -154,7 +154,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<version>${okhttp.version}</version>
<optional>true</optional>
</dependency>

View File

@ -14,7 +14,7 @@
HAPI FHIR
-->
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.99-SNAPSHOT</version>
<version>5.6.100-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
@ -24,6 +24,7 @@
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
<maven_clean_version>3.1.0</maven_clean_version>
<okhttp.version>4.9.3</okhttp.version>
<jacoco_version>0.8.8</jacoco_version>
<info_cqframework_version>1.5.1</info_cqframework_version>
<lombok_version>1.18.22</lombok_version>
@ -36,6 +37,7 @@
<maven.compiler.testRelease>11</maven.compiler.testRelease>
<maven.compiler.testSource>11</maven.compiler.testSource>
<maven.compiler.testTarget>11</maven.compiler.testTarget>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
</properties>
<name>HL7 Core Artifacts</name>
@ -228,7 +230,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>${maven-jar-plugin.version}</version>
<executions>
<execution>
<goals>