Package org.waveprotocol.wave.model.conversation

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


    assertEquals("Expected the same id as the removed blip", newBlip.getId(),
        event.getRemovedBlipId());
  }

  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
    // here below will confirm that there was actually a real
View Full Code Here


    DocumentChangedEvent event = DocumentChangedEvent.as(messages.getEvents().get(0));
    assertEquals(ALEX.getAddress(), event.getModifiedBy());
  }

  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

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

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

    String annotationKey = "key";
    String annotationValue = "value";
    rootBlip.getContent().setAnnotation(0, 1, annotationKey, annotationValue);

    EventMessageBundle messages = generateAndCheckEvents(EventType.ANNOTATED_TEXT_CHANGED);
    assertEquals("Expected one event only", 1, messages.getEvents().size());
    AnnotatedTextChangedEvent event = AnnotatedTextChangedEvent.as(messages.getEvents().get(0));
    assertEquals("Expected the key of the annotation", annotationKey, event.getName());
View Full Code Here

  }

  public void testPutNonTemporaryBlip() throws Exception {
    // Non temporary blip is ignored
    Conversation conversation = mock(Conversation.class);
    ConversationBlip blip = mock(ConversationBlip.class);
    String blipId = "b+1234";
    when(blip.getId()).thenReturn(blipId);
    when(conversation.getBlip(blipId)).thenReturn(blip);

    operationContext.putBlip(blip.getId(), blip);
    assertEquals(operationContext.getBlip(conversation, blipId), blip);
  }
View Full Code Here

    assertEquals(operationContext.getBlip(conversation, blipId), blip);
  }

  public void testPutTemporaryBlip() throws Exception {
    Conversation conversation = mock(Conversation.class);
    ConversationBlip blip = mock(ConversationBlip.class);
    String tempBlipId = OperationContextImpl.TEMP_ID_MARKER + "random";
    String blipId = "b+1234";
    when(blip.getId()).thenReturn(blipId);
    when(conversation.getBlip(blipId)).thenReturn(blip);

    operationContext.putBlip(tempBlipId, blip);
    assertEquals("Expected blip for the given tempId",
        operationContext.getBlip(conversation, tempBlipId), blip);
View Full Code Here

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());

    ConversationBlip newBlip = checkAndGetNewBlip(context, conversation, response);

    Iterator<? extends ObservableConversationBlip> it =
        conversation.getRootThread().getBlips().iterator();
    it.next(); // skip, root
    it.next(); // skip, first reply
View Full Code Here

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());

    ConversationBlip newBlip = checkAndGetNewBlip(context, conversation, response);

    Iterator<? extends ObservableConversationThread> it =
        conversation.getRootThread().getFirstBlip().getReplyThreads().iterator();
    assertEquals("New blip should be the first blip in the first reply thread",
        it.next().getFirstBlip(), newBlip);
View Full Code Here

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse(response.isError());

    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();
    ConversationBlip newBlip = checkAndGetNewBlip(context, conversation, response);

    Iterator<? extends ObservableConversationBlip> it =
        conversation.getRootThread().getBlips().iterator();
    it.next(); // skip, root
    assertEquals("New blip should be the second blip in the root thread", newBlip, it.next());
View Full Code Here

    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();

    // Append the custom markup to the newly created blip.
    ConversationBlip markupBlip = conversation.getRootThread().appendBlip();

    OperationRequest operation = operationRequest(OperationType.DOCUMENT_APPEND_MARKUP,
        markupBlip.getId(), Parameter.of(ParamsProperty.CONTENT, markup));

    try {
      service.execute(operation, context, ALEX);

      fail("Bad Markup should have generated error in service execution.");
View Full Code Here

    OperationContextImpl context = helper.getContext();
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();

    // Append the custom markup to the newly created blip.
    ConversationBlip markupBlip = conversation.getRootThread().appendBlip();

    OperationRequest operation = operationRequest(OperationType.DOCUMENT_APPEND_MARKUP,
        markupBlip.getId(), Parameter.of(ParamsProperty.CONTENT, markup));

    service.execute(operation, context, ALEX);

    JsonRpcResponse response = context.getResponse(OPERATION_ID);
    assertFalse("CustomMarkup generated error in service execution.", response.isError());

    // The xml in new blip should match custom markup.
    String actualContent = markupBlip.getContent().toXmlString();
    assertTrue("Expected the new blip to contain the custom markup as specified in the " +
        "operation. actualcontent: " + actualContent, actualContent.contains(markup));
  }
View Full Code Here

TOP

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

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.