Some test fixes

This commit is contained in:
jamesagnew 2018-05-30 11:01:43 -04:00
parent be1e0df9e2
commit d127a89047
9 changed files with 27 additions and 151 deletions

View File

@ -398,6 +398,10 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
<dependency> <dependency>
<groupId>javax.validation</groupId> <groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId> <artifactId>validation-api</artifactId>

View File

@ -1016,42 +1016,6 @@ public class JsonParserHl7OrgDstu2Test {
//@formatter:on //@formatter:on
} }
/*
* Narrative generation is disabled for HL7org structs for now
*/
// @Test
public void testNarrativeGeneration() throws DataFormatException, IOException {
Patient patient = new Patient();
patient.addName().addFamily("Smith");
Organization org = new Organization();
patient.getManagingOrganization().setResource(org);
INarrativeGenerator gen = new INarrativeGenerator() {
@Override
public void generateNarrative(FhirContext theContext, IBaseResource theResource, INarrative theNarrative) {
try {
theNarrative.setDivAsString("<div>help</div>");
} catch (Exception e) {
throw new Error(e);
}
theNarrative.setStatusAsString("generated");
}
};
FhirContext context = ourCtx;
context.setNarrativeGenerator(gen);
IParser p = context.newJsonParser();
p.encodeResourceToWriter(patient, new OutputStreamWriter(System.out));
String str = p.encodeResourceToString(patient);
ourLog.info(str);
assertThat(str, StringContains.containsString(",\"text\":{\"status\":\"generated\",\"div\":\"<div>help</div>\"},"));
}
@Test @Test
public void testNestedContainedResources() { public void testNestedContainedResources() {

View File

@ -1502,37 +1502,6 @@ public class XmlParserHl7OrgDstu2Test {
"<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>")); "<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
} }
// Narrative generation not currently supported for HL7org structures
public void testNarrativeGeneration() throws DataFormatException, IOException {
Patient patient = new Patient();
patient.addName().addFamily("Smith");
Organization org = new Organization();
patient.getManagingOrganization().setResource(org);
INarrativeGenerator gen = new INarrativeGenerator() {
@Override
public void generateNarrative(FhirContext theContext, IBaseResource theResource, INarrative theNarrative) {
try {
theNarrative.setDivAsString("<div>help</div>");
} catch (Exception e) {
throw new Error(e);
}
theNarrative.setStatusAsString("generated");
}
};
FhirContext context = ourCtx;
context.setNarrativeGenerator(gen);
IParser p = context.newXmlParser();
String str = p.encodeResourceToString(patient);
ourLog.info(str);
assertThat(str, StringContains.containsString(",\"text\":{\"status\":\"generated\",\"div\":\"<div>help</div>\"},"));
}
@Test @Test
public void testNestedContainedResources() { public void testNestedContainedResources() {

View File

@ -99,23 +99,6 @@ public class BinaryHl7OrgDstu2Test {
} }
public void testCreateWrongType() throws Exception {
Binary res = new Binary();
res.setContent(new byte[] { 1, 2, 3, 4 });
res.setContentType("text/plain");
String stringContent = ourCtx.newJsonParser().encodeResourceToString(res);
HttpPost http = new HttpPost("http://localhost:" + ourPort + "/Binary");
http.setEntity(new StringEntity(stringContent, ContentType.create(Constants.CT_FHIR_JSON, "UTF-8")));
HttpResponse status = ourClient.execute(http);
assertEquals(201, status.getStatusLine().getStatusCode());
assertEquals("text/plain", ourLast.getContentType());
assertArrayEquals(new byte[] { 1, 2, 3, 4 }, ourLast.getContent());
}
@Test @Test
public void testRead() throws Exception { public void testRead() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo"); HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");

View File

@ -95,20 +95,6 @@ public class IncludeHl7OrgDstu2Test {
assertEquals("foo", p.getName().get(0).getFamily().get(0).getValue()); assertEquals("foo", p.getName().get(0).getFamily().get(0).getValue());
} }
// @Test
public void testMixedContainedAndNonContained() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, responseContent);
assertEquals(4, bundle.getEntry().size());
}
@Test @Test
public void testIIncludedResourcesNonContained() throws Exception { public void testIIncludedResourcesNonContained() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=normalInclude&_pretty=true"); HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=normalInclude&_pretty=true");

View File

@ -185,20 +185,6 @@ public class IncludeTest {
} }
} }
// @Test
public void testMixedContainedAndNonContained() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, responseContent);
assertEquals(4, bundle.getEntry().size());
}
@Test @Test
public void testNoIncludes() throws Exception { public void testNoIncludes() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello"); HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello");

View File

