Repository: jclouds-labs
Updated Branches:
  refs/heads/master 6e1a0376f -> 590bf3e47


implement OSImageToImage Function

implement OSImageToImage Function

implement OSImageToImage Function

Code Style Changes

chahnge locations list to location

Address test failiures

Address Review Suggestions

Added more tests

Minor changes


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

Branch: refs/heads/master
Commit: 4065bfc72d7f3ff3ba4bb8760aec09eb4727e99d
Parents: 1b689dc
Author: hsbhathiya <[email protected]>
Authored: Mon Dec 15 17:26:49 2014 +0530
Committer: hsbhathiya <[email protected]>
Committed: Sat Jan 10 14:23:32 2015 +0530

----------------------------------------------------------------------
 .../compute/functions/OSImageToImage.java       | 110 ++++++++-
 .../jclouds/azurecompute/domain/OSImage.java    |  12 +-
 .../jclouds/azurecompute/xml/DiskHandler.java   |   2 +-
 .../azurecompute/xml/OSImageHandler.java        |  18 +-
 .../compute/functions/OSImageToImageTest.java   | 233 +++++++++++++++++++
 .../azurecompute/features/DiskApiLiveTest.java  |   5 +-
 .../features/OSImageApiLiveTest.java            |   2 +-
 .../xml/ListOSImagesHandlerTest.java            |  31 ++-
 azurecompute/src/test/resources/images.xml      |  11 +-
 9 files changed, 393 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
 
b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
index 9cd1e70..22d0f1a 100644
--- 
a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
+++ 
b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
@@ -16,15 +16,121 @@
  */
 package org.jclouds.azurecompute.compute.functions;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
 import org.jclouds.azurecompute.domain.OSImage;
 import org.jclouds.compute.domain.Image;
 
 import com.google.common.base.Function;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.location.suppliers.all.JustProvider;
