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

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder


    assertReversible(makeBlipOp("elements", m.build()));
  }

  public void testCharactersAndElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.elementStart("a", a);
    m.characters("hello");
    m.elementStart("b", b);
    m.characters("world");
    m.elementStart("c", c);
    m.elementEnd();
    m.characters("blah");
    m.elementEnd();
    m.elementEnd();

    assertReversible(makeBlipOp("charactersAndElements", m.build()));
  }
View Full Code Here


    assertReversible(makeBlipOp("charactersAndElements", m.build()));
  }

  public void testDeleteElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.deleteElementStart("a", a);
    m.deleteElementStart("b", b);
    m.deleteElementStart("c", c);
    m.deleteElementEnd();
    m.deleteElementEnd();
    m.deleteElementEnd();

    assertReversible(makeBlipOp("deleteElements", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("deleteElements", m.build()));
  }

  public void testDeleteCharactersAndElements() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes b = new AttributesImpl();
    Attributes c = new AttributesImpl(ImmutableMap.of("c1", "1", "c2", "2", "c3", "3"));

    m.deleteElementStart("a", a);
    m.deleteCharacters("hello");
    m.deleteElementStart("b", b);
    m.deleteCharacters("world");
    m.deleteElementStart("c", c);
    m.deleteElementEnd();
    m.deleteCharacters("blah");
    m.deleteElementEnd();
    m.deleteElementEnd();

    assertReversible(makeBlipOp("deleteCharactersAndElements", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("deleteCharactersAndElements", m.build()));
  }

  public void testAnnotationBoundary() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    AnnotationBoundaryMap mapA = new AnnotationBoundaryMapImpl(
        new String[]{},new String[]{"a"},new String[]{null},new String[]{"b"});
    AnnotationBoundaryMap mapB = new AnnotationBoundaryMapImpl(
        new String[]{},new String[]{"a"},new String[]{"b"},new String[]{null});
    AnnotationBoundaryMap mapC = new AnnotationBoundaryMapImpl(
        new String[]{"a"},new String[]{},new String[]{},new String[]{});
    m.elementStart("a", a);
    m.annotationBoundary(mapA);
    m.characters("test");
    m.annotationBoundary(mapB);
    m.characters("text");
    m.annotationBoundary(mapC);
    m.elementEnd();

    assertReversible(makeBlipOp("annotationBoundary", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("annotationBoundary", m.build()));
  }

  public void testEmptyAnnotationBoundary() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes a = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    m.elementStart("a", a);
    m.annotationBoundary(AnnotationBoundaryMapImpl.EMPTY_MAP);
    m.characters("text");
    m.annotationBoundary(AnnotationBoundaryMapImpl.EMPTY_MAP);
    m.elementEnd();

    assertReversible(makeBlipOp("emptyAnnotationBoundary", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("emptyAnnotationBoundary", m.build()));
  }

  public void testReplaceAttributes() {
    DocOpBuilder m = new DocOpBuilder();

    Attributes oldA = new AttributesImpl(ImmutableMap.of("a1", "1", "a2", "2"));
    Attributes newA = new AttributesImpl(ImmutableMap.of("a1", "3", "a2", "4"));

    m.retain(4);
    m.replaceAttributes(oldA, newA);
    m.retain(4);

    assertReversible(makeBlipOp("replaceAttributes", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("replaceAttributes", m.build()));
  }

  public void testEmptyReplaceAttributes() {
    DocOpBuilder m = new DocOpBuilder();

    m.retain(4);
    m.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
    m.retain(4);

    assertReversible(makeBlipOp("emptyReplaceAttributes", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("emptyReplaceAttributes", m.build()));
  }

  public void testUpdateAttributes() {
    DocOpBuilder m = new DocOpBuilder();

    AttributesUpdate u = new AttributesUpdateImpl(new String[]{"a", null, "2", "b", "1", null});

    m.retain(4);
    m.updateAttributes(u);
    m.retain(4);

    assertReversible(makeBlipOp("updateAttributes", m.build()));
  }
View Full Code Here

    assertReversible(makeBlipOp("updateAttributes", m.build()));
  }

  public void testEmptyUpdateAttributes() {
    DocOpBuilder m = new DocOpBuilder();

    m.retain(4);
    m.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
    m.retain(4);

    assertReversible(makeBlipOp("emptyUpdateAttributes", m.build()));
  }
View Full Code Here

    return new AddParticipant(opContext(time, version), user);
  }

  private WaveletOperation addBlip(String id, long time, HashedVersion version) {
    return new WaveletBlipOperation(id,
        new BlipContentOperation(opContext(time, version), new DocOpBuilder().build()));
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.impl.DocOpBuilder

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.