Search in sources :

Example 6 with LoadedFile

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");
    });
}
Also used : LoadedFile(gov.cms.bfd.model.rif.LoadedFile) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 7 with LoadedFile

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");
    });
}
Also used : LoadedFile(gov.cms.bfd.model.rif.LoadedFile) LoadedBatch(gov.cms.bfd.model.rif.LoadedBatch) Test(org.junit.jupiter.api.Test)

Aggregations

LoadedFile (gov.cms.bfd.model.rif.LoadedFile)7 LoadedBatch (gov.cms.bfd.model.rif.LoadedBatch)4 Test (org.junit.jupiter.api.Test)3 IOException (java.io.IOException)2 UncheckedIOException (java.io.UncheckedIOException)2 Instant (java.time.Instant)2 EntityManager (javax.persistence.EntityManager)2 EntityTransaction (javax.persistence.EntityTransaction)2 Disabled (org.junit.jupiter.api.Disabled)2 Slf4jReporter (com.codahale.metrics.Slf4jReporter)1 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)1 BeneficiaryColumn (gov.cms.bfd.model.rif.BeneficiaryColumn)1 BeneficiaryHistory (gov.cms.bfd.model.rif.BeneficiaryHistory)1 BeneficiaryHistory_ (gov.cms.bfd.model.rif.BeneficiaryHistory_)1 BeneficiaryMonthly (gov.cms.bfd.model.rif.BeneficiaryMonthly)1 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)1 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)1 RifFile (gov.cms.bfd.model.rif.RifFile)1 RifFileEvent (gov.cms.bfd.model.rif.RifFileEvent)1 RifFileRecords (gov.cms.bfd.model.rif.RifFileRecords)1