You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by ab...@apache.org on 2012/08/23 21:52:34 UTC

svn commit: r1376666 - in /whirr/trunk: ./ core/src/main/java/org/apache/whirr/ core/src/main/java/org/apache/whirr/internal/ core/src/test/java/org/apache/whirr/ core/src/test/java/org/apache/whirr/internal/

Author: abayer
Date: Thu Aug 23 19:52:34 2012
New Revision: 1376666

URL: http://svn.apache.org/viewvc?rev=1376666&view=rev
Log:
WHIRR-641. Improved parsing of config -> TemplatebuidlerSpec. Contributed by Adrian Cole.

Added:
    whirr/trunk/core/src/main/java/org/apache/whirr/internal/
    whirr/trunk/core/src/main/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpec.java   (with props)
    whirr/trunk/core/src/test/java/org/apache/whirr/internal/
    whirr/trunk/core/src/test/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpecTest.java   (with props)
Modified:
    whirr/trunk/CHANGES.txt
    whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java
    whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java

Modified: whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1376666&r1=1376665&r2=1376666&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Thu Aug 23 19:52:34 2012
@@ -2,6 +2,15 @@ Apache Whirr Change Log
 
 Trunk (unreleased changes)
 
+  NEW FEATURES
+
+  IMPROVEMENTS
+
+  BUG FIXES
+
+    WHIRR-641. Improved parsing of config ->
+    TemplateBuilderSpec. (Adrian Cole via abayer)
+
 Release 0.8.0 - 2012-08-17
 
   NEW FEATURES

Modified: whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java?rev=1376666&r1=1376665&r2=1376666&view=diff
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java (original)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java Thu Aug 23 19:52:34 2012
@@ -39,6 +39,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.ConfigurationUtils;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.io.IOUtils;
+import org.apache.whirr.internal.ConfigToTemplateBuilderSpec;
 import org.jclouds.compute.domain.TemplateBuilderSpec;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.predicates.validators.DnsNameValidator;
