clean up style warnings

This commit is contained in:
Adrian Cole 2011-07-22 12:48:59 +10:00
parent 0f9dd50d7d
commit acd4b4a628
20 changed files with 59 additions and 66 deletions

View File

@ -27,8 +27,6 @@ import java.net.URI;
*/ */
public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> { public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
/** The serialVersionUID */
private static final long serialVersionUID = 8373435988423605652L;
private String name; private String name;
private boolean cdn_enabled; private boolean cdn_enabled;
private long ttl; private long ttl;

View File

@ -31,16 +31,13 @@ import com.google.common.collect.Maps;
public class Server { public class Server {
private int id; private int id;
private String name; private String name;
private Map<String, String> metadata = Maps.newHashMap(); private Map<String, String> metadata = Maps.newHashMap();
private Addresses addresses; private Addresses addresses;
private String adminPass; private String adminPass;
private Integer flavorId; private Integer flavorId;
private String hostId; private String hostId;
private Integer imageId; private Integer imageId;
private Integer sharedIpGroupId; private Integer sharedIpGroupId;
private Integer progress; private Integer progress;
private ServerStatus status; private ServerStatus status;

View File

@ -22,16 +22,16 @@ import static org.testng.Assert.assertEquals;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import org.jclouds.cloudservers.functions.ParseImageFromJsonResponseTest;
import org.jclouds.compute.config.BaseComputeServiceContextModule; import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
import org.jclouds.cloudservers.functions.ParseImageFromJsonResponseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.inject.Guice; import com.google.inject.Guice;
@ -49,7 +49,7 @@ public class CloudServersImageToImageTest {
new ImageBuilder() new ImageBuilder()
.name("CentOS 5.2") .name("CentOS 5.2")
.operatingSystem( .operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(true) new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(true)
.build()).description("CentOS 5.2").defaultCredentials(new Credentials("root", null)) .build()).description("CentOS 5.2").defaultCredentials(new Credentials("root", null))
.ids("2").version("1286712000000").build()); .ids("2").version("1286712000000").build());
} }

View File

@ -34,7 +34,7 @@ import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.NodeState; import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Processor; import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.Volume; import org.jclouds.compute.domain.Volume;
@ -119,7 +119,7 @@ public class ServerToNodeMetadataTest {
assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses( assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
ImmutableSet.of("67.23.10.132", "67.23.10.131")).privateAddresses(ImmutableSet.of("10.176.42.16")) ImmutableSet.of("67.23.10.132", "67.23.10.131")).privateAddresses(ImmutableSet.of("10.176.42.16"))
.imageId("2").operatingSystem( .imageId("2").operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
.is64Bit(true).build()).id("1234").providerId("1234").name("sample-server").location( .is64Bit(true).build()).id("1234").providerId("1234").name("sample-server").location(
new LocationBuilder().scope(LocationScope.HOST).id("e4d909c290d0fb1ca068ffaddf22cbd0") new LocationBuilder().scope(LocationScope.HOST).id("e4d909c290d0fb1ca068ffaddf22cbd0")
.description("e4d909c290d0fb1ca068ffaddf22cbd0").parent(provider).build()) .description("e4d909c290d0fb1ca068ffaddf22cbd0").parent(provider).build())
@ -147,7 +147,7 @@ public class ServerToNodeMetadataTest {
ImmutableList.of(new Processor(1.0, 1.0))).ram(256).volumes( ImmutableList.of(new Processor(1.0, 1.0))).ram(256).volumes(
ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(10.0f).durable(true) ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(10.0f).durable(true)
.bootDevice(true).build())).build()).operatingSystem( .bootDevice(true).build())).build()).operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
.is64Bit(true).build()).id("1234").providerId("1234").name("sample-server").location( .is64Bit(true).build()).id("1234").providerId("1234").name("sample-server").location(
new LocationBuilder().scope(LocationScope.HOST).id("e4d909c290d0fb1ca068ffaddf22cbd0") new LocationBuilder().scope(LocationScope.HOST).id("e4d909c290d0fb1ca068ffaddf22cbd0")
.description("e4d909c290d0fb1ca068ffaddf22cbd0").parent(provider).build()) .description("e4d909c290d0fb1ca068ffaddf22cbd0").parent(provider).build())

