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

Examples of org.waveprotocol.wave.model.document.raw.impl.RawDocumentImpl


    Bundle data = new Bundle();
    assertTrue(data.walker.checkWalk(data.doc, data.A));

    // do the same, but with an isomorphic tree instead of the actual same tree.
    data = new Bundle();
    RawDocumentImpl doc = DocProviders.ROJO.parse("<r><a>child</a></r>");
    assertTrue(data.walker.checkWalk(doc, doc.getDocumentElement().getFirstChild()));
  }
View Full Code Here


  }

  /** Make sure that a walk over a non-identical tree fails. */
  public void testDifferentTreeWalkFails() {
    Bundle data = new Bundle();
    RawDocumentImpl doc = DocProviders.ROJO.parse("<a>child<b></b></a>");
    try {
      assertFalse(data.walker.checkWalk(doc, doc.getDocumentElement()));
    } catch (IllegalStateException e) {}
  }
View Full Code Here

    assertTrue(data.walker.checkComplete());
  }

  /** Check that walking a subtree correctly works. */
  public void testWalkSubtree() {
    RawDocumentImpl doc;
    Node A, B, C, S, T;
    ReadableTreeWalker<Node, Element, Text> walker;
    doc = DocProviders.ROJO.parse("<a><b><c x=\"y\"></c>sub</b>child</a>");
    A = doc.getDocumentElement();
    B = doc.getFirstChild(A);
    C = doc.getFirstChild(B);
    S = doc.getLastChild(B);
    T = doc.getLastChild(A);
    walker = new ReadableTreeWalker<Node, Element, Text>(doc, B);

    // walk!
    assertEquals(B, walker.checkElement("b", Collections.<String, String>emptyMap()));
    assertEquals(C, walker.checkElement("c", Collections.singletonMap("x", "y")));
View Full Code Here

  protected void checkConstruction(String xml) {
    try {
      String outerXml = "<DOC a=\"b\">" + xml + "</DOC>";

      RawDocumentImpl doc = RawDocumentImpl.PROVIDER.parse(outerXml);
      Element element = doc.getDocumentElement();

      int size = element.calculateSize();

      check(size - 2, xml, XmlStringBuilder.createChildren(doc, element));
      check(size, outerXml, XmlStringBuilder.createNode(doc, element));
View Full Code Here

  }

  public void testCantGetLocationOfInvalidNode() throws OperationException {
    AnnotationTree<Object> annotations = new AnnotationTree<Object>(
        "a", "b", null);
    RawDocumentImpl rawDoc = RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>");
    IndexedDocumentImpl<Node, Element, Text, ?> doc =
        new IndexedDocumentImpl<Node, Element, Text, Void>(rawDoc, annotations,
            DocumentSchema.NO_SCHEMA_CONSTRAINTS);

    Node element = doc.getDocumentElement().getFirstChild();

    // element is valid
    assertEquals(0, doc.getLocation(element));

    doc.consumeAndReturnInvertible(Nindo.deleteElement(0));

    // element was deleted
    try {
      doc.getLocation(element);
      fail("Expected: IllegalArgumentException");
    } catch (IllegalArgumentException iae) {
      // OK
    }

    // element that was never valid to begin with
    try {
      doc.getLocation(rawDoc.createElement("abc", Collections.<String, String>emptyMap(),
          doc.getDocumentElement(), null));
      fail("Expected: IllegalArgumentException");
    } catch (IllegalArgumentException iae) {
      // OK
    }
View Full Code Here

  boolean testNindoConsume;

  private void create(String xml) {

    RawDocumentImpl raw = DocProviders.ROJO.parse("<d>" + xml + "</d>");
    RawDocumentImpl raw2 = DocProviders.ROJO.parse("<d>" + xml + "</d>");

    indexed = new ObservableIndexedDocument<Node, Element, Text, Void>(handler, raw, null,
        DocumentSchema.NO_SCHEMA_CONSTRAINTS);
    indexedCopy = new ObservableIndexedDocument<Node, Element, Text, Void>(
        handler2, raw2, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.raw.impl.RawDocumentImpl

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.