Package org.waveprotocol.wave.model.document

Examples of org.waveprotocol.wave.model.document.ObservableDocument


   * Creates a basic wrapper, missing the optional image and thumbnail metadata fields.
   *
   * @return the new wrapper
   */
  private AttachmentDocumentWrapper<Doc.N, Doc.E, Doc.T> createBasicWrapper() {
    ObservableDocument document = BasicFactories.observableDocumentProvider()
        .parse(String.format(
            "<node key=\"upload_progress\" value=\"%d\"/>"
                + "<node key=\"creator\" value=\"%s\"/>"
                + "<node key=\"attachment_size\" value=\"%d\"/>"
                + "<node key=\"malware\" value=\"false\"/>"
View Full Code Here


   * Creates a full wrapper with image and thumbnail elements populated.
   *
   * @return the new wrapper
   */
  private AttachmentDocumentWrapper<Doc.N, Doc.E, Doc.T> createFullWrapper() {
    ObservableDocument document = BasicFactories.observableDocumentProvider()
        .parse(String.format(
            "<node key=\"upload_progress\" value=\"%d\"/>"
            + "<node key=\"creator\" value=\"%s\"/>"
            + "<node key=\"attachment_size\" value=\"%d\"/>"
            + "<node key=\"malware\" value=\"false\"/>"
View Full Code Here

   * @throws InvalidIdException
   */
  public void testIdWithDomain() throws InvalidIdException {
    String attachmentId = "domain.com/some-id";
    createAttachmentDataDoc(attachmentId);
    ObservableDocument attachmentDataDoc =
        AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, attachmentId);
    assertEquals(DATA_DOC_CONTENT, attachmentDataDoc.toXmlString());
  }
View Full Code Here

   */
  public void testIdWithDifferentDomain() throws InvalidIdException {
    String attachmentId = "domain.com/some-id";
    String attachmentIdDifferentDomain = "something-else/some-id";
    createAttachmentDataDoc(attachmentIdDifferentDomain);
    ObservableDocument attachmentDataDoc =
        AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, attachmentId);
    assertEquals(DATA_DOC_CONTENT, attachmentDataDoc.toXmlString());
  }
View Full Code Here

   * @throws InvalidIdException
   */
  public void testIdWithNoDomain() throws InvalidIdException {
    String attachmentId = "some-id";
    createAttachmentDataDoc(attachmentId);
    ObservableDocument attachmentDataDoc =
        AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, attachmentId);
    assertEquals(DATA_DOC_CONTENT, attachmentDataDoc.toXmlString());
  }
View Full Code Here

   *
   * @throws InvalidIdException
   */
  public void testIdNotFound() throws InvalidIdException {
    String attachmentId = "domain.com/some-id";
    ObservableDocument attachmentDataDoc =
        AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, attachmentId);
    assertEquals(EMPTY_DATA_DOC, attachmentDataDoc.toXmlString());
  }
View Full Code Here

   *
   * @throws InvalidIdException
   */
  public void testNullId() throws InvalidIdException {
    try {
      ObservableDocument attachmentDataDoc =
          AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, null);
      fail("NullPointerException was expected but not thrown.");
    } catch (NullPointerException expected) {
      // empty
    }
View Full Code Here

   * Test case where an attachment id contains too many components.
   */
  public void testInvalidIdInput() {
    try {
      String attachmentId = "domain.com/blah/some-id";
      ObservableDocument attachmentDataDoc =
          AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, attachmentId);
      fail("InvalidIdException was expected but not thrown.");
    } catch (InvalidIdException expected) {
      // empty
    }
View Full Code Here

  public void testInvalidAttachmentDataDocId() {
    try {
      String attachmentId = "domain.com/some-id";
      String invalidAttachmentId = "domain.com/blah/some-id";
      createAttachmentDataDoc(invalidAttachmentId);
      ObservableDocument attachmentDataDoc =
          AttachmentDataDocHelper.getAttachmentDataDoc(wavelet, attachmentId);
      fail("InvalidIdException was expected but not thrown.");
    } catch (InvalidIdException expected) {
      // empty
    }
View Full Code Here

    if (blip != null) {
      String blipId1 = blip.getId();

      EventGeneratingDocumentHandler docHandler = docHandlers.get(blipId1);
      if (docHandler == null) {
        ObservableDocument doc = (ObservableDocument) blip.getContent();
        docHandler = new EventGeneratingDocumentHandler(
            doc, blip, capabilities, messages, deltaAuthor, timestamp);
        doc.addListener(docHandler);
        docHandlers.put(blipId1, docHandler);
      } else {
        docHandler.setAuthorAndTimeStamp(deltaAuthor, timestamp);
      }
    }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.ObservableDocument

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.