Search in sources :

Example 21 with DataSetMetadata

use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.

the class HtmlSchemaParserTest method should_not_accept_csv_update.

@Test
public void should_not_accept_csv_update() throws Exception {
    final DataSetMetadata metadata = metadataBuilder.metadata().id("toto").formatFamilyId("formatGuess#csv").build();
    assertFalse(parser.accept(metadata));
}
Also used : DataSetMetadata(org.talend.dataprep.api.dataset.DataSetMetadata) Test(org.junit.Test)

Example 22 with DataSetMetadata

use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.

the class HtmlSchemaParserTest 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(parser.accept(metadata));
}
Also used : DataSetMetadata(org.talend.dataprep.api.dataset.DataSetMetadata) Test(org.junit.Test)

Example 23 with DataSetMetadata

use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.

the class XlsSchemaParserTest 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(parser.accept(metadata));
}
Also used : DataSetMetadata(org.talend.dataprep.api.dataset.DataSetMetadata) Test(org.junit.Test)

Example 24 with DataSetMetadata

use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.

the class XlsSchemaParserTest method should_not_accept_csv_update.

@Test
public void should_not_accept_csv_update() throws Exception {
    final DataSetMetadata metadata = metadataBuilder.metadata().id("toto").formatFamilyId("formatGuess#csv").build();
    assertFalse(parser.accept(metadata));
}
Also used : DataSetMetadata(org.talend.dataprep.api.dataset.DataSetMetadata) Test(org.junit.Test)

Example 25 with DataSetMetadata

use of org.talend.dataprep.api.dataset.DataSetMetadata in project data-prep by Talend.

the class XlsSchemaParserTest method checkColumnsName.

/**
 * Load the excel file and check the parsed columns name against the given ones.
 *
 * @param inputStream the excel file name as inputStream
 * @param expectedColsName the expected columns name.
 * @throws IOException if an error occurs while reading the excel file.
 */
private void checkColumnsName(InputStream inputStream, String... expectedColsName) throws IOException {
    DataSetMetadata datasetMetadata = ioTestUtils.getSimpleDataSetMetadata();
    Schema result = parser.parse(new SchemaParser.Request(inputStream, datasetMetadata));
    List<ColumnMetadata> columns = result.getSheetContents().get(0).getColumnMetadatas();
    final List<String> actual = columns.stream().map(ColumnMetadata::getName).collect(Collectors.toList());
    assertThat(actual).containsExactly(expectedColsName);
}
Also used : ColumnMetadata(org.talend.dataprep.api.dataset.ColumnMetadata) Schema(org.talend.dataprep.schema.Schema) SchemaParser(org.talend.dataprep.schema.SchemaParser) DataSetMetadata(org.talend.dataprep.api.dataset.DataSetMetadata)

Aggregations

DataSetMetadata (org.talend.dataprep.api.dataset.DataSetMetadata)192 Test (org.junit.Test)126 DataSetBaseTest (org.talend.dataprep.dataset.DataSetBaseTest)63 ColumnMetadata (org.talend.dataprep.api.dataset.ColumnMetadata)48 InputStream (java.io.InputStream)45 Matchers.containsString (org.hamcrest.Matchers.containsString)28 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)28 TDPException (org.talend.dataprep.exception.TDPException)26 RowMetadata (org.talend.dataprep.api.dataset.RowMetadata)20 DataSetServiceTest (org.talend.dataprep.dataset.service.DataSetServiceTest)20 ApiOperation (io.swagger.annotations.ApiOperation)18 DataSet (org.talend.dataprep.api.dataset.DataSet)18 Type (org.talend.dataprep.api.type.Type)17 Timed (org.talend.dataprep.metrics.Timed)17 DistributedLock (org.talend.dataprep.lock.DistributedLock)16 Autowired (org.springframework.beans.factory.annotation.Autowired)14 DataSetRow (org.talend.dataprep.api.dataset.row.DataSetRow)14 IOException (java.io.IOException)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 ArrayList (java.util.ArrayList)12