Search in sources :

Example 6 with SerPropertiesDto

use of org.talend.components.service.rest.dto.SerPropertiesDto in project components by Talend.

the class FullExampleComponentTestIT method testAfterDatastoreCalled.

@Test
public void testAfterDatastoreCalled() throws java.io.IOException {
    SerPropertiesDto serPropertiesDto = createDatasetDatastoreSerPropertiesDto();
    // 
    given().content(serPropertiesDto).contentType(ServiceConstants.JSONIO_CONTENT_TYPE).accept(// 
    ServiceConstants.UI_SPEC_CONTENT_TYPE).expect().statusCode(200).log().ifError().when().post(// 
    getVersionPrefix() + "/properties/uispec").then().body("jsonSchema", // 
    notNullValue()).body("properties", // 
    notNullValue()).body("uiSchema", // 
    notNullValue()).body("properties.testAfterDatastoreTrigger", // 
    equalTo("bar"));
}
Also used : SerPropertiesDto(org.talend.components.service.rest.dto.SerPropertiesDto) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with SerPropertiesDto

use of org.talend.components.service.rest.dto.SerPropertiesDto in project components by Talend.

the class RuntimeControllerImplTest method validateConnectionJsonio.

@Test
public void validateConnectionJsonio() throws Exception {
    SerPropertiesDto propertiesDto = buildTestDataStoreSerProps();
    // 
    given().accept(APPLICATION_JSON_UTF8_VALUE).with().content(// 
    propertiesDto).contentType(// 
    ServiceConstants.JSONIO_CONTENT_TYPE).when().post(// 
    getVersionPrefix() + "/runtimes/check").then().statusCode(HttpStatus.OK.value()).log().ifError().assertThat().body(// 
    notNullValue()).assertThat().body(instanceOf(String.class));
}
Also used : SerPropertiesDto(org.talend.components.service.rest.dto.SerPropertiesDto) Test(org.junit.Test)

Example 8 with SerPropertiesDto

use of org.talend.components.service.rest.dto.SerPropertiesDto in project components by Talend.

the class JdbcComponentTestIT method initializeJDBCDatastoreProperties.

@Test
public void initializeJDBCDatastoreProperties() throws java.io.IOException {
    // given
    SerPropertiesDto propDto = new SerPropertiesDto();
    propDto.setProperties(new JDBCDatastoreProperties("").init().toSerialized());
    // when
    Response response = // 
    given().content(propDto).contentType(ServiceConstants.JSONIO_CONTENT_TYPE).accept(// 
    ServiceConstants.UI_SPEC_CONTENT_TYPE).expect().statusCode(200).log().ifError().post(getVersionPrefix() + "/properties/uispec");
    // then
    ObjectNode jdbcProperties = mapper.readerFor(ObjectNode.class).readValue(response.asInputStream());
    // should resemble jdbc_data_store_form.json
    assertNotNull(jdbcProperties.get("jsonSchema"));
    assertNotNull(jdbcProperties.get("properties"));
    assertNotNull(jdbcProperties.get("uiSchema"));
    assertEquals("JDBCDatastore", jdbcProperties.get("properties").get("@definitionName").textValue());
}
Also used : Response(com.jayway.restassured.response.Response) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JDBCDatastoreProperties(org.talend.components.jdbc.datastore.JDBCDatastoreProperties) SerPropertiesDto(org.talend.components.service.rest.dto.SerPropertiesDto) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with SerPropertiesDto

use of org.talend.components.service.rest.dto.SerPropertiesDto in project components by Talend.

the class FullExampleComponentTestIT method initializeFullExampleDatastoreProperties.

@Test
public void initializeFullExampleDatastoreProperties() throws java.io.IOException {
    SerPropertiesDto serProperties = new SerPropertiesDto();
    serProperties.setProperties(new FullExampleDatastoreProperties("").init().toSerialized());
    // 
    given().content(serProperties).contentType(ServiceConstants.JSONIO_CONTENT_TYPE).accept(// 
    ServiceConstants.UI_SPEC_CONTENT_TYPE).expect().statusCode(200).log().ifError().when().post(// 
    getVersionPrefix() + "/properties/uispec").then().body("jsonSchema", // 
    notNullValue()).body("properties", // 
    notNullValue()).body("uiSchema", // 
    notNullValue()).body("properties.@definitionName", // 
    equalTo("FullExampleDatastore"));
}
Also used : FullExampleDatastoreProperties(org.talend.components.service.rest.fullexample.datastore.FullExampleDatastoreProperties) SerPropertiesDto(org.talend.components.service.rest.dto.SerPropertiesDto) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 10 with SerPropertiesDto

use of org.talend.components.service.rest.dto.SerPropertiesDto in project components by Talend.

the class RuntimeControllerImplTest method getDatasetSchemaJsonIo.

@Test
public void getDatasetSchemaJsonIo() throws Exception {
    // given
    SerPropertiesDto formDataContainer = buildTestDataSetSerProps();
    // 
    given().accept(APPLICATION_JSON_UTF8_VALUE).with().content(// 
    formDataContainer).contentType(// 
    ServiceConstants.JSONIO_CONTENT_TYPE).when().post(// 
    getVersionPrefix() + "/runtimes/schema").then().statusCode(200).log().ifError().assertThat().body(equalTo(MockDatasetRuntime.getSchemaJsonRepresentation()));
}
Also used : SerPropertiesDto(org.talend.components.service.rest.dto.SerPropertiesDto) Test(org.junit.Test)

Aggregations

SerPropertiesDto (org.talend.components.service.rest.dto.SerPropertiesDto)12 Test (org.junit.Test)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 Response (com.jayway.restassured.response.Response)2 JDBCDatastoreProperties (org.talend.components.jdbc.datastore.JDBCDatastoreProperties)2 FullExampleDatastoreProperties (org.talend.components.service.rest.fullexample.datastore.FullExampleDatastoreProperties)2 MockDatastoreProperties (org.talend.components.service.rest.mock.MockDatastoreProperties)2 DatasetProperties (org.talend.components.common.dataset.DatasetProperties)1 DatastoreProperties (org.talend.components.common.datastore.DatastoreProperties)1 JDBCDatasetProperties (org.talend.components.jdbc.dataset.JDBCDatasetProperties)1 FullExampleDatasetProperties (org.talend.components.service.rest.fullexample.dataset.FullExampleDatasetProperties)1 MockDatasetProperties (org.talend.components.service.rest.mock.MockDatasetProperties)1 Properties (org.talend.daikon.properties.Properties)1