Package org.waveprotocol.wave.model.document

Examples of org.waveprotocol.wave.model.document.ObservableDocument.toXmlString()


  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());
  }

  /**
   * Test case where the domain component is stripped off but a data doc with a
   * matching id component is found.
View Full Code Here


    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());
  }

  /**
   * Test case where the data doc for a non-migrated id with no domain
   * component is found.
View Full Code Here

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

  /**
   * Test case where no match can be found.
   *
 
View Full Code Here

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

  /**
   * Test case where a null attachment id is requested.
   *
 
View Full Code Here

  public void testOnlyPersistsChangedRole() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
    DocumentBasedRoles permissions = DocumentBasedRoles.create(doc);
    permissions.assign(p("public@a.gwave.com"), Role.READ_ONLY);
    assertEquals("<assign address=\"public@a.gwave.com\" role=\"READ_ONLY\"/>", doc.toXmlString());
  }

  public void testPersistNothingWhenSettingDefaultRole() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
    DocumentBasedRoles permissions = DocumentBasedRoles.create(doc);
View Full Code Here

  public void testPersistNothingWhenSettingDefaultRole() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
    DocumentBasedRoles permissions = DocumentBasedRoles.create(doc);
    permissions.assign(p("joe@example.com"), Role.FULL);
    assertEquals("", doc.toXmlString());
  }

  @Override
  protected ObservableRoles getRoles() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
View Full Code Here

        "<node key=\"filename\" value=\"CIMG0217.JPG\"></node>" +
        "<node key=\"thumbnail_url\" value=\"/thumbnail/CIMG0217_thumb.jpg?id=xJFILMDj3&amp;" +
            "key=AH0qf5woLURO3-CemfDebYFaWA9fD3PMuA\"></node>" +
        "<node key=\"attachment_url\" value=\"" + ATTACHMENT_URL + "\"></node>";
    ObservableDocument document = mock(ObservableDocument.class);
    when(document.toXmlString()).thenReturn(xmlString);

    Wavelet wavelet = mock(Wavelet.class);
    when(wavelet.getDocument("attach+" + attachmentId)).thenReturn(document);
    return wavelet;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.