Пример #1
0
        public void BlobProtocolListBlobsCloudAnonSync()
        {
            BlobListingContext listingContext = new BlobListingContext("p", null, null, BlobListingDetails.All);

            cloudAnonSync.ListBlobsScenarioTest(cloudSetup.PublicContainerName, listingContext, null, cloudSetup.PublicBlobName);

            cloudSetup.CreateBlob(cloudSetup.PublicContainerName, "newblob1", true);
            cloudSetup.CreateBlob(cloudSetup.PublicContainerName, "newblob2", true);

            try
            {
                cloudAnonSync.ListBlobsScenarioTest(cloudSetup.PublicContainerName, listingContext, null, cloudSetup.PublicBlobName);

                // snapshots cannot be listed along with delimiter
                listingContext = new BlobListingContext("n", 10, "/", BlobListingDetails.Metadata);
                cloudAnonSync.ListBlobsScenarioTest(cloudSetup.PublicContainerName, listingContext, null, "newblob1", "newblob2");
            }
            finally
            {
                cloudSetup.DeleteBlob(cloudSetup.PublicContainerName, "newblob1");
                cloudSetup.DeleteBlob(cloudSetup.PublicContainerName, "newblob2");
            }
        }
Пример #2
0
        public async Task BlobProtocolPutGetBlockListCloudOwnerSync()
        {
            string blockId1 = Convert.ToBase64String(new byte[] { 99, 100, 101 });
            string blockId2 = Convert.ToBase64String(new byte[] { 102, 103, 104 });

            // use a unique name since temp blocks from previous runs can exist
            string                  blobName       = "blob2" + DateTime.UtcNow.Ticks;
            BlobProperties          blobProperties = new BlobProperties();
            List <PutBlockListItem> blocks         = new List <PutBlockListItem>();
            PutBlockListItem        block1         = new PutBlockListItem(blockId1, BlockSearchMode.Uncommitted);

            blocks.Add(block1);
            PutBlockListItem block2 = new PutBlockListItem(blockId2, BlockSearchMode.Uncommitted);

            blocks.Add(block2);
            try
            {
                await cloudOwnerSync.PutBlockScenarioTest(cloudSetup.ContainerName, blobName, blockId1, cloudSetup.LeaseId, cloudSetup.Content, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.All, cloudSetup.LeaseId, null, blockId1);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Uncommitted, cloudSetup.LeaseId, null, blockId1);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Committed, cloudSetup.LeaseId, null);

                await cloudOwnerSync.PutBlockScenarioTest(cloudSetup.ContainerName, blobName, blockId2, cloudSetup.LeaseId, cloudSetup.Content, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.All, cloudSetup.LeaseId, null, blockId1, blockId2);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Uncommitted, cloudSetup.LeaseId, null, blockId1, blockId2);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Committed, cloudSetup.LeaseId, null);

                await cloudOwnerSync.PutBlockListScenarioTest(cloudSetup.ContainerName, blobName, blocks, blobProperties, cloudSetup.LeaseId, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.All, cloudSetup.LeaseId, null, blockId1, blockId2);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Uncommitted, cloudSetup.LeaseId, null);

                await cloudOwnerSync.GetBlockListScenarioTest(cloudSetup.ContainerName, blobName, BlockListingFilter.Committed, cloudSetup.LeaseId, null, blockId1, blockId2);
            }
            finally
            {
                await cloudOwnerSync.DeleteBlob(cloudSetup.ContainerName, blobName);
            }
        }