use of org.talend.dataprep.command.preparation.PreparationDetailsGet in project data-prep by Talend.
the class TransformationService method getPreparation.
/**
* Get the preparation from the preparation service.
*
* @param preparationId the wanted preparation id.
* @return the preparation from the preparation service.
*/
private Preparation getPreparation(@ApiParam(value = "The preparation id") @PathVariable String preparationId) {
final Preparation preparation;
try {
final PreparationDetailsGet details = applicationContext.getBean(PreparationDetailsGet.class, preparationId);
preparation = mapper.readerFor(Preparation.class).readValue(details.execute());
} catch (IOException e) {
throw new TDPException(PREPARATION_DOES_NOT_EXIST, e, build().put("id", preparationId));
}
return preparation;
}
use of org.talend.dataprep.command.preparation.PreparationDetailsGet in project data-prep by Talend.
the class PreparationExportStrategyTest method configurePreparation.
private void configurePreparation(Preparation preparation, String preparationId, String stepId) throws IOException {
final StringWriter preparationAsString = new StringWriter();
mapper.writerFor(Preparation.class).writeValue(preparationAsString, preparation);
when(preparationDetailsGet.execute()).thenReturn(new ByteArrayInputStream(preparationAsString.toString().getBytes()));
when(applicationContext.getBean(eq(PreparationDetailsGet.class), eq(preparationId), eq(stepId))).thenReturn(preparationDetailsGet);
}
Aggregations