Repository: jclouds-labs
Updated Branches:
  refs/heads/master 89cb6f0f7 -> 28c56e067


separate the DeploymentToVMDeployment to a function

- refactor logback-test.xml
- change jsonBall to Value


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/28c56e06
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/28c56e06
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/28c56e06

Branch: refs/heads/master
Commit: 28c56e0673fb5b24334eba451a7349313e0433aa
Parents: 89cb6f0
Author: Andrea Turli <andrea.tu...@gmail.com>
Authored: Thu Aug 11 10:52:27 2016 +0200
Committer: Andrea Turli <andrea.tu...@gmail.com>
Committed: Wed Sep 21 16:32:43 2016 +0200

----------------------------------------------------------------------
 .../arm/compute/AzureComputeServiceAdapter.java | 172 ++++++-------------
 .../functions/DeploymentToVMDeployment.java     | 121 +++++++++++++
 .../azurecompute/arm/domain/Deployment.java     |  14 +-
 .../jclouds/azurecompute/arm/domain/Value.java  |  42 +++++
 .../azurecompute/arm/util/BlobHelper.java       |   6 +-
 .../src/test/resources/logback-test.xml         |  64 ++++---
 6 files changed, 262 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/28c56e06/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
index 82b792c..3941ebc 100644
--- 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
+++ 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
@@ -16,11 +16,8 @@
  */
 package org.jclouds.azurecompute.arm.compute;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import javax.annotation.Resource;
@@ -30,33 +27,32 @@ import javax.inject.Singleton;
 
 import org.jclouds.azurecompute.arm.AzureComputeApi;
 import 
org.jclouds.azurecompute.arm.compute.config.AzureComputeServiceContextModule.AzureComputeConstants;
+import org.jclouds.azurecompute.arm.compute.functions.DeploymentToVMDeployment;
 import org.jclouds.azurecompute.arm.compute.functions.VMImageToImage;
 import org.jclouds.azurecompute.arm.domain.Deployment;
 import org.jclouds.azurecompute.arm.domain.DeploymentBody;
 import org.jclouds.azurecompute.arm.domain.DeploymentProperties;
-import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCard;
-import org.jclouds.azurecompute.arm.domain.ResourceProviderMetaData;
-import org.jclouds.azurecompute.arm.domain.StorageService;
-import org.jclouds.azurecompute.arm.domain.VMImage;
-import org.jclouds.azurecompute.arm.domain.VMHardware;
 import org.jclouds.azurecompute.arm.domain.Location;
 import org.jclouds.azurecompute.arm.domain.Offer;
-import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
+import org.jclouds.azurecompute.arm.domain.ResourceProviderMetaData;
 import org.jclouds.azurecompute.arm.domain.SKU;
+import org.jclouds.azurecompute.arm.domain.StorageService;
 import org.jclouds.azurecompute.arm.domain.VMDeployment;
 import org.jclouds.azurecompute.arm.domain.VMSize;
 import org.jclouds.azurecompute.arm.domain.Version;
-import org.jclouds.azurecompute.arm.domain.VirtualMachine;
-import org.jclouds.azurecompute.arm.domain.VirtualMachineInstance;
+import org.jclouds.azurecompute.arm.domain.VMHardware;
+import org.jclouds.azurecompute.arm.domain.VMImage;
+import org.jclouds.azurecompute.arm.domain.Value;
 import org.jclouds.azurecompute.arm.features.DeploymentApi;
 import org.jclouds.azurecompute.arm.features.OSImageApi;
-import org.jclouds.azurecompute.arm.util.BlobHelper;
 import org.jclouds.azurecompute.arm.functions.CleanupResources;
+import org.jclouds.azurecompute.arm.util.BlobHelper;
 import org.jclouds.azurecompute.arm.util.DeploymentTemplateBuilder;
 import org.jclouds.compute.ComputeServiceAdapter;
 import org.jclouds.compute.domain.Template;
 import org.jclouds.compute.reference.ComputeServiceConstants;
 import org.jclouds.domain.LoginCredentials;
+import org.jclouds.json.Json;
 import org.jclouds.location.reference.LocationConstants;
 import org.jclouds.logging.Logger;
 import org.jclouds.providers.ProviderMetadata;
