Example usage for org.apache.commons.lang3 SerializationUtils roundtrip

List of usage examples for org.apache.commons.lang3 SerializationUtils roundtrip

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SerializationUtils roundtrip.

Prototype

@SuppressWarnings("unchecked") 
public static <T extends Serializable> T roundtrip(final T msg) 

Source Link

Document

Performs a serialization roundtrip.

Usage

From source file:com.gooddata.md.report.ReportDefinitionContentTest.java

@Test
public void testSerializable() throws Exception {
    final ReportDefinitionContent def = new GridReportDefinitionContent(
            new Grid(Collections.emptyList(), Collections.emptyList(), Collections.emptyList()));
    final ReportDefinitionContent deserialized = SerializationUtils.roundtrip(def);

    assertThat(deserialized, jsonEquals(def));
}

From source file:com.gooddata.md.DataLoadingColumnTest.java

@Test
public void testSerializable() throws Exception {
    final DataLoadingColumn column = readObjectFromResource("/md/dataLoadingColumn.json",
            DataLoadingColumn.class);
    final DataLoadingColumn deserialized = SerializationUtils.roundtrip(column);

    assertThat(deserialized, jsonEquals(column));
}

From source file:com.gooddata.md.ProjectDashboardTest.java

@Test
public void testSerializable() throws Exception {
    final ProjectDashboard dashboard = readObjectFromResource("/md/projectDashboard.json",
            ProjectDashboard.class);
    final ProjectDashboard deserialized = SerializationUtils.roundtrip(dashboard);

    assertThat(deserialized, jsonEquals(dashboard));
}

From source file:com.gooddata.md.AttributeSortTest.java

@Test
public void testSerializable() throws Exception {
    final AttributeSort attributeSort = new AttributeSort("/gdc/md/PROJECT_ID/obj/1806", true);
    final AttributeSort deserialized = SerializationUtils.roundtrip(attributeSort);

    assertThat(deserialized, jsonEquals(attributeSort));
}

From source file:com.gooddata.md.report.ReportTest.java

@Test
public void testSerializable() throws Exception {
    final Report report = readObjectFromResource("/md/report/report.json", Report.class);
    final Report deserialized = SerializationUtils.roundtrip(report);

    assertThat(deserialized, jsonEquals(report));
}

From source file:com.gooddata.md.report.MetricElementTest.java

@Test
public void testSerializable() throws Exception {
    final MetricElement element = new MetricElement(URI, ALIAS, FORMAT, DRILL_URI);
    final MetricElement deserialized = SerializationUtils.roundtrip(element);

    assertThat(deserialized, jsonEquals(element));
}

From source file:com.gooddata.md.DatasetTest.java

@Test
public void testSerializable() throws Exception {
    final Dataset dataset = new Dataset("Dataset");
    final Dataset deserialized = SerializationUtils.roundtrip(dataset);

    assertThat(deserialized, jsonEquals(dataset));
}

From source file:com.gooddata.md.DisplayFormTest.java

@Test
public void testSerializable() throws Exception {
    final DisplayForm displayForm = new DisplayForm(new Meta("Person Name"),
            new DisplayForm.Content(FORM_OF, EXPRESSION, LDM_EXPRESSION, null),
            new DisplayForm.Links(ELEMENTS_LINK));
    final DisplayForm deserialized = SerializationUtils.roundtrip(displayForm);

    assertThat(deserialized, jsonEquals(displayForm));
}

From source file:com.gooddata.md.AttributeDisplayFormTest.java

@Test
public void testSerializable() throws Exception {
    final DisplayForm attrDF = new AttributeDisplayForm(TITLE, FORM_OF, EXPRESSION, DEFAULT, LDM_EXPRESSION,
            TYPE, ELEMENTS_LINK);//from w  w  w .j a  va  2s .c o m
    final DisplayForm deserialized = SerializationUtils.roundtrip(attrDF);

    assertThat(deserialized, jsonEquals(attrDF));
}

From source file:com.gooddata.md.report.GridTest.java

@Test
public void testSerializable() throws Exception {
    final Grid grid = readObjectFromResource("/md/report/grid.json", Grid.class);
    final Grid deserialized = SerializationUtils.roundtrip(grid);

    assertThat(deserialized, jsonEquals(grid));
}