Use server name as narrative text in CapabilityStatement (#6060)
* Use server name as narrative text in CapabilityStatement * Credit for #6060 * Fix spotless --------- Co-authored-by: James Agnew <jamesagnew@gmail.com>
This commit is contained in:
parent
ec7538c78f
commit
b6bcb292b6
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
type: add
|
||||||
|
issue: 6060
|
||||||
|
title: "The server-generated CapabilityStatement will now use the server
|
||||||
|
name defined by `RestfulServer#setServerName(..)` instead of the hardcoded
|
||||||
|
string `HAPI FHIR`. Thanks to Renaud Subiger for the pull request!"
|
|
@ -208,7 +208,8 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
|
||||||
terser.addElement(retVal, "name", "RestServer");
|
terser.addElement(retVal, "name", "RestServer");
|
||||||
IBase text = terser.addElement(retVal, "text");
|
IBase text = terser.addElement(retVal, "text");
|
||||||
terser.addElement(text, "status", "generated");
|
terser.addElement(text, "status", "generated");
|
||||||
terser.addElement(text, "div", "<div xmlns=\"http://www.w3.org/1999/xhtml\">HAPI-FHIR Server</div>");
|
terser.addElement(
|
||||||
|
text, "div", "<div xmlns=\"http://www.w3.org/1999/xhtml\">" + configuration.getServerName() + "</div>");
|
||||||
terser.addElement(retVal, "publisher", myPublisher);
|
terser.addElement(retVal, "publisher", myPublisher);
|
||||||
terser.addElement(retVal, "date", conformanceDate(configuration));
|
terser.addElement(retVal, "date", conformanceDate(configuration));
|
||||||
terser.addElement(
|
terser.addElement(
|
||||||
|
|
|
@ -160,6 +160,29 @@ public class ServerCapabilityStatementProviderR4Test extends BaseValidationTestW
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNarrativeText() throws ServletException {
|
||||||
|
RestfulServer rs = new RestfulServer(myCtx);
|
||||||
|
|
||||||
|
ServerCapabilityStatementProvider sc = new ServerCapabilityStatementProvider(rs);
|
||||||
|
rs.setServerConformanceProvider(sc);
|
||||||
|
|
||||||
|
rs.init(createServletConfig());
|
||||||
|
|
||||||
|
CapabilityStatement cs;
|
||||||
|
String narrativeText;
|
||||||
|
|
||||||
|
cs = (CapabilityStatement) sc.getServerConformance(createHttpServletRequest(), createRequestDetails(rs));
|
||||||
|
narrativeText = cs.getText().getDivAsString();
|
||||||
|
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">HAPI FHIR Server</div>", narrativeText);
|
||||||
|
|
||||||
|
rs.setServerName("My Server Name");
|
||||||
|
|
||||||
|
cs = (CapabilityStatement) sc.getServerConformance(createHttpServletRequest(), createRequestDetails(rs));
|
||||||
|
narrativeText = cs.getText().getDivAsString();
|
||||||
|
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">My Server Name</div>", narrativeText);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormats() throws ServletException {
|
public void testFormats() throws ServletException {
|
||||||
RestfulServer rs = new RestfulServer(myCtx);
|
RestfulServer rs = new RestfulServer(myCtx);
|
||||||
|
|
Loading…
Reference in New Issue