use of org.talend.components.service.rest.dto.UiSpecsPropertiesDto in project components by Talend.
the class DatasetWritePayload method readData.
public static DatasetWritePayload readData(InputStream input, ObjectMapper mapper) throws IOException {
JsonParser parser = mapper.getFactory().createParser(input);
JsonToken objectStartToken = parser.nextToken();
isTrue(START_OBJECT == objectStartToken, invalidInputMessage(START_OBJECT, objectStartToken));
UiSpecsPropertiesDto configuration = readConfiguration(parser);
Schema schema = readAvroSchema(parser);
Iterator<IndexedRecord> streamToReadData = createStreamToReadData(parser, mapper, schema, input);
return new DatasetWritePayload(configuration, streamToReadData, parser);
}
use of org.talend.components.service.rest.dto.UiSpecsPropertiesDto in project components by Talend.
the class AbstractSpringIntegrationTests method buildTestDataStoreFormData.
protected UiSpecsPropertiesDto buildTestDataStoreFormData() throws java.io.IOException {
UiSpecsPropertiesDto formDataContainer = new UiSpecsPropertiesDto();
formDataContainer.setProperties(mapper.readerFor(ObjectNode.class).readValue(TEST_DATA_STORE_PROPERTIES));
return formDataContainer;
}
use of org.talend.components.service.rest.dto.UiSpecsPropertiesDto in project components by Talend.
the class RuntimeControllerImplTest method validateConnectionUiSpecs.
@Test
public void validateConnectionUiSpecs() throws Exception {
UiSpecsPropertiesDto propertiesDto = buildTestDataStoreFormData();
//
given().accept(APPLICATION_JSON_UTF8_VALUE).with().content(//
propertiesDto).contentType(//
ServiceConstants.UI_SPEC_CONTENT_TYPE).when().post(//
getVersionPrefix() + "/runtimes/check").then().statusCode(HttpStatus.OK.value()).log().ifError().assertThat().body(//
notNullValue()).assertThat().body(instanceOf(String.class));
}
use of org.talend.components.service.rest.dto.UiSpecsPropertiesDto in project components by Talend.
the class RuntimeControllerImplTest method getDatasetDataUisSpecs.
@Test
public void getDatasetDataUisSpecs() throws Exception {
// given
UiSpecsPropertiesDto formDataContainer = buildTestDataSetFormData();
//
given().accept(APPLICATION_JSON_UTF8_VALUE).with().content(//
formDataContainer).contentType(//
ServiceConstants.UI_SPEC_CONTENT_TYPE).when().post(//
getVersionPrefix() + "/runtimes/data").then().statusCode(200).log().ifError().assertThat().body(equalTo(MockDatasetRuntime.getRecordJsonRepresentation()));
}
use of org.talend.components.service.rest.dto.UiSpecsPropertiesDto in project components by Talend.
the class JdbcComponentTestIT method testTrigger.
@Test
public void testTrigger() throws java.io.IOException {
// given
String triggerName = "after";
String triggerProperty = "dbTypes";
UiSpecsPropertiesDto properties = new UiSpecsPropertiesDto();
properties.setProperties(getFileAsObjectNode("jdbc_data_store_properties.json"));
// when
Response response = //
given().content(properties).contentType(ServiceConstants.UI_SPEC_CONTENT_TYPE).accept(//
ServiceConstants.UI_SPEC_CONTENT_TYPE).expect().statusCode(200).log().ifError().post(getVersionPrefix() + "/properties/trigger/{trigger}/{property}", triggerName, triggerProperty);
ObjectNode jdbcPropertiesAfterTrigger = getResponseAsObjectNode(response);
// then
// should resemble jdbc_data_store_form_after_trigger.json
assertNotNull(jdbcPropertiesAfterTrigger.get("jsonSchema"));
assertNotNull(jdbcPropertiesAfterTrigger.get("properties"));
assertNotNull(jdbcPropertiesAfterTrigger.get("uiSchema"));
assertEquals("JDBCDatastore", jdbcPropertiesAfterTrigger.get("properties").get("@definitionName").textValue());
}
Aggregations