// BeanRuleSet.setLog(log);
// log = new SimpleLog("[CombinedRoundTrip]");
// log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
BeanReader reader = createBeanReader();
PhysicalSchema schema = (PhysicalSchema) reader.parse(
getTestFileURL("src/test/org/apache/commons/betwixt/schema/schema.xml"));
StringWriter buffer = new StringWriter();
write(schema, buffer, true);
// log.debug(buffer.getBuffer().toString());
StringReader in = new StringReader(buffer.getBuffer().toString());
reader = createBeanReader();
XMLIntrospector intro = createXMLIntrospector();
DefaultXMLBeanInfoRegistry registry = new DefaultXMLBeanInfoRegistry();
intro.setRegistry(registry);
// we have written the xml file back with element collections,
// so we have to say to the reader we want to use that now
// (the default when creating in this test is not to use them)
intro.setWrapCollectionsInElement(true);
// first flush the cash, else setting other options, doesn't
// end up in rereading / mapping the object model.
registry.flush();
// set the xmlIntrospector back to the reader
reader.setXMLIntrospector(intro);
reader.deregisterBeanClass(PhysicalSchema.class);
reader.registerBeanClass(PhysicalSchema.class);
PhysicalSchema schemaSecond = (PhysicalSchema) reader.parse(in);
buffer.close();
write(schema,buffer, true);
assertEquals(schema, schemaSecond);
}