/** * Returns the blob's copy state. * * @return A {@link CopyState} object that represents the copy state of the blob. */ public CopyState getCopyState() { return this.properties.getCopyState(); }
/** * Returns the blob's copy state. * * @return A {@link CopyState} object that represents the copy state of the blob. */ public CopyState getCopyState() { return this.properties.getCopyState(); }
@Override public CopyState getCopyState() { return this.properties.getCopyState(); }
@Override public CopyState getCopyState() { return this.properties.getCopyState(); }
@Override public String preProcessResponse(CloudBlob blob, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_ACCEPTED) { this.setNonExceptionedRetryableFailure(true); return null; } blob.updateEtagAndLastModifiedFromResponse(this.getConnection()); blob.properties.setCopyState(BlobResponse.getCopyState(this.getConnection())); blob.properties.setPremiumPageBlobTier(premiumPageBlobTier); if (premiumPageBlobTier != null) { blob.properties.setBlobTierInferred(false); } return blob.properties.getCopyState().getCopyId(); } };
@Override public String preProcessResponse(CloudBlob blob, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_ACCEPTED) { this.setNonExceptionedRetryableFailure(true); return null; } blob.updateEtagAndLastModifiedFromResponse(this.getConnection()); blob.properties.setCopyState(BlobResponse.getCopyState(this.getConnection())); blob.properties.setPremiumPageBlobTier(premiumPageBlobTier); if (premiumPageBlobTier != null) { blob.properties.setBlobTierInferred(false); } return blob.properties.getCopyState().getCopyId(); } };
/** * Start copying a blob and then abort */ @Test public void testCopyFromAppendBlobAbortTest() throws StorageException, URISyntaxException, IOException { final int length = 512; CloudAppendBlob originalBlob = (CloudAppendBlob) BlobTestHelper.uploadNewBlob( this.container, BlobType.APPEND_BLOB, "originalBlob", length, null); CloudAppendBlob copyBlob = this.container.getAppendBlobReference(originalBlob.getName() + "copyed"); copyBlob.startCopy(originalBlob); try { copyBlob.abortCopy(copyBlob.getProperties().getCopyState().getCopyId()); } catch (StorageException e) { if (!e.getErrorCode().contains("NoPendingCopyOperation")) { throw e; } } }
/** * Start copying a blob and then abort * * @throws StorageException * @throws URISyntaxException * @throws IOException * @throws InterruptedException */ @Test public void testCopyFromPageBlobAbortTest() throws StorageException, URISyntaxException, IOException { final int length = 512; CloudPageBlob originalBlob = (CloudPageBlob) BlobTestHelper.uploadNewBlob( this.container, BlobType.PAGE_BLOB, "originalBlob", length, null); CloudPageBlob copyBlob = this.container.getPageBlobReference(originalBlob.getName() + "copyed"); copyBlob.startCopy(originalBlob); try { copyBlob.abortCopy(copyBlob.getProperties().getCopyState().getCopyId()); } catch (StorageException e) { if (!e.getErrorCode().contains("NoPendingCopyOperation")) { throw e; } } }
/** * Start copying a blob and then abort * * @throws StorageException * @throws URISyntaxException * @throws IOException * @throws InterruptedException */ @Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCopyFromBlobAbortTest() throws StorageException, URISyntaxException, IOException { final int length = 128; CloudBlockBlob originalBlob = (CloudBlockBlob) BlobTestHelper.uploadNewBlob( this.container, BlobType.BLOCK_BLOB, "originalBlob", length, null); CloudBlockBlob copyBlob = this.container.getBlockBlobReference(originalBlob.getName() + "copyed"); copyBlob.startCopy(originalBlob); try { copyBlob.abortCopy(copyBlob.getProperties().getCopyState().getCopyId()); } catch (StorageException e) { if (!e.getErrorCode().contains("NoPendingCopyOperation")) { throw e; } } }
destination.abortCopy(destination.getProperties().getCopyState().getCopyId()); BlobTestHelper.waitForCopy(destination); fail();
assertEquals(copyId, copy.getProperties().getCopyState().getCopyId());
BlobTestHelper.assertStreamsAreEqual(stream, new ByteArrayInputStream( copyStream.toByteArray())); assertEquals(copyId, copy.getProperties().getCopyState().getCopyId());
assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.properties.isIncrementalCopy()); assertNotNull(copy.properties.getCopyState().getCopyDestinationSnapshotID()); assertNotNull(copy.getCopyState().getCompletionTime());
assertEquals(data.length(), destination.getCopyState().getTotalBytes().intValue()); assertEquals(data.length(), destination.getCopyState().getBytesCopied().intValue()); assertEquals(copyId, destination.getProperties().getCopyState().getCopyId()); assertTrue(destination.getCopyState().getCompletionTime() .compareTo(new Date(calendar.get(Calendar.MINUTE) - 1)) > 0);
assertEquals(data.length(), destination.getCopyState().getTotalBytes().intValue()); assertEquals(data.length(), destination.getCopyState().getBytesCopied().intValue()); assertEquals(copyId, destination.getProperties().getCopyState().getCopyId());
assertEquals(copyId, copy.getProperties().getCopyState().getCopyId());
CopyState state1 = props1.getCopyState(); CopyState state2 = props2.getCopyState(); if (state1 == null && state2 == null) { return;