use of gov.cms.ab2d.worker.config.SearchConfig in project ab2d by CMSgov.
the class JobProcessorIntegrationTest method setUp.
@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this);
LogManager logManager = new LogManager(sqlEventLogger, kinesisEventLogger, slackLogger);
PdpClient pdpClient = createClient();
contract = createContract();
contractForCoverageDTO = mapping.map(contract);
fail = new RuntimeException("TEST EXCEPTION");
job = createJob(pdpClient);
job.setContractNumber(contract.getContractNumber());
job.setStatus(JobStatus.IN_PROGRESS);
jobRepository.saveAndFlush(job);
when(mockBfdClient.requestEOBFromServer(eq(STU3), anyLong())).thenAnswer((args) -> {
ExplanationOfBenefit copy = EOB.copy();
copy.getPatient().setReference("Patient/" + args.getArgument(1));
return EobTestDataUtil.createBundle(copy);
});
when(mockBfdClient.requestEOBFromServer(eq(STU3), anyLong(), any())).thenAnswer((args) -> {
ExplanationOfBenefit copy = EOB.copy();
copy.getPatient().setReference("Patient/" + args.getArgument(1));
return EobTestDataUtil.createBundle(copy);
});
when(mockCoverageDriver.numberOfBeneficiariesToProcess(any(Job.class), any(ContractDTO.class))).thenReturn(100);
when(mockCoverageDriver.pageCoverage(any(CoveragePagingRequest.class))).thenReturn(new CoveragePagingResult(loadFauxMetadata(contractForCoverageDTO, 99), null));
SearchConfig searchConfig = new SearchConfig(tmpEfsMountDir.getAbsolutePath(), STREAMING_DIR, FINISHED_DIR, 0, 0, MULTIPLIER, NUMBER_PATIENT_REQUESTS_PER_THREAD);
PatientClaimsProcessor patientClaimsProcessor = new PatientClaimsProcessorImpl(mockBfdClient, logManager, searchConfig);
ReflectionTestUtils.setField(patientClaimsProcessor, "earliestDataDate", "01/01/1900");
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
pool.initialize();
ContractProcessor contractProcessor = new ContractProcessorImpl(contractWorkerClient, jobRepository, mockCoverageDriver, patientClaimsProcessor, logManager, eobClaimRequestsQueue, jobChannelService, jobProgressService, mapping, pool, searchConfig);
cut = new JobProcessorImpl(fileService, jobChannelService, jobProgressService, jobProgressUpdateService, jobRepository, jobOutputRepository, contractProcessor, logManager);
ReflectionTestUtils.setField(cut, "efsMount", tmpEfsMountDir.toString());
ReflectionTestUtils.setField(cut, "failureThreshold", 10);
}
use of gov.cms.ab2d.worker.config.SearchConfig in project ab2d by CMSgov.
the class PatientClaimsProcessorUnitTest method setUp.
@BeforeEach
void setUp() throws Exception {
searchConfig = new SearchConfig(tmpEfsMountDir.getAbsolutePath(), "streamingDir", "finishedDir", 0, 0, 1, 2);
cut = new PatientClaimsProcessorImpl(mockBfdClient, eventLogger, searchConfig);
ReflectionTestUtils.setField(cut, "earliestDataDate", "01/01/1900");
eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
createOutputFiles();
List<CoverageSummary> coverageSummaries = new ArrayList<>();
coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(patientId), null, List.of(TestUtil.getOpenRange()));
coverageSummaries.add(coverageSummary);
CoverageSummary fileSummary = new CoverageSummary(createIdentifierWithoutMbi(-199900000022040L), null, List.of(TestUtil.getOpenRange()));
coverageSummaries.add(fileSummary);
request = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, tmpEfsMountDir.getAbsolutePath());
}
use of gov.cms.ab2d.worker.config.SearchConfig in project ab2d by CMSgov.
the class AggregatorJobTest method setUp.
@BeforeEach
void setUp() {
SearchConfig searchConfig = new SearchConfig(tempDir.getAbsolutePath(), STREAMING, FINISHED, 0, 0, 1, 2);
processor = new PatientClaimsProcessorImpl(bfdClient, logManager, searchConfig);
}
use of gov.cms.ab2d.worker.config.SearchConfig in project ab2d by CMSgov.
the class ContractProcessorUnitTest method setUp.
@BeforeEach
void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
patientClaimsProcessor = spy(PatientClaimsProcessorStub.class);
mapping = new ContractToContractCoverageMapping();
contract = createContractDTO();
contractForCoverageDTO = mapping.map(contract);
PdpClient pdpClient = createClient();
job = createJob(pdpClient);
job.setContractNumber(contract.getContractNumber());
jobRepository = new StubJobRepository(job);
JobProgressServiceImpl jobProgressImpl = new JobProgressServiceImpl(jobRepository);
jobProgressImpl.initJob(jobUuid);
ReflectionTestUtils.setField(jobProgressImpl, "reportProgressDbFrequency", 2);
ReflectionTestUtils.setField(jobProgressImpl, "reportProgressLogFrequency", 3);
jobChannelService = new JobChannelStubServiceImpl(jobProgressImpl);
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
pool.initialize();
SearchConfig searchConfig = new SearchConfig(efsMountTmpDir.toFile().getAbsolutePath(), STREAMING, FINISHED, 0, 0, 2, 1);
ContractWorkerClient contractWorkerClient = new ContractWorkerClientMock();
cut = new ContractProcessorImpl(contractWorkerClient, jobRepository, coverageDriver, patientClaimsProcessor, eventLogger, requestQueue, jobChannelService, jobProgressImpl, mapping, pool, searchConfig);
// ReflectionTestUtils.setField(cut, "numberPatientRequestsPerThread", 2);
var outputDirPath = Paths.get(efsMountTmpDir.toString(), jobUuid);
Files.createDirectories(outputDirPath);
}
use of gov.cms.ab2d.worker.config.SearchConfig in project ab2d by CMSgov.
the class ContractProcessorInvalidPatientTest method setup.
@BeforeEach
void setup() {
contractWorkerClient = new ContractWorkerClientMock();
contract = new ContractDTO(contractId, contractId, OffsetDateTime.now().minusYears(50), null);
SearchConfig searchConfig = new SearchConfig(tmpDirFolder.getAbsolutePath(), STREAMING_DIR, FINISHED_DIR, 0, 0, 1, 2);
job.setJobUuid(jobId);
job.setContractNumber(contract.getContractNumber());
JobRepository jobRepository = new StubJobRepository(job);
patientClaimsProcessor = new PatientClaimsProcessorImpl(bfdClient, eventLogger, searchConfig);
JobProgressServiceImpl jobProgressUpdateService = new JobProgressServiceImpl(jobRepository);
jobProgressUpdateService.initJob(jobId);
JobChannelService jobChannelService = new JobChannelStubServiceImpl(jobProgressUpdateService);
ThreadPoolTaskExecutor aggTP = new ThreadPoolTaskExecutor();
aggTP.initialize();
cut = new ContractProcessorImpl(contractWorkerClient, jobRepository, coverageDriver, patientClaimsProcessor, eventLogger, requestQueue, jobChannelService, jobProgressUpdateService, mapping, aggTP, searchConfig);
ReflectionTestUtils.setField(cut, "eobJobPatientQueueMaxSize", 1);
ReflectionTestUtils.setField(cut, "eobJobPatientQueuePageSize", 1);
jobChannelService.sendUpdate(jobId, JobMeasure.FAILURE_THRESHHOLD, 100);
ReflectionTestUtils.setField(patientClaimsProcessor, "earliestDataDate", "01/01/2020");
}
Aggregations