Skip to content

Commit 24bf897

Browse files
authored
Merge pull request #42 from Azure/dev
Dev
2 parents ba03f63 + 0ff76b7 commit 24bf897

File tree

90 files changed

+4335
-1790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+4335
-1790
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
If you intend to contribute to the project, please make sure you've followed the instructions provided in the [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/).
22
## Project Setup
3-
The Azure Storage development team uses Eclipse so instructions will be tailored to that preference. However, any preferred IDE or other toolset should be usable.
3+
The Azure Storage development team uses Android Studio so instructions will be tailored to that preference. However, any preferred IDE or other toolset should be usable.
44

55
### Install
66
* Java SE 6+
7-
* [Eclipse](https://eclipse.org/downloads/)
8-
* [Maven plugin for Eclipse](http://www.eclipse.org/m2e/index.html). Some Eclipse packages (ex Eclipse IDE for Java Developers) may come with this plugin already installed.
7+
* [Android](https://developer.android.com/studio/index.html)
98
* [Maven](https://maven.apache.org/install.html)
109
* [Jackson-Core](https://github.com/FasterXML/jackson-core) is used for JSON parsing.
1110
* Clone the source code from GitHub
1211

1312
### Open Solution
14-
Open the project from Eclipse using File->Import->Maven->Existing Maven Projects and navigating to the azure-storage-java folder. Select the listed pom. This imports the source and the test files and downloads the required dependencies via Maven. If you'd like to import the samples, follow the same procedure but navigate to the azure-storage-java\microsoft-azure-storage-samples folder and select that pom. Both projects can be opened at the same time and will be shown in the Package Explorer.
13+
Open the project from Android Studio using File->Open and navigating to the azure-storage-android folder.
1514

1615
## Tests
1716

1817
### Configuration
19-
The only step to configure testing is to setup a configuration file or connection string via environment variables. To use the connection string route, create an environment variable named "storageConnection". To use the configuration file route, create an environment variable named "storageTestConfiguration" with the path to a TestConfigurations.xml file with this [template](https://github.com/Azure/azure-storage-java/blob/master/microsoft-azure-storage-test/res/TestConfigurations.xml).
18+
The only step to configure testing is to populate the accountName, accountKey, and service endpoints in TestHelper.java.
2019

2120
### Running
22-
To actually run tests, right click on the test class in the Package Explorer or the individual test in the Outline and select Run As-> Android JUnit Test. All tests or tests grouped by service can be run using the test runners in the com.microsoft.azure.storage package TestRunners file. Running all tests from the top of the package explorer will result in each test being run multiple times as the package explorer will also run every test runner.
21+
To actually run tests, right click on the test class in the Package Explorer or the individual test in the Outline and select Run -> Run. All tests or tests grouped by service can be run using the test runners in the com.microsoft.azure.storage package TestRunners file. Running all tests from the top of the package explorer will result in each test being run multiple times as the package explorer will also run every test runner.
22+
If a test run failed to test runner not found, go to Run -> Edig Configurations... -> Specifc instrumentation runner (optional) -> ... ->AndroidJUnitRunner (android.support.test.runner). Then rerun the test.
2323

2424
### Testing Features
2525
As you develop a feature, you'll need to write tests to ensure quality. You should also run existing tests related to your change to address any unexpected breaks.

ChangeLog.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2017.01.30 Version 1.0.0
2+
* Android Studio support via Gradle build system.
3+
* Updated tests from JUnit 3 to Android Junit 4.
4+
* Prefix support for listing files and directories.
5+
* Added support for setting public access when creating a blob container
6+
* The public access setting on a blob container is now a container property returned from downloadProperties.
7+
* Add Message now modifies the PopReceipt, Id, NextVisibleTime, InsertionTime, and ExpirationTime properties of its CloudQueueMessage parameter.
8+
* Populate content MD5 for range gets on Blobs and Files.
9+
* Added support in Page Blob for incremental copy.
10+
* getQualifiedUri() has been deprecated for Blobs. Please use getSnapshotQualifiedUri() instead. This new function will return the blob including the snapshot (if present) and no SAS token.
11+
* getQualifiedStorageUri() has been deprecated for Blobs. Please use getSnapshotQualifiedStorageUri() instead. This new function will return the blob including the snapshot (if present) and no SAS token.
12+
* Fixed a bug where copying from a blob that included a SAS token and a snapshot ommitted the SAS token.
13+
114
2016.07.14 Version 0.8.0
215
* Added support for server-side encryption.
316
* Fixed a bug in the retry policies where 300 status codes were being retried when they shouldn't be.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ First, add mavenCentral to your repositories by adding the following to your gra
4646
Then, add a dependency by adding the following to your gradle build file:
4747

4848
dependencies {
49-
compile 'com.microsoft.azure.android:azure-storage-android:0.7.0@aar'
49+
compile 'com.microsoft.azure.android:azure-storage-android:1.0.0@aar'
5050
}
5151

5252
###Option 4: aar via Maven
@@ -57,7 +57,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
5757
<dependency>
5858
<groupId>com.microsoft.azure.android</groupId>
5959
<artifactId>azure-storage-android</artifactId>
60-
<version>0.7.0</version>
60+
<version>1.0.0</version>
6161
<type>aar</type>
6262
</dependency>
6363
```
@@ -75,9 +75,9 @@ To use this SDK to call Microsoft Azure storage services, you need to first [cre
7575

7676
Samples are provided in the microsoft-azure-storage-samples folder. The unit tests in microsoft-azure-storage-test can also be helpful.
7777

78-
Make sure the storage client library is added as a project dependency. If using source and in Eclipse, right click on the project, select "Properties", navigate to the Android tab, and under "Library" click "Add.." and select the project. To do this, the storage client library should already be imported into Eclipse as an Android project.
78+
Make sure the storage client library is added as a project dependency. From Android Studio, go to File -> Project Structure. Click on the module (either sample or test). If 'microsoft-azure-storage' is not listed as a dependy, click the '+' sign. Then click module dependency and select 'microsoft-azure-storage'.
7979

80-
If using Maven or Gradle, Jackson-Core should be automatically added to the build path. Otherwise, please download the jar and add it to your build path. Also, please make sure that the jar will be added to your project's apk. To do this in Eclipse, right click your project, select "Build Path->Configure Build Path", navigate to the "Order and Export" tab and check the box next to the jackson-core jar.
80+
If using Maven or Gradle, Jackson-Core should be automatically added to the build path. Otherwise, please download the jar and add it to your build path. Also, please make sure that the jar will be added to your project's apk. To do this in Android Studio, go to File -> Project Structure -> Modules. Click the Dependencies tab. Click the '+' sign and click 'File Dependency'. Navigate the .jar.
8181

8282
##Code Samples
8383

microsoft-azure-storage-test/src/com/microsoft/azure/storage/runners/AnalyticsTestSuite.java renamed to build.gradle

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
/**
22
* Copyright Microsoft Corporation
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
* http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package com.microsoft.azure.storage.runners;
1615

17-
import junit.framework.Test;
18-
import junit.framework.TestSuite;
19-
20-
import com.microsoft.azure.storage.analytics.CloudAnalyticsClientTests;
16+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
17+
buildscript {
18+
repositories {
19+
mavenCentral()
20+
}
21+
dependencies {
22+
classpath 'com.android.tools.build:gradle:2.2.3'
23+
}
24+
}
2125

22-
public class AnalyticsTestSuite extends TestSuite {
23-
public static Test suite() {
24-
TestSuite suite = new TestSuite("AnalyticsTestSuite");
25-
suite.addTestSuite(CloudAnalyticsClientTests.class);
26-
return suite;
26+
allprojects {
27+
repositories {
28+
jcenter()
2729
}
28-
}
30+
}
31+

gradle/wrapper/gradle-wrapper.jar

48.7 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Nov 30 14:47:51 PST 2016
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

gradlew

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#!/usr/bin/env bash
2+
3+
##############################################################################
4+
##
5+
## Gradle start up script for UN*X
6+
##
7+
## This project is not maintained for Unix-based platforms.
8+
## There are no guarantees that the project will work out of the box for Unix-based platforms and may require additional changes.
9+
## This is an auto-generated file that is being left in for users wishing to experiment with the library.
10+
##
11+
##############################################################################
12+
13+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
14+
DEFAULT_JVM_OPTS=""
15+
16+
APP_NAME="Gradle"
17+
APP_BASE_NAME=`basename "$0"`
18+
19+
# Use the maximum available, or set MAX_FD != -1 to use that value.
20+
MAX_FD="maximum"
21+
22+
warn ( ) {
23+
echo "$*"
24+
}
25+
26+
die ( ) {
27+
echo
28+
echo "$*"
29+
echo
30+
exit 1
31+
}
32+
33+
# OS specific support (must be 'true' or 'false').
34+
cygwin=false
35+
msys=false
36+
darwin=false
37+
case "`uname`" in
38+
CYGWIN* )
39+
cygwin=true
40+
;;
41+
Darwin* )
42+
darwin=true
43+
;;
44+
MINGW* )
45+
msys=true
46+
;;
47+
esac
48+
49+
# For Cygwin, ensure paths are in UNIX format before anything is touched.
50+
if $cygwin ; then
51+
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
52+
fi
53+
54+
# Attempt to set APP_HOME
55+
# Resolve links: $0 may be a link
56+
PRG="$0"
57+
# Need this for relative symlinks.
58+
while [ -h "$PRG" ] ; do
59+
ls=`ls -ld "$PRG"`
60+
link=`expr "$ls" : '.*-> \(.*\)$'`
61+
if expr "$link" : '/.*' > /dev/null; then
62+
PRG="$link"
63+
else
64+
PRG=`dirname "$PRG"`"/$link"
65+
fi
66+
done
67+
SAVED="`pwd`"
68+
cd "`dirname \"$PRG\"`/" >&-
69+
APP_HOME="`pwd -P`"
70+
cd "$SAVED" >&-
71+
72+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
73+
74+
# Determine the Java command to use to start the JVM.
75+
if [ -n "$JAVA_HOME" ] ; then
76+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
77+
# IBM's JDK on AIX uses strange locations for the executables
78+
JAVACMD="$JAVA_HOME/jre/sh/java"
79+
else
80+
JAVACMD="$JAVA_HOME/bin/java"
81+
fi
82+
if [ ! -x "$JAVACMD" ] ; then
83+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
84+
85+
Please set the JAVA_HOME variable in your environment to match the
86+
location of your Java installation."
87+
fi
88+
else
89+
JAVACMD="java"
90+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
91+
92+
Please set the JAVA_HOME variable in your environment to match the
93+
location of your Java installation."
94+
fi
95+
96+
# Increase the maximum file descriptors if we can.
97+
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
98+
MAX_FD_LIMIT=`ulimit -H -n`
99+
if [ $? -eq 0 ] ; then
100+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
101+
MAX_FD="$MAX_FD_LIMIT"
102+
fi
103+
ulimit -n $MAX_FD
104+
if [ $? -ne 0 ] ; then
105+
warn "Could not set maximum file descriptor limit: $MAX_FD"
106+
fi
107+
else
108+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
109+
fi
110+
fi
111+
112+
# For Darwin, add options to specify how the application appears in the dock
113+
if $darwin; then
114+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
115+
fi
116+
117+
# For Cygwin, switch paths to Windows format before running java
118+
if $cygwin ; then
119+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
120+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
121+
122+
# We build the pattern for arguments to be converted via cygpath
123+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
124+
SEP=""
125+
for dir in $ROOTDIRSRAW ; do
126+
ROOTDIRS="$ROOTDIRS$SEP$dir"
127+
SEP="|"
128+
done
129+
OURCYGPATTERN="(^($ROOTDIRS))"
130+
# Add a user-defined pattern to the cygpath arguments
131+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
132+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
133+
fi
134+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
135+
i=0
136+
for arg in "$@" ; do
137+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
138+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
139+
140+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
141+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
142+
else
143+
eval `echo args$i`="\"$arg\""
144+
fi
145+
i=$((i+1))
146+
done
147+
case $i in
148+
(0) set -- ;;
149+
(1) set -- "$args0" ;;
150+
(2) set -- "$args0" "$args1" ;;
151+
(3) set -- "$args0" "$args1" "$args2" ;;
152+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
153+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
154+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
155+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
156+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
157+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
158+
esac
159+
fi
160+
161+
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
162+
function splitJvmOpts() {
163+
JVM_OPTS=("$@")
164+
}
165+
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
166+
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
167+
168+
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

gradlew.bat

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem Gradle startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12+
set DEFAULT_JVM_OPTS=
13+
14+
set DIRNAME=%~dp0
15+
if "%DIRNAME%" == "" set DIRNAME=.
16+
set APP_BASE_NAME=%~n0
17+
set APP_HOME=%DIRNAME%
18+
19+
@rem Find java.exe
20+
if defined JAVA_HOME goto findJavaFromJavaHome
21+
22+
set JAVA_EXE=java.exe
23+
%JAVA_EXE% -version >NUL 2>&1
24+
if "%ERRORLEVEL%" == "0" goto init
25+
26+
echo.
27+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:findJavaFromJavaHome
35+
set JAVA_HOME=%JAVA_HOME:"=%
36+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37+
38+
if exist "%JAVA_EXE%" goto init
39+
40+
echo.
41+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42+
echo.
43+
echo Please set the JAVA_HOME variable in your environment to match the
44+
echo location of your Java installation.
45+
46+
goto fail
47+
48+
:init
49+
@rem Get command-line arguments, handling Windowz variants
50+
51+
if not "%OS%" == "Windows_NT" goto win9xME_args
52+
if "%@eval[2+2]" == "4" goto 4NT_args
53+
54+
:win9xME_args
55+
@rem Slurp the command line arguments.
56+
set CMD_LINE_ARGS=
57+
set _SKIP=2
58+
59+
:win9xME_args_slurp
60+
if "x%~1" == "x" goto execute
61+
62+
set CMD_LINE_ARGS=%*
63+
goto execute
64+
65+
:4NT_args
66+
@rem Get arguments from the 4NT Shell from JP Software
67+
set CMD_LINE_ARGS=%$
68+
69+
:execute
70+
@rem Setup the command line
71+
72+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
74+
@rem Execute Gradle
75+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76+
77+
:end
78+
@rem End local scope for the variables with windows NT shell
79+
if "%ERRORLEVEL%"=="0" goto mainEnd
80+
81+
:fail
82+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83+
rem the _cmd.exe /c_ return code!
84+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85+
exit /b 1
86+
87+
:mainEnd
88+
if "%OS%"=="Windows_NT" endlocal
89+
90+
:omega

0 commit comments

Comments
 (0)