|
33 | 33 | import com.microsoft.azure.storage.file.SharedAccessFilePermissions; |
34 | 34 | import com.microsoft.azure.storage.file.SharedAccessFilePolicy; |
35 | 35 |
|
| 36 | +import junit.framework.Assert; |
| 37 | + |
36 | 38 | import org.junit.After; |
37 | 39 | import org.junit.Before; |
38 | 40 | import org.junit.Test; |
|
58 | 60 | import java.util.Random; |
59 | 61 | import java.util.TimeZone; |
60 | 62 |
|
| 63 | +import org.junit.After; |
| 64 | +import org.junit.Before; |
| 65 | +import org.junit.Test; |
| 66 | +import org.junit.experimental.categories.Category; |
| 67 | + |
| 68 | +import com.microsoft.azure.storage.AccessCondition; |
| 69 | +import com.microsoft.azure.storage.Constants; |
| 70 | +import com.microsoft.azure.storage.NameValidator; |
| 71 | +import com.microsoft.azure.storage.OperationContext; |
| 72 | +import com.microsoft.azure.storage.RetryNoRetry; |
| 73 | +import com.microsoft.azure.storage.SendingRequestEvent; |
| 74 | +import com.microsoft.azure.storage.StorageCredentialsAnonymous; |
| 75 | +import com.microsoft.azure.storage.StorageCredentialsSharedAccessSignature; |
61 | 76 | import com.microsoft.azure.storage.StorageErrorCodeStrings; |
| 77 | +import com.microsoft.azure.storage.StorageEvent; |
| 78 | +import com.microsoft.azure.storage.StorageException; |
62 | 79 | import com.microsoft.azure.storage.TestRunners.CloudTests; |
63 | 80 | import com.microsoft.azure.storage.TestRunners.DevFabricTests; |
64 | 81 | import com.microsoft.azure.storage.TestRunners.DevStoreTests; |
65 | 82 | import com.microsoft.azure.storage.TestRunners.SlowTests; |
| 83 | +import com.microsoft.azure.storage.core.Utility; |
| 84 | +import com.microsoft.azure.storage.file.CloudFile; |
| 85 | +import com.microsoft.azure.storage.file.CloudFileShare; |
| 86 | +import com.microsoft.azure.storage.file.FileProperties; |
| 87 | +import com.microsoft.azure.storage.file.FileTestHelper; |
| 88 | +import com.microsoft.azure.storage.file.SharedAccessFilePermissions; |
| 89 | +import com.microsoft.azure.storage.file.SharedAccessFilePolicy; |
66 | 90 |
|
67 | 91 | import static org.junit.Assert.*; |
68 | 92 |
|
@@ -994,44 +1018,6 @@ public void testLargeBlobUploadFromStreamTest() throws URISyntaxException, Stora |
994 | 1018 | blockBlobRef.download(dstStream); |
995 | 1019 | BlobTestHelper.assertStreamsAreEqual(srcStream, new ByteArrayInputStream(dstStream.toByteArray())); |
996 | 1020 | } |
997 | | - |
998 | | - @Test |
999 | | - @Category({ DevFabricTests.class, DevStoreTests.class, SlowTests.class }) |
1000 | | - public void testLargeSinglePutBlobTest() throws URISyntaxException, StorageException, IOException { |
1001 | | - final String blockBlobName = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlockBlob"); |
1002 | | - final String blockBlobName2 = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlockBlob"); |
1003 | | - final String blockBlobName3 = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlockBlob"); |
1004 | | - final CloudBlockBlob blob = this.container.getBlockBlobReference(blockBlobName); |
1005 | | - final CloudBlockBlob blob2 = this.container.getBlockBlobReference(blockBlobName2); |
1006 | | - final CloudBlockBlob blob3 = this.container.getBlockBlobReference(blockBlobName3); |
1007 | | - BlobRequestOptions options = new BlobRequestOptions(); |
1008 | | - options.setStoreBlobContentMD5(false); |
1009 | | - options.setEncryptionPolicy(null); |
1010 | | - try |
1011 | | - { |
1012 | | - byte[] buffer = BlobTestHelper.getRandomBuffer(256 * Constants.MB); |
1013 | | - |
1014 | | - OperationContext operationContext = new OperationContext(); |
1015 | | - |
1016 | | - blob.uploadFromByteArray(buffer, 0, 128 * Constants.MB, null, null, operationContext); |
1017 | | - assertEquals(1, operationContext.getRequestResults().size()); |
1018 | | - |
1019 | | - options.setSingleBlobPutThresholdInBytes(256 * Constants.MB); |
1020 | | - blob2.uploadFromByteArray(buffer, 0, 256 * Constants.MB, null, options, operationContext); |
1021 | | - assertEquals(1, operationContext.getRequestResults().size()); |
1022 | | - |
1023 | | - // Reduce threshold and upload data greater than the single put blob upload threshold |
1024 | | - options.setSingleBlobPutThresholdInBytes(Constants.MB); |
1025 | | - blob3.uploadFromByteArray(buffer, 0, 3 * Constants.MB, null, options, operationContext); |
1026 | | - assertTrue(operationContext.getRequestResults().size() > 1); |
1027 | | - } |
1028 | | - finally |
1029 | | - { |
1030 | | - blob.delete(); |
1031 | | - blob2.delete(); |
1032 | | - blob3.delete(); |
1033 | | - } |
1034 | | - } |
1035 | 1021 |
|
1036 | 1022 | @Test |
1037 | 1023 | @Category({ DevFabricTests.class, DevStoreTests.class }) |
@@ -1173,29 +1159,6 @@ public void testBlobUploadWithoutMD5Validation() throws URISyntaxException, Stor |
1173 | 1159 | assertEquals("MDAwMDAwMDA=", blockBlobRef2.properties.getContentMD5()); |
1174 | 1160 | } |
1175 | 1161 |
|
1176 | | - @Test |
1177 | | - @Category({ DevFabricTests.class, DevStoreTests.class }) |
1178 | | - public void testVerifyTransactionalMD5ValidationMissingOverallMD5() throws URISyntaxException, StorageException, IOException { |
1179 | | - final String blockBlobName = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlockBlob"); |
1180 | | - final CloudBlockBlob blockBlobRef = this.container.getBlockBlobReference(blockBlobName); |
1181 | | - |
1182 | | - final int length = 2 * 1024 * 1024; |
1183 | | - ByteArrayInputStream srcStream = BlobTestHelper.getRandomDataStream(length); |
1184 | | - BlobRequestOptions options = new BlobRequestOptions(); |
1185 | | - options.setSingleBlobPutThresholdInBytes(1024*1024); |
1186 | | - options.setDisableContentMD5Validation(true); |
1187 | | - options.setStoreBlobContentMD5(false); |
1188 | | - |
1189 | | - blockBlobRef.upload(srcStream, -1, null, options, null); |
1190 | | - |
1191 | | - options.setDisableContentMD5Validation(false); |
1192 | | - options.setStoreBlobContentMD5(true); |
1193 | | - options.setUseTransactionalContentMD5(true); |
1194 | | - final CloudBlockBlob blockBlobRef2 = this.container.getBlockBlobReference(blockBlobName); |
1195 | | - blockBlobRef2.downloadRange(1024, (long)1024, new ByteArrayOutputStream(), null, options, null); |
1196 | | - assertNull(blockBlobRef2.getProperties().getContentMD5()); |
1197 | | - } |
1198 | | - |
1199 | 1162 | @Test |
1200 | 1163 | @Category({ DevFabricTests.class, DevStoreTests.class }) |
1201 | 1164 | public void testBlockBlobUploadContentMD5() throws URISyntaxException, StorageException, IOException { |
@@ -1235,7 +1198,7 @@ public void eventOccurred(SendingRequestEvent eventArg) { |
1235 | 1198 | } |
1236 | 1199 | }; |
1237 | 1200 |
|
1238 | | - length = BlobConstants.DEFAULT_SINGLE_BLOB_PUT_THRESHOLD_IN_BYTES + 1; |
| 1201 | + length = 33 * Constants.MB; |
1239 | 1202 | srcStream = BlobTestHelper.getRandomDataStream(length); |
1240 | 1203 |
|
1241 | 1204 | sendingRequestEventContext.getSendingRequestEventHandler().addListener(event); |
@@ -1746,23 +1709,6 @@ public void testBlobConditionalAccess() throws StorageException, IOException, UR |
1746 | 1709 | newETag = blob.getProperties().getEtag(); |
1747 | 1710 | assertFalse("ETage should be modified on write metadata", newETag.equals(currentETag)); |
1748 | 1711 | } |
1749 | | - |
1750 | | - @Test |
1751 | | - public void testBlobExceedMaxRange() throws URISyntaxException, StorageException, IOException |
1752 | | - { |
1753 | | - CloudBlockBlob blob = container.getBlockBlobReference("blockblob4"); |
1754 | | - blob.deleteIfExists(); |
1755 | | - |
1756 | | - byte[] msg = "my message".getBytes("UTF-8"); |
1757 | | - blob.uploadFromByteArray(msg, 0, msg.length); |
1758 | | - |
1759 | | - byte[] buffer = new byte[msg.length + 5]; |
1760 | | - |
1761 | | - blob.downloadRangeToByteArray(0, (long) buffer.length, buffer, 0, null, null, null); |
1762 | | - String expected = new String (msg, "UTF-8"); |
1763 | | - String actual = new String(buffer, "UTF-8").substring(0, 10); |
1764 | | - assertEquals(expected, actual); |
1765 | | - } |
1766 | 1712 |
|
1767 | 1713 | @Test |
1768 | 1714 | @Category({ DevFabricTests.class, DevStoreTests.class }) |
|
0 commit comments