Search in sources :

Example 1 with JobProfile

use of org.folio.rest.jaxrs.model.JobProfile in project mod-source-record-manager by folio-org.

the class DataImportPayloadContextBuilderImplTest method setUp.

@Before
public void setUp() throws Exception {
    record = new Record();
    JobProfile jobProfile = new JobProfile().withId(UUID.randomUUID().toString()).withName("Create MARC Bibs").withDataType(JobProfile.DataType.MARC);
    ActionProfile actionProfile = new ActionProfile().withId(UUID.randomUUID().toString()).withName("Create MARC Bib").withAction(ActionProfile.Action.CREATE).withFolioRecord(ActionProfile.FolioRecord.INSTANCE);
    profileSnapshotWrapper = new ProfileSnapshotWrapper().withId(UUID.randomUUID().toString()).withProfileId(jobProfile.getId()).withContentType(JOB_PROFILE).withContent(jobProfile).withChildSnapshotWrappers(Collections.singletonList(new ProfileSnapshotWrapper().withProfileId(actionProfile.getId()).withContentType(ACTION_PROFILE).withContent(actionProfile)));
}
Also used : Record(org.folio.rest.jaxrs.model.Record) ParsedRecord(org.folio.rest.jaxrs.model.ParsedRecord) JobProfile(org.folio.rest.jaxrs.model.JobProfile) ActionProfile(org.folio.rest.jaxrs.model.ActionProfile) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) Before(org.junit.Before)

Example 2 with JobProfile

use of org.folio.rest.jaxrs.model.JobProfile in project mod-source-record-manager by folio-org.

the class JobExecutionServiceImpl method loadJobProfileById.

private Future<JobProfile> loadJobProfileById(String jobProfileId, OkapiConnectionParams params) {
    Promise<JobProfile> promise = Promise.promise();
    DataImportProfilesClient client = new DataImportProfilesClient(params.getOkapiUrl(), params.getTenantId(), params.getToken());
    client.getDataImportProfilesJobProfilesById(jobProfileId, false, null, response -> {
        if (response.result().statusCode() == HTTP_OK.toInt()) {
            promise.handle(Try.itGet(() -> response.result().bodyAsJsonObject().mapTo(JobProfile.class)));
        } else {
            String message = String.format("Error loading JobProfile by JobProfile id '%s', response code %s", jobProfileId, response.result().statusCode());
            LOGGER.error(message);
            promise.fail(message);
        }
    });
    return promise.future();
}
Also used : DataImportProfilesClient(org.folio.rest.client.DataImportProfilesClient) JobProfile(org.folio.rest.jaxrs.model.JobProfile)

Example 3 with JobProfile

use of org.folio.rest.jaxrs.model.JobProfile in project mod-source-record-manager by folio-org.

the class StoredRecordChunkConsumersVerticleTest method setUp.

@Before
public void setUp() {
    WireMock.stubFor(WireMock.get("/data-import-profiles/jobProfiles/" + JOB_PROFILE_ID + "?withRelations=false&").willReturn(WireMock.ok().withBody(Json.encode(new JobProfile().withId(JOB_PROFILE_ID).withName("Create instance")))));
    InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(1);
    List<JobExecution> createdJobExecutions = response.getJobExecutions();
    assertThat(createdJobExecutions.size(), is(1));
    jobExec = createdJobExecutions.get(0);
    RestAssured.given().spec(spec).body(new JobProfileInfo().withName("MARC records").withId(JOB_PROFILE_ID).withDataType(JobProfileInfo.DataType.MARC)).when().put(JOB_EXECUTION_PATH + jobExec.getId() + JOB_PROFILE_PATH).then().statusCode(HttpStatus.SC_OK);
}
Also used : JobExecution(org.folio.rest.jaxrs.model.JobExecution) JobProfileInfo(org.folio.rest.jaxrs.model.JobProfileInfo) InitJobExecutionsRsDto(org.folio.rest.jaxrs.model.InitJobExecutionsRsDto) JobProfile(org.folio.rest.jaxrs.model.JobProfile) Before(org.junit.Before)

Aggregations

JobProfile (org.folio.rest.jaxrs.model.JobProfile)3 Before (org.junit.Before)2 DataImportProfilesClient (org.folio.rest.client.DataImportProfilesClient)1 ActionProfile (org.folio.rest.jaxrs.model.ActionProfile)1 InitJobExecutionsRsDto (org.folio.rest.jaxrs.model.InitJobExecutionsRsDto)1 JobExecution (org.folio.rest.jaxrs.model.JobExecution)1 JobProfileInfo (org.folio.rest.jaxrs.model.JobProfileInfo)1 ParsedRecord (org.folio.rest.jaxrs.model.ParsedRecord)1 ProfileSnapshotWrapper (org.folio.rest.jaxrs.model.ProfileSnapshotWrapper)1 Record (org.folio.rest.jaxrs.model.Record)1