Package org.waveprotocol.wave.model.document.operation

Examples of org.waveprotocol.wave.model.document.operation.DocOp$IsDocOp


    normalizer.deleteCharacters("");
    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS4);
    normalizer.retain(1);
    DocOp docOp = normalizer.finish();
    DocOp expected = new DocOpBuilder()
        .retain(1)
        .annotationBoundary(ANNOTATIONS123)
        .retain(1)
        .annotationBoundary(ANNOTATIONS4)
        .retain(1)
View Full Code Here


public class DocOpCollectorTest extends TestCase {

  public void testSimpleMonotonicComposition() {
    DocOpCollector collector = new DocOpCollector();

    DocOp a = new DocOpBuilder().characters("a").build();
    DocOp b = new DocOpBuilder().retain(1).characters("b").build();
    DocOp c = new DocOpBuilder().retain(2).characters("c").build();
    DocOp d = new DocOpBuilder().retain(3).characters("d").build();

    collector.add(a);
    collector.add(b);
    collector.add(c);
    collector.add(d);

    DocOp expected = new DocOpBuilder().characters("abcd").build();
    assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, collector.composeAll()));
  }
View Full Code Here

        CoreWaveletDocumentOperation) {
      CoreWaveletDocumentOperation clientWaveDocOp = (CoreWaveletDocumentOperation) clientOp;
      CoreWaveletDocumentOperation serverWaveDocOp = (CoreWaveletDocumentOperation) serverOp;
      if (clientWaveDocOp.getDocumentId().equals(serverWaveDocOp.getDocumentId())) {
        // Transform document operations
        DocOp clientMutation = clientWaveDocOp.getOperation();
        DocOp serverMutation = serverWaveDocOp.getOperation();
        OperationPair<DocOp> transformedDocOps =
          Transformer.transform(clientMutation, serverMutation);
        clientOp = new CoreWaveletDocumentOperation(clientWaveDocOp.getDocumentId(),
            transformedDocOps.clientOp());
        serverOp = new CoreWaveletDocumentOperation(serverWaveDocOp.getDocumentId(),
View Full Code Here

    b2.updateAttributes(ATTRSUP_SCRUBBED);

    b1.annotationBoundary(ANNO);
    b2.annotationBoundary(ANNO_SCRUBBED);

    DocOp o1 = DocOpScrub.scrub(b1.buildUnchecked());
    DocOp o2 = b2.buildUnchecked();
    assertTrue("\n" + o1 + "\n but expected \n" + o2,
        OpComparators.SYNTACTIC_IDENTITY.equal(o1, o2));
  }
View Full Code Here

  private WaveletOperation makeBlipContentOp(String id, long timestamp) throws OperationException {
    if (!docs.containsKey(id)) {
      docs.put(id, DocProviders.POJO.parse("<x></x>"));
    }
    Nindo nindo = Nindo.insertCharacters(1, "hi");
    DocOp op = docs.get(id).consumeAndReturnInvertible(nindo);
    return new WaveletBlipOperation(id, new BlipContentOperation(getContext(timestamp), op));
  }
View Full Code Here

    logger.trace().logXml("Testing: " + msg);

    // Execute the operation on starting content
    setContent(editor, startContent);
    // Get a docOp out of the nindo
    DocOp docOp = getDocOpFromNindo(nindo);
    editor.getContent().consume(docOp);

    // Assert editor health (editor already does this in debug builds)
    if (!LogLevel.showDebug()) {
      EditorTestingUtil.checkHealth(editor);
View Full Code Here

    try {
      // Execute the operation on starting content
      setContent(editor, startContent);

      DocOp docOp = getDocOpFromNindo(nindo);
      editor.getContent().consume(docOp);
    } catch (Throwable e) {
      // Test succeeds
      return;
    }
View Full Code Here

    String initial = DocOpUtil.toXmlString(docAsOp);
    IndexedDocument<Node, Element, Text> copy = DocProviders.POJO.build(docAsOp,
        DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    System.out.println(doc);

    DocOp docOp = doc.consumeAndReturnInvertible(op);

    System.out.println(op + "==========> " + docOp);
    ViolationCollector v = new ViolationCollector();
    if (!DocOpValidator.validate(v, DocumentSchema.NO_SCHEMA_CONSTRAINTS,
        Automatons.fromReadable(copy), docOp).isValid()) {
      v.printDescriptions(System.err);
      fail("Invalid operation");
    }

    copy.consume(docOp);

    System.out.println("=======" + doc + " --------- " + copy);
    assertEquals(
        DocOpUtil.toXmlString(doc.asOperation()),
        DocOpUtil.toXmlString(copy.asOperation()));
    DocOp inverted = DocOpInverter.invert(docOp);
    v = new ViolationCollector();
    if (!DocOpValidator.validate(v, DocumentSchema.NO_SCHEMA_CONSTRAINTS,
        Automatons.fromReadable(copy), inverted).isValid()) {
      v.printDescriptions(System.err);
      fail("Invalid operation");
View Full Code Here

    b.startAnnotation("a", "2");
    b.skip(2);
    b.startAnnotation("a", null);
    b.skip(3);
    b.endAnnotation("a");
    DocOp docOp = doc.consumeAndReturnInvertible(b.build());

    doc2.consumeAndReturnInvertible(Nindo.fromDocOp(docOp, true));
    assertEquals(
        DocOpUtil.toXmlString(doc.asOperation()),
        DocOpUtil.toXmlString(doc2.asOperation()));
View Full Code Here

    b = new Nindo.Builder();
    b.startAnnotation("z", "1");
    b.skip(doc.size());
    b.endAnnotation("z");
    DocOp docOp = doc.consumeAndReturnInvertible(b.build());
    assertEquals(3, docOp.size());
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.DocOp$IsDocOp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.