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

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


        DocHelper.getLastElementWithTagName(doc, TAG));
  }

  public void testAtomicReplacementOfEquivalentFiresNoEvents() {
    target.set("42");
    DocOp replacement = createReplaceOp(createErasureOp(), createRestoreOp());
    target.addListener(listener);
    doc.hackConsume(Nindo.fromDocOp(replacement, false));
    listener.verifyNoEvent();
  }
View Full Code Here


  }

  public void testAtomicReplacementFiresSingleEvent() {
    // Build "insert 42" state.
    target.set("42");
    DocOp restore = createRestoreOp();

    // Build "delete 43" state.
    target.set("43");
    DocOp erasure = createErasureOp();

    DocOp restoration = createReplaceOp(erasure, restore);
    target.addListener(listener);
    doc.hackConsume(Nindo.fromDocOp(restoration, false));
    listener.verifyValueChanged(43, 42);
  }
View Full Code Here

  public void testDocOp() {
    OpEquator eq = OpComparators.SYNTACTIC_IDENTITY;

    DocOpBuffer ba1 = new DocOpBuffer();
    ba1.characters("a");
    DocOp a1 = ba1.finish();

    DocOpBuffer ba2 = new DocOpBuffer();
    ba2.characters("a");
    DocOp a2 = ba2.finish();

    DocOpBuffer bb1 = new DocOpBuffer();
    bb1.deleteCharacters("a");
    DocOp b1 = bb1.finish();

    DocOpBuffer bb2 = new DocOpBuffer();
    bb2.deleteCharacters("a");
    DocOp b2 = bb1.finish();

    assertTrue(eq.equal(a1, a1));
    assertTrue(eq.equal(a1, a2));
    assertTrue(eq.equal(a2, a1));
    assertTrue(eq.equal(a2, a2));
View Full Code Here

    for (int i = 0; i < 200; i++) {
      BootstrapDocument doc = new BootstrapDocument();
      for (int j = 0; j < 20; j++) {
        RandomProvider ra = RandomProviderImpl.ofSeed(i * 20 + j);
        RandomProvider rb = RandomProviderImpl.ofSeed(i * 20 + j + 1);
        DocOp a = RandomDocOpGenerator.generate(ra, p, doc);
        DocOp b = RandomDocOpGenerator.generate(rb, p, doc);
        doc.consume(a);
        assertTrue(eq.equal(a, a));
        // The combination of RandomProvider and RandomDocOpGenerator doesn't
        // really guarantee this property, but it happens to be true with the
        // random seeds that occur here.
View Full Code Here

  }

  private BlipOperation createSampleContentOperation(WaveletOperationContext context,
      UpdateContributorMethod method) {
    // Some random op that doesn't actually update the document but still "isWorthy"
    DocOp op = new DocOpBuilder()
        .retain(1)
        .deleteElementStart("line", Attributes.EMPTY_MAP)
        .deleteElementEnd()
        .elementStart("line", Attributes.EMPTY_MAP)
        .elementEnd()
View Full Code Here

  protected void tearDown() throws Exception {
    super.tearDown();
  }

  public void testBlipContentOperationVisitor() {
    DocOp docOp = ModelTestUtils.createContent("Hello");
    BlipContentOperation op = new BlipContentOperation(context, docOp);
    op.acceptVisitor(visitor);
    assertEquals(op, visitor.visitedBlipContentOperation);
  }
View Full Code Here

    return waveletOp;
  }

  private WaveletOperation mutateBlip(WaveletOperationContext context, String blipId)
      throws OperationException {
    DocOp docOp = ModelTestUtils.createContent("Hello");
    BlipOperation blipOp = new BlipContentOperation(LOCAL_CONTEXT, docOp);
    WaveletOperation waveletBlipOp = new WaveletBlipOperation(blipId, blipOp);
    waveletBlipOp.apply(waveletData);
    return waveletBlipOp;
  }
View Full Code Here

            .characters("a")
            .elementStart(WorthyChangeChecker.THREAD_INLINE_ANCHOR_TAGNAME, Attributes.EMPTY_MAP)
            .elementEnd()
            .build(),
        DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    DocOp op = d.consumeAndReturnInvertible(new Nindo.Builder() {
      {
        skip(2);
        deleteElementStart();
        deleteElementEnd();
      }
View Full Code Here

            .elementStart(WorthyChangeChecker.THREAD_INLINE_ANCHOR_TAGNAME, Attributes.EMPTY_MAP)
            .elementEnd()
            .annotationBoundary(new AnnotationBoundaryMapBuilder().end("a").build())
            .build(),
        DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    DocOp op = d.consumeAndReturnInvertible(new Nindo.Builder() {
      {
        deleteElementStart();
        deleteElementEnd();
      }
    }.build());
View Full Code Here

      BootstrapDocument document= new BootstrapDocument();
      for (int i = 0; i < INITIAL_MUTATION_COUNT; ++i) {
        document.consume(generator.randomOperation(document, r));
      }
      for (int i = 0; i < FEATURE_ITERATION_COUNT; ++i) {
        DocOp clientOp = generator.randomOperation(document, r);
        DocOp serverOp = generator.randomOperation(document, r);
        OperationPair<DocOp> pair = Transformer.transform(clientOp, serverOp);
        OperationPair<DocOp> referencePair =
            ReferenceTransformer.transform(clientOp, serverOp);
        assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
            pair.clientOp(), referencePair.clientOp()));
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.