mirror of https://github.com/apache/jclouds.git
Renaming ServerIp to Ip
This commit is contained in:
parent
6f009695e5
commit
f3bbcb601d
|
@ -28,7 +28,7 @@ import com.google.common.base.Objects;
|
|||
* @see ServerCreated
|
||||
* @see ServerDetails
|
||||
*/
|
||||
public class ServerIp {
|
||||
public class Ip {
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
|
@ -62,11 +62,11 @@ public class ServerIp {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ServerIp build() {
|
||||
return new ServerIp(ip, version, cost);
|
||||
public Ip build() {
|
||||
return new Ip(ip, version, cost);
|
||||
}
|
||||
|
||||
public Builder fromIpCreated(ServerIp from) {
|
||||
public Builder fromIpCreated(Ip from) {
|
||||
return ip(from.getIp()).version(from.getVersion()).cost(from.getCost());
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class ServerIp {
|
|||
protected final int version;
|
||||
protected final double cost;
|
||||
|
||||
public ServerIp(String ip, int version, double cost) {
|
||||
public Ip(String ip, int version, double cost) {
|
||||
this.ip = ip;
|
||||
this.version = version;
|
||||
this.cost = cost;
|
||||
|
@ -107,8 +107,8 @@ public class ServerIp {
|
|||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof ServerIp) {
|
||||
final ServerIp other = (ServerIp) object;
|
||||
if (object instanceof Ip) {
|
||||
final Ip other = (Ip) object;
|
||||
return Objects.equal(ip, other.ip)
|
||||
&& Objects.equal(version, other.version)
|
||||
&& Objects.equal(cost, other.cost);
|
|
@ -43,19 +43,19 @@ public class ServerCreated {
|
|||
public static class Builder {
|
||||
private String id;
|
||||
private String hostname;
|
||||
private List<ServerIp> ips;
|
||||
private List<Ip> ips;
|
||||
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ips(List<ServerIp> ips) {
|
||||
public Builder ips(List<Ip> ips) {
|
||||
this.ips = ips;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ips(ServerIp... ips) {
|
||||
public Builder ips(Ip... ips) {
|
||||
return ips(Arrays.asList(ips));
|
||||
}
|
||||
|
||||
|
@ -77,9 +77,9 @@ public class ServerCreated {
|
|||
private final String id;
|
||||
private final String hostname;
|
||||
@SerializedName("iplist")
|
||||
private final List<ServerIp> ips;
|
||||
private final List<Ip> ips;
|
||||
|
||||
public ServerCreated(String id, @Nullable String hostname, List<ServerIp> ips) {
|
||||
public ServerCreated(String id, @Nullable String hostname, List<Ip> ips) {
|
||||
checkNotNull(id, "id");
|
||||
this.id = id;
|
||||
this.hostname = hostname;
|
||||
|
@ -100,8 +100,8 @@ public class ServerCreated {
|
|||
}
|
||||
|
||||
/** @return the IP addresses assigned to the server */
|
||||
public List<ServerIp> getIps() {
|
||||
return ips == null ? ImmutableList.<ServerIp>of() : ips;
|
||||
public List<Ip> getIps() {
|
||||
return ips == null ? ImmutableList.<Ip>of() : ips;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ServerDetails extends Server {
|
|||
private int disk;
|
||||
private int transfer;
|
||||
private Cost cost;
|
||||
private List<ServerIp> ips;
|
||||
private List<Ip> ips;
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
|
@ -83,11 +83,11 @@ public class ServerDetails extends Server {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder ips(ServerIp... ips) {
|
||||
public Builder ips(Ip... ips) {
|
||||
return ips(Arrays.asList(ips));
|
||||
}
|
||||
|
||||
public Builder ips(List<ServerIp> ips) {
|
||||
public Builder ips(List<Ip> ips) {
|
||||
this.ips = ips;
|
||||
return this;
|
||||
}
|
||||
|
@ -136,10 +136,10 @@ public class ServerDetails extends Server {
|
|||
private final int transfer;
|
||||
private final Cost cost;
|
||||
@SerializedName("iplist")
|
||||
private final List<ServerIp> ips;
|
||||
private final List<Ip> ips;
|
||||
|
||||
public ServerDetails(String id, String hostname, String datacenter, String platform, String template,
|
||||
String description, int cpuCores, int memory, int disk, int transfer, Cost cost, List<ServerIp> ips) {
|
||||
String description, int cpuCores, int memory, int disk, int transfer, Cost cost, List<Ip> ips) {
|
||||
super(id, hostname, datacenter, platform);
|
||||
this.template = checkNotNull(template, "template");
|
||||
this.description = description;
|
||||
|
@ -148,7 +148,7 @@ public class ServerDetails extends Server {
|
|||
this.disk = disk;
|
||||
this.transfer = transfer;
|
||||
this.cost = checkNotNull(cost, "cost");
|
||||
this.ips = ips == null ? ImmutableList.<ServerIp>of() : ips;
|
||||
this.ips = ips == null ? ImmutableList.<Ip>of() : ips;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,7 +196,7 @@ public class ServerDetails extends Server {
|
|||
/**
|
||||
* @return the ip addresses assigned to the server
|
||||
*/
|
||||
public List<ServerIp> getIps() {
|
||||
public List<Ip> getIps() {
|
||||
return ips;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.jclouds.glesys.GleSYSClient;
|
|||
import org.jclouds.glesys.domain.Server;
|
||||
import org.jclouds.glesys.domain.ServerCreated;
|
||||
import org.jclouds.glesys.domain.ServerDetails;
|
||||
import org.jclouds.glesys.domain.ServerIp;
|
||||
import org.jclouds.glesys.domain.Ip;
|
||||
import org.jclouds.glesys.options.*;
|
||||
import org.jclouds.glesys.parse.*;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -128,7 +128,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
|||
.put("template", "Ubuntu 32-bit")
|
||||
.put("disksize", "5").build())).build(),
|
||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_created.json")).build()).getServerClient();
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(ServerIp.builder().ip("109.74.10.27").build()).build();
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(Ip.builder().ip("109.74.10.27").build()).build();
|
||||
|
||||
assertEquals(client.createServer("Falkenberg", "OpenVZ", "jclouds-test", "Ubuntu 32-bit", 5, 512, 1, "password", 50), expected);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
|||
.put("ip", "10.0.0.1").build())).build(),
|
||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_created.json")).build()).getServerClient();
|
||||
ServerCreateOptions options = ServerCreateOptions.Builder.description("Description-of-server").ip("10.0.0.1");
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(ServerIp.builder().ip("109.74.10.27").build()).build();
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(Ip.builder().ip("109.74.10.27").build()).build();
|
||||
|
||||
assertEquals(client.createServer("Falkenberg", "OpenVZ", "jclouds-test", "Ubuntu 32-bit", 5, 512, 1, "password", 50, options), expected);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
|||
.put("serverid", "server111")
|
||||
.put("hostname", "hostname1").build())).build(),
|
||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_created.json")).build()).getServerClient();
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(ServerIp.builder().ip("109.74.10.27").build()).build();
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(Ip.builder().ip("109.74.10.27").build()).build();
|
||||
|
||||
assertEquals(client.cloneServer("server111", "hostname1"), expected);
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
|
|||
.put("cpucores", "1").build())).build(),
|
||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_created.json")).build()).getServerClient();
|
||||
ServerCloneOptions options = (ServerCloneOptions) ServerCloneOptions.Builder.description("Description-of-server").disksize(1).memorysize(512).cpucores(1);
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(ServerIp.builder().ip("109.74.10.27").build()).build();
|
||||
ServerCreated expected = ServerCreated.builder().hostname("jclouds-test").id("xm3630641").ips(Ip.builder().ip("109.74.10.27").build()).build();
|
||||
|
||||
assertEquals(client.cloneServer("server111", "hostname1", options), expected);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.google.inject.Guice;
|
|||
import com.google.inject.Injector;
|
||||
import org.jclouds.glesys.config.GleSYSParserModule;
|
||||
import org.jclouds.glesys.domain.ServerCreated;
|
||||
import org.jclouds.glesys.domain.ServerIp;
|
||||
import org.jclouds.glesys.domain.Ip;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
|
@ -47,7 +47,7 @@ public class ParseServerCreatedTest extends BaseItemParserTest<ServerCreated> {
|
|||
@SelectJson("server")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public ServerCreated expected() {
|
||||
return ServerCreated.builder().id("xm3630641").hostname("jclouds-test-host").ips(ServerIp.builder().ip("109.74.10.27").version4().cost(2.00).build()).build();
|
||||
return ServerCreated.builder().id("xm3630641").hostname("jclouds-test-host").ips(Ip.builder().ip("109.74.10.27").version4().cost(2.00).build()).build();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.inject.Injector;
|
|||
import org.jclouds.glesys.config.GleSYSParserModule;
|
||||
import org.jclouds.glesys.domain.Cost;
|
||||
import org.jclouds.glesys.domain.ServerDetails;
|
||||
import org.jclouds.glesys.domain.ServerIp;
|
||||
import org.jclouds.glesys.domain.Ip;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
|
@ -48,7 +48,7 @@ public class ParseServerDetailsTest extends BaseItemParserTest<ServerDetails> {
|
|||
@SelectJson("server")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public ServerDetails expected() {
|
||||
ServerIp ip = ServerIp.builder().version4().ip("31.192.226.45").cost(2.0).build();
|
||||
Ip ip = Ip.builder().version4().ip("31.192.226.45").cost(2.0).build();
|
||||
Cost cost = Cost.builder().amount(6.38).currency("EUR").timePeriod("month").build();
|
||||
return ServerDetails.builder().id("vz1375882").transfer(50).hostname("jclouds-unit").cpuCores(1).memory(128).disk(5)
|
||||
.description("unit test server").datacenter("Falkenberg").platform("OpenVZ").template("Debian 6.0 64-bit")
|
||||
|
|
Loading…
Reference in New Issue