@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; } } }
public static void assertAreEqual(CopyState copy1, CopyState copy2) { if (copy1 == null) { assertNull(copy2); } else { assertNotNull(copy2); assertEquals(copy1.getBytesCopied(), copy2.getBytesCopied()); assertEquals(copy1.getCompletionTime(), copy2.getCompletionTime()); assertEquals(copy1.getCopyId(), copy2.getCopyId()); assertEquals(copy1.getSource(), copy2.getSource()); assertEquals(copy1.getStatus(), copy2.getStatus()); assertEquals(copy1.getTotalBytes(), copy2.getTotalBytes()); } } }
assertEquals(buffer.length, copy.getCopyState().getTotalBytes().intValue()); assertEquals(buffer.length, copy.getCopyState().getBytesCopied().intValue()); assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.getCopyState().getCompletionTime().compareTo(new Date(calendar.get(Calendar.MINUTE) - 1)) > 0); copy.abortCopy(copy.getCopyState().getCopyId());
destination.abortCopy(destination.getProperties().getCopyState().getCopyId()); BlobTestHelper.waitForCopy(destination); fail();
assertEquals(buffer.length, copy.getCopyState().getTotalBytes().intValue()); assertEquals(buffer.length, copy.getCopyState().getBytesCopied().intValue()); assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.getCopyState().getCompletionTime().compareTo(new Date(calendar.get(Calendar.MINUTE) - 1)) > 0);
assertEquals(buffer.length, copy.getCopyState().getBytesCopied() .intValue()); assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.getCopyState().getCompletionTime() .compareTo(new Date(calendar.get(Calendar.MINUTE) - 1)) > 0);
BlobTestHelper.assertStreamsAreEqual(stream, new ByteArrayInputStream( copyStream.toByteArray())); assertEquals(copyId, copy.getProperties().getCopyState().getCopyId());
assertEquals(copyId, copy.getProperties().getCopyState().getCopyId());
assertEquals(buffer.length, copy.getCopyState().getBytesCopied() .intValue()); assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.getCopyState().getCompletionTime() .compareTo(new Date(calendar.get(Calendar.MINUTE) - 1)) > 0); copy.abortCopy(copy.getCopyState().getCopyId()); } catch (StorageException ex) { assertEquals(HttpURLConnection.HTTP_CONFLICT,
assertEquals(data.length(), copy.getCopyState().getTotalBytes().intValue()); assertEquals(data.length(), copy.getCopyState().getBytesCopied().intValue()); assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.getCopyState().getCompletionTime().compareTo(new Date(calendar.get(Calendar.MINUTE) - 1)) > 0);
assertTrue(buffer.length == copy.getCopyState().getTotalBytes()); assertTrue(buffer.length == copy.getCopyState().getBytesCopied()); assertEquals(copyId, copy.getCopyState().getCopyId()); assertTrue(copy.properties.isIncrementalCopy()); assertNotNull(copy.properties.getCopyState().getCopyDestinationSnapshotID());
assertEquals(data.length(), destination.getCopyState().getTotalBytes().intValue()); assertEquals(data.length(), destination.getCopyState().getBytesCopied().intValue()); assertEquals(copyId, destination.getProperties().getCopyState().getCopyId()); destination.abortCopy(destination.getCopyState().getCopyId()); fail();
assertEquals(copyId, copySas.getCopyState().getCopyId());
assertEquals(copyId, copySas.getCopyState().getCopyId());
assertEquals(copyId, copy.getProperties().getCopyState().getCopyId());