use of org.talend.components.service.rest.impl.ApiError in project components by Talend.
the class JdbcComponentTestIT method testGetSchema_wrongSql.
@Test
public void testGetSchema_wrongSql() throws java.io.IOException {
// given
UiSpecsPropertiesDto datasetConnectionInfo = new UiSpecsPropertiesDto();
datasetConnectionInfo.setProperties(mapper.readValue(getClass().getResourceAsStream("jdbc_data_set_properties_no_schema_wrong_table_name.json"), ObjectNode.class));
datasetConnectionInfo.setDependencies(singletonList(getJdbcDataStoreProperties()));
String dataSetDefinitionName = "JDBCDataset";
// when
ApiError response = //
given().content(datasetConnectionInfo).contentType(APPLICATION_JSON_UTF8_VALUE).accept(//
APPLICATION_JSON_UTF8_VALUE).expect().statusCode(400).log().ifValidationFails().post(getVersionPrefix() + "/runtimes/schema").as(ApiError.class);
// then
assertEquals("TCOMP_JDBC_SQL_SYNTAX_ERROR", response.getCode());
assertEquals("Table/View 'TOTO' does not exist.", response.getMessage());
}
Aggregations