new IndexedDocumentImpl<Node, Element, Text, Void>(RawDocumentImpl.PROVIDER.parse("<a></a>"),
new AnnotationTree<Object>("a", "b", null), DocumentSchema.NO_SCHEMA_CONSTRAINTS);
AutomatonDocument autoDoc = Automatons.fromReadable(doc);
ModifiableDocument checkDoc;
IsDocOp checkDocOpProvider;
AutomatonDocument checkAuto;
// Set to false for faster test runs
boolean checkAgainstBootstrapDocument = true;
if (checkAgainstBootstrapDocument) {
BootstrapDocument bootstrapDoc = new BootstrapDocument();
checkDocOpProvider = bootstrapDoc;
checkDoc = bootstrapDoc;
checkAuto = bootstrapDoc;
} else {
IndexedDocument<Node, Element, Text> indexedDoc = DocProviders.POJO.parse("");
checkDocOpProvider = indexedDoc;
checkDoc = indexedDoc;
checkAuto = Automatons.fromReadable(indexedDoc);
}
for (int i = 0; i < NUM_INITIAL_MUTATIONS; i++) {
DocOp op = RandomDocOpGenerator.generate(random, params,
// FIXME(ohler): Add back schema constraints
// DocumentOperationValidator.DEFAULT_BLIP_SCHEMA_CONSTRAINTS,
autoDoc);
doc.consume(op);
checkDoc.consume(op);
}
String originalXml = DocOpUtil.toXmlString(doc.asOperation());
for (int i = 0; i < NUM_REVERSED_MUTATIONS_PER_RUN; i++) {
// Apply random mutation and revert it.
DocOp op = RandomDocOpGenerator.generate(random, params,
// FIXME(ohler): Add back schema constraints
// DocumentOperationValidator.DEFAULT_BLIP_SCHEMA_CONSTRAINTS,
autoDoc);
Nindo nindo = null;
String finalXml = null;
DocOp docOpCopy = null;
DocInitialization docAsOp = null;
try {
//System.out.println(" " + i);
//System.out.println("\n===" + iteration + "." + i + "===============================");
docAsOp = doc.asOperation();
validate(DocOpAutomaton.EMPTY_DOCUMENT, docAsOp);
IndexedDocument<Node, Element, Text> copy = DocProviders.POJO.build(docAsOp,
DocumentSchema.NO_SCHEMA_CONSTRAINTS);
BootstrapDocument copy2 = new BootstrapDocument();
copy2.consume(docAsOp);
// CONSUME
doc.consume(op);
checkDoc.consume(op);
finalXml = DocOpUtil.toXmlString(checkDocOpProvider.asOperation());
assertEquals(finalXml, DocOpUtil.toXmlString(doc.asOperation()));
// UNDO
DocOp inverted1 = DocOpInverter.invert(op);