use of gov.cms.bfd.model.rif.LoadedFile in project beneficiary-fhir-data by CMSgov.
the class RifLoaderIT method multipleFileLoads.
@Test
@Disabled
public void multipleFileLoads() {
PipelineTestUtils.get().doTestWithDb((dataSource, entityManager) -> {
// Verify that a loaded files exsits
loadSample(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
final List<LoadedFile> beforeLoadedFiles = PipelineTestUtils.get().findLoadedFiles(entityManager);
assertTrue(beforeLoadedFiles.size() > 0, "Expected to have at least one file");
LoadedFile beforeLoadedFile = beforeLoadedFiles.get(0);
LoadedFile beforeOldestFile = beforeLoadedFiles.get(beforeLoadedFiles.size() - 1);
PipelineTestUtils.get().pauseMillis(10);
loadSample(Arrays.asList(StaticRifResourceGroup.SAMPLE_U.getResources()));
// Verify that the loaded list was updated properly
final List<LoadedFile> afterLoadedFiles = PipelineTestUtils.get().findLoadedFiles(entityManager);
assertTrue(beforeLoadedFiles.size() < afterLoadedFiles.size(), "Expected to have more loaded files");
final LoadedFile afterLoadedFile = afterLoadedFiles.get(0);
final LoadedFile afterOldestFile = afterLoadedFiles.get(afterLoadedFiles.size() - 1);
assertEquals(beforeOldestFile.getLoadedFileId(), afterOldestFile.getLoadedFileId(), "Expected same oldest file");
assertTrue(beforeLoadedFile.getCreated().isBefore(afterLoadedFile.getCreated()), "Expected range to expand");
});
}
use of gov.cms.bfd.model.rif.LoadedFile in project beneficiary-fhir-data by CMSgov.
the class RifLoaderIT method singleFileLoad.
@Test
public void singleFileLoad() {
PipelineTestUtils.get().doTestWithDb((dataSource, entityManager) -> {
// Verify that LoadedFile entity
loadSample(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
final List<LoadedFile> loadedFiles = PipelineTestUtils.get().findLoadedFiles(entityManager);
assertTrue(loadedFiles.size() > 1, "Expected to have many loaded files in SAMPLE A");
final LoadedFile loadedFile = loadedFiles.get(0);
assertNotNull(loadedFile.getCreated());
// Verify that beneficiaries table was loaded
final List<LoadedBatch> batches = loadBatches(entityManager, loadedFile.getLoadedFileId());
final LoadedBatch allBatches = batches.stream().reduce(null, LoadedBatch::combine);
assertTrue(batches.size() > 0, "Expected to have at least one beneficiary loaded");
assertEquals("567834", allBatches.getBeneficiariesAsList().get(0), "Expected to match the sample-a beneficiary");
});
}
Aggregations