use of gov.cms.ab2d.common.model.PdpClient in project ab2d by CMSgov.
the class DataSetup method setupNonStandardClient.
public PdpClient setupNonStandardClient(String clientdId, String contractNumber, List<String> clientRoles) {
PdpClient testPdpClient = pdpClientRepository.findByClientId(clientdId);
if (testPdpClient != null) {
return testPdpClient;
}
Contract contract = setupContract(contractNumber);
return savePdpClient(clientdId, contract, clientRoles);
}
use of gov.cms.ab2d.common.model.PdpClient in project ab2d by CMSgov.
the class FileDeletionServiceTest method init.
@BeforeEach
public void init() {
pathsToDelete = new ArrayList<>();
PdpClient pdpClient = dataSetup.setupPdpClient(List.of());
// Connected to a job that is finished and has expired
job = new AuditMockJob(new StaleJob(UUID.randomUUID().toString(), pdpClient.getOrganization()), SUCCESSFUL, OffsetDateTime.now().minusDays(4));
jobAuditClientMock.update(job);
// Connected to a job, but in progress
jobInProgress = new AuditMockJob(new StaleJob(UUID.randomUUID().toString(), pdpClient.getOrganization()), IN_PROGRESS, null);
jobAuditClientMock.update(jobInProgress);
// Connected to a job that is finished where the file has yet to expire
jobNotExpiredYet = new AuditMockJob(new StaleJob(UUID.randomUUID().toString(), pdpClient.getOrganization()), SUCCESSFUL, OffsetDateTime.now().minusHours(55));
jobAuditClientMock.update(jobNotExpiredYet);
jobCancelled = new AuditMockJob(new StaleJob(UUID.randomUUID().toString(), pdpClient.getOrganization()), CANCELLED, null);
jobAuditClientMock.update(jobCancelled);
jobFailed = new AuditMockJob(new StaleJob(UUID.randomUUID().toString(), pdpClient.getOrganization()), FAILED, null);
jobAuditClientMock.update(jobFailed);
efsMount = tmpDirFolder.toPath().toString();
ReflectionTestUtils.setField(fileDeletionService, "efsMount", efsMount);
}
use of gov.cms.ab2d.common.model.PdpClient in project ab2d by CMSgov.
the class EndToEndBfdTests method setupClient.
private PdpClient setupClient(Contract contract) {
PdpClient pdpClient = new PdpClient();
pdpClient.setClientId(EndToEndBfdTests.CONTRACT_TO_USE_CLIENT_ID);
pdpClient.setOrganization("Synthea Data");
pdpClient.setEnabled(true);
pdpClient.setContract(contract);
return pdpClientRepository.save(pdpClient);
}
use of gov.cms.ab2d.common.model.PdpClient in project ab2d by CMSgov.
the class EndToEndBfdTests method runJobs.
/**
* Run a bunch of jobs with different scenarios to test the default _since capabilities. To run the jobs,
* we first need to do some setup:
*
* 1. Disable all contracts except the one we want to use
* 2. Load all the coverage data for that contract
* 3. Run the jobs
* 4. Clean up files for the jobs if necessary
*/
@Test
void runJobs() throws InterruptedException {
PdpClient pdpClient = setupClient(getContract());
final String path = System.getProperty("java.io.tmpdir");
// So we don't load coverage data for all the contracts we need, disable all but the one we want
disableContractWeDontNeed();
// Get all the coverage data for all enabled contracts
getCoverage();
// -------------- FIRST JOB --------------------
Job firstJob = createJob(pdpClient);
String firstJobId = firstJob.getJobUuid();
OffsetDateTime firstTime = firstJob.getCreatedAt();
firstJob = jobPreProcessor.preprocess(firstJob.getJobUuid());
Assertions.assertEquals(SinceSource.FIRST_RUN, firstJob.getSinceSource());
assertNull(firstJob.getSince());
firstJob = jobProcessor.process(firstJob.getJobUuid());
List<JobOutput> jobOutputs1 = firstJob.getJobOutputs();
assertNotNull(jobOutputs1);
assertEquals(JobStatus.SUCCESSFUL, firstJob.getStatus());
assertTrue(jobOutputs1.size() > 0);
jobOutputs1.forEach(f -> downloadFile(path, firstJobId, f.getFilePath()));
}
use of gov.cms.ab2d.common.model.PdpClient in project ab2d by CMSgov.
the class JobPreProcessorIntegrationTest method createClient.
private PdpClient createClient(Contract contract) {
PdpClient pdpClient = new PdpClient();
pdpClient.setClientId("Harry_Potter");
pdpClient.setOrganization("Harry_Potter");
pdpClient.setEnabled(true);
pdpClient.setContract(contract);
pdpClient = pdpClientRepository.save(pdpClient);
dataSetup.queueForCleanup(pdpClient);
return pdpClient;
}
Aggregations