Examples of AttachmentId


Examples of org.waveprotocol.wave.media.model.AttachmentId

    assertEquals(testData, dataToString(data));
  }

  public void testContentLengthMatchesDataSize() throws Exception {
    String testData = "blah blah blah";
    AttachmentId id = new AttachmentId("", "id_2");
    AttachmentStore store = makeStoreWithData(id, testData);

    AttachmentData data = store.getAttachment(id);
    assertEquals(testData.length(), data.getSize());
  }
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

    assertEquals(testData.length(), data.getSize());
  }

  public void testStoreCanDeleteData() throws Exception {
    String testData = "some day, I'm going to run out of test strings";
    AttachmentId id = new AttachmentId("", "id_3");
    AttachmentStore store = makeStoreWithData(id, testData);

    store.deleteAttachment(id);
    AttachmentData data = store.getAttachment(id);
    assertNull(data);
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

    assertNull(data);
  }

  public void testAttachmentCanWriteToOutputStream() throws Exception {
    String testData = "maybe there's some easy way to generate test strings";
    AttachmentId id = new AttachmentId("", "id_4");
    AttachmentStore store = makeStoreWithData(id, testData);
    AttachmentData data = store.getAttachment(id);

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    InputStream io = data.getInputStream();
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

    }
  }

  public void testAttachmentHasWorkingInputStream() throws Exception {
    String testData = "I suppose these strings don't actually need to be different";
    AttachmentId id = new AttachmentId("", "id_5");
    AttachmentStore store = makeStoreWithData(id, testData);
    AttachmentData data = store.getAttachment(id);

    BufferedReader reader = new BufferedReader(new InputStreamReader(data.getInputStream()));
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

    assertEquals(testData, builder.toString());
  }

  public void testGetStreamReturnsNewStream() throws Exception {
    String testData = "There's something quite peaceful about writing tests.";
    AttachmentId id = new AttachmentId("", "id_6");
    AttachmentStore store = makeStoreWithData(id, testData);
    AttachmentData data = store.getAttachment(id);

    InputStream is1 = data.getInputStream();
    InputStream is2 = data.getInputStream();
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

    }
  }

  public void testOverwriteAttachmentThrowsException() throws Exception {
    String testData = "First.";
    AttachmentId id = new AttachmentId("", "id_7");
    AttachmentStore store = makeStoreWithData(id, testData);

    boolean exceptionThrown=false;
    try {
      // A second element added with the same ID should not write.
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

  @Override
  public void execute(OperationRequest operation, OperationContext context, ParticipantId participant)
      throws InvalidRequestException {
    WaveId waveId;
    WaveletId waveletId;
    AttachmentId attachmentId;
    RawAttachmentData attachmentData;
    try {
      waveId = ApiIdSerializer.instance().deserialiseWaveId(
          OperationUtil.<String>getRequiredParameter(operation, ParamsProperty.WAVE_ID));
      waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

  }

  @Override
  public void execute(OperationRequest operation, OperationContext context, ParticipantId participant)
      throws InvalidRequestException {
    AttachmentId attachmentId;
    try {
      attachmentId =  AttachmentId.deserialise(OperationUtil.<String>getRequiredParameter(operation,
          ParamsProperty.ATTACHMENT_ID));
    } catch (InvalidIdException ex) {
      throw new InvalidRequestException("Invalid id", operation, ex);
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

    this.thumbnailPattternsDirectory = thumbnailPatternsDirectory;
  }

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    AttachmentId attachmentId = getAttachmentIdFromRequest(request);

    if (attachmentId == null) {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
      return;
    }
View Full Code Here

Examples of org.waveprotocol.wave.media.model.AttachmentId

      // Parse the request.
      try {
        @SuppressWarnings("unchecked")
        List<FileItem> items = upload.parseRequest(request);
        AttachmentId id = null;
        String waveRefStr = null;
        FileItem fileItem = null;
        for (FileItem item : items) {
          // Process only file upload - discard other form item types.
          if (item.isFormField()) {
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.