failing test
This commit is contained in:
parent
dd8c8a3b24
commit
832c540036
|
@ -5,8 +5,11 @@ import ca.uhn.fhir.jpa.api.model.BulkExportJobResults;
|
||||||
import ca.uhn.fhir.jpa.api.svc.IBatch2JobRunner;
|
import ca.uhn.fhir.jpa.api.svc.IBatch2JobRunner;
|
||||||
import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse;
|
import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse;
|
||||||
import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test;
|
import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test;
|
||||||
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.util.BulkExportUtils;
|
import ca.uhn.fhir.jpa.util.BulkExportUtils;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
|
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||||
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
|
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
|
||||||
import ca.uhn.fhir.util.JsonUtil;
|
import ca.uhn.fhir.util.JsonUtil;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
@ -72,6 +75,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test {
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach() {
|
void afterEach() {
|
||||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED);
|
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED);
|
||||||
|
myDaoConfig.setBulkExportFileMaximumCapacity(DaoConfig.DEFAULT_BULK_EXPORT_FILE_MAXIMUM_CAPACITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -618,6 +622,33 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test {
|
||||||
verifyBulkExportResults(options, List.of("Patient/P1", deviceId), Collections.emptyList());
|
verifyBulkExportResults(options, List.of("Patient/P1", deviceId), Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConsecutiveExportsWithLowMaxFileCapacity() {
|
||||||
|
final int numPatients = 1000;
|
||||||
|
myDaoConfig.setBulkExportFileMaximumCapacity(1);
|
||||||
|
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||||
|
|
||||||
|
RequestDetails details = new SystemRequestDetails();
|
||||||
|
for(int i = 0; i < numPatients; i++){
|
||||||
|
Patient patient = new Patient();
|
||||||
|
patient.getNameFirstRep().addGiven("Patient-"+i);
|
||||||
|
myPatientDao.create(patient, details);
|
||||||
|
}
|
||||||
|
|
||||||
|
int patientsCreated = myPatientDao.search(SearchParameterMap.newSynchronous(), details).size();
|
||||||
|
assertEquals(numPatients, patientsCreated);
|
||||||
|
|
||||||
|
BulkDataExportOptions options = new BulkDataExportOptions();
|
||||||
|
options.setResourceTypes(Sets.newHashSet("Patient"));
|
||||||
|
options.setExportStyle(BulkDataExportOptions.ExportStyle.PATIENT);
|
||||||
|
options.setOutputFormat(Constants.CT_FHIR_NDJSON);
|
||||||
|
|
||||||
|
Batch2JobStartResponse job1 = myJobRunner.startNewJob(BulkExportUtils.createBulkExportJobParametersFromExportOptions(options));
|
||||||
|
Batch2JobStartResponse job2 = myJobRunner.startNewJob(BulkExportUtils.createBulkExportJobParametersFromExportOptions(options));
|
||||||
|
myBatch2JobHelper.awaitJobCompletion(job1.getJobId());
|
||||||
|
myBatch2JobHelper.awaitJobCompletion(job2.getJobId());
|
||||||
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("bulkExportOptionsResourceTypes")
|
@MethodSource("bulkExportOptionsResourceTypes")
|
||||||
public void testDeviceBulkExportWithPatientPartOfGroup(Set<String> resourceTypesForExport) {
|
public void testDeviceBulkExportWithPatientPartOfGroup(Set<String> resourceTypesForExport) {
|
||||||
|
|
|
@ -97,6 +97,8 @@ public class DaoConfig {
|
||||||
public static final int DEFAULT_BUNDLE_BATCH_POOL_SIZE = 20; // 1 for single thread
|
public static final int DEFAULT_BUNDLE_BATCH_POOL_SIZE = 20; // 1 for single thread
|
||||||
public static final int DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE = 100; // 1 for single thread
|
public static final int DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE = 100; // 1 for single thread
|
||||||
public static final int DEFAULT_BUNDLE_BATCH_QUEUE_CAPACITY = 200;
|
public static final int DEFAULT_BUNDLE_BATCH_QUEUE_CAPACITY = 200;
|
||||||
|
|
||||||
|
public static final int DEFAULT_BULK_EXPORT_FILE_MAXIMUM_CAPACITY = 1_000;
|
||||||
/**
|
/**
|
||||||
* Default value for {@link #setMaximumSearchResultCountInTransaction(Integer)}
|
* Default value for {@link #setMaximumSearchResultCountInTransaction(Integer)}
|
||||||
*
|
*
|
||||||
|
@ -332,7 +334,7 @@ public class DaoConfig {
|
||||||
/**
|
/**
|
||||||
* Since 6.2.0
|
* Since 6.2.0
|
||||||
*/
|
*/
|
||||||
private int myBulkExportFileMaximumCapacity = 1_000;
|
private int myBulkExportFileMaximumCapacity = DEFAULT_BULK_EXPORT_FILE_MAXIMUM_CAPACITY;
|
||||||
/**
|
/**
|
||||||
* Since 6.4.0
|
* Since 6.4.0
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue