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());
}
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;
}
Aggregations