use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class JSONPersistencesTest method testParseAndGenerateWithPrettyPrinter.
@Test
public void testParseAndGenerateWithPrettyPrinter() throws Exception {
IEntity sampleModel = JSONSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getClass().getResourceAsStream("sample.json")));
assertEquals(sampleString, PrettyPrinterOperation.toPrettyPrintString(sampleModel));
}
use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class JSONPersistencesTest method testStreamAndBuildParserEquivalence.
@Test
public void testStreamAndBuildParserEquivalence() throws Exception {
IEntity sampleModelByFactory = JSONSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getClass().getResourceAsStream("sample.json")));
ModelBuilderOperation op = new ModelBuilderOperation();
new JSONParserTemplateFactory(new JsonFactory().createParser(sampleString)).apply(op);
IEntity sampleModelByBuilder = ReflectionFactory.makeRootEntity(op.wGetResult());
assertTrue(Matcher.match(sampleModelByFactory, sampleModelByBuilder));
}
use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class GrammarsUtilsTest method testUnparseXmlDocument.
@Category(KnownFailingTests.class)
@Test
public void testUnparseXmlDocument() throws Exception {
IEntity xmlDocument = XmlSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getClass().getResourceAsStream("sample.xwl")));
StringBuilder sb = new StringBuilder();
GrammarsUtils.unparse(xmlDocument, sb, xmlGrammarURI);
Assert.assertEquals("FIXME encoding and indentation", sb.toString());
}
Aggregations