Correctly include project description in capabilitystatement
This commit is contained in:
parent
6d09f5025f
commit
3583dfd503
|
@ -96,6 +96,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<version>${slf4j_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -27,6 +27,8 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
|
import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
|
||||||
import ca.uhn.fhir.util.VersionUtil;
|
import ca.uhn.fhir.util.VersionUtil;
|
||||||
|
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
public class RestulfulServerConfiguration {
|
public class RestulfulServerConfiguration {
|
||||||
|
|
||||||
private Collection<ResourceBinding> resourceBindings;
|
private Collection<ResourceBinding> resourceBindings;
|
||||||
|
@ -84,6 +86,9 @@ public class RestulfulServerConfiguration {
|
||||||
* @return the implementationDescription
|
* @return the implementationDescription
|
||||||
*/
|
*/
|
||||||
public String getImplementationDescription() {
|
public String getImplementationDescription() {
|
||||||
|
if (isBlank(implementationDescription)) {
|
||||||
|
return "HAPI FHIR";
|
||||||
|
}
|
||||||
return implementationDescription;
|
return implementationDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,4 +116,16 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -18,4 +18,16 @@
|
||||||
<module>hapi-fhir-spring-boot-sample-server-jpa</module>
|
<module>hapi-fhir-spring-boot-sample-server-jpa</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,4 +1,4 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -25,4 +25,16 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -14,6 +14,14 @@
|
||||||
<name>HAPI FHIR Structures - DSTU1 (FHIR v0.80)</name>
|
<name>HAPI FHIR Structures - DSTU1 (FHIR v0.80)</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-base</artifactId>
|
<artifactId>hapi-fhir-base</artifactId>
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) {
|
||||||
String resourceName = "";
|
String resourceName = "";
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
resourceToMethods.put(resourceName, new ArrayList<>());
|
||||||
}
|
}
|
||||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||||
}
|
}
|
||||||
|
@ -618,8 +618,9 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
|
||||||
* See the class documentation for an important note if you are extending this class
|
* See the class documentation for an important note if you are extending this class
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public void setCache(boolean theCache) {
|
public ServerCapabilityStatementProvider setCache(boolean theCache) {
|
||||||
myCache = theCache;
|
myCache = theCache;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider;
|
import org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider;
|
||||||
import org.hl7.fhir.dstu3.model.CapabilityStatement;
|
import org.hl7.fhir.dstu3.model.CapabilityStatement;
|
||||||
import org.hl7.fhir.dstu3.model.Patient;
|
import org.hl7.fhir.dstu3.model.Patient;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -45,6 +46,11 @@ public class MetadataCapabilityStatementDstu3Test {
|
||||||
private static Server ourServer;
|
private static Server ourServer;
|
||||||
private static RestfulServer ourServlet;
|
private static RestfulServer ourServlet;
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void after() {
|
||||||
|
ourServlet.setServerAddressStrategy(new IncomingRequestAddressStrategy());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testElements() throws Exception {
|
public void testElements() throws Exception {
|
||||||
String output;
|
String output;
|
||||||
|
@ -124,26 +130,21 @@ public class MetadataCapabilityStatementDstu3Test {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testResponseContainsBaseUrlFixed() throws Exception {
|
public void testResponseContainsBaseUrlFixed() throws Exception {
|
||||||
IServerAddressStrategy addressStrategy = ourServlet.getServerAddressStrategy();
|
ourServlet.setServerAddressStrategy(new HardcodedServerAddressStrategy("http://foo/bar"));
|
||||||
|
|
||||||
|
String output;
|
||||||
|
|
||||||
|
HttpRequestBase httpPost = new HttpGet("http://localhost:" + ourPort + "/metadata?_format=json");
|
||||||
|
CloseableHttpResponse status = ourClient.execute(httpPost);
|
||||||
try {
|
try {
|
||||||
ourServlet.setServerAddressStrategy(new HardcodedServerAddressStrategy("http://foo/bar"));
|
output = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
ourLog.info(output);
|
||||||
|
CapabilityStatement cs = ourCtx.newJsonParser().parseResource(CapabilityStatement.class, output);
|
||||||
|
|
||||||
String output;
|
assertEquals("http://foo/bar", cs.getImplementation().getUrl());
|
||||||
|
|
||||||
HttpRequestBase httpPost = new HttpGet("http://localhost:" + ourPort + "/metadata?_format=json");
|
|
||||||
CloseableHttpResponse status = ourClient.execute(httpPost);
|
|
||||||
try {
|
|
||||||
output = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
|
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
|
||||||
ourLog.info(output);
|
|
||||||
CapabilityStatement cs = ourCtx.newJsonParser().parseResource(CapabilityStatement.class, output);
|
|
||||||
|
|
||||||
assertEquals("http://foo/bar", cs.getImplementation().getUrl());
|
|
||||||
} finally {
|
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
ourServlet.setServerAddressStrategy(addressStrategy);
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +198,7 @@ public class MetadataCapabilityStatementDstu3Test {
|
||||||
ourServlet = new RestfulServer(ourCtx);
|
ourServlet = new RestfulServer(ourCtx);
|
||||||
ourServlet.setResourceProviders(patientProvider);
|
ourServlet.setResourceProviders(patientProvider);
|
||||||
|
|
||||||
ourServlet.setServerConformanceProvider(new ServerCapabilityStatementProvider(ourServlet));
|
ourServlet.setServerConformanceProvider(new ServerCapabilityStatementProvider(ourServlet).setCache(false));
|
||||||
|
|
||||||
ServletHolder servletHolder = new ServletHolder(ourServlet);
|
ServletHolder servletHolder = new ServletHolder(ourServlet);
|
||||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||||
|
|
12
pom.xml
12
pom.xml
|
@ -515,6 +515,7 @@
|
||||||
<plexus_compiler_api_version>2.8.4</plexus_compiler_api_version>
|
<plexus_compiler_api_version>2.8.4</plexus_compiler_api_version>
|
||||||
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
||||||
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
||||||
|
<slf4j_version>1.7.25</slf4j_version>
|
||||||
<spring_version>5.0.6.RELEASE</spring_version>
|
<spring_version>5.0.6.RELEASE</spring_version>
|
||||||
<spring_data_version>2.0.7.RELEASE</spring_data_version>
|
<spring_data_version>2.0.7.RELEASE</spring_data_version>
|
||||||
|
|
||||||
|
@ -1108,17 +1109,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-android</artifactId>
|
<artifactId>slf4j-android</artifactId>
|
||||||
<version>1.7.25</version>
|
<version>${slf4j_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.25</version>
|
<version>${slf4j_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
<version>1.7.25</version>
|
<version>${slf4j_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
|
@ -1216,6 +1217,11 @@
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue