Calls with zero request details and non-partitionable resource automatically go to default now. This updates the test to pass in servletrequest details, simulating a user request (#2636)

This commit is contained in:
Tadgh 2021-05-05 16:57:12 -04:00 committed by GitHub
parent 95f951e776
commit 4031968357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import ca.uhn.fhir.jpa.interceptor.ex.PartitionInterceptorReadPartitionsBasedOnS
import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc; import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
@ -92,7 +93,7 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest {
StructureDefinition sd = new StructureDefinition(); StructureDefinition sd = new StructureDefinition();
sd.setUrl("http://foo"); sd.setUrl("http://foo");
myStructureDefinitionDao.create(sd); myStructureDefinitionDao.create(sd, new ServletRequestDetails());
runInTransaction(()->{ runInTransaction(()->{
List<ResourceTable> resources = myResourceTableDao.findAll(); List<ResourceTable> resources = myResourceTableDao.findAll();
@ -108,7 +109,7 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest {
StructureDefinition sd = new StructureDefinition(); StructureDefinition sd = new StructureDefinition();
sd.setUrl("http://foo"); sd.setUrl("http://foo");
myStructureDefinitionDao.create(sd); myStructureDefinitionDao.create(sd, new ServletRequestDetails());
runInTransaction(()->{ runInTransaction(()->{
List<ResourceTable> resources = myResourceTableDao.findAll(); List<ResourceTable> resources = myResourceTableDao.findAll();
@ -124,7 +125,7 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest {
StructureDefinition sd = new StructureDefinition(); StructureDefinition sd = new StructureDefinition();
sd.setUrl("http://foo"); sd.setUrl("http://foo");
try { try {
myStructureDefinitionDao.create(sd); myStructureDefinitionDao.create(sd, new ServletRequestDetails());
fail(); fail();
} catch (UnprocessableEntityException e) { } catch (UnprocessableEntityException e) {
assertEquals("Resource type StructureDefinition can not be partitioned", e.getMessage()); assertEquals("Resource type StructureDefinition can not be partitioned", e.getMessage());