Skip to content

Commit

Permalink
Merge pull request Azure#46 from emgerner-msft/master
Browse files Browse the repository at this point in the history
Java Storage Client Library 3.0.0
  • Loading branch information
emgerner-msft committed Aug 5, 2015
2 parents 08705eb + ef7a7bd commit 71a603d
Show file tree
Hide file tree
Showing 129 changed files with 10,174 additions and 3,118 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tmp/**/*
*~.nib
local.properties
.settings/**
*/.settings/**
.loadpath

# External tool builders
Expand Down
29 changes: 29 additions & 0 deletions BreakingChanges.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
Changes in 3.0.0

BLOB
* Removed getSubDirectoryReference(). Use getDirectoryReference() instead.
* Changed maxResults argument of CloudBlobDirectory.ListBlobsSegmented() to type Integer instead of int.
* Deprecated startCopyFromBlob() on CloudBlob. Use startCopy() instead.
* Deprecated blob and container constructors which take service clients in favor of constructors which take credentials.
* Invalid lease duration and break period values will cause a client-side StorageException rather than failing on the service.

QUEUE
* Deprecated queue constructors which take service clients in favor of constructors which take credentials.

TABLE
* Removed getEntityClass() in TableQuery. Please use getClazzType() instead.
* Deprecated the setters for timestamp as this property is only modifiable by the service.
* Deprecated table constructors which take service clients in favor of constructors which take credentials.

FILE
* Removed getSubDirectoryReference(). Use getDirectoryReference() instead.
* Changed exception thrown by requesting a file's name from a URI with no file name from StorageException to IllegalArgumentException.
* Deprecated file, directory and share constructors which take service clients in favor of constructors which take credentials.

OTHER
* Removed deprecated AuthenticationScheme and its getter and setter. In the future only SharedKey will be used.
* Removed deprecated getter/setters for all request option properties on the service clients. Please use the default request options getter/setters instead.
* Deprecated the Credentials and StorageKey classes. Please use the appropriate methods on StorageCredentialsAccountAndKey instead.
* Changed library behavior to retry all exceptions thrown when parsing a response object.
* Changed behavior to stop removing query parameters passed in with the resource URI if that URI contains a SAS token. Some query parameters such as comp, restype, snapshot and api-version will still be removed.

Changes in 2.0.0

BLOB
Expand Down
25 changes: 25 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
2015.08.04 Version 3.0.0
* Added support for SAS to the Azure File service.
* Added support for Append Blob.
* Added support for Access Control Lists (ACL) to File Shares.
* Added support for getting and setting of CORS rules to File service.
* Added support for ShareStats to File Shares.
* Added support for copying an Azure File to another Azure File or a Block Blob asynchronously, and aborting Azure File copy operations asynchronously.
* Added support for copying a Blob to an Azure File asynchronously.
* Added support for setting a maximum quota property on a File Share.
* Removed deprecated AuthenticationScheme and its getter and setter. In the future only SharedKey will be used.
* Removed deprecated getter/setters for all request option properties on the service clients. Please use the default request options getter/setters instead.
* Removed getSubDirectoryReference() for blob directories and file directories. Use getDirectoryReference() instead.
* Removed getEntityClass() in TableQuery. Please use getClazzType() instead.
* Added client-side verification for lease duration and break periods.
* Deprecated the setters in table for timestamp as this property is only modifiable by the service.
* Deprecated startCopyFromBlob() on CloudBlob. Use startCopy() instead.
* Deprecated the Credentials and StorageKey classes. Please use the appropriate methods on StorageCredentialsAccountAndKey instead.
* Deprecated constructors which take service clients in favor of constructors which take credentials.
* Fixed a bug where the DateBackwardCompatibility flag was not applied if set on the CloudTableClient default request options.
* Changed library behavior to retry all exceptions thrown when parsing a response object.
* Changed behavior to stop removing query parameters passed in with the resource URI if that URI contains a SAS token. Some query parameters such as comp, restype, snapshot and api-version will still be removed.
* Added support for logging StringToSign to SharedKey and SAS.
* Added a connect timeout to prevent hangs when establishing the network connection.
* Made performance enhancements to the BlobOutputStream class.

2015.05.26 Version 2.2.0
* Fixed a bug where maximum execution time was ignored for file, queue, and table services.
* Changed the socket timeout to be set to the service side timeout plus 5 minutes when maximum execution time is not set.
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#Microsoft Azure Storage SDK for Java

This project provides a client library in Java that makes it easy to consume Microsoft Azure Storage services. For documentation please see the Microsoft Azure [Java Developer Center](http://azure.microsoft.com/en-us/develop/java/) and the [JavaDocs](http://dl.windowsazure.com/storage/javadoc).
This project provides a client library in Java that makes it easy to consume Microsoft Azure Storage services. For documentation please see the Microsoft Azure [Java Developer Center](http://azure.microsoft.com/en-us/develop/java/) and the [JavaDocs](http://azure.github.io/azure-storage-java/).

> If you are looking for the Azure Storage Android SDK, please visit [https://github.com/Azure/azure-storage-android](https://github.com/Azure/azure-storage-android).
#Features
* Blob
Expand Down Expand Up @@ -28,7 +30,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>2.2.0</version>
<version>3.0.0</version>
</dependency>
```

Expand Down Expand Up @@ -130,4 +132,4 @@ If you encounter any bugs with the library please file an issue in the [Issues](
* [Azure Developer Center](http://azure.microsoft.com/en-us/develop/java/)
* [Azure Storage Service](http://azure.microsoft.com/en-us/documentation/services/storage/)
* [Azure Storage Team Blog](http://blogs.msdn.com/b/windowsazurestorage/)
* [JavaDocs](http://dl.windowsazure.com/storage/javadoc)
* [JavaDocs](http://azure.github.io/azure-storage-java/)
61 changes: 31 additions & 30 deletions microsoft-azure-storage-samples/pom.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>windowsazure-storage-samples</groupId>
<artifactId>windowsazure-storage-samples</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>Microsoft Azure Storage Client Samples</name>
<description>Samples for creating blobs, queues and tables</description>
<url>https://github.com/Azure/azure-storage-java</url>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage-samples</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>Microsoft Azure Storage Client Samples</name>
<description>Samples for creating blobs, queues and tables</description>
<url>https://github.com/Azure/azure-storage-java</url>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URISyntaxException;
import java.security.InvalidKeyException;

import org.junit.AfterClass;
import org.junit.Before;
Expand All @@ -32,6 +34,11 @@
import com.microsoft.azure.storage.TestRunners.CloudTests;
import com.microsoft.azure.storage.TestRunners.DevFabricTests;
import com.microsoft.azure.storage.TestRunners.DevStoreTests;
import com.microsoft.azure.storage.blob.BlobTestHelper;
import com.microsoft.azure.storage.blob.BlobType;
import com.microsoft.azure.storage.blob.CloudBlob;
import com.microsoft.azure.storage.blob.CloudBlobContainer;
import com.microsoft.azure.storage.core.LogConstants;
import com.microsoft.azure.storage.core.Logger;

/*
Expand Down Expand Up @@ -268,6 +275,62 @@ public synchronized void testError() throws IOException {
readAndCompareOutput(ERROR, OperationContext.defaultLoggerName, ctx.getClientRequestID());
}

@Test
public synchronized void testStringToSign()
throws IOException, InvalidKeyException, StorageException, URISyntaxException {

OperationContext.setLoggingEnabledByDefault(true);
final CloudBlobContainer cont = BlobTestHelper.getRandomContainerReference();

try {
cont.create();
final CloudBlob blob = BlobTestHelper.uploadNewBlob(cont, BlobType.BLOCK_BLOB, "", 0, null);

// Test logging for SAS access
baos.reset();
blob.generateSharedAccessSignature(null, null);
baos.flush();

String log = baos.toString();
String[] logEntries = log.split("[\\r\\n]+");

assertEquals(1, logEntries.length);

// example log entry: TRACE ROOT - {0b902691-1a8e-41da-ab60-5b912df186a6}: {Test string}
String[] segment = logEntries[0].split("\\{");
assertEquals(3, segment.length);
assertTrue(segment[1].startsWith("*"));
assertTrue(segment[2].startsWith(String.format(LogConstants.SIGNING, Constants.EMPTY_STRING)));
baos.reset();

// Test logging for Shared Key access
OperationContext ctx = new OperationContext();
blob.downloadAttributes(null, null, ctx);

baos.flush();
log = baos.toString();
logEntries = log.split("[\\r\\n]+");
assertNotEquals(0, logEntries.length);

// Select correct log entry
for (int n = 0; n < logEntries.length; n++) {
if (logEntries[n].startsWith(LoggerTests.TRACE)) {
segment = logEntries[n].split("\\{");
assertEquals(3, segment.length);
assertTrue(segment[1].startsWith(ctx.getClientRequestID()));
assertTrue(segment[2].startsWith(String.format(LogConstants.SIGNING, Constants.EMPTY_STRING)));
return;
}
}

// If this line is reached then the log entry was not found
fail();
}
finally {
cont.deleteIfExists();
}
}

private void writeTraceLogs(OperationContext ctx) {
Logger.trace(ctx, ARG0);
Logger.trace(ctx, ARG1, ARG1_VAL);
Expand Down
Loading

0 comments on commit 71a603d

Please sign in to comment.