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

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


        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

TOP

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

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.