Fix another test
This commit is contained in:
parent
290894557d
commit
9abc75dc32
|
@ -75,6 +75,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
||||||
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
|
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
|
||||||
myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
|
myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
|
||||||
|
myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo());
|
||||||
|
|
||||||
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null);
|
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null);
|
||||||
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(SearchCoordinatorSvcImpl.DEFAULT_SYNC_SIZE);
|
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(SearchCoordinatorSvcImpl.DEFAULT_SYNC_SIZE);
|
||||||
|
@ -116,20 +117,6 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateWrongResourceType() throws IOException {
|
|
||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/dstu3-person.json"), StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
try {
|
|
||||||
MethodOutcome resp = ourClient.update().resource(input).withId("Patient/PERSON1").execute();
|
|
||||||
} catch (InvalidRequestException e) {
|
|
||||||
assertEquals("", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
MethodOutcome resp = ourClient.update().resource(input).withId("Person/PERSON1").execute();
|
|
||||||
assertEquals("Person/PERSON1/_history/1", resp.getId().toUnqualified().getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See #484
|
* See #484
|
||||||
*/
|
*/
|
||||||
|
@ -1571,6 +1558,27 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetResourceCountsOperation() throws Exception {
|
||||||
|
String methodName = "testMetaOperations";
|
||||||
|
|
||||||
|
Patient pt = new Patient();
|
||||||
|
pt.addName().setFamily(methodName);
|
||||||
|
ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
HttpGet get = new HttpGet(ourServerBase + "/$get-resource-counts");
|
||||||
|
CloseableHttpResponse response = ourHttpClient.execute(get);
|
||||||
|
try {
|
||||||
|
assertEquals(200, response.getStatusLine().getStatusCode());
|
||||||
|
String output = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
|
IOUtils.closeQuietly(response.getEntity().getContent());
|
||||||
|
ourLog.info(output);
|
||||||
|
assertThat(output, containsString("<parameter><name value=\"Patient\"/><valueInteger value=\""));
|
||||||
|
} finally {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// private void delete(String theResourceType, String theParamName, String theParamValue) {
|
// private void delete(String theResourceType, String theParamName, String theParamValue) {
|
||||||
// Bundle resources;
|
// Bundle resources;
|
||||||
// do {
|
// do {
|
||||||
|
@ -1596,27 +1604,6 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetResourceCountsOperation() throws Exception {
|
|
||||||
String methodName = "testMetaOperations";
|
|
||||||
|
|
||||||
Patient pt = new Patient();
|
|
||||||
pt.addName().setFamily(methodName);
|
|
||||||
ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
|
|
||||||
|
|
||||||
HttpGet get = new HttpGet(ourServerBase + "/$get-resource-counts");
|
|
||||||
CloseableHttpResponse response = ourHttpClient.execute(get);
|
|
||||||
try {
|
|
||||||
assertEquals(200, response.getStatusLine().getStatusCode());
|
|
||||||
String output = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
|
||||||
IOUtils.closeQuietly(response.getEntity().getContent());
|
|
||||||
ourLog.info(output);
|
|
||||||
assertThat(output, containsString("<parameter><name value=\"Patient\"/><valueInteger value=\""));
|
|
||||||
} finally {
|
|
||||||
response.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHasParameter() throws Exception {
|
public void testHasParameter() throws Exception {
|
||||||
IIdType pid0;
|
IIdType pid0;
|
||||||
|
@ -3137,6 +3124,77 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
assertEquals(2, response.getEntry().size());
|
assertEquals(2, response.getEntry().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchWithCountNotSet() throws Exception {
|
||||||
|
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
|
||||||
|
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(100);
|
||||||
|
|
||||||
|
for (int i =0; i < 10; i++) {
|
||||||
|
Patient pat = new Patient();
|
||||||
|
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
|
||||||
|
ourClient.create().resource(pat).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
Bundle found = ourClient
|
||||||
|
.search()
|
||||||
|
.forResource(Patient.class)
|
||||||
|
.returnBundle(Bundle.class)
|
||||||
|
.count(1)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
// If this fails under load, try increasing the throttle above
|
||||||
|
assertEquals(null, found.getTotalElement().getValue());
|
||||||
|
assertEquals(1, found.getEntry().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchWithCountSearchResultsUpTo20() throws Exception {
|
||||||
|
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
|
||||||
|
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(100);
|
||||||
|
myDaoConfig.setCountSearchResultsUpTo(20);
|
||||||
|
|
||||||
|
for (int i =0; i < 10; i++) {
|
||||||
|
Patient pat = new Patient();
|
||||||
|
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
|
||||||
|
ourClient.create().resource(pat).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
Bundle found = ourClient
|
||||||
|
.search()
|
||||||
|
.forResource(Patient.class)
|
||||||
|
.returnBundle(Bundle.class)
|
||||||
|
.count(1)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
// If this fails under load, try increasing the throttle above
|
||||||
|
assertEquals(10, found.getTotalElement().getValue().intValue());
|
||||||
|
assertEquals(1, found.getEntry().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchWithCountSearchResultsUpTo5() throws Exception {
|
||||||
|
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
|
||||||
|
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(100);
|
||||||
|
myDaoConfig.setCountSearchResultsUpTo(5);
|
||||||
|
|
||||||
|
for (int i =0; i < 10; i++) {
|
||||||
|
Patient pat = new Patient();
|
||||||
|
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
|
||||||
|
ourClient.create().resource(pat).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
Bundle found = ourClient
|
||||||
|
.search()
|
||||||
|
.forResource(Patient.class)
|
||||||
|
.returnBundle(Bundle.class)
|
||||||
|
.count(1)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
// If this fails under load, try increasing the throttle above
|
||||||
|
assertEquals(null, found.getTotalElement().getValue());
|
||||||
|
assertEquals(1, found.getEntry().size());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithEmptyParameter() throws Exception {
|
public void testSearchWithEmptyParameter() throws Exception {
|
||||||
Observation obs= new Observation();
|
Observation obs= new Observation();
|
||||||
|
@ -3194,77 +3252,6 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
assertEquals(SearchEntryMode.INCLUDE, found.getEntry().get(1).getSearch().getMode());
|
assertEquals(SearchEntryMode.INCLUDE, found.getEntry().get(1).getSearch().getMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchWithCountNotSet() throws Exception {
|
|
||||||
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
|
|
||||||
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(100);
|
|
||||||
|
|
||||||
for (int i =0; i < 10; i++) {
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
|
|
||||||
ourClient.create().resource(pat).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
Bundle found = ourClient
|
|
||||||
.search()
|
|
||||||
.forResource(Patient.class)
|
|
||||||
.returnBundle(Bundle.class)
|
|
||||||
.count(1)
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
// If this fails under load, try increasing the throttle above
|
|
||||||
assertEquals(null, found.getTotalElement().getValue());
|
|
||||||
assertEquals(1, found.getEntry().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchWithCountSearchResultsUpTo5() throws Exception {
|
|
||||||
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
|
|
||||||
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(100);
|
|
||||||
myDaoConfig.setCountSearchResultsUpTo(5);
|
|
||||||
|
|
||||||
for (int i =0; i < 10; i++) {
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
|
|
||||||
ourClient.create().resource(pat).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
Bundle found = ourClient
|
|
||||||
.search()
|
|
||||||
.forResource(Patient.class)
|
|
||||||
.returnBundle(Bundle.class)
|
|
||||||
.count(1)
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
// If this fails under load, try increasing the throttle above
|
|
||||||
assertEquals(null, found.getTotalElement().getValue());
|
|
||||||
assertEquals(1, found.getEntry().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchWithCountSearchResultsUpTo20() throws Exception {
|
|
||||||
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
|
|
||||||
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(100);
|
|
||||||
myDaoConfig.setCountSearchResultsUpTo(20);
|
|
||||||
|
|
||||||
for (int i =0; i < 10; i++) {
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
|
|
||||||
ourClient.create().resource(pat).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
Bundle found = ourClient
|
|
||||||
.search()
|
|
||||||
.forResource(Patient.class)
|
|
||||||
.returnBundle(Bundle.class)
|
|
||||||
.count(1)
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
// If this fails under load, try increasing the throttle above
|
|
||||||
assertEquals(10, found.getTotalElement().getValue().intValue());
|
|
||||||
assertEquals(1, found.getEntry().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test()
|
@Test()
|
||||||
public void testSearchWithInvalidNumberPrefix() throws Exception {
|
public void testSearchWithInvalidNumberPrefix() throws Exception {
|
||||||
try {
|
try {
|
||||||
|
@ -4069,6 +4056,20 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateWrongResourceType() throws IOException {
|
||||||
|
String input = IOUtils.toString(getClass().getResourceAsStream("/dstu3-person.json"), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
try {
|
||||||
|
MethodOutcome resp = ourClient.update().resource(input).withId("Patient/PERSON1").execute();
|
||||||
|
} catch (InvalidRequestException e) {
|
||||||
|
assertEquals("", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
MethodOutcome resp = ourClient.update().resource(input).withId("Person/PERSON1").execute();
|
||||||
|
assertEquals("Person/PERSON1/_history/1", resp.getId().toUnqualified().getValue());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidateBadInputViaGet() throws IOException {
|
public void testValidateBadInputViaGet() throws IOException {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue