diff --git a/.gitignore b/.gitignore
index 1760b790d8515..1b07ae5c5817a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,42 @@
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# Azure Tooling #
+node_modules
+
+# Eclipse #
+*.pydevproject
+.project
+.metadata
+bin/**
+tmp/**
+tmp/**/*
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# Other Tooling #
.classpath
.project
target
-node_modules
.idea
*.iml
+
+# Mac OS #
+.DS_Store
+.DS_Store?
+
+# Windows #
+Thumbs.db
\ No newline at end of file
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 034592cc26044..d0d8f8f005b4d 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,7 @@
+2014.04.2 Version 0.5.0
+ * Add multiple service management modules
+ * Split the SDK into multiple sub-modules
+
2013.09.30 Version 0.4.6
* Allow users to set the client-request-id for better tracking/debugging of storage requests. This is set on the OperationContext.
* Prevent a potential arithmetic overflow while calculating the exponential retry back-off interval in storage.
diff --git a/README.md b/README.md
index 93e0046cec226..b5c98c31e1b32 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-#Windows Azure SDK for Java
+#Microsoft Azure SDK for Java
-This project provides a client library in Java that makes it easy to consume Windows Azure services. For documentation please see the [Windows Azure Java Developer Center](http://www.windowsazure.com/en-us/develop/java/).
+This project provides a client library in Java that makes it easy to consume Microsoft Azure services. For documentation please see the [Microsoft Azure Java Developer Center](http://azure.microsoft.com/en-us/develop/java/).
#Features
@@ -38,10 +38,14 @@ This project provides a client library in Java that makes it easy to consume Win
* Add/Get job notifications
* Create/Read/Update/Delete notification endpoints
* Service Management
- * Manage affinity groups
+ * Compute Management
+ * Web Site Management
+ * Virtual Network Management
+ * Storage Management
+ * Sql Database Management
* Service Runtime
* Retrieve information about the state of your Azure Compute instances
-
+
#Getting Started
@@ -50,7 +54,7 @@ This project provides a client library in Java that makes it easy to consume Win
To get the source code of the SDK via git just type:
- git clone git://github.com/WindowsAzure/azure-sdk-for-java.git
+ git clone git://github.com/Azure/azure-sdk-for-java.git
cd ./azure-sdk-for-java/microsoft-azure-api/
mvn compile
@@ -71,19 +75,19 @@ within your project you can also have them installed by the Java package manager
* Java 1.6
* (Optional) Maven
-
+
##Usage
-To use this SDK to call Windows Azure services, you need to first create an
-account. To host your Java code in Windows Azure, you additionally need to download
-the full Windows Azure SDK for Java - which includes packaging, emulation, and
+To use this SDK to call Microsoft Azure services, you need to first create an
+account. To host your Java code in Microsoft Azure, you additionally need to download
+the full Microsoft Azure SDK for Java - which includes packaging, emulation, and
deployment tools.
##Code Sample
The following is a quick example on how to set up a Azure blob using the API
-and uploading a file to it. For additional information on using the client libraries to access Azure services see the How To guides listed [here](http://www.windowsazure.com/en-us/develop/java/).
+and uploading a file to it. For additional information on using the client libraries to access Azure services see the How To guides listed [here](http://azure.microsoft.com/en-us/develop/java/).
```java
import java.io.*;
@@ -92,63 +96,63 @@ import com.microsoft.windowsazure.services.core.storage.*;
import com.microsoft.windowsazure.services.blob.client.*;
public class BlobSample {
- public static final String storageConnectionString =
- "DefaultEndpointsProtocol=http;"
- + "AccountName=your_account_name;"
- + "AccountKey= your_account_key";
-
- public static void main(String[] args) {
- try {
- CloudStorageAccount account;
- CloudBlobClient serviceClient;
- CloudBlobContainer container;
- CloudBlockBlob blob;
-
- account = CloudStorageAccount.parse(storageConnectionString);
- serviceClient = account.createCloudBlobClient();
- // Container name must be lower case.
- container = serviceClient.getContainerReference("blobsample");
- container.createIfNotExist();
-
- // Set anonymous access on the container.
- BlobContainerPermissions containerPermissions;
- containerPermissions = new BlobContainerPermissions();
- container.uploadPermissions(containerPermissions);
-
- // Upload an image file.
- blob = container.getBlockBlobReference("image1.jpg");
- File fileReference = new File("c:\\myimages\\image1.jpg");
- blob.upload(new FileInputStream(fileReference), fileReference.length());
- } catch (FileNotFoundException fileNotFoundException) {
- System.out.print("FileNotFoundException encountered: ");
- System.out.println(fileNotFoundException.getMessage());
- System.exit(-1);
- } catch (StorageException storageException) {
- System.out.print("StorageException encountered: ");
- System.out.println(storageException.getMessage());
- System.exit(-1);
- } catch (Exception e) {
- System.out.print("Exception encountered: ");
- System.out.println(e.getMessage());
- System.exit(-1);
- }
-
- }
+ public static final String storageConnectionString =
+ "DefaultEndpointsProtocol=http;"
+ + "AccountName=your_account_name;"
+ + "AccountKey= your_account_key";
+
+ public static void main(String[] args) {
+ try {
+ CloudStorageAccount account;
+ CloudBlobClient serviceClient;
+ CloudBlobContainer container;
+ CloudBlockBlob blob;
+
+ account = CloudStorageAccount.parse(storageConnectionString);
+ serviceClient = account.createCloudBlobClient();
+ // Container name must be lower case.
+ container = serviceClient.getContainerReference("blobsample");
+ container.createIfNotExist();
+
+ // Set anonymous access on the container.
+ BlobContainerPermissions containerPermissions;
+ containerPermissions = new BlobContainerPermissions();
+ container.uploadPermissions(containerPermissions);
+
+ // Upload an image file.
+ blob = container.getBlockBlobReference("image1.jpg");
+ File fileReference = new File("c:\\myimages\\image1.jpg");
+ blob.upload(new FileInputStream(fileReference), fileReference.length());
+ } catch (FileNotFoundException fileNotFoundException) {
+ System.out.print("FileNotFoundException encountered: ");
+ System.out.println(fileNotFoundException.getMessage());
+ System.exit(-1);
+ } catch (StorageException storageException) {
+ System.out.print("StorageException encountered: ");
+ System.out.println(storageException.getMessage());
+ System.exit(-1);
+ } catch (Exception e) {
+ System.out.print("Exception encountered: ");
+ System.out.println(e.getMessage());
+ System.exit(-1);
+ }
+
+ }
}
```
#Need Help?
-Be sure to check out the Windows Azure [Developer Forums on Stack Overflow](http://go.microsoft.com/fwlink/?LinkId=234489) if you have trouble with the provided code.
+Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow](http://go.microsoft.com/fwlink/?LinkId=234489) if you have trouble with the provided code.
#Contribute Code or Provide Feedback
-If you would like to become an active contributor to this project please follow the instructions provided in [Windows Azure Projects Contribution Guidelines](http://windowsazure.github.com/guidelines.html).
+If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.com/guidelines.html).
-If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/WindowsAzure/azure-sdk-for-java/issues) section of the project.
+If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-java/issues) section of the project.
#Learn More
-* [Windows Azure Java Developer Center](http://www.windowsazure.com/en-us/develop/java/)
+* [Microsoft Azure Java Developer Center](http://azure.microsoft.com/en-us/develop/java/)
* [JavaDocs](http://dl.windowsazure.com/javadoc/)
diff --git a/core-test/pom.xml b/core-test/pom.xml
new file mode 100644
index 0000000000000..78100f8a60d89
--- /dev/null
+++ b/core-test/pom.xml
@@ -0,0 +1,95 @@
+
+
+ 4.0.0
+
+ com.microsoft.windowsazure
+ microsoft-azure-api-parent
+ 0.5.0
+ ../parent/pom.xml
+
+
+ microsoft-azure-api-core-test
+ jar
+
+ Microsoft Azure Core Test Client API
+ API for Testing Microsoft Azure Clients
+ https://github.com/Azure/azure-sdk-for-java
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ scm:git:https://github.com/Azure/azure-sdk-for-java
+ scm:git:git://github.com/Azure/azure-sdk-for-java.git
+
+
+
+ UTF-8
+
+
+
+
+
+ microsoft
+ Microsoft
+
+
+
+
+
+ ${project.groupId}
+ microsoft-azure-api-core
+ 0.5.0
+
+
+ ${project.groupId}
+ microsoft-azure-api-management
+ 0.5.0
+
+
+ ${project.groupId}
+ microsoft-azure-api-management-websites
+ 0.5.0
+
+
+ ${project.groupId}
+ microsoft-azure-api-management-storage
+ 0.5.0
+
+
+ ${project.groupId}
+ microsoft-azure-api-management-sql
+ 0.5.0
+
+
+
+ info.cukes
+ cucumber-java
+ test
+
+
+ info.cukes
+ cucumber-junit
+ test
+
+
+
diff --git a/core-test/src/test/java/com/microsoft/windowsazure/ManagementResourceStepdefs.java b/core-test/src/test/java/com/microsoft/windowsazure/ManagementResourceStepdefs.java
new file mode 100644
index 0000000000000..c16257e3a9a99
--- /dev/null
+++ b/core-test/src/test/java/com/microsoft/windowsazure/ManagementResourceStepdefs.java
@@ -0,0 +1,693 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.microsoft.windowsazure;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Random;
+
+import org.junit.Assert;
+
+import com.microsoft.windowsazure.core.utils.KeyStoreType;
+import com.microsoft.windowsazure.management.configuration.ManagementConfiguration;
+
+import cucumber.api.java.en.And;
+import cucumber.api.java.en.Given;
+import cucumber.api.java.en.Then;
+import cucumber.api.java.en.When;
+
+/**
+ * The Class ManagementResourceStepdefs.
+ */
+public class ManagementResourceStepdefs {
+ /** The objects. */
+ private HashMap objects = new HashMap();
+
+ /** The random. */
+ private static Random random = new Random();
+
+ /**
+ * I_create_a_character_random_string_with_name.
+ *
+ * @param length the length
+ * @param name the name
+ * @param prefix the prefix
+ */
+ @And("^I create a \"([^\"]*)\" character random String with name \"([^\"]*)\" and prefix \"([^\"]*)\"$")
+ public void i_create_a_character_random_string_with_name(int length, String name, String prefix) {
+ StringBuilder stringBuilder = new StringBuilder(length);
+ for (int i=0; i serviceClass = Class.forName("com.microsoft.windowsazure.management.ManagementService");
+ Method method = serviceClass.getMethod("create", Configuration.class);
+ objects.put(name, method.invoke(null, createConfiguration()));
+ }
+ else if (objectType.equals("WebSiteManagementClient")) {
+ Class> serviceClass = Class.forName("com.microsoft.windowsazure.management.websites.WebSiteManagementService");
+ Method method = serviceClass.getMethod("create", Configuration.class);
+ objects.put(name, method.invoke(null, createConfiguration()));
+ }
+ else if (objectType.equals("StorageManagementClient")) {
+ Class> serviceClass = Class.forName("com.microsoft.windowsazure.management.storage.StorageManagementService");
+ Method method = serviceClass.getMethod("create", Configuration.class);
+ objects.put(name, method.invoke(null, createConfiguration()));
+ }
+ else if (objectType.equals("SqlManagementClient")) {
+ Class> serviceClass = Class.forName("com.microsoft.windowsazure.management.sql.SqlManagementService");
+ Method method = serviceClass.getMethod("create", Configuration.class);
+ objects.put(name, method.invoke(null, createConfiguration()));
+ }
+ else {
+ Class> objectClass = TextUtility.getJavaType(objectType);
+ objects.put(name, objectClass.newInstance());
+ }
+ }
+
+ /**
+ * Set_property_obj.
+ *
+ * @param propertyName the property name
+ * @param propertyObj the property obj
+ * @param propertyType the property type
+ * @throws ClassNotFoundException the class not found exception
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ @Given("^set \"([^\"]*)\" with \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public void set_property_obj(String propertyName, String propertyObj, String propertyType) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ String[] parts = propertyName.split("\\.");
+ Object object = getObject(parts);
+ if (parts.length > 1) {
+ Method method = object.getClass().getMethod("set" + TextUtility.ToPascalCase(parts[parts.length - 1]), TextUtility.getJavaType(propertyType));
+ method.invoke(object, objects.get(propertyObj));
+ }
+ else {
+ objects.put(propertyName, objects.get(propertyObj));
+ }
+ }
+
+ /**
+ * Set_property.
+ *
+ * @param propertyName the property name
+ * @param propertyValue the property value
+ * @param propertyType the property type
+ * @throws ClassNotFoundException the class not found exception
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ @Given("^set \"([^\"]*)\" with value \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public void set_property(String propertyName, String propertyValue, String propertyType) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ String[] parts = propertyName.split("\\.");
+ Object object = getObject(parts);
+ if (parts.length > 1) {
+ Method method = object.getClass().getMethod("set" + TextUtility.ToPascalCase(parts[parts.length - 1]), TextUtility.getJavaType(propertyType));
+ method.invoke(object, TextUtility.convertStringTo(propertyValue, propertyType));
+ }
+ else {
+ objects.put(propertyName, TextUtility.convertStringTo(propertyValue, propertyType));
+ }
+ }
+
+ /**
+ * Set_property_from_path.
+ *
+ * @param propertyName the property name
+ * @param valuePath the value path
+ * @param propertyType the property type
+ * @throws ClassNotFoundException the class not found exception
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ @Given("^set \"([^\"]*)\" with value from path \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public void set_property_from_path(String propertyName, String valuePath, String propertyType) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ String[] propertyParts = valuePath.split("\\.");
+ Object propertyObject = getObject(propertyParts);
+
+ Object propertyValue = getPropertyValue(propertyObject, propertyParts[propertyParts.length - 1]);
+
+ String[] parts = propertyName.split("\\.");
+ Object object = getObject(parts);
+ if (parts.length > 1) {
+ Method method = object.getClass().getMethod("set" + TextUtility.ToPascalCase(parts[parts.length - 1]), TextUtility.getJavaType(propertyType));
+ method.invoke(object, propertyValue);
+ }
+ else {
+ objects.put(propertyName, propertyValue);
+ }
+ }
+
+ /**
+ * Set_value_where_equals.
+ *
+ * @param objectName the object name
+ * @param path the path
+ * @param propertyPath the property path
+ * @param propertyType the property type
+ * @param value the value
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @And("^set \"([^\"]*)\" with value from list \"([^\"]*)\" where \"([^\"]*)\" of type \"([^\"]*)\" equals \"([^\"]*)\"$")
+ public void set_value_where_equals(String objectName, String path, String propertyPath, String propertyType, String value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = path.split("\\.");
+ Object parent = getObject(parts);
+ ArrayList> arrayObject = (ArrayList>) getPropertyValue(parent, parts[parts.length - 1]);
+
+ for (int i = 0; i < arrayObject.size(); i++) {
+ String[] propertyParts = propertyPath.split("\\.");
+ Object propertyParent = getObject(arrayObject.get(i), propertyParts);
+ Object propertyValue = getPropertyValue(propertyParent, propertyParts[propertyParts.length - 1]);
+ if (propertyValue.equals(TextUtility.convertStringTo(value, propertyType))) {
+ objects.put(objectName, arrayObject.get(i));
+ return;
+ }
+ }
+
+ throw new NullPointerException();
+ }
+
+ /**
+ * Set_value_where_equals_parameter.
+ *
+ * @param objectName the object name
+ * @param path the path
+ * @param propertyPath the property path
+ * @param propertyType the property type
+ * @param parameterName the parameter name
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @And("^set \"([^\"]*)\" with value from list \"([^\"]*)\" where \"([^\"]*)\" of type \"([^\"]*)\" equals parameter \"([^\"]*)\"$")
+ public void set_value_where_equals_parameter(String objectName, String path, String propertyPath, String propertyType, String parameterName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = path.split("\\.");
+ Object parent = getObject(parts);
+ ArrayList> arrayObject = (ArrayList>) getPropertyValue(parent, parts[parts.length - 1]);
+ Object value = objects.get(parameterName);
+ for (int i = 0; i < arrayObject.size(); i++) {
+ String[] propertyParts = propertyPath.split("\\.");
+ Object propertyParent = getObject(arrayObject.get(i), propertyParts);
+ Object propertyValue = getPropertyValue(propertyParent, propertyParts[propertyParts.length - 1]);
+ if (propertyValue.equals(value)) {
+ objects.put(objectName, arrayObject.get(i));
+ return;
+ }
+ }
+
+ throw new NullPointerException();
+ }
+
+ /**
+ * Gets the property value.
+ *
+ * @param parent the parent
+ * @param propertyName the property name
+ * @return the property value
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ private Object getPropertyValue(Object parent, String propertyName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ Method method;
+ if (propertyName.toLowerCase().equals("length")) {
+ method = parent.getClass().getMethod("size");
+ }
+ else {
+ method = parent.getClass().getMethod("get" + TextUtility.ToPascalCase(propertyName));
+ }
+
+ return method.invoke(parent);
+ }
+
+ /**
+ * And_get_property_equals.
+ *
+ * @param propertyType the property type
+ * @param propertyName the property name
+ * @param propertyValue the property value
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @And("^property with type \"([^\"]*)\" and path \"([^\"]*)\" should equal \"([^\"]*)\"$")
+ public void and_get_property_equals(String propertyType, String propertyName, String propertyValue) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = propertyName.split("\\.");
+ Object object = getObject(parts);
+
+ Object result = getPropertyValue(object, parts[parts.length - 1]);
+
+ // Assert
+ Assert.assertEquals(TextUtility.convertStringTo(propertyValue, propertyType), result);
+ }
+
+ @And("^property with type \"([^\"]*)\" and path \"([^\"]*)\" should equal parameter \"([^\"]*)\"$")
+ public void and_get_property_equals_parameters(String propertyType, String propertyName, String parameterName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = propertyName.split("\\.");
+ Object object = getObject(parts);
+
+ Object result = getPropertyValue(object, parts[parts.length - 1]);
+
+ Object parameterValue = objects.get(parameterName);
+ // Assert
+ Assert.assertEquals(parameterValue, result);
+ }
+
+ /**
+ * And_get_property_not_equals.
+ *
+ * @param propertyType the property type
+ * @param propertyName the property name
+ * @param propertyValue the property value
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @And("^property with type \"([^\"]*)\" and path \"([^\"]*)\" should not equal \"([^\"]*)\"$")
+ public void and_get_property_not_equals(String propertyType, String propertyName, String propertyValue) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = propertyName.split("\\.");
+ Object object = getObject(parts);
+
+ Method method = object.getClass().getMethod("get" + TextUtility.ToPascalCase(parts[parts.length - 1]));
+ Object result = method.invoke(object);
+
+ // Assert
+ Assert.assertNotEquals(TextUtility.convertStringTo(propertyValue, propertyType), result);
+ }
+
+ /**
+ * When_invoke_with_parameter_value_get_result.
+ *
+ * @param methodName the method name
+ * @param parameterValue the parameter value
+ * @param parameterType the parameter type
+ * @param resultName the result name
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameter value \"([^\"]*)\" of type \"([^\"]*)\" I get the result into \"([^\"]*)\"$")
+ public void when_invoke_with_parameter_value_get_result(String methodName, String parameterValue, String parameterType, String resultName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ objects.put(resultName, when_invoke_with_parameter_converted_value(methodName, TextUtility.convertStringTo(parameterValue, parameterType), parameterType));
+ }
+
+ /**
+ * When_invoke_with_parameter_get_result.
+ *
+ * @param methodName the method name
+ * @param parameterName the parameter name
+ * @param resultName the result name
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameter \"([^\"]*)\" I get the result into \"([^\"]*)\"$")
+ public void when_invoke_with_parameter_get_result(String methodName, String parameterName, String resultName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ Object parameter = objects.get(parameterName);
+ objects.put(resultName, when_invoke_with_parameter_converted_value(methodName, parameter, parameter.getClass().getName()));
+ }
+
+ /**
+ * When_invoke_get_result.
+ *
+ * @param methodName the method name
+ * @param resultName the result name
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ @When("^I invoke \"([^\"]*)\" I get the result into \"([^\"]*)\"$")
+ public void when_invoke_get_result(String methodName, String resultName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ objects.put(resultName, when_invoke(methodName));
+ }
+
+ /**
+ * When_invoke.
+ *
+ * @param methodName the method name
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ @When("^I invoke \"([^\"]*)\"$")
+ public Object when_invoke(String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ String[] parts = methodName.split("\\.");
+ Object object = getObject(parts);
+
+ Method method = object.getClass().getMethod(TextUtility.ToCamelCase(parts[parts.length - 1]));
+ return method.invoke(object);
+ }
+
+ /**
+ * When_invoke_with_parameter_values.
+ *
+ * @param methodName the method name
+ * @param parameter1 the parameter1
+ * @param parameter1Type the parameter1 type
+ * @param parameter2 the parameter2
+ * @param parameter2Type the parameter2 type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ public Object when_invoke_with_parameter_values(String methodName, Object parameter1, String parameter1Type, Object parameter2, String parameter2Type) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = methodName.split("\\.");
+ Object object = getObject(parts);
+
+ Method method = object.getClass().getMethod(TextUtility.ToCamelCase(parts[parts.length - 1]), TextUtility.getJavaType(parameter1Type), TextUtility.getJavaType(parameter2Type));
+ return method.invoke(object, parameter1, parameter2);
+ }
+
+ public Object when_invoke_with_parameter_values(String methodName, Object parameter1, String parameter1Type, Object parameter2, String parameter2Type, Object parameter3, String parameter3Type) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = methodName.split("\\.");
+ Object object = getObject(parts);
+
+ Method method = object.getClass().getMethod(TextUtility.ToCamelCase(parts[parts.length - 1]), TextUtility.getJavaType(parameter1Type), TextUtility.getJavaType(parameter2Type), TextUtility.getJavaType(parameter3Type));
+ return method.invoke(object, parameter1, parameter2, parameter3);
+ }
+
+ /**
+ * When_invoke_with_parameter_values_string.
+ *
+ * @param methodName the method name
+ * @param parameter1 the parameter1
+ * @param parameter1Type the parameter1 type
+ * @param parameter2 the parameter2
+ * @param parameter2Type the parameter2 type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameter values \"([^\"]*)\" of type \"([^\"]*)\" and \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public Object when_invoke_with_parameter_values_string(String methodName, String parameter1, String parameter1Type, String parameter2, String parameter2Type) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ return when_invoke_with_parameter_values(methodName, TextUtility.convertStringTo(parameter1, parameter1Type), parameter1Type, TextUtility.convertStringTo(parameter2, parameter2Type), parameter2Type);
+ }
+
+ /**
+ * When_invoke_with_parameter_value.
+ *
+ * @param methodName the method name
+ * @param parameterValue the parameter value
+ * @param parameterType the parameter type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameter value \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public Object when_invoke_with_parameter_value(String methodName, String parameterValue, String parameterType) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ return when_invoke_with_parameter_converted_value(methodName, TextUtility.convertStringTo(parameterValue, parameterType), parameterType);
+ }
+
+ /**
+ * When_invoke_with_parameter_converted_value.
+ *
+ * @param methodName the method name
+ * @param parameterValue the parameter value
+ * @param parameterType the parameter type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ public Object when_invoke_with_parameter_converted_value(String methodName, Object parameterValue, String parameterType) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts = methodName.split("\\.");
+ Object object = getObject(parts);
+
+ Method method = object.getClass().getMethod(TextUtility.ToCamelCase(parts[parts.length - 1]), TextUtility.getJavaType(parameterType));
+ return method.invoke(object, parameterValue);
+ }
+
+ /**
+ * When_invoke_with_parameter.
+ *
+ * @param methodName the method name
+ * @param parameterName the parameter name
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameter \"([^\"]*)\"$")
+ public Object when_invoke_with_parameter(String methodName, String parameterName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ Object parameter = objects.get(parameterName);
+ return when_invoke_with_parameter_converted_value(methodName, parameter, parameter.getClass().getName());
+ }
+
+ /**
+ * When_invoke_with_parameter.
+ *
+ * @param methodName the method name
+ * @param parameter1Name the parameter1 name
+ * @param parameter2Name the parameter2 name
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameters \"([^\"]*)\" and \"([^\"]*)\"$")
+ public Object when_invoke_with_parameter(String methodName, String parameter1Name, String parameter2Name) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts1 = parameter1Name.split("\\.");
+ Object parameter1 = getObject(parts1);
+
+ String[] parts2 = parameter2Name.split("\\.");
+ Object parameter2 = getObject(parts2);
+
+ return when_invoke_with_parameter_values(methodName, parameter1, parameter1.getClass().getName(), parameter2, parameter2.getClass().getName());
+ }
+
+ /**
+ * When_invoke_with_parameter.
+ *
+ * @param methodName the method name
+ * @param parameter1Name the parameter1 name
+ * @param parameter2Name the parameter2 name
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameters \"([^\"]*)\" and \"([^\"]*)\" and \"([^\"]*)\"$")
+ public Object when_invoke_with_parameter(String methodName, String parameter1Name, String parameter2Name, String parameter3Name) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ String[] parts1 = parameter1Name.split("\\.");
+ Object parameter1 = getObject(parts1);
+
+ String[] parts2 = parameter2Name.split("\\.");
+ Object parameter2 = getObject(parts2);
+
+ String[] parts3 = parameter3Name.split("\\.");
+ Object parameter3 = getObject(parts3);
+
+ return when_invoke_with_parameter_values(methodName, parameter1, parameter1.getClass().getName(), parameter2, parameter2.getClass().getName(), parameter3, parameter3.getClass().getName());
+ }
+
+ /**
+ * When_invoke_with_parameters_get_result.
+ *
+ * @param methodName the method name
+ * @param parameter1Name the parameter1 name
+ * @param parameter2Name the parameter2 name
+ * @param resultName the result name
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @When("^I invoke \"([^\"]*)\" with parameters \"([^\"]*)\" and \"([^\"]*)\" I get the result into \"([^\"]*)\"$")
+ public void when_invoke_with_parameters_get_result(String methodName, String parameter1Name, String parameter2Name, String resultName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ objects.put(resultName, when_invoke_with_parameter(methodName, parameter1Name, parameter2Name));
+ }
+
+ /**
+ * Then_invoke_with_parameter_of_type.
+ *
+ * @param methodName the method name
+ * @param parameter the parameter
+ * @param parameterType the parameter type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws SecurityException the security exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @Then("^invoke \"([^\"]*)\" with parameter \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public Object then_invoke_with_parameter_of_type(String methodName, Object parameter, String parameterType) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, SecurityException, ClassNotFoundException {
+ String[] parts = methodName.split("\\.");
+ Object object = getObject(parts);
+ Object parameterObject = objects.get(parameter);
+ Method method = object.getClass().getMethod(TextUtility.ToCamelCase(parts[parts.length - 1]), TextUtility.getJavaType(parameterType));
+ return method.invoke(object, parameterObject);
+ }
+
+ /**
+ * Then_invoke_with_parameter_value.
+ *
+ * @param methodName the method name
+ * @param parameter the parameter
+ * @param parameterType the parameter type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @Then("^invoke \"([^\"]*)\" with parameter value \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public Object then_invoke_with_parameter_value(String methodName, Object parameter, String parameterType) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ return when_invoke_with_parameter_converted_value(methodName, parameter, parameterType);
+ }
+
+ /**
+ * I_invoke_with_parameter_values_of_type_and_of_type_ i_get_the_result_into.
+ *
+ * @param methodName the method name
+ * @param parameter1 the parameter1
+ * @param parameter1Type the parameter1 type
+ * @param parameter2 the parameter2
+ * @param parameter2Type the parameter2 type
+ * @param resultName the result name
+ * @throws Throwable the throwable
+ */
+ @When("^I invoke \"([^\"]*)\" with parameter values \"([^\"]*)\" of type \"([^\"]*)\" and \"([^\"]*)\" of type \"([^\"]*)\" I get the result into \"([^\"]*)\"$")
+ public void I_invoke_with_parameter_values_of_type_and_of_type_I_get_the_result_into(String methodName, String parameter1, String parameter1Type, String parameter2, String parameter2Type, String resultName) throws Throwable {
+ objects.put(resultName, when_invoke_with_parameter_values(methodName, TextUtility.convertStringTo(parameter1, parameter1Type), parameter1Type, TextUtility.convertStringTo(parameter2, parameter2Type), parameter2Type));
+ }
+
+ /**
+ * Then_invoke_with_parameter_values.
+ *
+ * @param methodName the method name
+ * @param parameter1 the parameter1
+ * @param parameter1Type the parameter1 type
+ * @param parameter2 the parameter2
+ * @param parameter2Type the parameter2 type
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @Then("^invoke \"([^\"]*)\" with parameter values \"([^\"]*)\" of type \"([^\"]*)\" and \"([^\"]*)\" of type \"([^\"]*)\"$")
+ public Object then_invoke_with_parameter_values(String methodName, Object parameter1, String parameter1Type, Object parameter2, String parameter2Type) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
+ return when_invoke_with_parameter_values(methodName, parameter1, parameter1Type, parameter2, parameter2Type);
+ }
+
+ /**
+ * Gets the object.
+ *
+ * @param parts the parts
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ private Object getObject(String[] parts) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ if (objects.containsKey(parts[0])) {
+ Object object = objects.get(parts[0]);
+
+ String[] memberParts = Arrays.copyOfRange(parts, 1, parts.length);
+ return getObject(object, memberParts);
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets the object.
+ *
+ * @param parent the parent
+ * @param parts the parts
+ * @return the object
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ */
+ private Object getObject(Object parent, String[] parts) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ for (int i = 0; i < (parts.length - 1); i++) {
+ if (parts[i].endsWith("]")) {
+ String propertyName = parts[i].substring(0, parts[i].lastIndexOf("["));
+ Method method = parent.getClass().getMethod("get" + TextUtility.ToPascalCase(propertyName));
+ parent = method.invoke(parent);
+
+ int index = Integer.parseInt(parts[i].substring(parts[i].lastIndexOf("[") + 1, parts[i].length() - 1));
+ Method indexMethod = parent.getClass().getMethod("get", int.class);
+ parent = indexMethod.invoke(parent, index);
+ }
+ else {
+ Method method = parent.getClass().getMethod("get" + TextUtility.ToPascalCase(parts[i]));
+ parent = method.invoke(parent);
+ }
+ }
+
+ return parent;
+ }
+
+ /**
+ * Creates the configuration.
+ *
+ * @return the configuration
+ * @throws Exception the exception
+ */
+ protected static Configuration createConfiguration() throws Exception {
+ String baseUri = System.getenv(ManagementConfiguration.URI);
+ return ManagementConfiguration.configure(
+ baseUri != null ? new URI(baseUri) : null,
+ System.getenv(ManagementConfiguration.SUBSCRIPTION_ID),
+ System.getenv(ManagementConfiguration.KEYSTORE_PATH),
+ System.getenv(ManagementConfiguration.KEYSTORE_PASSWORD),
+ KeyStoreType.fromString(System.getenv(ManagementConfiguration.KEYSTORE_TYPE))
+ );
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/test/java/com/microsoft/windowsazure/RunCukesTest.java b/core-test/src/test/java/com/microsoft/windowsazure/RunCukesTest.java
new file mode 100644
index 0000000000000..e6f4dd10363d3
--- /dev/null
+++ b/core-test/src/test/java/com/microsoft/windowsazure/RunCukesTest.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.microsoft.windowsazure;
+
+import cucumber.api.junit.Cucumber;
+import cucumber.api.CucumberOptions;
+
+import org.junit.runner.RunWith;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(format = {"html:target/cucumber-html-report", "json:target/cucumber-json-report.json"})
+public class RunCukesTest {
+}
\ No newline at end of file
diff --git a/core-test/src/test/java/com/microsoft/windowsazure/TextUtility.java b/core-test/src/test/java/com/microsoft/windowsazure/TextUtility.java
new file mode 100644
index 0000000000000..91b823482ea2d
--- /dev/null
+++ b/core-test/src/test/java/com/microsoft/windowsazure/TextUtility.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.microsoft.windowsazure;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Calendar;
+
+import javax.xml.bind.DatatypeConverter;
+
+import com.microsoft.windowsazure.management.websites.models.WebSiteCreateParameters;
+
+public final class TextUtility
+{
+ public static String ToPascalCase(String input)
+ {
+ return input.substring(0, 1).toUpperCase() +
+ input.substring(1);
+ }
+
+ public static String ToCamelCase(String input)
+ {
+ return input.substring(0, 1).toLowerCase() +
+ input.substring(1);
+ }
+
+ public static Object convertStringTo(String input, String type) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException
+ {
+ if (input.equals("null"))
+ {
+ return null;
+ }
+
+ if (type.equals("System.Int32"))
+ {
+ return DatatypeConverter.parseInt(input);
+ }
+ else if (type.equals("System.String"))
+ {
+ return input;
+ }
+ else if (type.equals("System.DateTime"))
+ {
+ if (input.equals("DateTime.Now"))
+ {
+ return Calendar.getInstance();
+ }
+
+ return DatatypeConverter.parseDateTime(input);
+ }
+ else if (Enum.class.isAssignableFrom(getJavaType(type)))
+ {
+ Class> enumType = getJavaType(type);
+ Method method = enumType.getMethod("valueOf", String.class);
+ return method.invoke(null, input);
+ }
+ else
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public static Class> getJavaType(String csharpType) throws ClassNotFoundException
+ {
+ if (csharpType.equals("System.Int32"))
+ {
+ return int.class;
+ }
+ else if (csharpType.equals("System.String"))
+ {
+ return String.class;
+ }
+ else if (csharpType.equals("System.DateTime"))
+ {
+ return Calendar.class;
+ }
+ else if (csharpType.equals("Microsoft.WindowsAzure.Management.WebSites.Models.WebSiteCreateParameters.WebSpaceDetails"))
+ {
+ return WebSiteCreateParameters.WebSpaceDetails.class;
+ }
+ else
+ {
+ return Class.forName(csharpType
+ .replace("Microsoft.WindowsAzure.Management",
+ "com.microsoft.windowsazure.management")
+ .replace(".Models", ".models")
+ .replace(".WebSites.", ".websites.")
+ .replace(".Sql.", ".sql.")
+ .replace(".Storage.", ".storage."));
+ }
+ }
+}
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/affinitygroups.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/affinitygroups.feature
new file mode 100644
index 0000000000000..19529d7726e4a
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/affinitygroups.feature
@@ -0,0 +1,41 @@
+Feature: Affinity groups should work
+
+Background:
+ Given I create a "ManagementClient" with name "management"
+
+Scenario: Create an AffinityGroup
+ Given I create a "Microsoft.WindowsAzure.Management.Models.AffinityGroupCreateParameters" with name "parameters"
+ And I create a "10" character random String with name "testAffinityGroupName1" and prefix "azure-java-test-"
+ And set "parameters.Name" with "testAffinityGroupName1" of type "System.String"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.Label" with value "Great AF" of type "System.String"
+ When I invoke "management.AffinityGroupsOperations.Create" with parameter "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "201"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ Then invoke "management.AffinityGroupsOperations.Delete" with parameter "testAffinityGroupName1" of type "System.String"
+
+Scenario: Get an AffinityGroup
+ Given I create a "Microsoft.WindowsAzure.Management.Models.AffinityGroupCreateParameters" with name "parameters"
+ And I create a "10" character random String with name "testAffinityGroupName2" and prefix "azure-java-test-"
+ And set "parameters.Name" with "testAffinityGroupName2" of type "System.String"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.Label" with value "Great AF2" of type "System.String"
+ And I invoke "management.AffinityGroupsOperations.Create" with parameter "parameters"
+ When I invoke "management.AffinityGroupsOperations.Get" with parameter value "AF2" of type "System.String" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ Then invoke "management.AffinityGroupsOperations.Delete" with parameter "testAffinityGroupName2" of type "System.String"
+
+Scenario: List AffinityGroups
+ Given I create a "Microsoft.WindowsAzure.Management.Models.AffinityGroupCreateParameters" with name "parameters"
+ And I create a "10" character random String with name "testAffinityGroupName3" and prefix "azure-java-test-"
+ And set "parameters.Name" with "testAffinityGroupName3" of type "System.String"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.Label" with value "Great AF3" of type "System.String"
+ And I invoke "management.AffinityGroupsOperations.Create" with parameter "parameters"
+ When I invoke "management.AffinityGroupsOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element" with value from list "operationResponse.AffinityGroups" where "Name" of type "System.String" equals "AF3"
+ And property with type "System.String" and path "element.Name" should equal "AF3"
+ Then invoke "management.AffinityGroupsOperations.Delete" with parameter "testAffinityGroupName3" of type "System.String"
\ No newline at end of file
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/certificates.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/certificates.feature
new file mode 100644
index 0000000000000..7db12600fc7b0
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/certificates.feature
@@ -0,0 +1,9 @@
+Feature: Management Certificates should work
+
+Background:
+ Given I create a "ManagementClient" with name "management"
+
+Scenario: Get a Certificate
+ When I invoke "management.ManagementCertificatesOperations.Get" with parameter value "00EC75B90F4F59F172C3C321C150FE7E79FC29AB" of type "System.String" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
\ No newline at end of file
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/locations.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/locations.feature
new file mode 100644
index 0000000000000..5ecef17e5660f
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/locations.feature
@@ -0,0 +1,13 @@
+Feature: Locations should work
+
+Background:
+ Given I create a "ManagementClient" with name "management"
+
+Scenario: List Locations
+ When I invoke "management.LocationsOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element1" with value from list "operationResponse.Locations" where "Name" of type "System.String" equals "Southeast Asia"
+ And property with type "System.String" and path "element1.Name" should equal "Southeast Asia"
+ And set "element2" with value from list "operationResponse.Locations" where "Name" of type "System.String" equals "East Asia"
+ And property with type "System.String" and path "element2.Name" should equal "East Asia"
\ No newline at end of file
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/sql/sql.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/sql/sql.feature
new file mode 100644
index 0000000000000..bc9a155ae557f
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/sql/sql.feature
@@ -0,0 +1,47 @@
+Feature: SqlServer should work
+
+Background:
+ Given I create a "SqlManagementClient" with name "management"
+
+Scenario: Create SQL Server
+ Given I create a "Microsoft.WindowsAzure.Management.Sql.Models.ServerCreateParameters" with name "parameters"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.AdministratorPassword" with value "TestPassword12!" of type "System.String"
+ And set "parameters.AdministratorUserName" with value "testadministrator" of type "System.String"
+ And I invoke "management.ServersOperations.Create" with parameter "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "201"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+
+Scenario: List SQL Server
+ When I invoke "management.ServersOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element1" with value from list "operationResponse.Servers" where "Location" of type "System.String" equals "West US"
+
+Scenario: Create SQL Database
+ Given I invoke "management.ServersOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element1" with value from list "operationResponse.Servers" where "Location" of type "System.String" equals "West US"
+ And set "serverName" with value from path "element1.Name" of type "System.String"
+ When I create a "Microsoft.WindowsAzure.Management.Sql.Models.DatabaseCreateParameters" with name "parameters"
+ And set "parameters.MaximumDatabaseSizeInGB" with value "1" of type "System.Int32"
+ And set "parameters.Name" with value "expecteddatabasename" of type "System.String"
+ And set "parameters.CollationName" with value "SQL_Latin1_General_CP1_CI_AS" of type "System.String"
+ And set "parameters.Edition" with value "Web" of type "System.String"
+ And I invoke "management.DatabasesOperations.Create" with parameters "serverName" and "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "201"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+
+Scenario: Delete SQL Server
+ Given I invoke "management.ServersOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element1" with value from list "operationResponse.Servers" where "Location" of type "System.String" equals "West US"
+ And set "serverName" with value from path "element1.Name" of type "System.String"
+ And I create a "System.String" with name "param1"
+ And set "param1" with value "expecteddatabasename" of type "System.String"
+ When I invoke "management.DatabasesOperations.Delete" with parameters "serverName" and "param1" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+
\ No newline at end of file
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/storage/storageservice.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/storage/storageservice.feature
new file mode 100644
index 0000000000000..647a063286ce6
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/storage/storageservice.feature
@@ -0,0 +1,40 @@
+Feature: Managing Storage accounts
+
+Background:
+ Given I create a "StorageManagementClient" with name "management"
+
+Scenario: Create, List and Delete a storage account
+ Given I create a "Microsoft.WindowsAzure.Management.Storage.Models.StorageAccountCreateParameters" with name "parameters"
+ And I create a "10" character random String with name "testStorageAccountName1" and prefix "azurejavatest"
+ And set "parameters.Name" with "testStorageAccountName1" of type "System.String"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.Description" with value "Hi there" of type "System.String"
+ And set "parameters.Label" with value "Great St account" of type "System.String"
+ When I invoke "management.StorageAccountsOperations.Create" with parameter "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+
+Scenario: List a storage account
+ Given I create a "Microsoft.WindowsAzure.Management.Storage.Models.StorageAccountCreateParameters" with name "parameters"
+ And I create a "10" character random String with name "testStorageAccountName2" and prefix "azurejavatest"
+ And set "parameters.Name" with "testStorageAccountName2" of type "System.String"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.Description" with value "Hi there" of type "System.String"
+ And set "parameters.Label" with value "Great St account" of type "System.String"
+ When I invoke "management.StorageAccountsOperations.Create" with parameter "parameters" I get the result into "operationResponse"
+ When I invoke "management.StorageAccountsOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element" with value from list "operationResponse.StorageAccounts" where "Name" of type "System.String" equals parameter "testStorageAccountName2"
+ And property with type "System.String" and path "element.Name" should equal parameter "testStorageAccountName2"
+
+Scenario: Delete storage account
+ Given I create a "Microsoft.WindowsAzure.Management.Storage.Models.StorageAccountCreateParameters" with name "parameters"
+ And I create a "10" character random String with name "testStorageAccountName3" and prefix "azurejavatest"
+ And set "parameters.Name" with "testStorageAccountName3" of type "System.String"
+ And set "parameters.Location" with value "West US" of type "System.String"
+ And set "parameters.Description" with value "Hi there" of type "System.String"
+ And set "parameters.Label" with value "Great St account" of type "System.String"
+ When I invoke "management.StorageAccountsOperations.Create" with parameter "parameters" I get the result into "operationResponse"
+ When I invoke "management.StorageAccountsOperations.Delete" with parameter "testStorageAccountName3" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
\ No newline at end of file
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/subscriptions.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/subscriptions.feature
new file mode 100644
index 0000000000000..2ae1bfb73b821
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/subscriptions.feature
@@ -0,0 +1,12 @@
+Feature: Subscriptions should work
+
+Background:
+ Given I create a "ManagementClient" with name "management"
+
+Scenario: List subscription operations with start and end time
+ Given I create a "Microsoft.WindowsAzure.Management.Models.SubscriptionListOperationsParameters" with name "parameters"
+ And set "parameters.StartTime" with value "DateTime.Now" of type "System.DateTime"
+ And set "parameters.EndTime" with value "DateTime.Now" of type "System.DateTime"
+ When I invoke "management.SubscriptionsOperations.ListOperations" with parameter "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
\ No newline at end of file
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/serverfarm.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/serverfarm.feature
new file mode 100644
index 0000000000000..68fd521b64f6e
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/serverfarm.feature
@@ -0,0 +1,24 @@
+Feature: ServerFarm should work
+
+Background:
+ Given I create a "WebSiteManagementClient" with name "management"
+
+Scenario: Create Server Farm
+ Given I create a "Microsoft.WindowsAzure.Management.WebSites.Models.ServerFarmCreateParameters" with name "parameters"
+ And set "parameters.NumberOfWorkers" with value "1" of type "System.Int32"
+ And set "parameters.WorkerSize" with value "Small" of type "Microsoft.WindowsAzure.Management.WebSites.Models.ServerFarmWorkerSize"
+ And I create a "System.String" with name "param1"
+ And set "param1" with value "eastuswebspace" of type "System.String"
+ And I invoke "management.ServerFarmsOperations.Create" with parameters "param1" and "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+
+Scenario: List Server Farm
+ When I invoke "management.ServerFarmsOperations.List" with parameter value "eastuswebspace" of type "System.String" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+
+Scenario: Delete Server Farm
+ When I invoke "management.ServerFarmsOperations.Delete" with parameter value "eastuswebspace" of type "System.String" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/website.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/website.feature
new file mode 100644
index 0000000000000..af11ca684520f
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/website.feature
@@ -0,0 +1,40 @@
+Feature: WebSite should work
+
+Background:
+ Given I create a "WebSiteManagementClient" with name "management"
+
+Scenario: Create WebSite
+ Given I create a "Microsoft.WindowsAzure.Management.WebSites.Models.WebSiteCreateParameters" with name "parameters"
+ And set "webspace" with value "eastuswebspace" of type "System.String"
+ And I create a "10" character random String with name "testWebSiteName1" and prefix "azurejavatest"
+ And set "parameters.Name" with "testWebSiteName1" of type "System.String"
+ And set "parameters.WebSpaceName" with value "eastuswebspace" of type "System.String"
+ And I create a "Microsoft.WindowsAzure.Management.WebSites.Models.WebSiteCreateParameters.WebSpaceDetails" with name "webSpaceObj"
+ And set "webSpaceObj.Name" with value "eastuswebspace" of type "System.String"
+ And set "webSpaceObj.GeoRegion" with value "East US" of type "System.String"
+ And set "webSpaceObj.Plan" with value "VirtualDedicatedPlan" of type "System.String"
+ And set "parameters.WebSpace" with "webSpaceObj" of type "Microsoft.WindowsAzure.Management.WebSites.Models.WebSiteCreateParameters.WebSpaceDetails"
+ And I create a "System.String" with name "param1"
+ And set "param1" with value "eastuswebspace" of type "System.String"
+ And I invoke "management.WebSitesOperations.Create" with parameters "param1" and "parameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And I create a "Microsoft.WindowsAzure.Management.WebSites.Models.WebSiteDeleteParameters" with name "deleteParameters"
+ When I invoke "management.WebSitesOperations.Delete" with parameters "webspace" and "testWebSiteName1" and "deleteParameters"
+
+Scenario: List websites
+ When I invoke "management.WebSpacesOperations.ListWebSites" with parameter values "eastuswebspace" of type "System.String" and "null" of type "Microsoft.WindowsAzure.Management.WebSites.Models.WebSiteListParameters" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element1" with value from list "operationResponse.WebSites" where "Name" of type "System.String" equals "newtstsite"
+ And property with type "System.String" and path "element1.Name" should equal "newtstsite"
+
+Scenario: Create repository
+ When I invoke "management.WebSitesOperations.CreateRepository" with parameter values "eastuswebspace" of type "System.String" and "newtstsite" of type "System.String" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+
+Scenario: Generate password
+ When I invoke "management.WebSitesOperations.GeneratePassword" with parameter values "eastuswebspace" of type "System.String" and "newtstsite" of type "System.String" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
diff --git a/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/webspace.feature b/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/webspace.feature
new file mode 100644
index 0000000000000..4e27290d5efbd
--- /dev/null
+++ b/core-test/src/test/resources/com/microsoft/windowsazure/management/websites/webspace.feature
@@ -0,0 +1,12 @@
+Feature: WebSpace should work
+
+Background:
+ Given I create a "WebSiteManagementClient" with name "management"
+
+Scenario: List webspaces
+ When I invoke "management.WebSpacesOperations.List" I get the result into "operationResponse"
+ Then property with type "System.Int32" and path "operationResponse.StatusCode" should equal "200"
+ And property with type "System.String" and path "operationResponse.RequestId" should not equal "null"
+ And set "element1" with value from list "operationResponse.WebSpaces" where "GeoRegion" of type "System.String" equals "East US"
+ And property with type "System.String" and path "element1.GeoRegion" should equal "East US"
+ And property with type "System.String" and path "element1.Name" should equal "destanko-EastUSwebspace"
diff --git a/core/pom.xml b/core/pom.xml
new file mode 100644
index 0000000000000..16ca199a30500
--- /dev/null
+++ b/core/pom.xml
@@ -0,0 +1,223 @@
+
+
+ 4.0.0
+
+ com.microsoft.windowsazure
+ microsoft-azure-api-parent
+ 0.5.0
+ ../parent/pom.xml
+
+
+ microsoft-azure-api-core
+ jar
+
+ Microsoft Azure Core Client API
+ API for Microsoft Azure Clients
+ https://github.com/Azure/azure-sdk-for-java
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ scm:git:https://github.com/Azure/azure-sdk-for-java
+ scm:git:git://github.com/Azure/azure-sdk-for-java.git
+
+
+
+ UTF-8
+
+
+
+
+
+ microsoft
+ Microsoft
+
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ javax.xml.bind
+ jaxb-api
+ provided
+
+
+ javax.mail
+ mail
+
+
+ javax.inject
+ javax.inject
+
+
+ com.sun.jersey
+ jersey-client
+
+
+ com.sun.jersey
+ jersey-json
+
+
+ org.bouncycastle
+ bcprov-jdk16
+
+
+
+
+ org.hamcrest
+ hamcrest-all
+ test
+
+
+ org.mockito
+ mockito-all
+ test
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-help-plugin
+ 2.1.1
+
+
+ validate
+
+ evaluate
+
+
+ legal
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.6
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.8
+
+ *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage
+ /**
+ * Copyright Microsoft Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */]]>
+
+
+
+
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-help-plugin
+ [2.1.1,)
+
+ evaluate
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.4.3
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+
+ **/Test*.java
+ **/*Test.java
+ **/*Tests.java
+ **/*TestCase.java
+
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ emma-maven-plugin
+ 1.0-alpha-3
+ true
+
+
+ org.codehaus.mojo
+ surefire-report-maven-plugin
+ 2.0-beta-1
+ true
+
+
+
+
diff --git a/core/src/main/java/com/microsoft/windowsazure/Configuration.java b/core/src/main/java/com/microsoft/windowsazure/Configuration.java
new file mode 100644
index 0000000000000..101722a62328f
--- /dev/null
+++ b/core/src/main/java/com/microsoft/windowsazure/Configuration.java
@@ -0,0 +1,135 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.microsoft.windowsazure;
+
+import com.microsoft.windowsazure.core.Builder;
+import com.microsoft.windowsazure.core.DefaultBuilder;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class Configuration {
+ /**
+ * Property name for socket connection timeout used by services created with
+ * this configuration.
+ */
+ public static final String PROPERTY_CONNECT_TIMEOUT = "com.microsoft.windowsazure.Configuration.connectTimeout";
+
+ /**
+ * Property name for socket read timeout used by services created with this
+ * configuration.
+ */
+ public static final String PROPERTY_READ_TIMEOUT = "com.microsoft.windowsazure.Configuration.readTimeout";
+
+ /**
+ * Property name to control if HTTP logging to console is on or off. If
+ * property is set, logging is on, regardless of value.
+ */
+ public static final String PROPERTY_LOG_HTTP_REQUESTS = "com.microsoft.windowsazure.Configuration.logHttpRequests";
+
+ /**
+ * The configuration instance.
+ */
+ private static Configuration instance;
+
+ /**
+ * The configuration properties.
+ */
+ private final Map properties;
+
+ /**
+ * The builder.
+ */
+ private final Builder builder;
+
+ private static Log log = LogFactory.getLog(Configuration.class);
+
+ public Configuration() {
+ this.properties = new HashMap();
+ this.builder = DefaultBuilder.create();
+ }
+
+ public Configuration(Builder builder) {
+ this.properties = new HashMap();
+ this.builder = builder;
+ }
+
+ public static Configuration getInstance() {
+ if (instance == null) {
+ try {
+ instance = Configuration.load();
+ } catch (IOException e) {
+ log.error(
+ "Unable to load META-INF/com.microsoft.windowsazure.properties",
+ e);
+ instance = new Configuration();
+ }
+ }
+ return instance;
+ }
+
+ public static void setInstance(final Configuration configuration) {
+ Configuration.instance = configuration;
+ }
+
+ public static Configuration load() throws IOException {
+ final Configuration config = new Configuration();
+
+ final InputStream stream = Thread
+ .currentThread()
+ .getContextClassLoader()
+ .getResourceAsStream(
+ "META-INF/com.microsoft.windowsazure.properties");
+ if (stream != null) {
+ final Properties properties = new Properties();
+ properties.load(stream);
+ for (Map.Entry