Update CloneDriveOptions unit test to include tags and affinity

This commit is contained in:
Alasdair Hodge 2011-12-21 13:04:44 +00:00
parent c13e6e20bc
commit 5f63768d4d
1 changed files with 59 additions and 0 deletions

View File

@ -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;
/**
@ -55,4 +58,60 @@ public class CloneDriveOptionsTest {
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");
}
}