@@ -90,17 +86,16 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
    @Resource
    @Named(ComputeServiceConstants.COMPUTE_LOGGER)
    private Logger logger = Logger.NULL;
-
+   private final Json json;
    private final AzureComputeApi api;
-
    private final AzureComputeConstants azureComputeConstants;
-
    private final ProviderMetadata providerMetadata;
+   private final DeploymentToVMDeployment deploymentToVMDeployment;
 
    @Inject
    AzureComputeServiceAdapter(final AzureComputeApi api, final 
AzureComputeConstants azureComputeConstants,
-                              CleanupResources cleanupResources, 
ProviderMetadata providerMetadata) {
-
+                              CleanupResources cleanupResources, Json json, 
ProviderMetadata providerMetadata, DeploymentToVMDeployment 
deploymentToVMDeployment) {
+      this.json = json;
       this.api = api;
       this.azureComputeConstants = azureComputeConstants;
       this.azureGroup = azureComputeConstants.azureResourceGroup();
@@ -109,6 +104,7 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
 
       this.cleanupResources = cleanupResources;
       this.providerMetadata = providerMetadata;
+      this.deploymentToVMDeployment = deploymentToVMDeployment;
    }
 
    @Override
@@ -153,12 +149,8 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
          destroyNode(name);
          throw new IllegalStateException(illegalStateExceptionMessage);
       }
-
       final VMDeployment deployment = deployments.iterator().next();
-
-
-      NodeAndInitialCredentials<VMDeployment> credential = null;
-
+      NodeAndInitialCredentials<VMDeployment> credential;
       if (template.getOptions().getPublicKey() != null){
          String privateKey = template.getOptions().getPrivateKey();
          credential = new NodeAndInitialCredentials<VMDeployment>(deployment, 
name,
@@ -167,7 +159,6 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
          credential = new NodeAndInitialCredentials<VMDeployment>(deployment, 
name,
                  
LoginCredentials.builder().user(loginUser).password(loginPassword).authenticateSudo(true).build());
       }
-
       return credential;
    }
 
