use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.
the class Export method onExecute.
/**
* @param parameters the export parameters.
* @return the request to perform.
*/
private HttpRequestBase onExecute(ExportParameters parameters) {
try {
final String parametersAsString = objectMapper.writerFor(ExportParameters.class).writeValueAsString(parameters);
final HttpPost post = new HttpPost(transformationServiceUrl + "/apply");
post.setEntity(new StringEntity(parametersAsString, ContentType.APPLICATION_JSON));
return post;
} catch (Exception e) {
throw new TDPException(APIErrorCodes.UNABLE_TO_EXPORT_CONTENT, e);
}
}
use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.
the class AsyncAspectTest method shouldGetGroupIdFromAsyncGroupKeyAnnotation.
@Test
public void shouldGetGroupIdFromAsyncGroupKeyAnnotation() throws Exception {
// given
ExportParameters params = new ExportParameters();
params.setDatasetId("ds#123");
params.setPreparationId("prep#753");
// when
controller.groupNameFromAsyncGroupKeyAnnotation(params);
// then
assertGroupId(params.getPreparationId());
}
use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.
the class ExportParametersTest method noPreparationId.
@Test
public void noPreparationId() {
// given parameters without preparation not dataset id
ExportParameters params = new ExportParameters();
params.setDatasetId("dataset#19843");
// when
Set<ConstraintViolation<ExportParameters>> constraintViolations = validator.validate(params);
// then 1 violation (exportType is empty)
Assert.assertEquals(1, constraintViolations.size());
}
use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.
the class ExportParametersTest method noDataSetId.
@Test
public void noDataSetId() {
// given parameters without preparation not dataset id
ExportParameters params = new ExportParameters();
params.setPreparationId("prep#98435");
// when
Set<ConstraintViolation<ExportParameters>> constraintViolations = validator.validate(params);
// then 1 violation (exportType is empty)
Assert.assertEquals(1, constraintViolations.size());
}
use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.
the class ExportParametersTest method validInput.
@Test
public void validInput() {
// given parameters without preparation not dataset id
ExportParameters params = new ExportParameters();
params.setDatasetId("dataset#19843");
params.setExportType("TOTO");
// when
Set<ConstraintViolation<ExportParameters>> constraintViolations = validator.validate(params);
// then no violation
Assert.assertTrue(constraintViolations.isEmpty());
}
Aggregations