Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 08705eb

Browse files
committed
Merge pull request #43 from emgerner-msft/master
Java Storage Client Library 2.2.0
2 parents 950761b + 16072ef commit 08705eb

25 files changed

+563
-230
lines changed

ChangeLog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2015.05.26 Version 2.2.0
2+
* Fixed a bug where maximum execution time was ignored for file, queue, and table services.
3+
* Changed the socket timeout to be set to the service side timeout plus 5 minutes when maximum execution time is not set.
4+
* Changed the socket timeout to default to 5 minutes rather than infinite when neither service side timeout or maximum execution time are set.
5+
* Fixed a bug where MD5 was calculated for commitBlockList even though UseTransactionalMD5 was set to false.
6+
* Fixed a bug where selecting fields that did not exist returned an error rather than an EntityProperty with a null value.
7+
* Fixed a bug where table entities with a single quote in their partition or row key could be inserted but not operated on in any other way.
8+
19
2015.04.01 Version 2.1.0
210
* Fixed a bug for all listing API's where next() would sometimes throw an exception if hasNext() had not been called even if there were more elements to iterate on.
311
* Added sequence number to the blob properties. This is populated for page blobs.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
2828
<dependency>
2929
<groupId>com.microsoft.azure</groupId>
3030
<artifactId>azure-storage</artifactId>
31-
<version>2.1.0</version>
31+
<version>2.2.0</version>
3232
</dependency>
3333
```
3434

microsoft-azure-storage-samples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<dependency>
2626
<groupId>com.microsoft.azure</groupId>
2727
<artifactId>azure-storage</artifactId>
28-
<version>2.1.0</version>
28+
<version>2.2.0</version>
2929
</dependency>
3030
</dependencies>
3131
</project>

microsoft-azure-storage-test/src/com/microsoft/azure/storage/GenericTests.java

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import com.microsoft.azure.storage.blob.CloudBlobClient;
4141
import com.microsoft.azure.storage.blob.CloudBlobContainer;
4242
import com.microsoft.azure.storage.blob.CloudBlockBlob;
43-
import com.microsoft.azure.storage.core.BaseRequest;
4443
import com.microsoft.azure.storage.core.SR;
4544
import com.microsoft.azure.storage.core.Utility;
4645
import com.microsoft.azure.storage.queue.CloudQueue;
@@ -247,176 +246,6 @@ public void testNullRetryPolicy() throws URISyntaxException, StorageException {
247246
container.exists();
248247
}
249248

250-
@Test
251-
@Category({ DevFabricTests.class, DevStoreTests.class, SecondaryTests.class })
252-
public void testMaximumExecutionTime() throws URISyntaxException, StorageException {
253-
OperationContext opContext = new OperationContext();
254-
setDelay(opContext, 2500);
255-
256-
// set the maximum execution time
257-
BlobRequestOptions options = new BlobRequestOptions();
258-
options.setMaximumExecutionTimeInMs(2000);
259-
260-
// set the location mode to secondary, secondary request should fail
261-
// so set the timeout low to save time failing (or fail with a timeout)
262-
options.setLocationMode(LocationMode.SECONDARY_THEN_PRIMARY);
263-
options.setTimeoutIntervalInMs(1000);
264-
265-
CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
266-
CloudBlobContainer container = blobClient.getContainerReference(generateRandomContainerName());
267-
268-
try {
269-
// 1. download attributes will fail as the container does not exist
270-
// 2. the executor will attempt to retry as it is accessing secondary
271-
// 3. maximum execution time should prevent the retry from being made
272-
container.downloadAttributes(null, options, opContext);
273-
fail("Maximum execution time was reached but request did not fail.");
274-
}
275-
catch (StorageException e) {
276-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getMessage());
277-
}
278-
}
279-
280-
@Test
281-
@Category({ DevFabricTests.class, DevStoreTests.class, SlowTests.class })
282-
public void testMaximumExecutionTimeBlobWrites() throws URISyntaxException, StorageException, IOException {
283-
byte[] buffer = BlobTestHelper.getRandomBuffer(80 * 1024 * 1024);
284-
285-
// set the maximum execution time
286-
BlobRequestOptions options = new BlobRequestOptions();
287-
options.setMaximumExecutionTimeInMs(5000);
288-
289-
CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
290-
CloudBlobContainer container = blobClient.getContainerReference(generateRandomContainerName());
291-
292-
String blobName = "testBlob";
293-
final CloudBlockBlob blockBlobRef = container.getBlockBlobReference(blobName);
294-
blockBlobRef.setStreamWriteSizeInBytes(1 * 1024 * 1024);
295-
296-
ByteArrayInputStream inputStream = new ByteArrayInputStream(buffer);
297-
BlobOutputStream blobOutputStream = null;
298-
299-
try {
300-
container.createIfNotExists();
301-
302-
// make sure max timeout is thrown by Utility.writeToOutputStream() on upload
303-
try {
304-
blockBlobRef.upload(inputStream, buffer.length, null, options, null);
305-
fail("Maximum execution time was reached but request did not fail.");
306-
}
307-
catch (StorageException e) {
308-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getMessage());
309-
}
310-
catch (IOException e) {
311-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
312-
}
313-
assertFalse(blockBlobRef.exists());
314-
315-
// make sure max timeout applies on a per service request basis if the user creates the stream
316-
// adds a delay so the first service request should fail
317-
OperationContext opContext = new OperationContext();
318-
setDelay(opContext, 6000);
319-
blobOutputStream = blockBlobRef.openOutputStream(null, options, opContext);
320-
try {
321-
blobOutputStream.write(inputStream, buffer.length);
322-
fail("Maximum execution time was reached but request did not fail.");
323-
}
324-
catch (StorageException e) {
325-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
326-
}
327-
catch (IOException e) {
328-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
329-
}
330-
finally {
331-
try {
332-
blobOutputStream.close();
333-
}
334-
catch (IOException e) {
335-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
336-
}
337-
}
338-
assertFalse(blockBlobRef.exists());
339-
340-
// make sure max timeout applies on a per service request basis if the user creates the stream
341-
// adds a delay so the first service request should fail
342-
blobOutputStream = blockBlobRef.openOutputStream(null, options, opContext);
343-
try {
344-
blobOutputStream.write(buffer);
345-
fail("Maximum execution time was reached but request did not fail.");
346-
}
347-
catch (IOException e) {
348-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
349-
}
350-
finally {
351-
try {
352-
blobOutputStream.close();
353-
}
354-
catch (IOException e) {
355-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
356-
}
357-
}
358-
assertFalse(blockBlobRef.exists());
359-
360-
// make sure max timeout applies on a per service request basis only if the user creates the stream
361-
// should succeed as even if all requests would exceed the timeout, each one won't
362-
blobOutputStream = blockBlobRef.openOutputStream(null, options, null);
363-
try {
364-
blobOutputStream.write(inputStream, buffer.length);
365-
}
366-
finally {
367-
blobOutputStream.close();
368-
}
369-
assertTrue(blockBlobRef.exists());
370-
}
371-
finally {
372-
inputStream.close();
373-
container.deleteIfExists();
374-
}
375-
}
376-
377-
@Test
378-
@Category({ DevFabricTests.class, DevStoreTests.class, SlowTests.class })
379-
public void testMaximumExecutionTimeBlobByteArray() throws URISyntaxException, StorageException, IOException {
380-
int length = 10 * 1024 * 1024;
381-
byte[] uploadBuffer = BlobTestHelper.getRandomBuffer(length);
382-
byte[] downloadBuffer = new byte[length];
383-
384-
// set a delay in sending request
385-
OperationContext opContext = new OperationContext();
386-
setDelay(opContext, 2500);
387-
388-
// set the maximum execution time
389-
BlobRequestOptions options = new BlobRequestOptions();
390-
options.setMaximumExecutionTimeInMs(2000);
391-
392-
CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
393-
CloudBlobContainer container = blobClient.getContainerReference(generateRandomContainerName());
394-
395-
String blobName = "testBlob";
396-
final CloudBlockBlob blockBlobRef = container.getBlockBlobReference(blobName);
397-
398-
ByteArrayInputStream inputStream = new ByteArrayInputStream(uploadBuffer);
399-
400-
try {
401-
container.createIfNotExists();
402-
403-
blockBlobRef.upload(inputStream, length);
404-
assertTrue(blockBlobRef.exists());
405-
406-
try {
407-
blockBlobRef.downloadToByteArray(downloadBuffer, 0, null, options, opContext);
408-
fail("Maximum execution time was reached but request did not fail.");
409-
}
410-
catch (StorageException e) {
411-
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getCause().getMessage());
412-
}
413-
}
414-
finally {
415-
inputStream.close();
416-
container.deleteIfExists();
417-
}
418-
}
419-
420249
@Test
421250
public void testDateStringParsingWithRounding() throws ParseException {
422251
String fullDateString = "1999-12-31T23:59:45.1234567Z";
@@ -543,20 +372,4 @@ private static String generateRandomContainerName() {
543372
String containerName = "container" + UUID.randomUUID().toString();
544373
return containerName.replace("-", "");
545374
}
546-
547-
private void setDelay(final OperationContext ctx, final int timeInMs) {
548-
549-
ctx.getSendingRequestEventHandler().addListener(new StorageEvent<SendingRequestEvent>() {
550-
551-
@Override
552-
public void eventOccurred(SendingRequestEvent eventArg) {
553-
try {
554-
Thread.sleep(timeInMs);
555-
}
556-
catch (InterruptedException e) {
557-
// do nothing
558-
}
559-
}
560-
});
561-
}
562375
}

0 commit comments

Comments
 (0)