Package com.microsoft.windowsazure.services.blob.models

Examples of com.microsoft.windowsazure.services.blob.models.ListBlobBlocksResult$Entry


        service.createBlobBlock(container, blob, "124",
                new ByteArrayInputStream(new byte[512]));
        service.createBlobBlock(container, blob, "125",
                new ByteArrayInputStream(new byte[195]));

        ListBlobBlocksResult result1 = service.listBlobBlocks(container, blob,
                new ListBlobBlocksOptions().setCommittedList(true)
                        .setUncommittedList(true));
        ListBlobBlocksResult result2 = service.listBlobBlocks(container, blob,
                new ListBlobBlocksOptions().setCommittedList(true));
        ListBlobBlocksResult result3 = service.listBlobBlocks(container, blob,
                new ListBlobBlocksOptions().setUncommittedList(true));

        // Assert
        assertEquals(1, result1.getCommittedBlocks().size());
        assertEquals(2, result1.getUncommittedBlocks().size());

        assertEquals(1, result2.getCommittedBlocks().size());
        assertEquals(0, result2.getUncommittedBlocks().size());

        assertEquals(0, result3.getCommittedBlocks().size());
        assertEquals(2, result3.getUncommittedBlocks().size());
    }
View Full Code Here


        BlockList blockList = new BlockList();
        blockList.addUncommittedEntry(blockId1).addLatestEntry(blockId3);
        service.commitBlobBlocks(container, blob, blockList);

        ListBlobBlocksResult result = service.listBlobBlocks(container, blob,
                new ListBlobBlocksOptions().setCommittedList(true)
                        .setUncommittedList(true));

        // Assert
        assertNotNull(result);
        assertNotNull(result.getLastModified());
        assertNotNull(result.getEtag());
        assertEquals(256 + 195, result.getContentLength());

        assertNotNull(result.getCommittedBlocks());
        assertEquals(2, result.getCommittedBlocks().size());
        assertEquals(blockId1, result.getCommittedBlocks().get(0).getBlockId());
        assertEquals(256, result.getCommittedBlocks().get(0).getBlockLength());
        assertEquals(blockId3, result.getCommittedBlocks().get(1).getBlockId());
        assertEquals(195, result.getCommittedBlocks().get(1).getBlockLength());

        assertNotNull(result.getUncommittedBlocks());
        assertEquals(0, result.getUncommittedBlocks().size());
    }
View Full Code Here

            // exists. However, the service sometimes allow this improper
            // access, so
            // the SDK has to handle the situation gracefully.
            service.createBlobBlock(container, blob, "01",
                    new ByteArrayInputStream(new byte[] { 0x00 }));
            ListBlobBlocksResult result = service.listBlobBlocks(container,
                    blob);
            assertEquals(0, result.getCommittedBlocks().size());
        } catch (ServiceException ex) {
            assertEquals(404, ex.getHttpStatusCode());
        }
    }
View Full Code Here

        String blob = "test13";
        String content = new String(new char[512]);
        service.createBlockBlob(container, blob, new ByteArrayInputStream(
                content.getBytes("UTF-8")));

        ListBlobBlocksResult result = service.listBlobBlocks(container, blob);

        // Assert
        assertNotNull(result);
        assertNotNull(result.getLastModified());
        assertNotNull(result.getEtag());
        assertEquals(512, result.getContentLength());
        assertNotNull(result.getCommittedBlocks());
        assertEquals(0, result.getCommittedBlocks().size());
        assertNotNull(result.getUncommittedBlocks());
        assertEquals(0, result.getUncommittedBlocks().size());
    }
View Full Code Here

        service.createBlobBlock(container, blob, "124",
                new ByteArrayInputStream(new byte[512]));
        service.createBlobBlock(container, blob, "125",
                new ByteArrayInputStream(new byte[195]));

        ListBlobBlocksResult result = service.listBlobBlocks(container, blob,
                new ListBlobBlocksOptions().setCommittedList(true)
                        .setUncommittedList(true));

        // Assert
        assertNotNull(result);
        assertNotNull(result.getLastModified());
        assertNotNull(result.getEtag());
        assertEquals(0, result.getContentLength());
        assertNotNull(result.getCommittedBlocks());
        assertEquals(0, result.getCommittedBlocks().size());
        assertNotNull(result.getUncommittedBlocks());
        assertEquals(3, result.getUncommittedBlocks().size());
        assertEquals("123", result.getUncommittedBlocks().get(0).getBlockId());
        assertEquals(256, result.getUncommittedBlocks().get(0).getBlockLength());
        assertEquals("124", result.getUncommittedBlocks().get(1).getBlockId());
        assertEquals(512, result.getUncommittedBlocks().get(1).getBlockLength());
        assertEquals("125", result.getUncommittedBlocks().get(2).getBlockId());
        assertEquals(195, result.getUncommittedBlocks().get(2).getBlockLength());
    }
View Full Code Here

                options.getLeaseId());

        ClientResponse response = builder.get(ClientResponse.class);
        throwIfError(response);

        ListBlobBlocksResult result = response
                .getEntity(ListBlobBlocksResult.class);
        result.setEtag(response.getHeaders().getFirst("ETag"));
        result.setContentType(response.getHeaders().getFirst("Content-Type"));

        String blobContentLength = response.getHeaders().getFirst(
                "x-ms-blob-content-length");
        if (blobContentLength != null) {
            result.setContentLength(Long.parseLong(blobContentLength));
        } else {
            result.setContentLength(0);
        }

        String lastModified = response.getHeaders().getFirst("Last-Modified");
        if (lastModified != null) {
            result.setLastModified(dateMapper.parse(lastModified));
        }

        return result;
    }
View Full Code Here

  }

  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Entry e = entry(req);
    S3Object remove = map.remove(e);
    if (remove == null) {
      resp.sendError(404, "Not found " + e);
    } else {
      resp.sendError(HttpURLConnection.HTTP_NO_CONTENT, "Deleted");
View Full Code Here

    }

  }

  private Entry entry(HttpServletRequest req) {
    return new Entry(key(uri(req)));
  }
View Full Code Here

        log("doGet " + uri);
    if ("/".equals(uri.getPath())) {
      list(req, resp);
    } else {
      String key = uri.getPath().substring(1);
      Entry e = new Entry(key);
      S3Object obj = map.get(e);
        if (debug)
          log("map.get(" + key + ") = " + obj);
      if (obj == null) {
        resp.sendError(404, "Not here: " + e);
View Full Code Here

    if (maxKeysStr != null)
      maxKeys = Integer.parseInt(maxKeysStr);
    Writer w = new Writer();
    SortedMap<Entry, S3Object> submap = new TreeMap<Entry, S3Object>(map);
    if (prefix != null)
      submap = submap.tailMap(new Entry(prefix));
    int keyCount = 0;
    boolean truncated = false;
    String nextMarker = null;
    for (Entry e : submap.keySet()) {
      if (++keyCount > maxKeys) {
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.services.blob.models.ListBlobBlocksResult$Entry

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.