Fix DSTU2 conformance statement (#4082)

* Fix DSTU2 conformance statement

* Add changelog and test
This commit is contained in:
James Agnew 2022-09-26 15:33:12 -04:00 committed by GitHub
parent 3435806df5
commit 641007f5b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 4082
title: "A bug prevented the DSTU2 JPA server Conformance.implementation.description
field from being populated in some cases. This has been corrected."

View File

@ -140,7 +140,9 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
}
}
retVal.getImplementation().setDescription(myImplementationDescription);
if (isNotBlank(myImplementationDescription)) {
retVal.getImplementation().setDescription(myImplementationDescription);
}
myCachedValue = retVal;
return retVal;
}

View File

@ -12,6 +12,7 @@ import ca.uhn.fhir.jpa.rp.dstu2.OrganizationResourceProvider;
import ca.uhn.fhir.jpa.rp.dstu2.PatientResourceProvider;
import ca.uhn.fhir.jpa.rp.dstu2.PractitionerResourceProvider;
import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Conformance;
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu2.resource.Patient;
@ -43,6 +44,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.io.InputStream;
@ -51,6 +53,7 @@ import java.util.concurrent.TimeUnit;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.emptyOrNullString;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -103,6 +106,9 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
restServer.setPlainProviders(mySystemProvider);
JpaConformanceProviderDstu2 myConformanceProvider = new JpaConformanceProviderDstu2(restServer, mySystemDao, myDaoConfig);
restServer.setServerConformanceProvider(myConformanceProvider);
ourServer = new Server(0);
ServletContextHandler proxyHandler = new ServletContextHandler();
@ -117,8 +123,8 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
ourServer.setHandler(proxyHandler);
JettyUtil.startServer(ourServer);
int myPort = JettyUtil.getPortForStartedServer(ourServer);
ourServerBase = "http://localhost:" + myPort + "/fhir/context";
int myPort = JettyUtil.getPortForStartedServer(ourServer);
ourServerBase = "http://localhost:" + myPort + "/fhir/context";
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
HttpClientBuilder builder = HttpClientBuilder.create();
@ -160,6 +166,13 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
myRestServer.unregisterInterceptor(interceptor);
}
@Test
public void testConformanceImplementationDescriptionGetsPopulated() {
Conformance conf = ourClient.capabilities().ofType(Conformance.class).execute();
assertThat(conf.getImplementation().getDescription(), not(emptyOrNullString()));
}
@Test
public void testEverythingReturnsCorrectBundleType() throws Exception {
myRestServer.setDefaultResponseEncoding(EncodingEnum.JSON);