@Override SnapshotDiskConfiguration setProjectId(String projectId) { Builder builder = toBuilder().setSourceSnapshot(sourceSnapshot.setProjectId(projectId)); if (getDiskType() != null) { builder.setDiskType(getDiskType().setProjectId(projectId)); } return builder.build(); }
private void compareSnapshotDiskConfiguration( SnapshotDiskConfiguration expected, SnapshotDiskConfiguration value) { assertEquals(expected, value); assertEquals(expected.getDiskType(), value.getDiskType()); assertEquals(expected.getSizeGb(), value.getSizeGb()); assertEquals(expected.getSourceSnapshot(), value.getSourceSnapshot()); assertEquals(expected.getSourceSnapshotId(), value.getSourceSnapshotId()); assertEquals(expected.getType(), value.getType()); assertEquals(expected.hashCode(), value.hashCode()); } }
@Test public void testBuilder() { assertEquals(DISK_TYPE, DISK_CONFIGURATION.getDiskType()); assertEquals(SIZE, DISK_CONFIGURATION.getSizeGb()); assertEquals(SNAPSHOT, DISK_CONFIGURATION.getSourceSnapshot()); assertEquals(SNAPSHOT_ID, DISK_CONFIGURATION.getSourceSnapshotId()); assertEquals(Type.SNAPSHOT, DISK_CONFIGURATION.getType()); }
@Test public void testOf() { SnapshotDiskConfiguration configuration = SnapshotDiskConfiguration.of(SNAPSHOT); assertNull(configuration.getDiskType()); assertNull(configuration.getSizeGb()); assertNull(configuration.getSourceSnapshotId()); assertEquals(SNAPSHOT, configuration.getSourceSnapshot()); assertEquals(Type.SNAPSHOT, configuration.getType()); }
assertEquals(snapshotName, remoteConfiguration.getSourceSnapshot().getSnapshot()); assertEquals(100L, (long) remoteConfiguration.getSizeGb()); assertEquals("pd-standard", remoteConfiguration.getDiskType().getType()); assertNotNull(remoteConfiguration.getSourceSnapshotId()); assertNull(remoteDisk.getLastAttachTimestamp()); assertEquals(snapshotName, remoteConfiguration.getSourceSnapshot().getSnapshot()); assertNull(remoteConfiguration.getSizeGb()); assertEquals("pd-standard", remoteConfiguration.getDiskType().getType()); assertNull(remoteDisk.<SnapshotDiskConfiguration>getConfiguration().getSourceSnapshotId()); assertNull(remoteDisk.getLastAttachTimestamp());