From ec140172b949f40221ff56f7bd12cdac21007ce5 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Tue, 26 Apr 2016 17:40:26 +0200 Subject: [PATCH] Rename type name getters (#957) * Rename DiskTypeId.diskType() to type() * Rename MachineTypeId.machineType() to type() --- .../google/gcloud/compute/ComputeImpl.java | 5 ++- .../com/google/gcloud/compute/DiskTypeId.java | 32 ++++++++--------- .../google/gcloud/compute/MachineType.java | 2 +- .../google/gcloud/compute/MachineTypeId.java | 28 +++++++-------- .../gcloud/compute/ComputeImplTest.java | 34 +++++++++---------- .../google/gcloud/compute/DiskInfoTest.java | 6 ++-- .../google/gcloud/compute/DiskTypeIdTest.java | 6 ++-- .../compute/ImageDiskConfigurationTest.java | 2 +- .../gcloud/compute/MachineTypeIdTest.java | 6 ++-- .../SnapshotDiskConfigurationTest.java | 2 +- .../StandardDiskConfigurationTest.java | 2 +- .../gcloud/compute/it/ITComputeTest.java | 26 +++++++------- 12 files changed, 75 insertions(+), 76 deletions(-) diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java index f19b6ee641a1..d8ac3a840761 100644 --- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java +++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java @@ -427,7 +427,7 @@ public DiskType getDiskType(final DiskTypeId diskTypeId, DiskTypeOption... optio runWithRetries(new Callable() { @Override public com.google.api.services.compute.model.DiskType call() { - return computeRpc.getDiskType(diskTypeId.zone(), diskTypeId.diskType(), optionsMap); + return computeRpc.getDiskType(diskTypeId.zone(), diskTypeId.type(), optionsMap); } }, options().retryParams(), EXCEPTION_HANDLER); return answer == null ? null : DiskType.fromPb(answer); @@ -515,8 +515,7 @@ public MachineType getMachineType(final MachineTypeId machineType, MachineTypeOp runWithRetries(new Callable() { @Override public com.google.api.services.compute.model.MachineType call() { - return computeRpc.getMachineType(machineType.zone(), machineType.machineType(), - optionsMap); + return computeRpc.getMachineType(machineType.zone(), machineType.type(), optionsMap); } }, options().retryParams(), EXCEPTION_HANDLER); return answer == null ? null : MachineType.fromPb(answer); diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskTypeId.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskTypeId.java index 039565ec827f..836ee907abe3 100644 --- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskTypeId.java +++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/DiskTypeId.java @@ -48,19 +48,19 @@ public String apply(DiskTypeId diskTypeId) { private static final long serialVersionUID = 7337881474103686219L; private final String zone; - private final String diskType; + private final String type; - private DiskTypeId(String project, String zone, String diskType) { + private DiskTypeId(String project, String zone, String type) { super(project); this.zone = checkNotNull(zone); - this.diskType = checkNotNull(diskType); + this.type = checkNotNull(type); } /** * Returns the name of the disk type. */ - public String diskType() { - return diskType; + public String type() { + return type; } /** @@ -79,17 +79,17 @@ public ZoneId zoneId() { @Override public String selfLink() { - return super.selfLink() + "/zones/" + zone + "/diskTypes/" + diskType; + return super.selfLink() + "/zones/" + zone + "/diskTypes/" + type; } @Override MoreObjects.ToStringHelper toStringHelper() { - return super.toStringHelper().add("zone", zone).add("diskType", diskType); + return super.toStringHelper().add("zone", zone).add("type", type); } @Override public int hashCode() { - return Objects.hash(super.baseHashCode(), zone, diskType); + return Objects.hash(super.baseHashCode(), zone, type); } @Override @@ -103,7 +103,7 @@ public boolean equals(Object obj) { DiskTypeId other = (DiskTypeId) obj; return baseEquals(other) && Objects.equals(zone, other.zone) - && Objects.equals(diskType, other.diskType); + && Objects.equals(type, other.type); } @Override @@ -111,28 +111,28 @@ DiskTypeId setProjectId(String projectId) { if (project() != null) { return this; } - return DiskTypeId.of(projectId, zone, diskType); + return DiskTypeId.of(projectId, zone, type); } /** * Returns a disk type identity given the zone identity and the disk type name. */ - public static DiskTypeId of(ZoneId zoneId, String diskType) { - return new DiskTypeId(zoneId.project(), zoneId.zone(), diskType); + public static DiskTypeId of(ZoneId zoneId, String type) { + return new DiskTypeId(zoneId.project(), zoneId.zone(), type); } /** * Returns a disk type identity given the zone and disk type names. */ - public static DiskTypeId of(String zone, String diskType) { - return of(ZoneId.of(null, zone), diskType); + public static DiskTypeId of(String zone, String type) { + return of(ZoneId.of(null, zone), type); } /** * Returns a disk type identity given project disk, zone and disk type names. */ - public static DiskTypeId of(String project, String zone, String diskType) { - return of(ZoneId.of(project, zone), diskType); + public static DiskTypeId of(String project, String zone, String type) { + return of(ZoneId.of(project, zone), type); } /** diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineType.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineType.java index 2d7bfa7d26c8..a381ec1de6b4 100644 --- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineType.java +++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineType.java @@ -260,7 +260,7 @@ com.google.api.services.compute.model.MachineType toPb() { if (creationTimestamp != null) { machineTypePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp)); } - machineTypePb.setName(machineTypeId.machineType()); + machineTypePb.setName(machineTypeId.type()); machineTypePb.setDescription(description); machineTypePb.setSelfLink(machineTypeId.selfLink()); machineTypePb.setGuestCpus(cpus); diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineTypeId.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineTypeId.java index a431d29d1e85..1d1e214a1475 100644 --- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineTypeId.java +++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/MachineTypeId.java @@ -50,19 +50,19 @@ public String apply(MachineTypeId machineTypeId) { private static final long serialVersionUID = -5819598544478859608L; private final String zone; - private final String machineType; + private final String type; - private MachineTypeId(String project, String zone, String machineType) { + private MachineTypeId(String project, String zone, String type) { super(project); this.zone = checkNotNull(zone); - this.machineType = checkNotNull(machineType); + this.type = checkNotNull(type); } /** * Returns the name of the machine type. */ - public String machineType() { - return machineType; + public String type() { + return type; } /** @@ -81,17 +81,17 @@ public ZoneId zoneId() { @Override public String selfLink() { - return super.selfLink() + "/zones/" + zone + "/machineTypes/" + machineType; + return super.selfLink() + "/zones/" + zone + "/machineTypes/" + type; } @Override MoreObjects.ToStringHelper toStringHelper() { - return super.toStringHelper().add("zone", zone).add("machineType", machineType); + return super.toStringHelper().add("zone", zone).add("type", type); } @Override public int hashCode() { - return Objects.hash(baseHashCode(), zone, machineType); + return Objects.hash(baseHashCode(), zone, type); } @Override @@ -105,7 +105,7 @@ public boolean equals(Object obj) { MachineTypeId other = (MachineTypeId) obj; return baseEquals(other) && Objects.equals(zone, other.zone) - && Objects.equals(machineType, other.machineType); + && Objects.equals(type, other.type); } @Override @@ -113,21 +113,21 @@ MachineTypeId setProjectId(String projectId) { if (project() != null) { return this; } - return MachineTypeId.of(projectId, zone, machineType); + return MachineTypeId.of(projectId, zone, type); } /** * Returns a machine type identity given the zone and type names. */ - public static MachineTypeId of(String zone, String machineType) { - return new MachineTypeId(null, zone, machineType); + public static MachineTypeId of(String zone, String type) { + return new MachineTypeId(null, zone, type); } /** * Returns a machine type identity given project, zone and type names. */ - public static MachineTypeId of(String project, String zone, String machineType) { - return new MachineTypeId(project, zone, machineType); + public static MachineTypeId of(String project, String zone, String type) { + return new MachineTypeId(project, zone, type); } /** diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java index 85ddd0e3595b..3dd28c043fd7 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java @@ -561,28 +561,28 @@ public void testGetOptions() { @Test public void testGetDiskType() { EasyMock.expect( - computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), EMPTY_RPC_OPTIONS)) + computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andReturn(DISK_TYPE.toPb()); EasyMock.replay(computeRpcMock); compute = options.service(); - DiskType diskType = compute.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType()); + DiskType diskType = compute.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type()); assertEquals(DISK_TYPE, diskType); } @Test public void testGetDiskType_Null() { EasyMock.expect( - computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), EMPTY_RPC_OPTIONS)) + computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andReturn(null); EasyMock.replay(computeRpcMock); compute = options.service(); - assertNull(compute.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType())); + assertNull(compute.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type())); } @Test public void testGetDiskTypeFromDiskTypeId() { EasyMock.expect( - computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), EMPTY_RPC_OPTIONS)) + computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andReturn(DISK_TYPE.toPb()); EasyMock.replay(computeRpcMock); compute = options.service(); @@ -595,12 +595,12 @@ public void testGetDiskTypeWithSelectedFields() { Capture> capturedOptions = Capture.newInstance(); EasyMock.expect( computeRpcMock.getDiskType( - eq(DISK_TYPE_ID.zone()), eq(DISK_TYPE_ID.diskType()), capture(capturedOptions))) + eq(DISK_TYPE_ID.zone()), eq(DISK_TYPE_ID.type()), capture(capturedOptions))) .andReturn(DISK_TYPE.toPb()); EasyMock.replay(computeRpcMock); compute = options.service(); DiskType diskType = - compute.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), DISK_TYPE_OPTION_FIELDS); + compute.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), DISK_TYPE_OPTION_FIELDS); String selector = (String) capturedOptions.getValue().get(DISK_TYPE_OPTION_FIELDS.rpcOption()); assertTrue(selector.contains("selfLink")); assertTrue(selector.contains("id")); @@ -748,12 +748,12 @@ public void testAggregatedListDiskTypesWithOptions() { public void testGetMachineType() { EasyMock.expect( computeRpcMock.getMachineType( - MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.machineType(), EMPTY_RPC_OPTIONS)) + MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andReturn(MACHINE_TYPE.toPb()); EasyMock.replay(computeRpcMock); compute = options.service(); MachineType machineType = - compute.getMachineType(MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.machineType()); + compute.getMachineType(MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.type()); assertEquals(MACHINE_TYPE, machineType); } @@ -761,17 +761,17 @@ public void testGetMachineType() { public void testGetMachineType_Null() { EasyMock.expect( computeRpcMock.getMachineType( - MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.machineType(), EMPTY_RPC_OPTIONS)) + MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andReturn(null); EasyMock.replay(computeRpcMock); compute = options.service(); - assertNull(compute.getMachineType(MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.machineType())); + assertNull(compute.getMachineType(MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.type())); } @Test public void testGetMachineTypeFromMachineTypeId() { EasyMock.expect(computeRpcMock.getMachineType( - MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.machineType(), EMPTY_RPC_OPTIONS)) + MACHINE_TYPE_ID.zone(), MACHINE_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andReturn(MACHINE_TYPE.toPb()); EasyMock.replay(computeRpcMock); compute = options.service(); @@ -783,13 +783,13 @@ public void testGetMachineTypeFromMachineTypeId() { public void testGetMachineTypeWithSelectedFields() { Capture> capturedOptions = Capture.newInstance(); EasyMock.expect( - computeRpcMock.getMachineType(eq(MACHINE_TYPE_ID.zone()), eq(MACHINE_TYPE_ID.machineType()), + computeRpcMock.getMachineType(eq(MACHINE_TYPE_ID.zone()), eq(MACHINE_TYPE_ID.type()), capture(capturedOptions))) .andReturn(MACHINE_TYPE.toPb()); EasyMock.replay(computeRpcMock); compute = options.service(); MachineType machineType = compute.getMachineType(MACHINE_TYPE_ID.zone(), - MACHINE_TYPE_ID.machineType(), MACHINE_TYPE_OPTION_FIELDS); + MACHINE_TYPE_ID.type(), MACHINE_TYPE_OPTION_FIELDS); String selector = (String) capturedOptions.getValue().get(DISK_TYPE_OPTION_FIELDS.rpcOption()); assertTrue(selector.contains("selfLink")); assertTrue(selector.contains("id")); @@ -3169,7 +3169,7 @@ public void testCreateNetworkWithOptions() { @Test public void testRetryableException() { EasyMock.expect( - computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), EMPTY_RPC_OPTIONS)) + computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andThrow(new ComputeException(500, "InternalError")) .andReturn(DISK_TYPE.toPb()); EasyMock.replay(computeRpcMock); @@ -3182,7 +3182,7 @@ public void testRetryableException() { public void testNonRetryableException() { String exceptionMessage = "Not Implemented"; EasyMock.expect( - computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), EMPTY_RPC_OPTIONS)) + computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andThrow(new ComputeException(501, exceptionMessage)); EasyMock.replay(computeRpcMock); compute = options.toBuilder().retryParams(RetryParams.defaultInstance()).build().service(); @@ -3195,7 +3195,7 @@ public void testNonRetryableException() { public void testRuntimeException() { String exceptionMessage = "Artificial runtime exception"; EasyMock.expect( - computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.diskType(), EMPTY_RPC_OPTIONS)) + computeRpcMock.getDiskType(DISK_TYPE_ID.zone(), DISK_TYPE_ID.type(), EMPTY_RPC_OPTIONS)) .andThrow(new RuntimeException(exceptionMessage)); EasyMock.replay(computeRpcMock); compute = options.toBuilder().retryParams(RetryParams.defaultInstance()).build().service(); diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskInfoTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskInfoTest.java index 1138d8008452..69919a871a49 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskInfoTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskInfoTest.java @@ -224,7 +224,7 @@ public void testToAndFromPb() { @Test public void testSetProjectId() { StandardDiskConfiguration standardDiskConfiguration = DISK_CONFIGURATION.toBuilder() - .diskType(DiskTypeId.of(TYPE.zone(), TYPE.diskType())) + .diskType(DiskTypeId.of(TYPE.zone(), TYPE.type())) .build(); DiskInfo diskInfo = DISK_INFO.toBuilder() .diskId(DiskId.of(DISK_ID.zone(), DISK_ID.disk())) @@ -232,7 +232,7 @@ public void testSetProjectId() { .build(); compareDiskInfo(DISK_INFO, diskInfo.setProjectId("project")); SnapshotDiskConfiguration snapshotDiskConfiguration = SNAPSHOT_DISK_CONFIGURATION.toBuilder() - .diskType(DiskTypeId.of(TYPE.zone(), TYPE.diskType())) + .diskType(DiskTypeId.of(TYPE.zone(), TYPE.type())) .sourceSnapshot(SnapshotId.of(SNAPSHOT.snapshot())) .build(); diskInfo = SNAPSHOT_DISK_INFO.toBuilder() @@ -241,7 +241,7 @@ public void testSetProjectId() { .build(); compareDiskInfo(SNAPSHOT_DISK_INFO, diskInfo.setProjectId("project")); ImageDiskConfiguration imageDiskConfiguration = IMAGE_DISK_CONFIGURATION.toBuilder() - .diskType(DiskTypeId.of(TYPE.zone(), TYPE.diskType())) + .diskType(DiskTypeId.of(TYPE.zone(), TYPE.type())) .sourceImage(ImageId.of(IMAGE.image())) .build(); diskInfo = IMAGE_DISK_INFO.toBuilder() diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskTypeIdTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskTypeIdTest.java index 5ff61d5777ba..c71099de1ecb 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskTypeIdTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/DiskTypeIdTest.java @@ -42,12 +42,12 @@ public void testOf() { DiskTypeId diskTypeId = DiskTypeId.of(PROJECT, ZONE, DISK_TYPE); assertEquals(PROJECT, diskTypeId.project()); assertEquals(ZONE, diskTypeId.zone()); - assertEquals(DISK_TYPE, diskTypeId.diskType()); + assertEquals(DISK_TYPE, diskTypeId.type()); assertEquals(URL, diskTypeId.selfLink()); diskTypeId = DiskTypeId.of(ZONE, DISK_TYPE); assertNull(diskTypeId.project()); assertEquals(ZONE, diskTypeId.zone()); - assertEquals(DISK_TYPE, diskTypeId.diskType()); + assertEquals(DISK_TYPE, diskTypeId.type()); } @Test @@ -77,7 +77,7 @@ private void compareDiskTypeId(DiskTypeId expected, DiskTypeId value) { assertEquals(expected, value); assertEquals(expected.project(), expected.project()); assertEquals(expected.zone(), expected.zone()); - assertEquals(expected.diskType(), expected.diskType()); + assertEquals(expected.type(), expected.type()); assertEquals(expected.selfLink(), expected.selfLink()); assertEquals(expected.hashCode(), expected.hashCode()); } diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ImageDiskConfigurationTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ImageDiskConfigurationTest.java index f388109db199..54e0e1607109 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ImageDiskConfigurationTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ImageDiskConfigurationTest.java @@ -93,7 +93,7 @@ public void testOf() { @Test public void testSetProjectId() { ImageDiskConfiguration diskConfiguration = DISK_CONFIGURATION.toBuilder() - .diskType(DiskTypeId.of(DISK_TYPE.zone(), DISK_TYPE.diskType())) + .diskType(DiskTypeId.of(DISK_TYPE.zone(), DISK_TYPE.type())) .sourceImage(ImageId.of(IMAGE.image())) .build(); compareImageDiskConfiguration(DISK_CONFIGURATION, diskConfiguration.setProjectId("project")); diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/MachineTypeIdTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/MachineTypeIdTest.java index 7e3f4d7eae35..10a607235a9e 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/MachineTypeIdTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/MachineTypeIdTest.java @@ -42,12 +42,12 @@ public void testOf() { MachineTypeId machineTypeId = MachineTypeId.of(PROJECT, ZONE, TYPE); assertEquals(PROJECT, machineTypeId.project()); assertEquals(ZONE, machineTypeId.zone()); - assertEquals(TYPE, machineTypeId.machineType()); + assertEquals(TYPE, machineTypeId.type()); assertEquals(URL, machineTypeId.selfLink()); machineTypeId = MachineTypeId.of(ZONE, TYPE); assertNull(machineTypeId.project()); assertEquals(ZONE, machineTypeId.zone()); - assertEquals(TYPE, machineTypeId.machineType()); + assertEquals(TYPE, machineTypeId.type()); } @Test @@ -76,7 +76,7 @@ private void compareMachineTypeId(MachineTypeId expected, MachineTypeId value) { assertEquals(expected, value); assertEquals(expected.project(), expected.project()); assertEquals(expected.zone(), expected.zone()); - assertEquals(expected.machineType(), expected.machineType()); + assertEquals(expected.type(), expected.type()); assertEquals(expected.selfLink(), expected.selfLink()); assertEquals(expected.hashCode(), expected.hashCode()); } diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/SnapshotDiskConfigurationTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/SnapshotDiskConfigurationTest.java index a6380dca667d..313ece829b25 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/SnapshotDiskConfigurationTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/SnapshotDiskConfigurationTest.java @@ -93,7 +93,7 @@ public void testOf() { @Test public void testSetProjectId() { SnapshotDiskConfiguration configuration = DISK_CONFIGURATION.toBuilder() - .diskType(DiskTypeId.of(DISK_TYPE.zone(), DISK_TYPE.diskType())) + .diskType(DiskTypeId.of(DISK_TYPE.zone(), DISK_TYPE.type())) .sourceSnapshot(SnapshotId.of(SNAPSHOT.snapshot())) .build(); compareSnapshotDiskConfiguration(DISK_CONFIGURATION, configuration.setProjectId("project")); diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/StandardDiskConfigurationTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/StandardDiskConfigurationTest.java index 702a362b6ddc..9240a758ab58 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/StandardDiskConfigurationTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/StandardDiskConfigurationTest.java @@ -87,7 +87,7 @@ public void testOf() { @Test public void testSetProjectId() { StandardDiskConfiguration configuration = DISK_CONFIGURATION.toBuilder() - .diskType(DiskTypeId.of(DISK_TYPE.zone(), DISK_TYPE.diskType())) + .diskType(DiskTypeId.of(DISK_TYPE.zone(), DISK_TYPE.type())) .build(); compareStandardDiskConfiguration(DISK_CONFIGURATION, configuration.setProjectId("project")); } diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java index aa94baf9809e..d47d0fb6082b 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java @@ -104,7 +104,7 @@ public void testGetDiskType() { DiskType diskType = compute.getDiskType(ZONE, DISK_TYPE); // assertNotNull(diskType.id()); assertEquals(ZONE, diskType.diskTypeId().zone()); - assertEquals(DISK_TYPE, diskType.diskTypeId().diskType()); + assertEquals(DISK_TYPE, diskType.diskTypeId().type()); assertNotNull(diskType.creationTimestamp()); assertNotNull(diskType.description()); assertNotNull(diskType.validDiskSize()); @@ -117,7 +117,7 @@ public void testGetDiskTypeWithSelectedFields() { Compute.DiskTypeOption.fields(Compute.DiskTypeField.CREATION_TIMESTAMP)); // assertNotNull(diskType.id()); assertEquals(ZONE, diskType.diskTypeId().zone()); - assertEquals(DISK_TYPE, diskType.diskTypeId().diskType()); + assertEquals(DISK_TYPE, diskType.diskTypeId().type()); assertNotNull(diskType.creationTimestamp()); assertNull(diskType.description()); assertNull(diskType.validDiskSize()); @@ -216,7 +216,7 @@ public void testAggregatedListDiskTypesWithFilter() { public void testGetMachineType() { MachineType machineType = compute.getMachineType(ZONE, MACHINE_TYPE); assertEquals(ZONE, machineType.machineTypeId().zone()); - assertEquals(MACHINE_TYPE, machineType.machineTypeId().machineType()); + assertEquals(MACHINE_TYPE, machineType.machineTypeId().type()); assertNotNull(machineType.id()); assertNotNull(machineType.creationTimestamp()); assertNotNull(machineType.description()); @@ -231,7 +231,7 @@ public void testGetMachineTypeWithSelectedFields() { MachineType machineType = compute.getMachineType(ZONE, MACHINE_TYPE, Compute.MachineTypeOption.fields(Compute.MachineTypeField.ID)); assertEquals(ZONE, machineType.machineTypeId().zone()); - assertEquals(MACHINE_TYPE, machineType.machineTypeId().machineType()); + assertEquals(MACHINE_TYPE, machineType.machineTypeId().type()); assertNotNull(machineType.id()); assertNull(machineType.creationTimestamp()); assertNull(machineType.description()); @@ -901,7 +901,7 @@ public void testCreateGetResizeAndDeleteStandardDisk() throws InterruptedExcepti assertTrue(remoteDisk.configuration() instanceof StandardDiskConfiguration); StandardDiskConfiguration remoteConfiguration = remoteDisk.configuration(); assertEquals(100L, (long) remoteConfiguration.sizeGb()); - assertEquals("pd-ssd", remoteConfiguration.diskType().diskType()); + assertEquals("pd-ssd", remoteConfiguration.diskType().type()); assertEquals(DiskConfiguration.Type.STANDARD, remoteConfiguration.type()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); @@ -919,7 +919,7 @@ public void testCreateGetResizeAndDeleteStandardDisk() throws InterruptedExcepti assertTrue(remoteDisk.configuration() instanceof StandardDiskConfiguration); remoteConfiguration = remoteDisk.configuration(); assertEquals(200L, (long) remoteConfiguration.sizeGb()); - assertEquals("pd-ssd", remoteConfiguration.diskType().diskType()); + assertEquals("pd-ssd", remoteConfiguration.diskType().type()); assertEquals(DiskConfiguration.Type.STANDARD, remoteConfiguration.type()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); @@ -953,7 +953,7 @@ public void testCreateGetAndDeleteImageDisk() throws InterruptedException { assertNotNull(remoteConfiguration.sourceImageId()); assertEquals(DiskConfiguration.Type.IMAGE, remoteConfiguration.type()); assertNotNull(remoteConfiguration.sizeGb()); - assertEquals("pd-standard", remoteConfiguration.diskType().diskType()); + assertEquals("pd-standard", remoteConfiguration.diskType().type()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); // test get with selected fields @@ -969,7 +969,7 @@ public void testCreateGetAndDeleteImageDisk() throws InterruptedException { assertNull(remoteConfiguration.sourceImageId()); assertEquals(DiskConfiguration.Type.IMAGE, remoteConfiguration.type()); assertNull(remoteConfiguration.sizeGb()); - assertEquals("pd-standard", remoteConfiguration.diskType().diskType()); + assertEquals("pd-standard", remoteConfiguration.diskType().type()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); operation = remoteDisk.delete(); @@ -1042,7 +1042,7 @@ public void testCreateGetAndDeleteSnapshotAndSnapshotDisk() throws InterruptedEx assertEquals(DiskConfiguration.Type.SNAPSHOT, remoteConfiguration.type()); assertEquals(snapshotName, remoteConfiguration.sourceSnapshot().snapshot()); assertEquals(100L, (long) remoteConfiguration.sizeGb()); - assertEquals("pd-standard", remoteConfiguration.diskType().diskType()); + assertEquals("pd-standard", remoteConfiguration.diskType().type()); assertNotNull(remoteConfiguration.sourceSnapshotId()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); @@ -1059,7 +1059,7 @@ public void testCreateGetAndDeleteSnapshotAndSnapshotDisk() throws InterruptedEx assertEquals(DiskConfiguration.Type.SNAPSHOT, remoteConfiguration.type()); assertEquals(snapshotName, remoteConfiguration.sourceSnapshot().snapshot()); assertNull(remoteConfiguration.sizeGb()); - assertEquals("pd-standard", remoteConfiguration.diskType().diskType()); + assertEquals("pd-standard", remoteConfiguration.diskType().type()); assertNull(remoteDisk.configuration().sourceSnapshotId()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); @@ -1108,7 +1108,7 @@ public void testListDisksAndSnapshots() throws InterruptedException { assertTrue(remoteDisk.configuration() instanceof StandardDiskConfiguration); StandardDiskConfiguration remoteConfiguration = remoteDisk.configuration(); assertEquals(100L, (long) remoteConfiguration.sizeGb()); - assertEquals("pd-ssd", remoteConfiguration.diskType().diskType()); + assertEquals("pd-ssd", remoteConfiguration.diskType().type()); assertEquals(DiskConfiguration.Type.STANDARD, remoteConfiguration.type()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); @@ -1130,7 +1130,7 @@ public void testListDisksAndSnapshots() throws InterruptedException { assertTrue(remoteDisk.configuration() instanceof StandardDiskConfiguration); StandardDiskConfiguration remoteConfiguration = remoteDisk.configuration(); assertNull(remoteConfiguration.sizeGb()); - assertEquals("pd-ssd", remoteConfiguration.diskType().diskType()); + assertEquals("pd-ssd", remoteConfiguration.diskType().type()); assertEquals(DiskConfiguration.Type.STANDARD, remoteConfiguration.type()); assertNull(remoteDisk.lastAttachTimestamp()); assertNull(remoteDisk.lastDetachTimestamp()); @@ -1228,7 +1228,7 @@ public void testAggregatedListDisks() throws InterruptedException { assertTrue(remoteDisk.configuration() instanceof StandardDiskConfiguration); StandardDiskConfiguration remoteConfiguration = remoteDisk.configuration(); assertEquals(100L, (long) remoteConfiguration.sizeGb()); - assertEquals("pd-ssd", remoteConfiguration.diskType().diskType()); + assertEquals("pd-ssd", remoteConfiguration.diskType().type()); assertEquals(DiskConfiguration.Type.STANDARD, remoteConfiguration.type()); count++; }