Search in sources :

Example 21 with ContractDTO

use of gov.cms.ab2d.common.dto.ContractDTO in project ab2d by CMSgov.

the class ContractToContractCoverageMapping method init.

@PostConstruct
public static void init() {
    modelMapper = new ModelMapper();
    modelMapper.getConfiguration().setSkipNullEnabled(true);
    Converter<ContractDTO, ContractForCoverageDTO> coverageContractDTOConverter = new AbstractConverter<>() {

        @Override
        protected ContractForCoverageDTO convert(ContractDTO source) {
            // NOSONAR
            return new ContractForCoverageDTO(source.getContractNumber(), source.getAttestedOn(), ContractForCoverageDTO.ContractType.valueOf(source.getContractType().toString()));
        }
    };
    Converter<Contract, ContractForCoverageDTO> contractToConverageDto = new AbstractConverter<>() {

        @Override
        protected ContractForCoverageDTO convert(Contract source) {
            // NOSONAR
            return new ContractForCoverageDTO(source.getContractNumber(), source.getAttestedOn(), ContractForCoverageDTO.ContractType.valueOf(source.getContractType().toString()));
        }
    };
    modelMapper.addConverter(coverageContractDTOConverter);
    modelMapper.addConverter(contractToConverageDto);
}
Also used : ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) ContractForCoverageDTO(gov.cms.ab2d.coverage.model.ContractForCoverageDTO) AbstractConverter(org.modelmapper.AbstractConverter) Contract(gov.cms.ab2d.common.model.Contract) ModelMapper(org.modelmapper.ModelMapper) PostConstruct(javax.annotation.PostConstruct)

Example 22 with ContractDTO

use of gov.cms.ab2d.common.dto.ContractDTO 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");
}
Also used : JobChannelStubServiceImpl(gov.cms.ab2d.worker.service.JobChannelStubServiceImpl) JobChannelService(gov.cms.ab2d.worker.service.JobChannelService) ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) ContractWorkerClientMock(gov.cms.ab2d.worker.util.ContractWorkerClientMock) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) SearchConfig(gov.cms.ab2d.worker.config.SearchConfig) JobRepository(gov.cms.ab2d.common.repository.JobRepository) StubJobRepository(gov.cms.ab2d.worker.repository.StubJobRepository) StubJobRepository(gov.cms.ab2d.worker.repository.StubJobRepository) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 23 with ContractDTO

use of gov.cms.ab2d.common.dto.ContractDTO in project ab2d by CMSgov.

the class JobPreProcessorUnitTest method setUp.

@BeforeEach
void setUp() {
    contract = new ContractDTO("JPP5678", "JPP5678", null, null);
    cut = new JobPreProcessorImpl(contractWorkerClient, jobRepository, eventLogger, coverageDriver);
    job = createJob();
}
Also used : ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 24 with ContractDTO

use of gov.cms.ab2d.common.dto.ContractDTO in project ab2d by CMSgov.

the class CoverageDriverTest method createClient.

private PdpClientDTO createClient(Contract contract, String clientId, @Nullable String roleName) {
    PdpClientDTO client = new PdpClientDTO();
    client.setClientId(clientId);
    client.setOrganization(clientId);
    client.setEnabled(true);
    ContractDTO contractDTO = new ContractDTO(contract.getContractNumber(), contract.getContractName(), contract.getAttestedOn(), contract.getContractType());
    client.setContract(contractDTO);
    client.setRole(roleName);
    return client;
}
Also used : ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) PdpClientDTO(gov.cms.ab2d.common.dto.PdpClientDTO)

Example 25 with ContractDTO

use of gov.cms.ab2d.common.dto.ContractDTO in project ab2d by CMSgov.

the class CoverageDriverUnitTest method periodUpdateFailsThenThrowException.

@DisplayName("Coverage period update fails then throw exception")
@Test
void periodUpdateFailsThenThrowException() {
    CoverageDriverException exception = assertThrows(CoverageDriverException.class, () -> {
        ContractDTO contract = new ContractDTO("contractNum", null, null, null);
        CoveragePeriod coveragePeriod = new CoveragePeriod();
        coveragePeriod.setContractNumber(contract.getContractNumber());
        coveragePeriod.setModified(OffsetDateTime.now().plus(1, ChronoUnit.HOURS));
        coveragePeriod.setStatus(CoverageJobStatus.FAILED);
        Job job = new Job();
        job.setCreatedAt(OffsetDateTime.now());
        driver.checkCoveragePeriodValidity(job, coveragePeriod);
    });
    assertTrue(exception.getMessage().contains("attempts to pull coverage information"));
}
Also used : ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) CoveragePeriod(gov.cms.ab2d.coverage.model.CoveragePeriod) Job(gov.cms.ab2d.common.model.Job) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

ContractDTO (gov.cms.ab2d.common.dto.ContractDTO)43 Test (org.junit.jupiter.api.Test)31 DisplayName (org.junit.jupiter.api.DisplayName)27 CoveragePeriod (gov.cms.ab2d.coverage.model.CoveragePeriod)18 ArrayList (java.util.ArrayList)13 CoverageMapping (gov.cms.ab2d.coverage.model.CoverageMapping)12 CoverageSearch (gov.cms.ab2d.coverage.model.CoverageSearch)12 CoverageSearchEvent (gov.cms.ab2d.coverage.model.CoverageSearchEvent)12 ContractToContractCoverageMapping (gov.cms.ab2d.worker.config.ContractToContractCoverageMapping)12 Job (gov.cms.ab2d.common.model.Job)11 CoverageCount (gov.cms.ab2d.coverage.model.CoverageCount)10 List (java.util.List)10 HashMap (java.util.HashMap)8 ContractForCoverageDTO (gov.cms.ab2d.coverage.model.ContractForCoverageDTO)7 CoveragePagingRequest (gov.cms.ab2d.coverage.model.CoveragePagingRequest)5 CoveragePagingResult (gov.cms.ab2d.coverage.model.CoveragePagingResult)5 Contract (gov.cms.ab2d.common.model.Contract)4 OffsetDateTime (java.time.OffsetDateTime)4 ZonedDateTime (java.time.ZonedDateTime)4 PdpClientDTO (gov.cms.ab2d.common.dto.PdpClientDTO)3