Package org.waveprotocol.wave.model.conversation

Examples of org.waveprotocol.wave.model.conversation.ObservableConversationBlip


  @Override
  protected void setUp() throws Exception {
    service = DocumentModifyService.create();
    helper = new OperationServiceHelper(WAVELET_NAME, ALEX);

    ObservableConversationBlip rootBlip = getRootBlip();
    rootBlipId = rootBlip.getId();
    LineContainers.appendToLastLine(
        rootBlip.getContent(), XmlStringBuilder.createText(INITIAL_CONTENT));
  }
View Full Code Here


        + "<state name=\"url\" " + "value=\"" + gadgetUrl + "\"/>"
        + "<state name=\"" + propertyName + "\" value=\"" + propertyValue + "\"/>"
        + "<state name=\"" + propertyNameToDelete + "\" value=\"" + propertyValueToDelete + "\"/>"
        + "</gadget>";

    ObservableConversationBlip rootBlip = getRootBlip();
    rootBlipId = rootBlip.getId();
    LineContainers.appendToLastLine(rootBlip.getContent(),
        XmlStringBuilder.createFromXmlString(gadgetXml));

    List<Element> updatedElementsIn = Lists.newArrayListWithCapacity(1);
    Map<String, String> newProperties = Maps.newHashMap();
View Full Code Here

        getRootBlip().getContent(), helper.getContext().openWavelet(WAVE_ID, WAVELET_ID, ALEX));
    return view;
  }

  private ObservableConversationBlip getRootBlip() throws InvalidRequestException {
    ObservableConversationBlip rootBlip =
        helper.getContext().openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot().getRootThread()
            .getFirstBlip();
    return rootBlip;
  }
View Full Code Here

   */
  public void testRobotSelfEventsFilteredAfterHuman() throws Exception {
    // 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);
    output.clear();

    // Delta2 event #1.
    conversation = conversationUtil.buildConversation(wavelet);
    newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta2 event #2.
    wavelet.addParticipant(BOB);
    // Delta2 event #3.
    builder = XmlStringBuilder.createText("some random content by robot");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
    List<WaveletOperation> ops2 = Lists.newArrayList(output.getOps());
    HashedVersion endVersion2 = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta2 = makeDeltaFromCapturedOps(ROBOT, ops2, endVersion2, 0L);
    output.clear();

View Full Code Here

   */
  public void testRobotSelfEventsFilteredBeforeHuman() throws Exception {
    // 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());
    HashedVersion endVersion = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ROBOT, ops1, endVersion, 0L);
    output.clear();

    // Delta2 event #1.
    conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta2 event #2.
    builder = XmlStringBuilder.createText("some random content by alex");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);

    List<WaveletOperation> ops2 = Lists.newArrayList(output.getOps());
    HashedVersion endVersion2 = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta2 = makeDeltaFromCapturedOps(ALEX, ops2, endVersion2, 0L);
    output.clear();
View Full Code Here

    assertEquals("Expected two events", 2, messages.getEvents().size());
  }

  public void testGenerateWaveletBlipCreatedEvent() throws Exception {
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_CREATED);
    assertEquals("Expected one event", 1, messages.getEvents().size());
    WaveletBlipCreatedEvent event = WaveletBlipCreatedEvent.as(messages.getEvents().get(0));
    assertEquals("Expected the same id as the new blip", newBlip.getId(), event.getNewBlipId());
  }
View Full Code Here

  }

  public void testGenerateWaveletBlipRemovedEvent() throws Exception {
    ObservableConversationThread rootThread =
        conversationUtil.buildConversation(wavelet).getRoot().getRootThread();
    ObservableConversationBlip newBlip = rootThread.appendBlip();
    newBlip.delete();
    EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_REMOVED);
    assertEquals("Expected two events", 2, messages.getEvents().size());
    // Blip removed should be the second event.
    WaveletBlipRemovedEvent event = WaveletBlipRemovedEvent.as(messages.getEvents().get(1));
    assertEquals("Expected the same id as the removed blip", newBlip.getId(),
        event.getRemovedBlipId());
  }
View Full Code Here

    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ALEX, ops1, endVersion, 0L);
    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);

    List<WaveletOperation> ops2 = Lists.newArrayList(output.getOps());
    HashedVersion endVersion2 = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta2 = makeDeltaFromCapturedOps(ROBOT, ops2, endVersion2, 0L);
    output.clear();
View Full Code Here

    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ROBOT, ops1, endVersion, 0L);
    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.
    wavelet.removeParticipant(BOB);

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

    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ALEX, ops, endVersion, 0L);
    output.clear();

    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    // 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());
    TransformedWaveletDelta delta2 = makeDeltaFromCapturedOps(ALEX, ops2, endVersion2, 0L);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.conversation.ObservableConversationBlip

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.