mirror of https://github.com/apache/jclouds.git
Add tests for Virtual CPU attribute in Flavor json
This commit is contained in:
parent
481f7a4b2f
commit
f50ef6ecfc
|
@ -44,7 +44,7 @@ public class FlavorToHardwareTest {
|
|||
public void test() throws UnknownHostException, URISyntaxException {
|
||||
Hardware flavor = convertFlavor();
|
||||
Hardware tempFlavor = new HardwareBuilder().ids("1").name("256 MB Server")
|
||||
.processors(ImmutableList.of(new Processor(1.0, 1.0)))
|
||||
.processors(ImmutableList.of(new Processor(2.0, 2.0)))
|
||||
.ram(256)
|
||||
.volumes(ImmutableList.of(
|
||||
new VolumeBuilder().type(Volume.Type.LOCAL).size(10.0f).durable(true).bootDevice(true).build()))
|
||||
|
|
|
@ -55,6 +55,7 @@ public class ParseFlavorFromJsonResponseTest {
|
|||
assertEquals(response.getName(), "256 MB Server");
|
||||
assertEquals(response.getDisk().intValue(), 10);
|
||||
assertEquals(response.getRam().intValue(), 256);
|
||||
assertEquals(response.getVcpus().intValue(), 2);
|
||||
}
|
||||
|
||||
public static Flavor parseFlavor() {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ParseFlavorListFromJsonResponseTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_flavors.json");
|
||||
|
||||
List<Flavor> expects = ImmutableList.of(new Flavor(1, "256 MB Server"), new Flavor(2, "512 MB Server"));
|
||||
List<Flavor> expects = ImmutableList.of(new Flavor(1, "256 MB Server", null, null, null), new Flavor(2, "512 MB Server", null, null, null));
|
||||
|
||||
UnwrapOnlyJsonValue<List<Flavor>> parser = i.getInstance(Key
|
||||
.get(new TypeLiteral<UnwrapOnlyJsonValue<List<Flavor>>>() {
|
||||
|
@ -69,13 +69,15 @@ public class ParseFlavorListFromJsonResponseTest {
|
|||
List<Flavor> response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
|
||||
assertEquals(response.get(0).getId(), 1);
|
||||
assertEquals(response.get(0).getName(), "256 MB Server");
|
||||
assertEquals(response.get(0).getDisk(), new Integer(10));
|
||||
assertEquals(response.get(0).getRam(), new Integer(256));
|
||||
assertEquals(response.get(0).getDisk(), Integer.valueOf(10));
|
||||
assertEquals(response.get(0).getRam(), Integer.valueOf(256));
|
||||
assertEquals(response.get(0).getVcpus(), Integer.valueOf(2));
|
||||
|
||||
assertEquals(response.get(1).getId(), 2);
|
||||
assertEquals(response.get(1).getName(), "512 MB Server");
|
||||
assertEquals(response.get(1).getDisk(), new Integer(20));
|
||||
assertEquals(response.get(1).getRam(), new Integer(512));
|
||||
assertEquals(response.get(1).getDisk(), Integer.valueOf(20));
|
||||
assertEquals(response.get(1).getRam(), Integer.valueOf(512));
|
||||
assertEquals(response.get(1).getVcpus(), Integer.valueOf(5));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"name" : "256 MB Server",
|
||||
"ram" : 256,
|
||||
"disk" : 10,
|
||||
"vcpus" : 2,
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"name" : "256 MB Server",
|
||||
"ram" : 256,
|
||||
"disk" : 10,
|
||||
"vcpus" : 2,
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
|
@ -27,6 +28,7 @@
|
|||
"name" : "512 MB Server",
|
||||
"ram" : 512,
|
||||
"disk" : 20,
|
||||
"vcpus" : 5,
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
|
|
Loading…
Reference in New Issue