cloudservers test fixes

This commit is contained in:
Adrian Cole 2012-05-21 20:19:58 -06:00
parent 7d9bba750a
commit 17079743f1
2 changed files with 28 additions and 70 deletions

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudservers.domain;
import java.util.Map; import java.util.Map;
import com.google.common.base.Objects;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
/** /**
@ -109,6 +110,10 @@ public class Server {
return imageId; return imageId;
} }
public void setName(String name) {
this.name = name;
}
public String getName() { public String getName() {
return name; return name;
} }
@ -141,86 +146,32 @@ public class Server {
return status; return status;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hashCode(id, name);
int result = 1;
result = prime * result + ((addresses == null) ? 0 : addresses.hashCode());
result = prime * result + ((adminPass == null) ? 0 : adminPass.hashCode());
result = prime * result + ((flavorId == null) ? 0 : flavorId.hashCode());
result = prime * result + ((hostId == null) ? 0 : hostId.hashCode());
result = prime * result + id;
result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
result = prime * result + ((metadata == null) ? 0 : metadata.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((sharedIpGroupId == null) ? 0 : sharedIpGroupId.hashCode());
return result;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) return true;
return true; if (obj == null || getClass() != obj.getClass()) return false;
if (obj == null) Server that = Server.class.cast(obj);
return false; return Objects.equal(this.getId(), that.getId())
if (getClass() != obj.getClass()) && Objects.equal(this.name, that.name);
return false;
Server other = (Server) obj;
if (addresses == null) {
if (other.addresses != null)
return false;
} else if (!addresses.equals(other.addresses))
return false;
if (adminPass == null) {
if (other.adminPass != null)
return false;
} else if (!adminPass.equals(other.adminPass))
return false;
if (flavorId == null) {
if (other.flavorId != null)
return false;
} else if (!flavorId.equals(other.flavorId))
return false;
if (hostId == null) {
if (other.hostId != null)
return false;
} else if (!hostId.equals(other.hostId))
return false;
if (id != other.id)
return false;
if (imageId == null) {
if (other.imageId != null)
return false;
} else if (!imageId.equals(other.imageId))
return false;
if (metadata == null) {
if (other.metadata != null)
return false;
} else if (!metadata.equals(other.metadata))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (sharedIpGroupId == null) {
if (other.sharedIpGroupId != null)
return false;
} else if (!sharedIpGroupId.equals(other.sharedIpGroupId))
return false;
return true;
}
public void setName(String name) {
this.name = name;
} }
@Override @Override
public String toString() { public String toString() {
return "Server [addresses=" + addresses + ", adminPass=" + adminPass + ", flavorId=" return Objects.toStringHelper("")
+ flavorId + ", hostId=" + hostId + ", id=" + id + ", imageId=" + imageId .add("id", getId())
+ ", metadata=" + metadata + ", name=" + name + ", sharedIpGroupId=" .add("name", name)
+ sharedIpGroupId + "]"; .add("addresses", addresses)
.add("flavorId", flavorId)
.add("imageId", imageId)
.add("hostId", hostId)
.add("metadata", metadata)
.add("sharedIpGroupId", sharedIpGroupId).toString();
} }
} }

View File

@ -53,6 +53,7 @@ import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen; import org.jclouds.predicates.SocketOpen;
import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException; import org.jclouds.ssh.SshException;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
@ -64,6 +65,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.net.HostAndPort; import com.google.common.net.HostAndPort;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Module;
/** /**
* Tests behavior of {@code CloudServersClient} * Tests behavior of {@code CloudServersClient}
@ -603,4 +605,9 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
client.deleteSharedIpGroup(sharedIpGroupId); client.deleteSharedIpGroup(sharedIpGroupId);
} }
} }
@Override
protected Module getSshModule() {
return new SshjSshClientModule();
}
} }