use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.
the class CompositeFormatDetectorTest method guess_html_format_fail.
@Test
public void guess_html_format_fail() throws Exception {
String fileName = "html/foo.html";
DataSetMetadata datasetMetadata = ioTestUtils.getSimpleDataSetMetadata();
datasetMetadata.setEncoding("UTF-16");
Format actual = formatDetector.detect(this.getClass().getResourceAsStream(fileName));
assertFalse(actual.getFormatFamily() instanceof HtmlFormatFamily);
}
use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.
the class CompositeFormatDetectorTest method guess_html_format_success.
@Test
public void guess_html_format_success() throws Exception {
String fileName = "html/sales-force.xls";
DataSetMetadata datasetMetadata = ioTestUtils.getSimpleDataSetMetadata();
datasetMetadata.setEncoding("UTF-16");
Charset charset = new HtmlEncodingDetector().detect(this.getClass().getResourceAsStream(fileName), new Metadata());
Format actual = formatDetector.detect(this.getClass().getResourceAsStream(fileName));
assertTrue(actual.getFormatFamily() instanceof HtmlFormatFamily);
assertTrue(StringUtils.equals("UTF-16", actual.getEncoding()));
}
use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.
the class IoTestUtils method getDataSetMetadata.
/**
* @return a ready to use dataset.
*/
public DataSetMetadata getDataSetMetadata() {
DataSetMetadata datasetMetadata = metadataBuilder.metadata().id("123456789").build();
datasetMetadata.getContent().addParameter(CSVFormatFamily.SEPARATOR_PARAMETER, ";");
return datasetMetadata;
}
use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.
the class CSVSchemaParserTest method should_not_accept_xls_update.
@Test
public void should_not_accept_xls_update() throws Exception {
final DataSetMetadata metadata = metadataBuilder.metadata().id("tata").formatFamilyId("formatGuess#xls").build();
assertFalse(csvSchemaParser.accept(metadata));
}
use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.
the class CSVSchemaParserTest method should_not_accept_html_update.
@Test
public void should_not_accept_html_update() throws Exception {
final DataSetMetadata metadata = metadataBuilder.metadata().id("tata").formatFamilyId("formatGuess#html").build();
assertFalse(csvSchemaParser.accept(metadata));
}
Aggregations