@Override public com.google.api.services.compute.model.Operation call() { return computeRpc.createSnapshot( completeSnapshot.getSourceDisk().getZone(), completeSnapshot.getSourceDisk().getDisk(), completeSnapshot.getSnapshotId().getSnapshot(), completeSnapshot.getDescription(), optionsMap); } },
@Test public void testToBuilder() { compareSnapshotInfo(SNAPSHOT_INFO, SNAPSHOT_INFO.toBuilder().build()); SnapshotInfo snapshotInfo = SNAPSHOT_INFO.toBuilder().setDescription("newDescription").build(); assertEquals("newDescription", snapshotInfo.getDescription()); snapshotInfo = snapshotInfo.toBuilder().setDescription("description").build(); compareSnapshotInfo(SNAPSHOT_INFO, snapshotInfo); }
public void compareSnapshotInfo(SnapshotInfo expected, SnapshotInfo value) { assertEquals(expected, value); assertEquals(expected.getGeneratedId(), value.getGeneratedId()); assertEquals(expected.getSnapshotId(), value.getSnapshotId()); assertEquals(expected.getCreationTimestamp(), value.getCreationTimestamp()); assertEquals(expected.getDescription(), value.getDescription()); assertEquals(expected.getStatus(), value.getStatus()); assertEquals(expected.getDiskSizeGb(), value.getDiskSizeGb()); assertEquals(expected.getLicenses(), value.getLicenses()); assertEquals(expected.getSourceDisk(), value.getSourceDisk()); assertEquals(expected.getSourceDiskId(), value.getSourceDiskId()); assertEquals(expected.getStorageBytes(), value.getStorageBytes()); assertEquals(expected.getStorageBytesStatus(), value.getStorageBytesStatus()); assertEquals(expected.hashCode(), value.hashCode()); } }
@Test public void testBuilder() { assertEquals(GENERATED_ID, SNAPSHOT_INFO.getGeneratedId()); assertEquals(SNAPSHOT_ID, SNAPSHOT_INFO.getSnapshotId()); assertEquals(CREATION_TIMESTAMP, SNAPSHOT_INFO.getCreationTimestamp()); assertEquals(DESCRIPTION, SNAPSHOT_INFO.getDescription()); assertEquals(STATUS, SNAPSHOT_INFO.getStatus()); assertEquals(DISK_SIZE_GB, SNAPSHOT_INFO.getDiskSizeGb()); assertEquals(LICENSES, SNAPSHOT_INFO.getLicenses()); assertEquals(SOURCE_DISK, SNAPSHOT_INFO.getSourceDisk()); assertEquals(SOURCE_DISK_ID, SNAPSHOT_INFO.getSourceDiskId()); assertEquals(STORAGE_BYTES, SNAPSHOT_INFO.getStorageBytes()); assertEquals(STORAGE_BYTES_STATUS, SNAPSHOT_INFO.getStorageBytesStatus()); }
@Test public void testOf() { SnapshotInfo snapshotInfo = SnapshotInfo.of(SNAPSHOT_ID, SOURCE_DISK); assertNull(snapshotInfo.getGeneratedId()); assertEquals(SNAPSHOT_ID, snapshotInfo.getSnapshotId()); assertNull(snapshotInfo.getCreationTimestamp()); assertNull(snapshotInfo.getDescription()); assertNull(snapshotInfo.getStatus()); assertNull(snapshotInfo.getDiskSizeGb()); assertNull(snapshotInfo.getLicenses()); assertEquals(SOURCE_DISK, snapshotInfo.getSourceDisk()); assertNull(snapshotInfo.getSourceDiskId()); assertNull(snapshotInfo.getStorageBytes()); assertNull(snapshotInfo.getStorageBytesStatus()); }