@@ -288,7 +279,7 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
 
    @Override
    public Iterable<Location> listLocations() {
-      final Iterable<String> whiteListZoneName = findWhiteListOfRegions();
+      final Iterable<String> whiteListedRegionNames = findWhiteListOfRegions();
 
       final Iterable<String> vmLocations = 
FluentIterable.from(api.getResourceProviderApi().get("Microsoft.Compute"))
               .filter(new Predicate<ResourceProviderMetaData>() {
@@ -314,7 +305,7 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
               .filter(new Predicate<Location>() {
                  @Override
                  public boolean apply(Location location) {
-                    return whiteListZoneName == null ? true : 
Iterables.contains(whiteListZoneName, location.name());
+                    return whiteListedRegionNames == null ? true : 
Iterables.contains(whiteListedRegionNames, location.name());
                  }
               })
               .toList();
@@ -322,27 +313,14 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
       return locations;
    }
 
-   private Iterable<String> findWhiteListOfRegions() {
-      if 
(providerMetadata.getDefaultProperties().get(LocationConstants.PROPERTY_REGIONS)
 == null)  return null;
-      return Splitter.on(",").trimResults().split((CharSequence) 
providerMetadata.getDefaultProperties().get(LocationConstants.PROPERTY_REGIONS));
-   }
-
-   private String getResourceGroupFromId(String id) {
-      String searchStr = "/resourceGroups/";
-      int indexStart = id.lastIndexOf(searchStr) + searchStr.length();
-      searchStr = "/providers/";
-      int indexEnd = id.lastIndexOf(searchStr);
-
-      String resourceGroup = id.substring(indexStart, indexEnd);
-      return resourceGroup;
-   }
-
    @Override
    public VMDeployment getNode(final String id) {
       Deployment deployment = api.getDeploymentApi(azureGroup).get(id);
-      if (deployment == null)
-         return null;
-      return convertDeploymentToVMDeployment(deployment);
+      if (deployment == null) return null;
+      if (new 
IsDeploymentInRegions(findWhiteListOfRegions()).apply(deployment)) {
+         return deploymentToVMDeployment.apply(deployment);
+      }
+      return null;
    }
 
    @Override
@@ -365,84 +343,21 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
       api.getVirtualMachineApi(azureGroup).stop(id);
    }
 
-   private List<PublicIPAddress> getIPAddresses(Deployment deployment) {
-      List<PublicIPAddress> list = new ArrayList<PublicIPAddress>();
-      String resourceGroup = getResourceGroupFromId(deployment.id());
-
-      if (deployment.properties() != null && 
deployment.properties().dependencies() != null) {
-         List<Deployment.Dependency> dependencies = 
deployment.properties().dependencies();
-         for (int d = 0; d < dependencies.size(); d++) {
-            if 
(dependencies.get(d).resourceType().equals("Microsoft.Network/networkInterfaces"))
 {
-               List<Deployment.Dependency> dependsOn = 
dependencies.get(d).dependsOn();
-               for (int e = 0; e < dependsOn.size(); e++) {
-                  if 
(dependsOn.get(e).resourceType().equals("Microsoft.Network/publicIPAddresses")) 
{
-                     String resourceName = dependsOn.get(e).resourceName();
-                     PublicIPAddress ip = 
api.getPublicIPAddressApi(resourceGroup).get(resourceName);
-                     list.add(ip);
-                     break;
-                  }
-               }
-            }
-         }
-      }
-      return list;
-   }
-
-   private List<NetworkInterfaceCard> getNetworkInterfaceCards(Deployment 
deployment) {
-      List<NetworkInterfaceCard> result = new 
ArrayList<NetworkInterfaceCard>();
-
-      String resourceGroup = getResourceGroupFromId(deployment.id());
-
-      if (deployment.properties() != null && 
deployment.properties().dependencies() != null) {
-         for (Deployment.Dependency dependency : 
deployment.properties().dependencies()) {
-            if 
(dependency.resourceType().equals("Microsoft.Network/networkInterfaces")) {
-               String resourceName = dependency.resourceName();
-               NetworkInterfaceCard nic = 
api.getNetworkInterfaceCardApi(resourceGroup).get(resourceName);
-               result.add(nic);
-            }
-         }
-      }
-
-      return result;
-   }
-
-   private VMDeployment convertDeploymentToVMDeployment(Deployment deployment) 
{
-      String id = deployment.id();
-      String resourceGroup = getResourceGroupFromId(id);
-
-      List<PublicIPAddress> ipAddressList = getIPAddresses(deployment);
-      List<NetworkInterfaceCard> networkInterfaceCards = 
getNetworkInterfaceCards(deployment);
-      VirtualMachine vm = api.getVirtualMachineApi(azureGroup).get(id);
-      VirtualMachineInstance vmInstanceDetails = 
api.getVirtualMachineApi(azureGroup).getInstanceDetails(id);
-      Map<String, String> userMetaData = null;
-      Iterable<String> tags = null;
-      if (vm != null && vm.tags() != null) {
-         userMetaData = vm.tags();
-         String tagString = userMetaData.get("tags");
-         tags = Arrays.asList(tagString.split(","));
-      }
-      return VMDeployment.create(deployment, ipAddressList, vmInstanceDetails, 
vm, networkInterfaceCards, userMetaData, tags);
-   }
-
    @Override
    public Iterable<VMDeployment> listNodes() {
-      List<Deployment> deployments = api.getDeploymentApi(azureGroup).list();
-
-      List<VMDeployment> vmDeployments = new ArrayList<VMDeployment>();
-      for (Deployment d : deployments){
-         // Check that this vm is not generalized and made to custom image
-         try {
-            String storageAccountName = d.name().replaceAll("[^A-Za-z0-9 ]", 
"") + "stor";
-            String key = 
api.getStorageAccountApi(azureGroup).getKeys(storageAccountName).key1();
-            if (!BlobHelper.customImageExists(storageAccountName, key))
-               vmDeployments.add(convertDeploymentToVMDeployment(d));
-         }
-         catch (Exception e) {
-            // This might happen if there is no custom images but vm is 
generalized. No need to list
-         }
-      }
-
-      return vmDeployments;
+      return FluentIterable.from(api.getDeploymentApi(azureGroup).list())
+              .filter(new IsDeploymentInRegions(findWhiteListOfRegions()))
+              .filter(new Predicate<Deployment>() {
+                 @Override
+                 public boolean apply(Deployment deployment) {
+                    Value storageAccountNameValue = 
deployment.properties().parameters().get("storageAccountName");
+                    String storageAccountName = 
storageAccountNameValue.value();
+                    String key = 
api.getStorageAccountApi(azureGroup).getKeys(storageAccountName).key1();
+                    return !BlobHelper.customImageExists(storageAccountName, 
key);
+                 }
+              })
+              .transform(deploymentToVMDeployment)
+              .toList();
    }
 
    @Override
@@ -455,4 +370,23 @@ public class AzureComputeServiceAdapter implements 
ComputeServiceAdapter<VMDeplo
       });
    }
 
