Package org.waveprotocol.wave.model.document.util

Examples of org.waveprotocol.wave.model.document.util.XmlStringBuilder


    // Robot receives two deltas, it is participant in wavelet before deltas.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    // Delta1 start events: event #1.
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta1 event #2.
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content by alex");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);

    List<WaveletOperation> ops1 = Lists.newArrayList(output.getOps());
    HashedVersion endVersion = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ALEX, ops1, endVersion, 0L);
View Full Code Here


    // Robot receives two deltas, it is participant in wavelet before deltas.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    // Delta1 start events: event #1.
    ObservableConversationBlip rootBlip = conversation.getRoot().getRootThread().getFirstBlip();
    // Delta1 event #2.
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content by robot");
    LineContainers.appendToLastLine(rootBlip.getContent(), builder);
    // Delta1 event #3.
    wavelet.addParticipant(BOB);

    List<WaveletOperation> ops1 = Lists.newArrayList(output.getOps());
View Full Code Here

  public void testGenerateDocumentChangedEvent() throws Exception {
    ConversationBlip rootBlip =
        conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip();

    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    LineContainers.appendToLastLine(rootBlip.getContent(), builder);

    EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED);
    assertEquals("Expected one event", 1, messages.getEvents().size());
    // Can not check the blip id because it is not accessible, however the line
View Full Code Here

  public void testGenerateDocumentChangedEventOnlyOnce() throws Exception {
    ConversationBlip rootBlip =
        conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip();

    // Change the document twice
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    LineContainers.appendToLastLine(rootBlip.getContent(), builder);
    LineContainers.appendToLastLine(rootBlip.getContent(), builder);

    EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED);
    assertEquals("Expected one event only", 1, messages.getEvents().size());
View Full Code Here

    output.clear();

    // Delta2 event #1.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    // Delta2 event #2.
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
    // Delta2 event #3.
    XmlStringBuilder.createText("some more random content by robot");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
View Full Code Here

    // Delta2 event #1.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();

    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    // Delta2 event #2.
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
    // Delta2 event #3.
    wavelet.removeParticipant(BOB);
View Full Code Here

    // Delta2 event #1.
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta2 event #2.
    wavelet.removeParticipant(ROBOT);
    // Delta2 event #3 - should be filtered.
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);


    List<WaveletOperation> ops2 = output.getOps();
    HashedVersion endVersion2 = HashedVersion.unsigned(waveletData.getVersion());
View Full Code Here

   * Tests the construct XML function which is used to insert gadgets into wave
   * XML representation.
   */
  public void testConstructXml() {
    String xmlSource = "http://test.com/gadget.xml";
    XmlStringBuilder builder = GadgetXmlUtil.constructXml(xmlSource, "", LOGIN_NAME);
    String xml = builder.toString();
    String expectedValue = "<" + TAGNAME +
        " " + URL_ATTRIBUTE + "=\"" + xmlSource + "\"" +
        " " + TITLE_ATTRIBUTE + "=\"\"" +
        " " + PREFS_ATTRIBUTE + "=\"\"" +
        " " + STATE_ATTRIBUTE + "=\"\"" +
        " " + AUTHOR_ATTRIBUTE + "=\"johnny_addgadget@rentacoder.com\">" +
        "</" + TAGNAME + ">";
    assertEquals(expectedValue, xml);
    String[] categories = {"chess", "game"};
    builder = GadgetXmlUtil.constructXml(xmlSource, "my pref", categories, LOGIN_NAME);
    xml = builder.toString();
    expectedValue = "<" + TAGNAME +
        " " + URL_ATTRIBUTE + "=\"" + xmlSource + "\"" +
        " " + TITLE_ATTRIBUTE + "=\"\"" +
        " " + PREFS_ATTRIBUTE + "=\"my pref\"" +
        " " + STATE_ATTRIBUTE + "=\"\"" +
View Full Code Here

    IndexedDocument<Node, Element, Text> parse = DocProviders.POJO.parse(initialContent);
    SubTreeXmlRenderer<Node, Element, Text> renderer =
      new SubTreeXmlRenderer<Node, Element, Text>(parse);

    Element nearestCommonAncestor = parse.getDocumentElement();
    XmlStringBuilder rendered = renderer.renderRange(parse.locate(start), parse.locate(end));

    assertEquals(expectedContent, rendered.toString());
  }
View Full Code Here

    String content = OperationUtil.getRequiredParameter(operation, ParamsProperty.CONTENT);
    String blipId = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_ID);
    ConversationBlip convBlip = context.getBlip(conversation, blipId);

    // Create builder from xml content.
    XmlStringBuilder markupBuilder = XmlStringBuilder.createFromXmlString(content);

    // Append the new markup to the blip doc.
    Document doc = convBlip.getContent();
    LineContainers.appendLine(doc, markupBuilder);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.util.XmlStringBuilder

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.