Skip to content

Commit 6d2e9e8

Browse files
committed
Merge pull request Azure#541 from Azure/dev
[release 0.9.0] merge dev into master
2 parents 61b0931 + 000ec06 commit 6d2e9e8

File tree

76 files changed

+1033
-265
lines changed

Some content is hidden

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

76 files changed

+1033
-265
lines changed

ChangeLog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2015.10.21 Version 0.9.0
2+
* New Azure Resource Manager Storage Management library
3+
* Fix a few bugs
4+
15
2015.9.22 Version 0.8.3
26
* Fix unexpected exceptions thrown in some long running operations
37

azure-mgmt-samples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.microsoft.azure</groupId>
1919
<artifactId>azure</artifactId>
20-
<version>0.8.4-SNAPSHOT</version>
20+
<version>0.9.1-SNAPSHOT</version>
2121
<relativePath>../azure/pom.xml</relativePath>
2222
</parent>
2323

azure/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<modelVersion>4.0.0</modelVersion>
1717
<parent>
1818
<groupId>com.microsoft.azure</groupId>
19-
<version>0.8.4-SNAPSHOT</version>
19+
<version>0.9.1-SNAPSHOT</version>
2020
<artifactId>azure-bom</artifactId>
2121
</parent>
2222

core/azure-core-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.microsoft.azure</groupId>
1919
<artifactId>azure</artifactId>
20-
<version>0.8.4-SNAPSHOT</version>
20+
<version>0.9.1-SNAPSHOT</version>
2121
<relativePath>../../azure/pom.xml</relativePath>
2222
</parent>
2323

core/azure-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.microsoft.azure</groupId>
1919
<artifactId>azure</artifactId>
20-
<version>0.8.4-SNAPSHOT</version>
20+
<version>0.9.1-SNAPSHOT</version>
2121
<relativePath>../../azure/pom.xml</relativePath>
2222
</parent>
2323

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Copyright Microsoft Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
package com.microsoft.windowsazure.core.utils;
16+
17+
import java.util.EnumSet;
18+
19+
/**
20+
* Provides functionality for parsing enums case insensitively.
21+
*/
22+
public final class EnumUtility {
23+
/**
24+
* Parses an Enum of type {@link T} case insensitively.
25+
*
26+
* @param enumClass the class of the Enum type
27+
* @param name the string to parse
28+
* @param <T> the type of the Enum class, should be inferred by enumClass
29+
* @return the parse Enum value of type {@link T}
30+
*/
31+
public static <T extends Enum<T>> T fromString(Class<T> enumClass, String name) {
32+
if (name == null) {
33+
return null;
34+
}
35+
36+
EnumSet<T> values = EnumSet.allOf(enumClass);
37+
for (T value : values) {
38+
if (value.name().equalsIgnoreCase(name)) {
39+
return value;
40+
}
41+
}
42+
throw new IllegalArgumentException(
43+
"No enum constant " + enumClass.getCanonicalName() + "." + name);
44+
}
45+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright Microsoft Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
package com.microsoft.windowsazure.core.utils;
17+
18+
import junit.framework.Assert;
19+
import org.junit.Test;
20+
21+
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.fail;
23+
24+
public class EnumUtilityTest {
25+
private enum Animal {
26+
Cat,
27+
Dog
28+
}
29+
30+
@Test
31+
public void EnumUtilityShouldParseCaseInsensitively()
32+
throws Exception {
33+
String cat = "cat";
34+
String dog = "dOG";
35+
Assert.assertEquals(Animal.Cat, EnumUtility.fromString(Animal.class, cat));
36+
Assert.assertEquals(Animal.Dog, EnumUtility.fromString(Animal.class, dog));
37+
}
38+
39+
@Test
40+
public void EnumUtilityShouldThrowOnBadString()
41+
throws Exception {
42+
String cat = "cag";
43+
try {
44+
EnumUtility.fromString(Animal.class, cat);
45+
fail();
46+
} catch (IllegalArgumentException ex) { }
47+
}
48+
}

core/azure-tracing-util/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.microsoft.azure</groupId>
1919
<artifactId>azure</artifactId>
20-
<version>0.8.4-SNAPSHOT</version>
20+
<version>0.9.1-SNAPSHOT</version>
2121
<relativePath>../../azure/pom.xml</relativePath>
2222
</parent>
2323

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<modelVersion>4.0.0</modelVersion>
1717
<groupId>com.microsoft.azure</groupId>
1818
<artifactId>azure-bom</artifactId>
19-
<version>0.8.4-SNAPSHOT</version>
19+
<version>0.9.1-SNAPSHOT</version>
2020
<packaging>pom</packaging>
2121

2222
<name>Microsoft Azure SDK</name>

resource-management/azure-mgmt-compute/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.microsoft.azure</groupId>
1919
<artifactId>azure</artifactId>
20-
<version>0.8.4-SNAPSHOT</version>
20+
<version>0.9.1-SNAPSHOT</version>
2121
<relativePath>../../azure/pom.xml</relativePath>
2222
</parent>
2323

0 commit comments

Comments
 (0)