Merge remote-tracking branch 'origin/windows-fixes' into windows-fixes

This commit is contained in:
Ken Stevens 2019-01-23 16:17:48 -05:00
commit cfd67d88c7
2 changed files with 31 additions and 4 deletions

View File

@ -211,9 +211,11 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
obs.getCode().setText("ZXCVBNM ASDFGHJKL QWERTYUIOPASDFGHJKL"); obs.getCode().setText("ZXCVBNM ASDFGHJKL QWERTYUIOPASDFGHJKL");
myObservationDao.update(obs, mySrd); myObservationDao.update(obs, mySrd);
// Try to wait for the indexing to complete
waitToParamsToIndex(ptId);
HttpGet get = new HttpGet(ourServerBase + "/$suggest-keywords?context=Patient/" + ptId.getIdPart() + "/$everything&searchParam=_content&text=zxc&_pretty=true&_format=xml"); HttpGet get = new HttpGet(ourServerBase + "/$suggest-keywords?context=Patient/" + ptId.getIdPart() + "/$everything&searchParam=_content&text=zxc&_pretty=true&_format=xml");
CloseableHttpResponse http = ourHttpClient.execute(get); try (CloseableHttpResponse http = ourHttpClient.execute(get)) {
try {
assertEquals(200, http.getStatusLine().getStatusCode()); assertEquals(200, http.getStatusLine().getStatusCode());
String output = IOUtils.toString(http.getEntity().getContent(), StandardCharsets.UTF_8); String output = IOUtils.toString(http.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(output); ourLog.info(output);
@ -225,11 +227,21 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
assertEquals("score", parameters.getParameter().get(0).getPart().get(1).getName()); assertEquals("score", parameters.getParameter().get(0).getPart().get(1).getName());
assertEquals(new DecimalDt("1.0"), parameters.getParameter().get(0).getPart().get(1).getValue()); assertEquals(new DecimalDt("1.0"), parameters.getParameter().get(0).getPart().get(1).getValue());
} finally {
http.close();
} }
} }
private void waitToParamsToIndex(IIdType thePtId) throws Exception {
waitForSize(2, ()->{
HttpGet get = new HttpGet(ourServerBase + "/$suggest-keywords?context=Patient/" + thePtId.getIdPart() + "/$everything&searchParam=_content&text=zxc&_pretty=true&_format=xml");
try (CloseableHttpResponse http = ourHttpClient.execute(get)) {
assertEquals(200, http.getStatusLine().getStatusCode());
String output = IOUtils.toString(http.getEntity().getContent(), StandardCharsets.UTF_8);
Parameters parameters = ourCtx.newXmlParser().parseResource(Parameters.class, output);
return parameters.getParameter().size();
}
});
}
@Test @Test
public void testSuggestKeywordsInvalid() throws Exception { public void testSuggestKeywordsInvalid() throws Exception {
Patient patient = new Patient(); Patient patient = new Patient();

View File

@ -279,6 +279,9 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
obs.getCode().setText("ZXCVBNM ASDFGHJKL QWERTYUIOPASDFGHJKL"); obs.getCode().setText("ZXCVBNM ASDFGHJKL QWERTYUIOPASDFGHJKL");
myObservationDao.update(obs, mySrd); myObservationDao.update(obs, mySrd);
// Try to wait for the indexing to complete
waitForParamsToIndex(ptId);
HttpGet get = new HttpGet(ourServerBase + "/$suggest-keywords?context=Patient/" + ptId.getIdPart() + "/$everything&searchParam=_content&text=zxc&_pretty=true&_format=xml"); HttpGet get = new HttpGet(ourServerBase + "/$suggest-keywords?context=Patient/" + ptId.getIdPart() + "/$everything&searchParam=_content&text=zxc&_pretty=true&_format=xml");
CloseableHttpResponse http = ourHttpClient.execute(get); CloseableHttpResponse http = ourHttpClient.execute(get);
try { try {
@ -298,6 +301,18 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
} }
} }
private void waitForParamsToIndex(IIdType thePtId) throws Exception {
waitForSize(2, ()->{
HttpGet get = new HttpGet(ourServerBase + "/$suggest-keywords?context=Patient/" + thePtId.getIdPart() + "/$everything&searchParam=_content&text=zxc&_pretty=true&_format=xml");
try (CloseableHttpResponse http = ourHttpClient.execute(get)) {
assertEquals(200, http.getStatusLine().getStatusCode());
String output = IOUtils.toString(http.getEntity().getContent(), StandardCharsets.UTF_8);
Parameters parameters = ourCtx.newXmlParser().parseResource(Parameters.class, output);
return parameters.getParameter().size();
}
});
}
@Test @Test
public void testSuggestKeywordsInvalid() throws Exception { public void testSuggestKeywordsInvalid() throws Exception {
Patient patient = new Patient(); Patient patient = new Patient();