use of gov.cms.ab2d.eventlogger.LogManager 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.eventlogger.LogManager in project ab2d by CMSgov.
the class JobPreProcessorIntegrationTest method setUp.
@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this);
LogManager manager = new LogManager(sqlEventLogger, kinesisEventLogger, slackLogger);
cut = new JobPreProcessorImpl(contractWorkerClient, jobRepository, manager, coverageDriver);
Contract tmpContract = new Contract();
tmpContract.setContractNumber(UUID.randomUUID().toString());
tmpContract.setContractName(UUID.randomUUID().toString());
contract = contractRepository.save(tmpContract);
pdpClient = createClient(tmpContract);
job = createJob(pdpClient, contract.getContractNumber());
}
use of gov.cms.ab2d.eventlogger.LogManager in project ab2d by CMSgov.
the class CoverageCheckQuartzJobTest method whenVerificationException_alertWithIssues.
@DisplayName("Report issues when verification detects issues")
@Test
void whenVerificationException_alertWithIssues() {
when(propertiesService.isInMaintenanceMode()).thenReturn(false);
doThrow(new CoverageVerificationException("testing123", List.of("alertalert"))).when(coverageDriver).verifyCoverage();
CoverageCheckQuartzJob job = new CoverageCheckQuartzJob(logManager, coverageDriver, propertiesService);
JobExecutionException exception = assertThrows(JobExecutionException.class, () -> job.executeInternal(null));
assertTrue(exception.getMessage().contains("testing123"));
verify(propertiesService, times(1)).isInMaintenanceMode();
verify(coverageDriver, times(1)).verifyCoverage();
verify(logManager, times(1)).alert(argThat(alert -> alert.contains("alertalert") && alert.contains("Coverage verification failed")), anyList());
}
use of gov.cms.ab2d.eventlogger.LogManager in project ab2d by CMSgov.
the class JobServiceTest method setup.
// Be safe and make sure nothing from another test will impact current test
@BeforeEach
public void setup() {
MockitoAnnotations.openMocks(this);
LogManager logManager = new LogManager(sqlEventLogger, kinesisEventLogger, slackLogger);
jobService = new JobServiceImpl(jobRepository, jobOutputService, logManager, loggerEventSummary, tmpJobLocation);
ReflectionTestUtils.setField(jobService, "fileDownloadPath", tmpJobLocation);
dataSetup.setupNonStandardClient(CLIENTID, CONTRACT_NUMBER, of());
setupRegularClientSecurityContext();
}
Aggregations