/** * Uploads the metadata in the <code>CloudQueue</code> object to the queue. * * @throws StorageException * If a storage service error occurred during the operation. */ @DoesServiceRequest public void uploadMetadata() throws StorageException { this.uploadMetadata(null /* options */, null /* opContext */); }
/** * Uploads the metadata in the <code>CloudQueue</code> object to the queue. * * @throws StorageException * If a storage service error occurred during the operation. */ @DoesServiceRequest public void uploadMetadata() throws StorageException { this.uploadMetadata(null /* options */, null /* opContext */); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testQueueUpdateMetaData() throws StorageException { final HashMap<String, String> metadata = new HashMap<String, String>(5); for (int i = 0; i < 5; i++) { metadata.put("key" + i, "value" + i); } this.queue.setMetadata(metadata); this.queue.uploadMetadata(); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testGetMetadata() throws StorageException { HashMap<String, String> metadata = new HashMap<String, String>(); metadata.put("ExistingMetadata", "ExistingMetadataValue"); this.queue.setMetadata(metadata); this.queue.uploadMetadata(); this.queue.downloadAttributes(); assertEquals(this.queue.getMetadata().get("ExistingMetadata"), "ExistingMetadataValue"); assertTrue(this.queue.getMetadata().containsKey("ExistingMetadata")); HashMap<String, String> empytMetadata = null; this.queue.setMetadata(empytMetadata); this.queue.uploadMetadata(); this.queue.downloadAttributes(); assertTrue(this.queue.getMetadata().size() == 0); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testUploadMetadataClearExisting() throws URISyntaxException, StorageException { CloudQueue queueForGet = this.queue.getServiceClient().getQueueReference(this.queue.getName()); HashMap<String, String> metadata1 = new HashMap<String, String>(); String key = "ExistingMetadata1" + UUID.randomUUID().toString().replace("-", ""); metadata1.put(key, "ExistingMetadataValue1"); this.queue.setMetadata(metadata1); queueForGet.downloadAttributes(); assertFalse(queueForGet.getMetadata().containsKey(key)); HashMap<String, String> metadata2 = new HashMap<String, String>(); this.queue.setMetadata(metadata2); this.queue.uploadMetadata(); queueForGet.downloadAttributes(); assertTrue(queueForGet.getMetadata().size() == 0); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testUploadMetadataNullInput() throws URISyntaxException, StorageException { CloudQueue queueForGet = this.queue.getServiceClient().getQueueReference(this.queue.getName()); HashMap<String, String> metadata1 = new HashMap<String, String>(); String key = "ExistingMetadata1" + UUID.randomUUID().toString().replace("-", ""); metadata1.put(key, "ExistingMetadataValue1"); this.queue.setMetadata(metadata1); queueForGet.downloadAttributes(); assertFalse(queueForGet.getMetadata().containsKey(key)); this.queue.uploadMetadata(); queueForGet.downloadAttributes(); assertTrue(queueForGet.getMetadata().containsKey(key)); this.queue.setMetadata(null); this.queue.uploadMetadata(); queueForGet.downloadAttributes(); assertTrue(queueForGet.getMetadata().size() == 0); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testUploadMetadata() throws URISyntaxException, StorageException { CloudQueue queueForGet = this.queue.getServiceClient().getQueueReference(this.queue.getName()); HashMap<String, String> metadata1 = new HashMap<String, String>(); metadata1.put("ExistingMetadata1", "ExistingMetadataValue1"); this.queue.setMetadata(metadata1); queueForGet.downloadAttributes(); assertFalse(queueForGet.getMetadata().containsKey("ExistingMetadata1")); this.queue.uploadMetadata(); queueForGet.downloadAttributes(); assertTrue(queueForGet.getMetadata().containsKey("ExistingMetadata1")); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testUploadMetadataNotFound() throws URISyntaxException, StorageException { final CloudQueue queue = QueueTestHelper.getRandomQueueReference(); try { queue.uploadMetadata(); fail(); } catch (StorageException e) { assertTrue(e.getHttpStatusCode() == HttpURLConnection.HTTP_NOT_FOUND); } }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testQueueDownloadAttributes() throws StorageException, URISyntaxException { final CloudQueueMessage message1 = new CloudQueueMessage("messagetest1"); this.queue.addMessage(message1); final CloudQueueMessage message2 = new CloudQueueMessage("messagetest2"); this.queue.addMessage(message2); final HashMap<String, String> metadata = new HashMap<String, String>(5); int sum = 5; for (int i = 0; i < sum; i++) { metadata.put("key" + i, "value" + i); } this.queue.setMetadata(metadata); this.queue.uploadMetadata(); CloudQueueClient qClient = TestHelper.createCloudQueueClient(); final CloudQueue queue2 = qClient.getQueueReference(this.queue.getName()); queue2.downloadAttributes(); assertEquals(sum, queue2.getMetadata().size()); }
queue.uploadMetadata(); sasQueue.uploadMetadata(); sasQueue.uploadMetadata(); fail(); queue.uploadMetadata();