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)));
}
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();
}
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);
}
Aggregations