+   private Iterable<String> findWhiteListOfRegions() {
+      if 
(providerMetadata.getDefaultProperties().get(LocationConstants.PROPERTY_REGIONS)
 == null)  return null;
+      return Splitter.on(",").trimResults().split((CharSequence) 
providerMetadata.getDefaultProperties().get(LocationConstants.PROPERTY_REGIONS));
+   }
+
+   private class IsDeploymentInRegions implements Predicate<Deployment> {
+
+      private final Iterable<String> whiteListOfRegions;
+
+      public IsDeploymentInRegions(Iterable<String> whiteListOfRegions) {
+         this.whiteListOfRegions = whiteListOfRegions;
+      }
+
+      @Override
+      public boolean apply(Deployment deployment) {
+         Value locationValue = 
deployment.properties().parameters().get("location");
+         return Iterables.contains(whiteListOfRegions, locationValue.value());
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/28c56e06/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/DeploymentToVMDeployment.java
----------------------------------------------------------------------
diff --git 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/DeploymentToVMDeployment.java
 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/DeploymentToVMDeployment.java
new file mode 100644
index 0000000..31f1a58
--- /dev/null
+++ 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/DeploymentToVMDeployment.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.jclouds.azurecompute.arm.compute.functions;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.azurecompute.arm.AzureComputeApi;
+import 
org.jclouds.azurecompute.arm.compute.config.AzureComputeServiceContextModule;
+import org.jclouds.azurecompute.arm.domain.Deployment;
+import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCard;
+import org.jclouds.azurecompute.arm.domain.PublicIPAddress;
+import org.jclouds.azurecompute.arm.domain.VMDeployment;
+import org.jclouds.azurecompute.arm.domain.VirtualMachine;
+import org.jclouds.azurecompute.arm.domain.VirtualMachineInstance;
+
+import com.google.common.base.Function;
+
+/**
+ * Converts an Deployment into a VMDeployment.
+ */
+@Singleton
+public class DeploymentToVMDeployment implements Function<Deployment, 
VMDeployment> {
+
+   private final AzureComputeServiceContextModule.AzureComputeConstants 
azureComputeConstants;
+
+   private final AzureComputeApi api;
+
+   @Inject
+   DeploymentToVMDeployment(AzureComputeApi api, final 
AzureComputeServiceContextModule.AzureComputeConstants azureComputeConstants) {
+      this.api = api;
+      this.azureComputeConstants = azureComputeConstants;
+   }
+
+   @Override
+   public VMDeployment apply(final Deployment deployment) {
+      String id = deployment.id();
+      List<PublicIPAddress> ipAddressList = getIPAddresses(deployment);
+      List<NetworkInterfaceCard> networkInterfaceCards = 
getNetworkInterfaceCards(deployment);
+      VirtualMachine vm = 
api.getVirtualMachineApi(azureComputeConstants.azureResourceGroup()).get(id);
+      VirtualMachineInstance vmInstanceDetails = 
api.getVirtualMachineApi(azureComputeConstants.azureResourceGroup()).getInstanceDetails(id);
+      Map<String, String> userMetaData = null;
+      Iterable<String> tags = null;
+      if (vm != null && vm.tags() != null) {
+         userMetaData = vm.tags();
+         String tagString = userMetaData.get("tags");
+         tags = Arrays.asList(tagString.split(","));
+      }
+      return VMDeployment.create(deployment, ipAddressList, vmInstanceDetails, 
vm, networkInterfaceCards, userMetaData, tags);
+   }
+
+   private List<PublicIPAddress> getIPAddresses(Deployment deployment) {
+      List<PublicIPAddress> list = new ArrayList<PublicIPAddress>();
+      String resourceGroup = getResourceGroupFromId(deployment.id());
+
+      if (deployment.properties() != null && 
deployment.properties().dependencies() != null) {
+         List<Deployment.Dependency> dependencies = 
deployment.properties().dependencies();
+         for (int d = 0; d < dependencies.size(); d++) {
+            if 
(dependencies.get(d).resourceType().equals("Microsoft.Network/networkInterfaces"))
 {
+               List<Deployment.Dependency> dependsOn = 
dependencies.get(d).dependsOn();
+               for (int e = 0; e < dependsOn.size(); e++) {
+                  if 
(dependsOn.get(e).resourceType().equals("Microsoft.Network/publicIPAddresses")) 
{
+                     String resourceName = dependsOn.get(e).resourceName();
+                     PublicIPAddress ip = 
api.getPublicIPAddressApi(resourceGroup).get(resourceName);
+                     list.add(ip);
+                     break;
+                  }
+               }
+            }
+         }
+      }
+      return list;
+   }
+
+   private String getResourceGroupFromId(String id) {
+      String searchStr = "/resourceGroups/";
+      int indexStart = id.lastIndexOf(searchStr) + searchStr.length();
+      searchStr = "/providers/";
+      int indexEnd = id.lastIndexOf(searchStr);
+
+      String resourceGroup = id.substring(indexStart, indexEnd);
+      return resourceGroup;
+   }
+
+   private List<NetworkInterfaceCard> getNetworkInterfaceCards(Deployment 
deployment) {
+      List<NetworkInterfaceCard> result = new 
ArrayList<NetworkInterfaceCard>();
+
+      String resourceGroup = getResourceGroupFromId(deployment.id());
+
+      if (deployment.properties() != null && 
deployment.properties().dependencies() != null) {
+         for (Deployment.Dependency dependency : 
deployment.properties().dependencies()) {
+            if 
(dependency.resourceType().equals("Microsoft.Network/networkInterfaces")) {
+               String resourceName = dependency.resourceName();
+               NetworkInterfaceCard nic = 
api.getNetworkInterfaceCardApi(resourceGroup).get(resourceName);
+               result.add(nic);
+            }
+         }
+      }
+      return result;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/28c56e06/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Deployment.java
----------------------------------------------------------------------
diff --git 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Deployment.java
 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Deployment.java
index 2fc85bc..be363ec 100644
--- 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Deployment.java
+++ 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Deployment.java
@@ -16,18 +16,18 @@
  */
 package org.jclouds.azurecompute.arm.domain;
 
-import static com.google.common.collect.ImmutableList.copyOf;
-
 import java.util.List;
 import java.util.Map;
 
-import com.google.common.collect.ImmutableMap;
 import org.jclouds.azurecompute.arm.util.GetEnumValue;
 import org.jclouds.domain.JsonBall;
 import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
 
 import com.google.auto.value.AutoValue;
-import org.jclouds.json.SerializedNames;
+import com.google.common.collect.ImmutableMap;
+
+import static com.google.common.collect.ImmutableList.copyOf;
 
 @AutoValue
 public abstract class Deployment {
@@ -186,7 +186,7 @@ public abstract class Deployment {
       public abstract ContentLink templateLink();
 
       @Nullable
-      public abstract Map<String, JsonBall> parameters();
+      public abstract Map<String, Value> parameters();
 
       @Nullable
       public abstract ContentLink parametersLink();
@@ -209,7 +209,7 @@ public abstract class Deployment {
                                                 final List<Dependency> 
dependencies,
                                                 final Map<String, JsonBall> 
template,
                                                 final ContentLink templateLink,
-                                                final Map<String, JsonBall> 
parameters,
+                                                final Map<String, Value> 
parameters,
                                                 final ContentLink 
parametersLink,
                                                 final String mode,
                                                 final String duration,
@@ -222,7 +222,7 @@ public abstract class Deployment {
                                                               dependencies == 
null ? null : copyOf(dependencies),
                                                               template == null 
? ImmutableMap.<String, JsonBall>builder().build() : 
ImmutableMap.copyOf(template),
                                                               templateLink,
-                                                              parameters == 
null ? ImmutableMap.<String, JsonBall>builder().build() : 
ImmutableMap.copyOf(parameters),
+                                                              parameters == 
null ? ImmutableMap.<String, Value>builder().build() : 
ImmutableMap.copyOf(parameters),
                                                               parametersLink,
                                                               mode,
                                                               duration,

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/28c56e06/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Value.java
----------------------------------------------------------------------
diff --git 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Value.java 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Value.java
new file mode 100644
index 0000000..4b0ce0c
--- /dev/null
+++ 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Value.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.jclouds.azurecompute.arm.domain;
+
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class Value {
+
+   /**
+    * The type of the Value
+    */
+   public abstract String type();
+
+   /**
+    * The name of the Value
+    */
+   public abstract String value();
+
+   @SerializedNames({"type", "value"})
+   public static Value create(final String type, final String value) {
+
+      return new AutoValue_Value(type, value);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/28c56e06/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/BlobHelper.java
----------------------------------------------------------------------
diff --git 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/BlobHelper.java
 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/BlobHelper.java
index ee794ec..f5bfc75 100644
--- 
a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/BlobHelper.java
+++ 
b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/BlobHelper.java
@@ -16,6 +16,9 @@
  */
 package org.jclouds.azurecompute.arm.util;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.jclouds.ContextBuilder;
 import org.jclouds.azure.storage.domain.BoundedSet;
 import org.jclouds.azureblob.AzureBlobClient;
@@ -25,9 +28,6 @@ import org.jclouds.azureblob.domain.ListBlobsResponse;
 import org.jclouds.azurecompute.arm.domain.VMImage;
 import org.jclouds.util.Closeables2;
 
-import java.util.ArrayList;
-import java.util.List;
-
 public class BlobHelper {
 
    public static void deleteContainerIfExists(String storage, String key, 
String containerName) {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/28c56e06/azurecompute-arm/src/test/resources/logback-test.xml
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/resources/logback-test.xml 
b/azurecompute-arm/src/test/resources/logback-test.xml
index c823913..cb55d49 100644
--- a/azurecompute-arm/src/test/resources/logback-test.xml
+++ b/azurecompute-arm/src/test/resources/logback-test.xml
@@ -1,34 +1,42 @@
 <?xml version="1.0"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You 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.
-
--->
-<configuration>
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+<configuration scan="false">
+    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+        <file>target/test-data/jclouds.log</file>
+        <encoder>
+            <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+        </encoder>
+    </appender>
+    <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
+        <file>target/test-data/jclouds-wire.log</file>
+        <encoder>
+            <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+        </encoder>
+    </appender>
+    <appender name="COMPUTEFILE" class="ch.qos.logback.core.FileAppender">
+        <file>target/jclouds-compute.log</file>
         <encoder>
-            <pattern>-  %msg%n</pattern>
+            <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
         </encoder>
     </appender>
-    <root level="info">
-        <appender-ref ref="STDOUT"/>
+
+    <logger name="org.jclouds">
+        <level value="DEBUG" />
+        <appender-ref ref="FILE" />
+    </logger>
+    <logger name="jclouds.compute">
+        <level value="DEBUG" />
+        <appender-ref ref="COMPUTEFILE" />
+    </logger>
+    <logger name="jclouds.wire">
+        <level value="DEBUG" />
+        <appender-ref ref="WIREFILE" />
+    </logger>
+    <logger name="jclouds.headers">
+        <level value="DEBUG" />
+        <appender-ref ref="WIREFILE" />
+    </logger>
+
+    <root>
+        <level value="INFO" />
     </root>
-    <logger name="jclouds.compute" level="debug"/>
-    <logger name="net.schmizz" level="warn"/>
-    <logger name="jclouds.wire" level="debug"/>
-    <logger name="jclouds.headers" level="debug"/>
-    <logger name="jclouds.ssh" level="debug"/>
 </configuration>

Reply via email to