use of com.linkedin.data.schema.SchemaToPdlEncoder in project rest.li by linkedin.
the class PdlEncoderTest method assertRoundTrip.
private void assertRoundTrip(String relativeName) throws IOException {
String fullName = "com.linkedin.pegasus.generator.test.idl." + relativeName;
String path = "/" + fullName.replace('.', '/') + ".pdl";
NamedDataSchema parsed = parseSchema(fullName);
String original = loadSchema(path);
assertNotNull(parsed, "Failed to resolve: " + fullName + "resolver path: " + pegasusSrcDir.getAbsolutePath());
StringWriter writer = new StringWriter();
SchemaToPdlEncoder encoder = new SchemaToPdlEncoder(writer);
encoder.setTypeReferenceFormat(SchemaToPdlEncoder.TypeReferenceFormat.PRESERVE);
encoder.encode(parsed);
String encoded = writer.toString();
assertEqualsIgnoringSpacing(original, encoded);
}
Aggregations