@ -693,41 +693,6 @@ public class QuestionnaireResponseValidatorDstu3Test {
assertThat(errors.toString(), containsString("LinkId \"link1\" not found in questionnaire")); assertThat(errors.toString(), containsString("LinkId \"link1\" not found in questionnaire"));
} }
// @Test
public void validateHealthConnexExample() throws Exception {
String input = IOUtils.toString(QuestionnaireResponseValidatorDstu3Test.class.getResourceAsStream("/questionnaireanswers-0f431c50ddbe4fff8e0dd6b7323625fc.xml"));
QuestionnaireResponse qa = ourCtx.newXmlParser().parseResource(QuestionnaireResponse.class, input);
ValidationResult errors = myVal.validateWithResult(qa);
assertEquals(errors.toString(), 0, errors.getMessages().size());
/*
* Now change a coded value
*/
//@formatter:off
input = input.replaceAll(
"<answer>\n" +
" <valueCoding>\n" +
" <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" +
" <code value=\"2\"/>\n" +
" <display value=\"Once/twice\"/>\n" +
" </valueCoding>\n" +
" </answer>",
"<answer>\n" +
" <valueCoding>\n" +
" <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" +
" <code value=\"GGG\"/>\n" +
" <display value=\"Once/twice\"/>\n" +
" </valueCoding>\n" +
" </answer>");
assertThat(input, containsString("GGG"));
//@formatter:on
qa = ourCtx.newXmlParser().parseResource(QuestionnaireResponse.class, input);
errors = myVal.validateWithResult(qa);
assertEquals(errors.toString(), 10, errors.getMessages().size());
}
@AfterClass @AfterClass
public static void afterClassClearContext() { public static void afterClassClearContext() {
myDefaultValidationSupport.flush(); myDefaultValidationSupport.flush();

13
pom.xml
View File

@ -493,13 +493,13 @@
<jaxb_api_version>2.3.0</jaxb_api_version> <jaxb_api_version>2.3.0</jaxb_api_version>
<jaxb_core_version>2.3.0</jaxb_core_version> <jaxb_core_version>2.3.0</jaxb_core_version>
<jersey_version>2.25.1</jersey_version> <jersey_version>2.25.1</jersey_version>
<jetty_version>9.4.8.v20171121</jetty_version> <jetty_version>9.4.10.v20180503</jetty_version>
<jsr305_version>3.0.2</jsr305_version> <jsr305_version>3.0.2</jsr305_version>
<!--<hibernate_version>5.2.10.Final</hibernate_version>--> <!--<hibernate_version>5.2.10.Final</hibernate_version>-->
<hibernate_version>5.2.16.Final</hibernate_version> <hibernate_version>5.3.1.Final</hibernate_version>
<hibernate_validator_version>5.4.1.Final</hibernate_validator_version> <hibernate_validator_version>5.4.1.Final</hibernate_validator_version>
<!-- Update lucene version when you update hibernate-search version --> <!-- Update lucene version when you update hibernate-search version -->
<hibernate_search_version>5.7.1.Final</hibernate_search_version> <hibernate_search_version>5.10.1.Final</hibernate_search_version>
<httpcore_version>4.4.6</httpcore_version> <httpcore_version>4.4.6</httpcore_version>
<httpclient_version>4.5.3</httpclient_version> <httpclient_version>4.5.3</httpclient_version>
<lucene_version>5.5.4</lucene_version> <lucene_version>5.5.4</lucene_version>
@ -510,7 +510,7 @@
<ph_commons_version>9.1.1</ph_commons_version> <ph_commons_version>9.1.1</ph_commons_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>
<spring_version>5.0.3.RELEASE</spring_version> <spring_version>5.0.6.RELEASE</spring_version>
<spring-boot.version>1.5.6.RELEASE</spring-boot.version> <spring-boot.version>1.5.6.RELEASE</spring-boot.version>
<stax2_api_version>3.1.4</stax2_api_version> <stax2_api_version>3.1.4</stax2_api_version>
<thymeleaf-version>3.0.9.RELEASE</thymeleaf-version> <thymeleaf-version>3.0.9.RELEASE</thymeleaf-version>
@ -625,6 +625,11 @@
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
</dependency> </dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId> <artifactId>javax.mail</artifactId>

View File

@ -6,6 +6,20 @@
<title>HAPI FHIR Changelog</title> <title>HAPI FHIR Changelog</title>
</properties> </properties>
<body> <body>
<release version="3.5.0" date="TBD">
<action type="add">
The version of a few dependencies have been bumped to the
latest versions (dependent HAPI modules listed in brackets):
<![CDATA[
<ul>
<li>Spring Framework (JPA): 5.0.3.RELEASE -&gt; 5.0.6.RELEASE</li>
<li>Hibernate OR (JPA): 5.2.16.Final -&gt; 5.3.1.Final</li>
<li>Hibernate Search (JPA): 5.7.1.Final -&gt; 5.10.1.Final</li>
<li>Jetty (CLI): 9.4.8.v20171121 -&gt; 9.4.10.v20180503</li>
</ul>
]]>
</action>
</release>
<release version="3.4.0" date="2018-05-28"> <release version="3.4.0" date="2018-05-28">
<action type="add"> <action type="add">
The version of a few dependencies have been bumped to the The version of a few dependencies have been bumped to the