From 5f63768d4df48d4f74a40a257e929131c7323d2f Mon Sep 17 00:00:00 2001 From: Alasdair Hodge Date: Wed, 21 Dec 2011 13:04:44 +0000 Subject: [PATCH] Update CloneDriveOptions unit test to include tags and affinity --- .../options/CloneDriveOptionsTest.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/options/CloneDriveOptionsTest.java b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/options/CloneDriveOptionsTest.java index c114f892b8..06175f999f 100644 --- a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/options/CloneDriveOptionsTest.java +++ b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/options/CloneDriveOptionsTest.java @@ -19,9 +19,12 @@ package org.jclouds.cloudsigma.options; import static org.jclouds.cloudsigma.options.CloneDriveOptions.Builder.size; +import static org.jclouds.cloudsigma.options.CloneDriveOptions.Builder.tags; +import static org.jclouds.cloudsigma.options.CloneDriveOptions.Builder.affinity; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; +import org.jclouds.cloudsigma.domain.AffinityType; import org.testng.annotations.Test; /** @@ -54,5 +57,61 @@ public class CloneDriveOptionsTest { public void testSizeNegative() { size(-1); } + + @Test + public void testNullTags() { + CloneDriveOptions options = new CloneDriveOptions(); + assertNull(options.getOptions().get("tags")); + } + @Test + public void testTags() { + CloneDriveOptions options = new CloneDriveOptions().tags("foo", "bar", "baz"); + assertEquals(options.getOptions().get("tags"), "foo bar baz"); + } + + @Test + public void testTagsStatic() { + CloneDriveOptions options = tags("foo", "bar", "baz"); + assertEquals(options.getOptions().get("tags"), "foo bar baz"); + } + + @Test + public void testHddAffinity() { + CloneDriveOptions options = new CloneDriveOptions().affinity(AffinityType.HDD); + assertNull(options.getOptions().get("tags")); + } + + @Test + public void testHddAffinityStatic() { + CloneDriveOptions options = affinity(AffinityType.HDD); + assertNull(options.getOptions().get("tags")); + } + + @Test + public void testSsdAffinity() { + CloneDriveOptions options = new CloneDriveOptions().affinity(AffinityType.SSD); + assertEquals(options.getOptions().get("tags"), "affinity:ssd"); + } + + @Test + public void testSsdAffinityStatic() { + CloneDriveOptions options = affinity(AffinityType.SSD); + assertEquals(options.getOptions().get("tags"), "affinity:ssd"); + } + + @Test + public void testHddAffinityWithTags() { + CloneDriveOptions options = new CloneDriveOptions().affinity(AffinityType.HDD); + options.tags("foo", "bar", "baz"); + assertEquals(options.getOptions().get("tags"), "foo bar baz"); + } + + @Test + public void testSsdAffinityWithTags() { + CloneDriveOptions options = new CloneDriveOptions().affinity(AffinityType.SSD); + options.tags("foo", "bar", "baz"); + assertEquals(options.getOptions().get("tags"), "foo bar baz affinity:ssd"); + } + }