@@ -46,10 +47,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Joiner;
 import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
 import com.google.common.collect.Iterators;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -64,7 +62,7 @@ import com.jcraft.jsch.KeyPair;
  */
 public class ClusterSpec {
   
-  private static final Logger LOG = LoggerFactory.getLogger(ClusterSpec.class);
+  static final Logger LOG = LoggerFactory.getLogger(ClusterSpec.class);
 
   public enum Property {
     CLUSTER_NAME(String.class, false,  "The name of the cluster " +
@@ -358,36 +356,9 @@ public class ClusterSpec {
     setAwsEc2SpotPrice(getFloat(Property.AWS_EC2_SPOT_PRICE, (Float) null));
 
     checkAndSetKeyPair();
-    
-    if (getList(Property.TEMPLATE).size() > 0) {
-       this.template = TemplateBuilderSpec.parse(Joiner.on(',').join(getList(Property.TEMPLATE)));
-    } else {
-       // until TemplateBuilderSpec has type-safe builder
-       Builder<String, String> template = ImmutableMap.<String, String>builder();
-       if (getString(Property.IMAGE_ID) != null) {
-          template.put("imageId", getString(Property.IMAGE_ID));
-       } else {
-          template.put("osFamily", "UBUNTU");
-          template.put("osVersionMatches", "10.04");
-          // canonical images, but not testing ones
-          if ("aws-ec2".equals(getProvider()))
-             template.put("osDescriptionMatches", "^(?!.*(daily|testing)).*ubuntu-images.*$");
-       }
-       if (getString(Property.HARDWARE_ID) != null) {
-          template.put("hardwareId", getString(Property.HARDWARE_ID));
-       } else {
-          template.put("minRam", Integer.toString(getInt(Property.HARDWARE_MIN_RAM, 1024)));
-       }
-       if (getString(Property.LOCATION_ID) != null) {
-          template.put("locationId", getString(Property.LOCATION_ID));
-       }
-       String bootstrapUser = getBootstrapUserOrDeprecatedLoginUser();
-       if (bootstrapUser != null) {
-          template.put("loginUser", bootstrapUser);
-       }
-       this.template = TemplateBuilderSpec.parse(Joiner.on(',').withKeyValueSeparator("=").join(template.build()));
-    }
-    
+
+    this.template = ConfigToTemplateBuilderSpec.INSTANCE.apply(config);
+
     setBlobStoreLocationId(getString(Property.BLOBSTORE_LOCATION_ID));
     setClientCidrs(getList(Property.CLIENT_CIDRS));
     
@@ -411,16 +382,7 @@ public class ClusterSpec {
     setVersion(getString(Property.VERSION));
     setRunUrlBase(getString(Property.RUN_URL_BASE));
   }
-
-  private String getBootstrapUserOrDeprecatedLoginUser() {
-    final String loginUserConfig = "whirr.login-user";
-    if (config.containsKey(loginUserConfig)) {
-      LOG.warn("whirr.login-user is deprecated. Please rename to whirr.bootstrap-user.");
-      return config.getString(loginUserConfig, null);
-    }
-    return getString(Property.BOOTSTRAP_USER);
-  }
-
+  
   /**
    * Create a deep object copy. It's not enough to just copy the configuration
    * because the object can also be modified using the setters and the changes
@@ -481,10 +443,6 @@ public class ClusterSpec {
     return config.getInt(key.getConfigName(), defaultValue);
   }
 
-  private float getFloat(Property key, float defaultValue) {
-    return config.getFloat(key.getConfigName(), defaultValue);
-  }
-  
   private Float getFloat(Property key, Float defaultValue) {
     return config.getFloat(key.getConfigName(), defaultValue);
   }
@@ -492,7 +450,7 @@ public class ClusterSpec {
   private List<String> getList(Property key) {
     return config.getList(key.getConfigName());
   }
-
+  
   private Configuration composeWithDefaults(Configuration userConfig)
       throws ConfigurationException {
     CompositeConfiguration composed = new CompositeConfiguration();

Added: whirr/trunk/core/src/main/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpec.java
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpec.java?rev=1376666&view=auto
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpec.java (added)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpec.java Thu Aug 23 19:52:34 2012
@@ -0,0 +1,117 @@
+/**
+ * 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.apache.whirr.internal;
+
+import static com.google.common.base.Predicates.in;
+import static com.google.common.collect.Iterables.any;
+
+import java.util.Map;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.ClusterSpec.Property;
+import org.jclouds.compute.domain.TemplateBuilderSpec;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Takes configuration parameters and converts them to templateBuilderSpec
+ */
+public enum ConfigToTemplateBuilderSpec implements Function<Configuration, TemplateBuilderSpec> {
+  INSTANCE;
+
+  static final Logger LOG = LoggerFactory.getLogger(ClusterSpec.class);
+
+  @Override
+  public TemplateBuilderSpec apply(Configuration in) {
+    // until TemplateBuilderSpec has type-safe builder
+    Builder<String, String> template = ImmutableMap.<String, String> builder();
+    if (in.getList(Property.TEMPLATE.getConfigName()).size() > 0) {
+      template.putAll(Splitter.on(',').withKeyValueSeparator("=")
+            .split(Joiner.on(',').join(in.getList(Property.TEMPLATE.getConfigName()))));
+    }
+    if (!hasImageParams(template.build())) {
+      String imageId = in.getString(Property.IMAGE_ID.getConfigName());
+      if (imageId != null) {
+        template.put("imageId", imageId);
+      } else {
+        template.put("osFamily", "UBUNTU");
+        template.put("osVersionMatches", "10.04");
+        // canonical images, but not testing ones
+        if ("aws-ec2".equals(in.getString(Property.PROVIDER.getConfigName())))
+          template.put("osDescriptionMatches", "^(?!.*(daily|testing)).*ubuntu-images.*$");
+      }
+    }
+    if (!hasHardwareParams(template.build())) {
+      String hardwareId = in.getString(Property.HARDWARE_ID.getConfigName());
+      if (hardwareId != null) {
+        template.put("hardwareId", hardwareId);
+      } else {
+        template.put("minRam", Integer.toString(in.getInt(Property.HARDWARE_MIN_RAM.getConfigName(), 1024)));
+      }
+    }
+    if (!hasLocationParams(template.build())) {
+      String locationId = in.getString(Property.LOCATION_ID.getConfigName());
+      if (locationId != null) {
+        template.put("locationId", locationId);
+      }
+    }
+    if (!hasLoginParams(template.build())) {
+      String bootstrapUser = getBootstrapUserOrDeprecatedLoginUser(in);
+      if (bootstrapUser != null) {
+        template.put("loginUser", bootstrapUser);
+      }
+    }
+    return TemplateBuilderSpec.parse(Joiner.on(',').withKeyValueSeparator("=").join(template.build()));
+  }
+
+  private static boolean hasImageParams(Map<String, String> template) {
+    return any(template.keySet(), in(ImmutableSet.of("imageId", "imageNameMatches", "osFamily", "osVersionMatches",
+          "os64Bit", "osArchMatches", "osDescriptionMatches")));
+  }
+
+  private static boolean hasHardwareParams(Map<String, String> template) {
+    return any(template.keySet(),
+          in(ImmutableSet.of("hardwareId", "minCores", "minRam", "minDisk", "hypervisorMatches")));
+  }
+
+  private static boolean hasLocationParams(Map<String, String> template) {
+    return any(template.keySet(), in(ImmutableSet.of("locationId")));
+  }
+
+  private static boolean hasLoginParams(Map<String, String> template) {
+    return any(template.keySet(), in(ImmutableSet.of("loginUser", "authenticateSudo")));
+  }
+
+  private static String getBootstrapUserOrDeprecatedLoginUser(Configuration in) {
+    final String loginUserConfig = "whirr.login-user";
+    if (in.containsKey(loginUserConfig)) {
+      LOG.warn("whirr.login-user is deprecated. Please rename to whirr.bootstrap-user.");
+      return in.getString(loginUserConfig, null);
+    }
+    return in.getString(Property.BOOTSTRAP_USER.getConfigName());
+  }
+}

Propchange: whirr/trunk/core/src/main/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpec.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java?rev=1376666&r1=1376665&r2=1376666&view=diff
==============================================================================
--- whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java (original)
+++ whirr/trunk/core/src/test/java/org/apache/whirr/ClusterSpecTest.java Thu Aug 23 19:52:34 2012
@@ -79,14 +79,27 @@ public class ClusterSpecTest {
     assertEquals(spec.getAwsEc2SpotPrice(), new Float(0.3));
   }
   
+  /**
+   * @see ConfigToTemplateBuilderSpecTest for more
+   */
   @Test
-  public void testTemplate() throws ConfigurationException {
+  public void testTemplateOverrides() throws ConfigurationException {
     Configuration conf = new PropertiesConfiguration();
     conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
     ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
     assertEquals(spec.getTemplate(), TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048"));
   }
   
+  /**
+   * @see ConfigToTemplateBuilderSpecTest for more
+   */
+  @Test
+  public void testNoTemplateSetsUbuntu1004With1GB() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
+    assertEquals(spec.getTemplate(), TemplateBuilderSpec.parse("osFamily=UBUNTU,osVersionMatches=10.04,minRam=1024"));
+  }
+  
   @Test
   public void testEndpoint() throws ConfigurationException {
     Configuration conf = new PropertiesConfiguration();

Added: whirr/trunk/core/src/test/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpecTest.java
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/test/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpecTest.java?rev=1376666&view=auto
==============================================================================
--- whirr/trunk/core/src/test/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpecTest.java (added)
+++ whirr/trunk/core/src/test/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpecTest.java Thu Aug 23 19:52:34 2012
@@ -0,0 +1,151 @@
+/**
+ * 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.apache.whirr.internal;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.whirr.ClusterSpec;
+import org.jclouds.compute.domain.TemplateBuilderSpec;
+import org.junit.Test;
+
+public class ConfigToTemplateBuilderSpecTest {
+
+  @Test
+  public void testTemplate() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048"));
+  }
+
+  @Test
+  public void testTemplateWithHardwareSpecsOverridesHardwareId() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
+    conf.setProperty(ClusterSpec.Property.HARDWARE_ID.getConfigName(), "m1.small");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048"));
+  }
+
+  @Test
+  public void testTemplateWithoutHardwareSpecsAcceptsHardwareId() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true");
+    conf.setProperty(ClusterSpec.Property.HARDWARE_ID.getConfigName(), "m1.small");
+
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,hardwareId=m1.small"));
+  }
+
+  @Test
+  public void testTemplateWithImageSpecsOverridesImageId() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
+    conf.setProperty(ClusterSpec.Property.IMAGE_ID.getConfigName(), "ami-fooo");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048"));
+  }
+
+  @Test
+  public void testTemplateWithoutImageSpecsAcceptsImageId() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "minRam=2048");
+    conf.setProperty(ClusterSpec.Property.IMAGE_ID.getConfigName(), "ami-fooo");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("minRam=2048,imageId=ami-fooo"));
+  }
+
+  @Test
+  public void testTemplateWithoutImageSpecsDefaultsToUbuntu1004() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "minRam=2048");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("minRam=2048,osFamily=UBUNTU,osVersionMatches=10.04"));
+  }
+
+  @Test
+  public void testTemplateWithoutImageSpecsDefaultsToUbuntu1004AndAWSPatternOnEC2() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.PROVIDER.getConfigName(), "aws-ec2");
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "minRam=2048");
+    assertEquals(
+          ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec
+                .parse("minRam=2048,osFamily=UBUNTU,osVersionMatches=10.04,osDescriptionMatches=^(?!.*(daily|testing)).*ubuntu-images.*$"));
+  }
+
+  @Test
+  public void testTemplateWithoutHardwareSpecsDefaultsTo1GB() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=1024"));
+  }
+
+  @Test
+  public void testTemplateWithDeprecatedLoginUser() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty("whirr.login-user", "user:pass");
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048,loginUser=user:pass"));
+  }
+
+  @Test
+  public void testTemplateWithLocationSpecsOverridesLocationId() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(),
+          "osFamily=UBUNTU,os64Bit=true,minRam=2048,locationId=us-west-2");
+    conf.setProperty(ClusterSpec.Property.LOCATION_ID.getConfigName(), "eu-west-1");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048,locationId=us-west-2"));
+  }
+
+  @Test
+  public void testTemplateWithoutLocationSpecsAcceptsLocationId() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
+    conf.setProperty(ClusterSpec.Property.LOCATION_ID.getConfigName(), "eu-west-1");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048,locationId=eu-west-1"));
+  }
+
+  @Test
+  public void testTemplateWithLoginSpecsOverridesBootstrapUser() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(),
+          "osFamily=UBUNTU,os64Bit=true,minRam=2048,loginUser=foo");
+    conf.setProperty(ClusterSpec.Property.BOOTSTRAP_USER.getConfigName(), "user:pass");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048,loginUser=foo"));
+  }
+
+  @Test
+  public void testTemplateWithoutLoginSpecsAcceptsBootstrapUser() throws ConfigurationException {
+    Configuration conf = new PropertiesConfiguration();
+    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
+    conf.setProperty(ClusterSpec.Property.BOOTSTRAP_USER.getConfigName(), "user:pass");
+    assertEquals(ConfigToTemplateBuilderSpec.INSTANCE.apply(conf),
+          TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048,loginUser=user:pass"));
+  }
+
+}

Propchange: whirr/trunk/core/src/test/java/org/apache/whirr/internal/ConfigToTemplateBuilderSpecTest.java
------------------------------------------------------------------------------
    svn:eol-style = native