Search in sources :

Example 21 with ExportParameters

use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.

the class ApplyPreparationExportStrategyTest method shouldAcceptIfDataSetAndPreparationParametersSet.

@Test
public void shouldAcceptIfDataSetAndPreparationParametersSet() throws Exception {
    // Given
    final ExportParameters parameters = new ExportParameters();
    parameters.setDatasetId("1234");
    parameters.setPreparationId("1234");
    // Then
    assertTrue(applyPreparationExportStrategy.accept(parameters));
}
Also used : ExportParameters(org.talend.dataprep.api.export.ExportParameters) ServiceBaseTest(org.talend.ServiceBaseTest) Test(org.junit.Test)

Example 22 with ExportParameters

use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.

the class ApplyPreparationExportStrategyTest method shouldNotAcceptIfDataSetParameterNotSet.

@Test
public void shouldNotAcceptIfDataSetParameterNotSet() throws Exception {
    // Given
    final ExportParameters parameters = new ExportParameters();
    parameters.setDatasetId("");
    parameters.setPreparationId("1234");
    parameters.setStepId("0");
    parameters.setExportType("text");
    parameters.setFrom(ExportParameters.SourceType.HEAD);
    // Then
    assertFalse(applyPreparationExportStrategy.accept(parameters));
}
Also used : ExportParameters(org.talend.dataprep.api.export.ExportParameters) ServiceBaseTest(org.talend.ServiceBaseTest) Test(org.junit.Test)

Example 23 with ExportParameters

use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.

the class CachedExportStrategyTest method shouldNotAcceptNullPreparationId.

@Test
public void shouldNotAcceptNullPreparationId() throws Exception {
    // Then
    final ExportParameters parameters = new ExportParameters();
    parameters.setContent(new DataSet());
    parameters.setPreparationId(null);
    assertFalse(cachedExportStrategy.accept(parameters));
}
Also used : DataSet(org.talend.dataprep.api.dataset.DataSet) ExportParameters(org.talend.dataprep.api.export.ExportParameters) Test(org.junit.Test) ServiceBaseTest(org.talend.ServiceBaseTest)

Example 24 with ExportParameters

use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.

the class CachedExportStrategyTest method shouldAcceptIfCacheEntryExists.

@Test
public void shouldAcceptIfCacheEntryExists() throws Exception {
    // Given
    final ExportParameters parameters = new ExportParameters();
    parameters.setDatasetId("1234");
    parameters.setPreparationId("1234");
    parameters.setStepId("0");
    parameters.setExportType("text");
    parameters.setFrom(HEAD);
    // Then
    assertTrue(cachedExportStrategy.accept(parameters));
}
Also used : ExportParameters(org.talend.dataprep.api.export.ExportParameters) Test(org.junit.Test) ServiceBaseTest(org.talend.ServiceBaseTest)

Example 25 with ExportParameters

use of org.talend.dataprep.api.export.ExportParameters in project data-prep by Talend.

the class CachedExportStrategyTest method shouldNotAcceptIfCacheEntryDoesNotExists.

@Test
public void shouldNotAcceptIfCacheEntryDoesNotExists() throws Exception {
    // Given
    final ExportParameters parameters = new ExportParameters();
    parameters.setDatasetId("1234");
    // Preparation differs from key.
    parameters.setPreparationId("2345");
    parameters.setStepId("0");
    parameters.setExportType("text");
    parameters.setFrom(HEAD);
    // Then
    assertFalse(cachedExportStrategy.accept(parameters));
}
Also used : ExportParameters(org.talend.dataprep.api.export.ExportParameters) Test(org.junit.Test) ServiceBaseTest(org.talend.ServiceBaseTest)

Aggregations

ExportParameters (org.talend.dataprep.api.export.ExportParameters)40 Test (org.junit.Test)23 StreamingResponseBody (org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody)11 TDPException (org.talend.dataprep.exception.TDPException)11 Preparation (org.talend.dataprep.api.preparation.Preparation)10 DataSet (org.talend.dataprep.api.dataset.DataSet)9 TransformationCacheKey (org.talend.dataprep.cache.TransformationCacheKey)9 OutputStream (java.io.OutputStream)8 Configuration (org.talend.dataprep.transformation.api.transformer.configuration.Configuration)8 TransformationServiceBaseTest (org.talend.dataprep.transformation.service.TransformationServiceBaseTest)8 JsonParser (com.fasterxml.jackson.core.JsonParser)7 InputStream (java.io.InputStream)7 StringUtils (org.apache.commons.lang.StringUtils)7 Component (org.springframework.stereotype.Component)7 ServiceBaseTest (org.talend.ServiceBaseTest)7 ExportFormat (org.talend.dataprep.format.export.ExportFormat)7 CSVFormat (org.talend.dataprep.transformation.format.CSVFormat)7 BaseExportStrategy (org.talend.dataprep.transformation.service.BaseExportStrategy)7 ExportUtils (org.talend.dataprep.transformation.service.ExportUtils)7 InputStreamReader (java.io.InputStreamReader)6