View File

@ -98,9 +98,6 @@ public class Image implements Comparable<Image> {
this.hypervisor = checkNotNull(hypervisor, "hypervisor"); this.hypervisor = checkNotNull(hypervisor, "hypervisor");
} }
/** The serialVersionUID */
private static final long serialVersionUID = -6965068835316857535L;
public static enum ImageState { public static enum ImageState {
/** /**
* the image is successfully registered and available for launching * the image is successfully registered and available for launching

View File

@ -56,7 +56,7 @@ public class RegionAndIdToImageTest {
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image); Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
expect(caller.getAMIServices()).andReturn(client).atLeastOnce(); expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn((Set) images); expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
expect(parser.apply(ec2Image)).andReturn(image); expect(parser.apply(ec2Image)).andReturn(image);
replay(caller); replay(caller);
@ -87,7 +87,7 @@ public class RegionAndIdToImageTest {
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image); Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
expect(caller.getAMIServices()).andReturn(client).atLeastOnce(); expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn((Set) images); expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException()); expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException());
replay(caller); replay(caller);
@ -118,7 +118,7 @@ public class RegionAndIdToImageTest {
Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image); Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);
expect(caller.getAMIServices()).andReturn(client).atLeastOnce(); expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn((Set) images); expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
expect(parser.apply(ec2Image)).andThrow(new NoSuchElementException()); expect(parser.apply(ec2Image)).andThrow(new NoSuchElementException());
replay(caller); replay(caller);

View File

@ -121,7 +121,7 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
expect(input.template.getImage()).andReturn(input.image).atLeastOnce(); expect(input.template.getImage()).andReturn(input.image).atLeastOnce();
expect(input.image.getProviderId()).andReturn(imageId).atLeastOnce(); expect(input.image.getProviderId()).andReturn(imageId).atLeastOnce();
expect(instanceClient.runInstancesInRegion(region, zone, imageId, 1, input.count, ec2Options)).andReturn( expect(instanceClient.runInstancesInRegion(region, zone, imageId, 1, input.count, ec2Options)).andReturn(
(Reservation) reservation); Reservation.class.cast(reservation));
expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce(); expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce();
// simulate a lazy credentials fetch // simulate a lazy credentials fetch
Credentials creds = new Credentials("foo", "bar"); Credentials creds = new Credentials("foo", "bar");

View File

@ -25,7 +25,7 @@ import javax.inject.Singleton;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.elasticstack.domain.DriveInfo; import org.jclouds.elasticstack.domain.DriveInfo;
@ -57,7 +57,7 @@ public class WellKnownImageToImage implements Function<DriveInfo, Image> {
.put("size", input.getSize() + "").build()).defaultCredentials( .put("size", input.getSize() + "").build()).defaultCredentials(
new Credentials(input.getLoginUser(), null)).location(locationSupplier.get()).name( new Credentials(input.getLoginUser(), null)).location(locationSupplier.get()).name(
input.getDescription()).description(drive.getName()).operatingSystem( input.getDescription()).description(drive.getName()).operatingSystem(
new OperatingSystemBuilder().family(input.getOsFamily()).version(input.getOsVersion()).name( new OperatingSystem.Builder().family(input.getOsFamily()).version(input.getOsVersion()).name(
input.getDescription()).description(drive.getName()).is64Bit(input.is64bit()).build()).version( input.getDescription()).description(drive.getName()).is64Bit(input.is64bit()).build()).version(
"").build(); "").build();
} }

View File

@ -18,13 +18,16 @@
*/ */
package org.jclouds.openstack.nova.live.novaclient; package org.jclouds.openstack.nova.live.novaclient;
import com.google.common.base.Predicate; import static org.jclouds.openstack.nova.live.PropertyHelper.setupKeyPair;
import com.google.common.collect.ImmutableMap; import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides;
import com.google.common.collect.ImmutableSet; import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties;
import com.google.inject.Injector; import static org.jclouds.openstack.nova.options.CreateServerOptions.Builder.withFile;
import com.google.inject.Module;
import org.jclouds.domain.Credentials; import java.io.IOException;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
import org.jclouds.openstack.nova.NovaClient; import org.jclouds.openstack.nova.NovaClient;
@ -34,20 +37,14 @@ import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen; import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.jclouds.ssh.jsch.JschSshClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import java.io.IOException; import com.google.common.base.Predicate;
import java.net.URISyntaxException; import com.google.common.collect.ImmutableMap;
import java.util.Map; import com.google.common.collect.ImmutableSet;
import java.util.Properties; import com.google.inject.Injector;
import java.util.Set; import com.google.inject.Module;
import java.util.concurrent.TimeUnit;
import static org.jclouds.openstack.nova.live.PropertyHelper.*;
import static org.jclouds.openstack.nova.options.CreateServerOptions.Builder.withFile;
/** /**
* @author Victor Galkin * @author Victor Galkin

View File

@ -26,8 +26,6 @@ import java.util.Date;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class BucketMetadata implements Comparable<BucketMetadata> { public class BucketMetadata implements Comparable<BucketMetadata> {
/** The serialVersionUID */
private static final long serialVersionUID = -6965068835316857535L;
private final Date creationDate; private final Date creationDate;
private final CanonicalUser owner; private final CanonicalUser owner;
private final String name; private final String name;

View File

@ -25,8 +25,6 @@ package org.jclouds.openstack.swift.domain;
* *
*/ */
public class ContainerMetadata implements Comparable<ContainerMetadata> { public class ContainerMetadata implements Comparable<ContainerMetadata> {
/** The serialVersionUID */
private static final long serialVersionUID = 2925863715029426128L;
private String name; private String name;
private long count; private long count;
private long bytes; private long bytes;

View File

@ -61,12 +61,14 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
private final Hardware hardware; private final Hardware hardware;
@Nullable @Nullable
private final OperatingSystem os; private final OperatingSystem os;
@Nullable
private final String hostname;
public NodeMetadataImpl(String providerId, String name, String id, Location location, URI uri, public NodeMetadataImpl(String providerId, String name, String id, Location location, URI uri,
Map<String, String> userMetadata, Set<String> tags, @Nullable String group, @Nullable Hardware hardware, Map<String, String> userMetadata, Set<String> tags, @Nullable String group, @Nullable Hardware hardware,
@Nullable String imageId, @Nullable OperatingSystem os, NodeState state, int loginPort, @Nullable String imageId, @Nullable OperatingSystem os, NodeState state, int loginPort,
Iterable<String> publicAddresses, Iterable<String> privateAddresses, @Nullable String adminPassword, Iterable<String> publicAddresses, Iterable<String> privateAddresses, @Nullable String adminPassword,
@Nullable Credentials credentials) { @Nullable Credentials credentials, String hostname) {
super(ComputeType.NODE, providerId, name, id, location, uri, userMetadata, tags); super(ComputeType.NODE, providerId, name, id, location, uri, userMetadata, tags);
this.group = group; this.group = group;
this.hardware = hardware; this.hardware = hardware;
@ -78,6 +80,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses")); this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses"));
this.adminPassword = adminPassword; this.adminPassword = adminPassword;
this.credentials = credentials; this.credentials = credentials;
this.hostname = hostname;
} }
/** /**
@ -168,13 +171,21 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
return os; return os;
} }
/**
* {@inheritDoc}
*/
@Override
public String getHostname() {
return hostname;
}
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", providerId=" + getProviderId() + ", group=" + getTag() + ", name=" + getName() return "[id=" + getId() + ", providerId=" + getProviderId() + ", group=" + getTag() + ", name=" + getName()
+ ", location=" + getLocation() + ", uri=" + getUri() + ", imageId=" + getImageId() + ", os=" + ", location=" + getLocation() + ", uri=" + getUri() + ", imageId=" + getImageId() + ", os="
+ getOperatingSystem() + ", state=" + getState() + ", loginPort=" + getLoginPort() + getOperatingSystem() + ", state=" + getState() + ", loginPort=" + getLoginPort() + ", hostname="
+ ", privateAddresses=" + privateAddresses + ", publicAddresses=" + publicAddresses + ", hardware=" + getHostname() + ", privateAddresses=" + privateAddresses + ", publicAddresses=" + publicAddresses
+ getHardware() + ", loginUser=" + ((credentials != null) ? credentials.identity : null) + ", hardware=" + getHardware() + ", loginUser=" + ((credentials != null) ? credentials.identity : null)
+ ", userMetadata=" + getUserMetadata() + ", tags=" + tags + "]"; + ", userMetadata=" + getUserMetadata() + ", tags=" + tags + "]";
} }