+
+import static com.google.common.base.Preconditions.checkNotNull;
 
 public class OSImageToImage implements Function<OSImage, Image> {
+   private static final String UNRECOGNIZED = "UNRECOGNIZED";
+
+   private static final String UBUNTU = "Ubuntu";
+   private static final String WINDOWS = "Windows";
+   private static final String OPENLOGIC = "openLogic";
+   private static final String CENTOS = "CentOS";
+   private static final String COREOS = "CoreOS";
+   private static final String OPENSUSE = "openSUSE";
+   private static final String SUSE = "SUSE";
+   private static final String SQL_SERVER = "SQL Server";
+   private static final String ORACLE_lINUX = "Orcale Linux";
+
+   private final JustProvider provider;
+
+   @Inject
+   OSImageToImage(JustProvider provider) {
+      this.provider = provider;
+   }
 
    @Override
-   public Image apply(OSImage input) {
-      return null;
+   public Image apply(OSImage image) {
+
+      ImageBuilder builder = new ImageBuilder()
+            .id(image.name())
+            .name(image.label())
+            .description(image.description())
+            .status(Image.Status.AVAILABLE)
+            .uri(image.mediaLink())
+            .providerId(image.name())
+            .location(createLocation(image.location()));
+
+      OperatingSystem.Builder osBuilder = osFamily().apply(image);
+      return builder.operatingSystem(osBuilder.build()).build();
+   }
+
+   private Location createLocation(String input) {
+      if (input != null) {
+         return new 
LocationBuilder().id(input).scope(LocationScope.REGION).description(input).parent(
+               
Iterables.getOnlyElement(provider.get())).metadata(ImmutableMap.<String, 
Object>of("name", input))
+               .build();
+      } else {
+         return null;
+      }
+   }
+
+   public static Function<OSImage, OperatingSystem.Builder> osFamily() {
+      return new Function<OSImage, OperatingSystem.Builder>() {
+         @Override
+         public OperatingSystem.Builder apply(final OSImage image) {
+
+            final String label = image.label();
+            checkNotNull(label, "label");
+            OsFamily family = OsFamily.UNRECOGNIZED;
+
+            if (label.contains(CENTOS))
+               family = OsFamily.CENTOS;
+            else if (label.contains(OPENLOGIC))
+               family = OsFamily.CENTOS;
+            else if (label.contains(SUSE))
+               family = OsFamily.SUSE;
+            else if (label.contains(UBUNTU))
+               family = OsFamily.UBUNTU;
+            else if (label.contains(WINDOWS))
+               family = OsFamily.WINDOWS;
+            else if (label.contains(ORACLE_lINUX))
+               family = OsFamily.OEL;
+
+            String version = UNRECOGNIZED;
+            //ex: CoreOS Alpha -> Alpha
+            if (label.contains(COREOS))
+               version = label.replace("CoreOS ", "");
+               //openSUSE 13.1 -> 13.1
+            else if (label.contains(OPENSUSE))
+               version = label.replace("openSUSE ", "");
+               //SUSE Linux Enterprise Server 11 SP3 (Premium Image) -> 11 
SP3(Premium Image)
+            else if (label.contains(SUSE))
+               version = label.replace("SUSE ", "");
+               //Ubuntu Server 12.04 LTS -> 12.04 LTS
+            else if (label.contains(UBUNTU))
+               version = label.replace("Ubuntu Server ", "");
+            else if (label.contains(SQL_SERVER))
+               version = label;
+            else if (label.contains(CENTOS))
+               version = label;
+            else if (label.contains(WINDOWS))
+               version = label;
+            else if (label.equals(ORACLE_lINUX))
+               version = label;
+            if (family != OsFamily.UNRECOGNIZED) {
+               return OperatingSystem.builder().family(family).version(version)
+                     .description(image.description() + "");
+            } else if (family == OsFamily.UNRECOGNIZED && image.os() == 
OSImage.Type.WINDOWS) {
+               return 
OperatingSystem.builder().family(OsFamily.WINDOWS).version(version)
+                     .description(image.description() + "");
+            }
+            return 
OperatingSystem.builder().family(OsFamily.LINUX).version(version).description(image.description());
+         }
+      };
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java 
b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
index cff6504..e9069a9 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
@@ -37,7 +37,7 @@ public abstract class OSImage {
    public abstract String name();
 
    /** The geo-locations of the image, if the image is not associated with an 
affinity group. */
-   public abstract List<String> locations();
+   @Nullable public abstract String location();
 
    /** The affinity group with which this image is associated, if any. */
    @Nullable public abstract String affinityGroup();
@@ -59,6 +59,9 @@ public abstract class OSImage {
    /** The operating system type of the OS image. */
    public abstract Type os();
 
+
+   //The name of the publisher of the image. All user images have a publisher 
name of User.
+   @Nullable public abstract String publisherName();
    /**
     * The locations of the blob in the blob store in which the media for the 
image is located. The
     * blob locations belongs to a storage account in the subscription 
specified by the
@@ -76,9 +79,10 @@ public abstract class OSImage {
    // Not URI as some providers put non-uri data in, such as riverbed.
    public abstract List<String> eula();
 
-   public static OSImage create(String name, List<String> locations, String 
affinityGroup, String label,
-         String description, String category, Type os, URI mediaLink, int 
logicalSizeInGB, List<String> eula) {
-      return new AutoValue_OSImage(name, locations, affinityGroup, label, 
description, category, os, mediaLink,
+
+   public static OSImage create(String name, String location, String 
affinityGroup, String label,
+         String description, String category, Type os, String publisherName, 
URI mediaLink, int logicalSizeInGB, List<String> eula) {
+      return new AutoValue_OSImage(name, location, affinityGroup, label, 
description, category, os, publisherName, mediaLink,
             logicalSizeInGB, eula);
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java 
b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
index b3ae8c2..eb00d72 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
@@ -74,7 +74,7 @@ final class DiskHandler extends 
ParseSax.HandlerForGeneratedRequestWithResult<Di
       } else if (qName.equals("OS")) {
          String osText = currentOrNull(currentText);
          if (osText != null) {
-            os = 
OSImage.Type.valueOf(currentOrNull(currentText).toUpperCase());
+            os = OSImage.Type.valueOf(osText.toUpperCase());
          }
       } else if (qName.equals("Name")) {
          name = currentOrNull(currentText);

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java 
b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
index c64b69f..ddbbc30 100644
--- 
a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
+++ 
b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
@@ -34,21 +34,23 @@ import com.google.common.collect.Lists;
  */
 final class OSImageHandler extends 
ParseSax.HandlerForGeneratedRequestWithResult<OSImage> {
    private String name;
-   private final List<String> locations = Lists.newArrayList();
+   private String location;
    private String affinityGroup;
    private String label;
    private String category;
    private String description;
    private OSImage.Type os;
+   private String publisherName;
    private URI mediaLink;
    private Integer logicalSizeInGB;
    private final List<String> eulas = Lists.newArrayList();
 
    private final StringBuilder currentText = new StringBuilder();
 
-   @Override public OSImage getResult() {
+   @Override
+   public OSImage getResult() {
       OSImage result = OSImage
-            .create(name, ImmutableList.copyOf(locations), affinityGroup, 
label, description, category, os, mediaLink,
+            .create(name, location, affinityGroup, label, description, 
category, os, publisherName, mediaLink,
                   logicalSizeInGB, ImmutableList.copyOf(eulas));
       resetState(); // handler is called in a loop.
       return result;
@@ -57,10 +59,11 @@ final class OSImageHandler extends 
ParseSax.HandlerForGeneratedRequestWithResult
    private void resetState() {
       name = affinityGroup = label = description = category = null;
       os = null;
+      publisherName = null;
       mediaLink = null;
       logicalSizeInGB = null;
       eulas.clear();
-      locations.clear();
+      location = null;
    }
 
    @Override public void endElement(String ignoredUri, String ignoredName, 
String qName) {
@@ -81,12 +84,11 @@ final class OSImageHandler extends 
ParseSax.HandlerForGeneratedRequestWithResult
       } else if (qName.equals("Category")) {
          category = currentOrNull(currentText);
       } else if (qName.equals("Location")) {
-         String locationField = currentOrNull(currentText);
-         if (locationField != null) {
-            locations.addAll(Splitter.on(';').splitToList(locationField));
-         }
+         location = currentOrNull(currentText);
       } else if (qName.equals("AffinityGroup")) {
          affinityGroup = currentOrNull(currentText);
+      } else if (qName.equals("PublisherName")) {
+         publisherName = currentOrNull(currentText);
       } else if (qName.equals("MediaLink")) {
          String link = currentOrNull(currentText);
          if (link != null) {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
 
b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
new file mode 100644
index 0000000..2d10f1f
--- /dev/null
+++ 
b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
@@ -0,0 +1,233 @@
+/*
+ * 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.azurecompute.domain.OSImage;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.domain.Location;
+import org.jclouds.location.suppliers.all.JustProvider;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "OSImageToImageTest")
+public class OSImageToImageTest {
+   public void testImageTransform() {
+      OSImageToImage imageToImage = new OSImageToImage(new 
JustProvider("azurecompute", Suppliers
+            .ofInstance(URI.create("foo")), ImmutableSet.<String>of()));
+      // OSImage OSImage = createOSImage();
+      for (OSImage OSImage : createOSImage()) {
+         org.jclouds.compute.domain.Image transformed = 
imageToImage.apply(OSImage);
+         OperatingSystem os = OSImageToImage.osFamily().apply(OSImage).build();
+         assertNotNull(OSImage.label());
+         assertNotNull(transformed.getId());
+         assertEquals(transformed.getId(), OSImage.name());
+         assertEquals(transformed.getName(), OSImage.label());
+         assertEquals(transformed.getOperatingSystem().getFamily(), 
os.getFamily());
+         assertEquals(transformed.getOperatingSystem().getVersion(), 
os.getVersion());
+         assertEquals(transformed.getProviderId(), OSImage.name());
+         Location location = transformed.getLocation();
+         if (location != null) {
+            assertEquals(location.getId(), OSImage.location());
+         }
+      }
+   }
+
+   public void testOperatingSystem() {
+      ImmutableList<String> version = ImmutableList.of(
+            "13.1",
+            "12.04 LTS",
+            "Windows Server 2008 R2 SP1, June 2012",
+            "Microsoft SQL Server 2012 Evaluation Edition",
+            "Windows Server 2012 Release Candidate, July 2012",
+            "Windows Server 2008 R2 SP1, July 2012",
+            "OpenLogic CentOS 6.2",
+            "12.1",
+            "Linux Enterprise Server",
+            "RightImage-CentOS-6.4-x64-v13.4"
+      );
+      ImmutableList<OsFamily> osFamily = ImmutableList.of(
+            OsFamily.SUSE,
+            OsFamily.UBUNTU,
+            OsFamily.WINDOWS,
+            OsFamily.WINDOWS,
+            OsFamily.WINDOWS,
+            OsFamily.WINDOWS,
+            OsFamily.CENTOS,
+            OsFamily.SUSE,
+            OsFamily.SUSE,
+            OsFamily.CENTOS
+      );
+
+      List<OSImage> images = createOSImage();
+      for (int i = 0; i < images.size(); i++) {
+         OSImage OSImage = images.get(i);
+         OperatingSystem os = OSImageToImage.osFamily().apply(OSImage).build();
+         assertEquals(os.getFamily(), osFamily.get(i));
+         assertEquals(os.getVersion(), version.get(i));
+      }
+   }
+
+   private static ImmutableList<OSImage> createOSImage() {
+      return ImmutableList.of(
+            OSImage.create(
+                  "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
+                  "Central US", // location
+                  null, // affinityGroup
+                  "openSUSE 13.1", // label
+                  "openSUSE 13.1 brings updated desktop environments and 
software, lot of polishing, a brand new KDE theme, "
+                        + "complete systemd integration and many other 
features.", // description
+                  "MSDN", // category
+                  OSImage.Type.WINDOWS, // os
+                  "SUSE", // publisherName
+                  
URI.create("http://example.blob.core.windows.net/disks/myimage.vhd";), // 
mediaLink
+                  30, // logicalSizeInGB
+                  
Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing";)// eula
+            ),
+            OSImage.create(
+                  
"CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd", 
// name
+                  null, // locations
+                  null, // affinityGroup
+                  "Ubuntu Server 12.04 LTS", // label
+                  "Ubuntu Server 12.04 LTS amd64 20120528 Cloud Image", 
//description
+                  "Canonical", // category
+                  OSImage.Type.LINUX, // os
+                  "Canonical", // publisherName
+                  null, // mediaLink
+                  30, // logicalSizeInGB
+                  
Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing";) // eula
+            ),
+            OSImage.create( //
+                  "MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd", // 
name
+                  "North Europe", // locations
+                  null, // affinityGroup
+                  "Windows Server 2008 R2 SP1, June 2012", // label
+                  "Windows Server 2008 R2 is a multi-purpose server.", 
//description
+                  "Microsoft", // category
+                  OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
+                  
URI.create("http://blobs/disks/mydeployment/MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd";),
+                  // mediaLink
+                  30, // logicalSizeInGB
+                  Collections.<String>emptyList() // eula
+            ),
+            OSImage.create( //
+                  
"MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd", // name
+                  null, // locations
+                  null, // affinityGroup
+                  "Microsoft SQL Server 2012 Evaluation Edition", // label
+                  "SQL Server 2012 Evaluation Edition (64-bit).", //description
+                  "Microsoft", // category
+                  OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
+                  null, // mediaLink
+                  30, // logicalSizeInGB
+                  
Arrays.asList("http://go.microsoft.com/fwlink/?LinkID=251820";,
+                        "http://go.microsoft.com/fwlink/?LinkID=131004";) // 
eula
+            ),
+            OSImage.create( //
+                  "MSFT__Win2K12RC-Datacenter-201207.02-en.us-30GB.vhd", // 
name
+                  null, // locations
+                  null, // affinityGroup
+                  "Windows Server 2012 Release Candidate, July 2012", // label
+                  "Windows Server 2012 incorporates Microsoft's experience 
building.", //description
+                  "Microsoft", // category
+                  OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
+                  null, // mediaLink
+                  30, // logicalSizeInGB
+                  Collections.<String>emptyList() // eula
+            ),
+            OSImage.create( //
+                  "MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd", // 
name
+                  null, // locations
+                  null, // affinityGroup
+                  "Windows Server 2008 R2 SP1, July 2012", // label
+                  "Windows Server 2008 R2 is a multi-purpose server.", 
//description
+                  "Microsoft", // category
+                  OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
+                  null, // mediaLink
+                  30, // logicalSizeInGB
+                  Collections.<String>emptyList() // eula
+            ),
+            OSImage.create( //
+                  "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd", // 
name
+                  null, // locations
+                  null, // affinityGroup
+                  "OpenLogic CentOS 6.2", // label
+                  "This distribution of Linux is based on CentOS.", 
//description
+                  "OpenLogic", // category
+                  OSImage.Type.LINUX, // os
+                  "openLogic", //publisherName
+                  
URI.create("http://blobs/disks/mydeployment/OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd";),
+                  // mediaLink
+                  30, //logicalSizeInGB
+                  
Arrays.asList("http://www.openlogic.com/azure/service-agreement/";) // eula
+            ),
+            OSImage.create( //
+                  "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
+                  null, // locations
+                  null, // affinityGroup
+                  "openSUSE 12.1", // label
+                  "openSUSE is a free and Linux-based operating system!", 
//description
+                  "SUSE", // category
+                  OSImage.Type.LINUX, // os
+                  "SUSE", //publisherName
+                  null, // mediaLink
+                  30, // logicalSizeInGB
+                  Arrays.asList("http://opensuse.org/";) // eula
+            ),
+            OSImage.create( //
+                  
"SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd", // name
+                  null, // locations
+                  null, // affinityGroup
+                  "SUSE Linux Enterprise Server", // label
+                  "SUSE Linux Enterprise Server is a highly reliable value.", 
//description
+                  "SUSE", // category
+                  OSImage.Type.LINUX, // os
+                  "SUSE", //publisherName
+                  null, // mediaLink
+                  30, // logicalSizeInGB
+                  Arrays.asList("http://www.novell.com/licensing/eula/";) // 
eula
+            ),
+            OSImage.create( //
+                  
"0b11de9248dd4d87b18621318e037d37__RightImage-CentOS-6.4-x64-v13.4", // name
+                  null, // locations
+                  null, // affinityGroup
+                  "RightImage-CentOS-6.4-x64-v13.4", // label
+                  null, //description
+                  "RightScale with Linux", // category
+                  OSImage.Type.LINUX, // os
+                  "RightScale with Linux",
+                  null, // mediaLink
+                  10, // logicalSizeInGB
+                  Collections.<String>emptyList() // No EULA, as RightScale 
stuffed ';' into the field.
+            )
+      );
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
 
b/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
index 2f9499e..f4090bf 100644
--- 
a/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
+++ 
b/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
@@ -17,7 +17,7 @@
 package org.jclouds.azurecompute.features;
 
 import static com.google.common.collect.Iterables.transform;
-import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
 import org.jclouds.azurecompute.domain.Disk;
@@ -60,8 +60,7 @@ public class DiskApiLiveTest extends 
BaseAzureComputeApiLiveTest {
    }
 
    private void checkDisk(Disk disk) {
-      assertNull(disk.name(), "Name cannot be null for: " + disk);
-      assertNull(disk.os(), "OS cannot be null for: " + disk);
+      assertNotNull(disk.name(), "Name cannot be null for: " + disk);
 
       if (disk.attachedTo() != null) {
          // TODO: verify you can lookup the role

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
 
b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
index 785a5a1..e965a21 100644
--- 
a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
+++ 
b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
@@ -68,7 +68,7 @@ public class OSImageApiLiveTest extends 
BaseAzureComputeApiLiveTest {
                "MediaLink should be an http(s) url" + OSImage);
       }
 
-      assertTrue(locations.containsAll(OSImage.locations()), "Locations not in 
" + locations + " :" + OSImage);
+      assertTrue(locations.contains(OSImage.location()), "Locations not in " + 
locations + " :" + OSImage);
 
       // Ex. Dirty data in RightScale eula field comes out as an empty string.
       assertFalse(OSImage.eula().contains(""));

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListOSImagesHandlerTest.java
----------------------------------------------------------------------
diff --git 
a/azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListOSImagesHandlerTest.java
 
b/azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListOSImagesHandlerTest.java
index 3809440..bdf7aaf 100644
--- 
a/azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListOSImagesHandlerTest.java
+++ 
b/azurecompute/src/test/java/org/jclouds/azurecompute/xml/ListOSImagesHandlerTest.java
@@ -44,24 +44,26 @@ public class ListOSImagesHandlerTest extends 
BaseHandlerTest {
       return ImmutableList.of( //
             OSImage.create( //
                   
"CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd", 
// name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "Ubuntu Server 12.04 LTS", // label
                   "Ubuntu Server 12.04 LTS amd64 20120528 Cloud Image", 
//description
                   "Canonical", // category
                   OSImage.Type.LINUX, // os
+                  "Canonical", //publisherName
                   null, // mediaLink
                   30, // logicalSizeInGB
                   
Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing";) // eula
             ),
             OSImage.create( //
                   "MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd", // 
name
-                  Arrays.asList("East Asia", "Southeast Asia", "North 
Europe"), // locations
-                  null, // affinityGroup
+                  "North Europe", // locations
+                   null, // affinityGroup
                   "Windows Server 2008 R2 SP1, June 2012", // label
                   "Windows Server 2008 R2 is a multi-purpose server.", 
//description
                   "Microsoft", // category
                   OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
                   
URI.create("http://blobs/disks/mydeployment/MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd";),
                   // mediaLink
                   30, // logicalSizeInGB
@@ -69,12 +71,13 @@ public class ListOSImagesHandlerTest extends 
BaseHandlerTest {
             ),
             OSImage.create( //
                   
"MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd", // name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "Microsoft SQL Server 2012 Evaluation Edition", // label
                   "SQL Server 2012 Evaluation Edition (64-bit).", //description
                   "Microsoft", // category
                   OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
                   null, // mediaLink
                   30, // logicalSizeInGB
                   
Arrays.asList("http://go.microsoft.com/fwlink/?LinkID=251820";,
@@ -82,73 +85,79 @@ public class ListOSImagesHandlerTest extends 
BaseHandlerTest {
             ),
             OSImage.create( //
                   "MSFT__Win2K12RC-Datacenter-201207.02-en.us-30GB.vhd", // 
name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "Windows Server 2012 Release Candidate, July 2012", // label
                   "Windows Server 2012 incorporates Microsoft's experience 
building.", //description
                   "Microsoft", // category
                   OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
                   null, // mediaLink
                   30, // logicalSizeInGB
                   Collections.<String>emptyList() // eula
             ),
             OSImage.create( //
                   "MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd", // 
name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "Windows Server 2008 R2 SP1, July 2012", // label
                   "Windows Server 2008 R2 is a multi-purpose server.", 
//description
                   "Microsoft", // category
                   OSImage.Type.WINDOWS, // os
+                  "Microsoft", //publisherName
                   null, // mediaLink
                   30, // logicalSizeInGB
                   Collections.<String>emptyList() // eula
             ),
             OSImage.create( //
                   "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd", // 
name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "OpenLogic CentOS 6.2", // label
                   "This distribution of Linux is based on CentOS.", 
//description
                   "OpenLogic", // category
                   OSImage.Type.LINUX, // os
+                  "openLogic", //publisherName
                   
URI.create("http://blobs/disks/mydeployment/OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd";),
                   // mediaLink
-                  30, // logicalSizeInGB
+                  30, //logicalSizeInGB
                   
Arrays.asList("http://www.openlogic.com/azure/service-agreement/";) // eula
             ),
             OSImage.create( //
                   "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "openSUSE 12.1", // label
                   "openSUSE is a free and Linux-based operating system!", 
//description
                   "SUSE", // category
                   OSImage.Type.LINUX, // os
+                  "SUSE", //publisherName
                   null, // mediaLink
                   30, // logicalSizeInGB
                   Arrays.asList("http://opensuse.org/";) // eula
             ),
             OSImage.create( //
                   
"SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd", // name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "SUSE Linux Enterprise Server", // label
                   "SUSE Linux Enterprise Server is a highly reliable value.", 
//description
                   "SUSE", // category
                   OSImage.Type.LINUX, // os
+                  "SUSE", //publisherName
                   null, // mediaLink
                   30, // logicalSizeInGB
                   Arrays.asList("http://www.novell.com/licensing/eula/";) // 
eula
             ),
             OSImage.create( //
                   
"0b11de9248dd4d87b18621318e037d37__RightImage-CentOS-6.4-x64-v13.4", // name
-                  Collections.<String>emptyList(), // locations
+                  null, // locations
                   null, // affinityGroup
                   "RightImage-CentOS-6.4-x64-v13.4", // label
                   null, //description
                   "RightScale with Linux", // category
                   OSImage.Type.LINUX, // os
+                  "RightScale with Linux",
                   null, // mediaLink
                   10, // logicalSizeInGB
                   Collections.<String>emptyList() // No EULA, as RightScale 
stuffed ';' into the field.

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/4065bfc7/azurecompute/src/test/resources/images.xml
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/resources/images.xml 
b/azurecompute/src/test/resources/images.xml
index e72370e..4601fc6 100644
--- a/azurecompute/src/test/resources/images.xml
+++ b/azurecompute/src/test/resources/images.xml
@@ -5,17 +5,19 @@
         <LogicalSizeInGB>30</LogicalSizeInGB>
         
<Name>CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd</Name>
         <OS>Linux</OS>
+        <PublisherName>Canonical</PublisherName>
         <Eula>http://www.ubuntu.com/project/about-ubuntu/licensing</Eula>
         <Description>Ubuntu Server 12.04 LTS amd64 20120528 Cloud 
Image</Description>
     </OSImage>
     <OSImage>
         <Category>Microsoft</Category>
         <Label>Windows Server 2008 R2 SP1, June 2012</Label>
-        <Location>East Asia;Southeast Asia;North Europe</Location>
+        <Location>North Europe</Location>
         <LogicalSizeInGB>30</LogicalSizeInGB>
         <Name>MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd</Name>
         
<MediaLink>http://blobs/disks/mydeployment/MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd</MediaLink>
         <OS>Windows</OS>
+        <PublisherName>Microsoft</PublisherName>
         <Eula />
         <Description>Windows Server 2008 R2 is a multi-purpose 
server.</Description>
     </OSImage>
@@ -25,6 +27,7 @@
         <LogicalSizeInGB>30</LogicalSizeInGB>
         
<Name>MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd</Name>
         <OS>Windows</OS>
+        <PublisherName>Microsoft</PublisherName>
         
<Eula>http://go.microsoft.com/fwlink/?LinkID=251820;http://go.microsoft.com/fwlink/?LinkID=131004</Eula>
         <Description>SQL Server 2012 Evaluation Edition (64-bit).</Description>
     </OSImage>
@@ -34,6 +37,7 @@
         <LogicalSizeInGB>30</LogicalSizeInGB>
         <Name>MSFT__Win2K12RC-Datacenter-201207.02-en.us-30GB.vhd</Name>
         <OS>Windows</OS>
+        <PublisherName>Microsoft</PublisherName>
         <Eula />
         <Description>Windows Server 2012 incorporates Microsoft's experience 
building.</Description>
     </OSImage>
@@ -43,6 +47,7 @@
         <LogicalSizeInGB>30</LogicalSizeInGB>
         <Name>MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd</Name>
         <OS>Windows</OS>
+        <PublisherName>Microsoft</PublisherName>
         <Eula />
         <Description>Windows Server 2008 R2 is a multi-purpose 
server.</Description>
     </OSImage>
@@ -53,6 +58,7 @@
         <Name>OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd</Name>
         
<MediaLink>http://blobs/disks/mydeployment/OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd</MediaLink>
         <OS>Linux</OS>
+        <PublisherName>openLogic</PublisherName>
         <Eula>http://www.openlogic.com/azure/service-agreement/</Eula>
         <Description>This distribution of Linux is based on 
CentOS.</Description>
     </OSImage>
@@ -62,6 +68,7 @@
         <LogicalSizeInGB>30</LogicalSizeInGB>
         <Name>SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd</Name>
         <OS>Linux</OS>
+        <PublisherName>SUSE</PublisherName>
         <Eula>http://opensuse.org/</Eula>
         <Description>openSUSE is a free and Linux-based operating 
system!</Description>
     </OSImage>
@@ -71,6 +78,7 @@
         <LogicalSizeInGB>30</LogicalSizeInGB>
         
<Name>SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd</Name>
         <OS>Linux</OS>
+        <PublisherName>SUSE</PublisherName>
         <Eula>http://www.novell.com/licensing/eula/</Eula>
         <Description>SUSE Linux Enterprise Server is a highly reliable 
value.</Description>
     </OSImage>
@@ -80,6 +88,7 @@
         <LogicalSizeInGB>10</LogicalSizeInGB>
         
<Name>0b11de9248dd4d87b18621318e037d37__RightImage-CentOS-6.4-x64-v13.4</Name>
         <OS>Linux</OS>
+        <PublisherName>RightScale with Linux</PublisherName>
         <Eula>;</Eula>
         <Description/>
     </OSImage>

Reply via email to