Search in sources :

Example 1 with MockDatasetProperties

use of org.talend.components.service.rest.mock.MockDatasetProperties in project components by Talend.

the class PropertiesControllerImplTest method testSerializeProperties.

@Test
public void testSerializeProperties() throws Exception {
    Response response = // 
    given().accept(ServiceConstants.JSONIO_CONTENT_TYPE).expect().statusCode(200).log().ifError().with().port(// 
    localServerPort).content(// 
    buildTestDataSetFormData()).contentType(// 
    ServiceConstants.UI_SPEC_CONTENT_TYPE).post(getVersionPrefix() + "/properties/serialize");
    assertNotNull(response);
    String content = response.asString();
    assertNotNull(content);
    // take the jsonIO
    JsonNode jsonNode = mapper.readTree(content);
    String jsonioProperties = jsonNode.get("properties").asText();
    Deserialized<MockDatasetProperties> fromSerializedPersistent = Properties.Helper.fromSerializedPersistent(jsonioProperties, MockDatasetProperties.class);
    assertNotNull(fromSerializedPersistent);
    assertNotNull(fromSerializedPersistent.object);
    MockDatasetProperties deserializedProps = fromSerializedPersistent.object;
    assertEquals("tata", deserializedProps.tag.getValue());
}
Also used : Response(com.jayway.restassured.response.Response) MockDatasetProperties(org.talend.components.service.rest.mock.MockDatasetProperties) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 2 with MockDatasetProperties

use of org.talend.components.service.rest.mock.MockDatasetProperties in project components by Talend.

the class AbstractSpringIntegrationTests method buildTestDataSetSerProps.

protected SerPropertiesDto buildTestDataSetSerProps() throws java.io.IOException {
    SerPropertiesDto formDataContainer = new SerPropertiesDto();
    MockDatasetProperties mockDatasetProperties = new MockDatasetProperties("foo");
    mockDatasetProperties.tag.setValue("tata");
    mockDatasetProperties.tagId.setValue(256);
    MockDatastoreProperties mockDatastoreProperties = new MockDatastoreProperties("bar");
    formDataContainer.setDependencies(singletonList(mockDatastoreProperties.toSerialized()));
    formDataContainer.setProperties(mockDatasetProperties.toSerialized());
    return formDataContainer;
}
Also used : MockDatasetProperties(org.talend.components.service.rest.mock.MockDatasetProperties) SerPropertiesDto(org.talend.components.service.rest.dto.SerPropertiesDto) MockDatastoreProperties(org.talend.components.service.rest.mock.MockDatastoreProperties)

Aggregations

MockDatasetProperties (org.talend.components.service.rest.mock.MockDatasetProperties)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Response (com.jayway.restassured.response.Response)1 Test (org.junit.Test)1 SerPropertiesDto (org.talend.components.service.rest.dto.SerPropertiesDto)1 MockDatastoreProperties (org.talend.components.service.rest.mock.MockDatastoreProperties)1