View File

@ -28,8 +28,6 @@ import org.jclouds.compute.domain.Volume;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class VolumeImpl implements Volume { public class VolumeImpl implements Volume {
/** The serialVersionUID */
private static final long serialVersionUID = -3306004212804159093L;
private final String id; private final String id;
private final Volume.Type type; private final Volume.Type type;

View File

@ -26,12 +26,13 @@ import javax.inject.Singleton;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.scriptbuilder.InitBuilder; import org.jclouds.scriptbuilder.InitBuilder;
import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey;
import org.jclouds.scriptbuilder.domain.InstallRSAPrivateKey;
import org.jclouds.scriptbuilder.domain.Statement; import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.scriptbuilder.domain.StatementList; import org.jclouds.scriptbuilder.domain.StatementList;
import org.jclouds.scriptbuilder.statements.ssh.AuthorizeRSAPublicKeys;
import org.jclouds.scriptbuilder.statements.ssh.InstallRSAPrivateKey;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
/** /**
* *
@ -44,7 +45,7 @@ public class TemplateOptionsToStatement implements Function<TemplateOptions, Sta
public Statement apply(TemplateOptions options) { public Statement apply(TemplateOptions options) {
List<Statement> bootstrap = newArrayList(); List<Statement> bootstrap = newArrayList();
if (options.getPublicKey() != null) if (options.getPublicKey() != null)
bootstrap.add(new AuthorizeRSAPublicKey(options.getPublicKey())); bootstrap.add(new AuthorizeRSAPublicKeys(ImmutableSet.of(options.getPublicKey())));
if (options.getRunScript() != null) if (options.getRunScript() != null)
bootstrap.add(options.getRunScript()); bootstrap.add(options.getRunScript());
if (options.getPrivateKey() != null) if (options.getPrivateKey() != null)

View File

@ -30,7 +30,7 @@ import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.NodeState; import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Processor; import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.Volume; import org.jclouds.compute.domain.Volume;
@ -111,7 +111,7 @@ public class SliceToNodeMetadataTest {
assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses( assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
ImmutableSet.of("174.143.212.229")).privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds") ImmutableSet.of("174.143.212.229")).privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds")
.imageId("2").operatingSystem( .imageId("2").operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
.is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo").location(provider) .is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo").location(provider)
.userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build()); .userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build());
} }
@ -135,7 +135,7 @@ public class SliceToNodeMetadataTest {
ImmutableList.of(new Processor(0.25, 1.0))).ram(256).volumes( ImmutableList.of(new Processor(0.25, 1.0))).ram(256).volumes(
ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(1.0f).durable(true) ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(1.0f).durable(true)
.bootDevice(true).build())).build()).operatingSystem( .bootDevice(true).build())).build()).operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
.is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo").location(provider) .is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo").location(provider)
.userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build()); .userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build());
} }

View File

@ -25,7 +25,7 @@ import java.net.UnknownHostException;
import org.jclouds.compute.config.BaseComputeServiceContextModule; import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
@ -49,7 +49,7 @@ public class SlicehostImageToImageTest {
@Test @Test
public void test() throws UnknownHostException { public void test() throws UnknownHostException {
assertEquals(convertImage(), new ImageBuilder().name("CentOS 5.2").operatingSystem( assertEquals(convertImage(), new ImageBuilder().name("CentOS 5.2").operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit( new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(
true).build()).description("CentOS 5.2").defaultCredentials(new Credentials("root", null)).ids( true).build()).description("CentOS 5.2").defaultCredentials(new Credentials("root", null)).ids(
"2").build()); "2").build());
} }
@ -58,7 +58,7 @@ public class SlicehostImageToImageTest {
public void test32() throws UnknownHostException { public void test32() throws UnknownHostException {
assertEquals(convertImage("/test_get_image32.xml"), new ImageBuilder().name("Ubuntu 10.10 (maverick) 32-bit") assertEquals(convertImage("/test_get_image32.xml"), new ImageBuilder().name("Ubuntu 10.10 (maverick) 32-bit")
.operatingSystem( .operatingSystem(
new OperatingSystemBuilder().family(OsFamily.UBUNTU).version("10.10").description( new OperatingSystem.Builder().family(OsFamily.UBUNTU).version("10.10").description(
"Ubuntu 10.10 (maverick) 32-bit").build()).description( "Ubuntu 10.10 (maverick) 32-bit").build()).description(
"Ubuntu 10.10 (maverick) 32-bit").defaultCredentials(new Credentials("root", null)).ids("70") "Ubuntu 10.10 (maverick) 32-bit").defaultCredentials(new Credentials("root", null)).ids("70")
.build()); .build());

View File

@ -120,6 +120,7 @@ public class VirtualMachineClientLiveTest extends BaseCloudStackClientLiveTest {
final Predicate<Template> hypervisorPredicate = new CorrectHypervisorForZone(client).apply(zoneId); final Predicate<Template> hypervisorPredicate = new CorrectHypervisorForZone(client).apply(zoneId);
final Predicate<Template> osTypePredicate = new OSCategoryIn(client).apply(acceptableCategories); final Predicate<Template> osTypePredicate = new OSCategoryIn(client).apply(acceptableCategories);
@SuppressWarnings("unchecked")
Predicate<Template> templatePredicate = Predicates.<Template> and(TemplatePredicates.isReady(), Predicate<Template> templatePredicate = Predicates.<Template> and(TemplatePredicates.isReady(),
hypervisorPredicate, osTypePredicate); hypervisorPredicate, osTypePredicate);
Iterable<Template> templates = filter( Iterable<Template> templates = filter(
@ -155,6 +156,7 @@ public class VirtualMachineClientLiveTest extends BaseCloudStackClientLiveTest {
return vm; return vm;
} }
@SuppressWarnings("unchecked")
public void testCreateVirtualMachine() throws Exception { public void testCreateVirtualMachine() throws Exception {
vm = createVirtualMachine(client, jobComplete, virtualMachineRunning); vm = createVirtualMachine(client, jobComplete, virtualMachineRunning);
if (vm.getPassword() != null) { if (vm.getPassword() != null) {

View File

@ -22,8 +22,6 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.classextension.EasyMock.createMock; import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.replay; import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify; import static org.easymock.classextension.EasyMock.verify;
import static org.jclouds.scriptbuilder.domain.Statements.appendFile;
import static org.jclouds.scriptbuilder.domain.Statements.call;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;

View File

@ -22,9 +22,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.classextension.EasyMock.createMock; import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.replay; import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify; import static org.easymock.classextension.EasyMock.verify;
import static org.testng.Assert.assertEquals;
import org.jclouds.domain.Credentials;
import org.jclouds.scriptbuilder.InitBuilder; import org.jclouds.scriptbuilder.InitBuilder;
import org.jclouds.scriptbuilder.domain.Statement; import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.scriptbuilder.domain.Statements; import org.jclouds.scriptbuilder.domain.Statements;

View File

@ -24,7 +24,7 @@ import javax.inject.Singleton;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
@ -51,7 +51,7 @@ public class ServerManagerImageToImage implements Function<org.jclouds.serverman
OsFamily family = null; OsFamily family = null;
try { try {
family = OsFamily.fromValue(from.name); family = OsFamily.fromValue(from.name);
builder.operatingSystem(new OperatingSystemBuilder().name(from.name).family(family).build()); builder.operatingSystem(new OperatingSystem.Builder().name(from.name).family(family).build());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.debug("<< didn't match os(%s)", from); logger.debug("<< didn't match os(%s)", from);
} }