Here are the examples of the java api class com.google.cloud.compute.AttachedDisk.ScratchDiskConfiguration taken from open source projects.
1. AttachedDiskTest#testConfigurationSetProjectId()
Project: gcloud-java
File: AttachedDiskTest.java
File: AttachedDiskTest.java
@Test public void testConfigurationSetProjectId() { PersistentDiskConfiguration persistentConfiguration = PersistentDiskConfiguration.of(DiskId.of("zone", "disk")); comparePersistentDiskConfiguration(PersistentDiskConfiguration.of(DiskId.of("project", "zone", "disk")), persistentConfiguration.setProjectId("project")); ScratchDiskConfiguration scratchDiskConfiguration = ScratchDiskConfiguration.of(DiskTypeId.of("zone", "diskType")); compareScratchDiskConfiguration(ScratchDiskConfiguration.of(DiskTypeId.of("project", "zone", "diskType")), scratchDiskConfiguration.setProjectId("project")); CreateDiskConfiguration createDiskConfiguration = CREATE_DISK_CONFIGURATION.toBuilder().diskType(DiskTypeId.of("zone", "diskType")).sourceImage(ImageId.of("image")).build(); compareCreateDiskConfiguration(CREATE_DISK_CONFIGURATION, createDiskConfiguration.setProjectId("project")); }
2. AttachedDiskTest#testConfigurationToBuilderIncomplete()
Project: gcloud-java
File: AttachedDiskTest.java
File: AttachedDiskTest.java
@Test public void testConfigurationToBuilderIncomplete() { PersistentDiskConfiguration persistentConfiguration = PersistentDiskConfiguration.of(DISK_ID); comparePersistentDiskConfiguration(persistentConfiguration, AttachedDisk.AttachedDiskConfiguration.<PersistentDiskConfiguration>fromPb(persistentConfiguration.toPb())); ScratchDiskConfiguration scratchDiskConfiguration = ScratchDiskConfiguration.of(DISK_TYPE_ID); compareScratchDiskConfiguration(scratchDiskConfiguration, AttachedDisk.AttachedDiskConfiguration.<ScratchDiskConfiguration>fromPb(scratchDiskConfiguration.toPb())); CreateDiskConfiguration createDiskConfiguration = CreateDiskConfiguration.of(IMAGE_ID); compareCreateDiskConfiguration(createDiskConfiguration, AttachedDisk.AttachedDiskConfiguration.<CreateDiskConfiguration>fromPb(createDiskConfiguration.toPb())); }
3. AttachedDiskTest#testSetProjectId()
Project: gcloud-java
File: AttachedDiskTest.java
File: AttachedDiskTest.java
@Test public void testSetProjectId() { PersistentDiskConfiguration persistentConfiguration = PersistentDiskConfiguration.of(DiskId.of("zone", "disk")); PersistentDiskConfiguration persistentConfigurationWithProject = PersistentDiskConfiguration.of(DiskId.of("project", "zone", "disk")); AttachedDisk attachedDisk = AttachedDisk.of(persistentConfiguration); compareAttachedDisk(AttachedDisk.of(persistentConfigurationWithProject), attachedDisk.setProjectId("project")); ScratchDiskConfiguration scratchDiskConfiguration = ScratchDiskConfiguration.of(DiskTypeId.of("zone", "diskType")); ScratchDiskConfiguration scratchDiskConfigurationWithProject = ScratchDiskConfiguration.of(DiskTypeId.of("project", "zone", "diskType")); compareAttachedDisk(AttachedDisk.of(scratchDiskConfigurationWithProject), AttachedDisk.of(scratchDiskConfiguration).setProjectId("project")); CreateDiskConfiguration createDiskConfiguration = CreateDiskConfiguration.of(ImageId.of("image")); CreateDiskConfiguration createDiskConfigurationWithProject = CreateDiskConfiguration.of(ImageId.of("project", "image")); compareAttachedDisk(AttachedDisk.of(createDiskConfigurationWithProject), AttachedDisk.of(createDiskConfiguration).setProjectId("project")); createDiskConfiguration = CREATE_DISK_CONFIGURATION.toBuilder().diskType(DiskTypeId.of("zone", "diskType")).sourceImage(ImageId.of("image")).build(); compareAttachedDisk(AttachedDisk.of(CREATE_DISK_CONFIGURATION), AttachedDisk.of(createDiskConfiguration).setProjectId("project")); }
4. AttachedDiskTest#testConfigurationToAndFromPb()
Project: gcloud-java
File: AttachedDiskTest.java
File: AttachedDiskTest.java
@Test public void testConfigurationToAndFromPb() { PersistentDiskConfiguration persistentConfiguration = PersistentDiskConfiguration.of(DISK_ID); comparePersistentDiskConfiguration(persistentConfiguration, AttachedDisk.AttachedDiskConfiguration.<PersistentDiskConfiguration>fromPb(persistentConfiguration.toPb())); comparePersistentDiskConfiguration(PERSISTENT_DISK_CONFIGURATION, AttachedDisk.AttachedDiskConfiguration.<PersistentDiskConfiguration>fromPb(PERSISTENT_DISK_CONFIGURATION.toPb())); ScratchDiskConfiguration scratchDiskConfiguration = ScratchDiskConfiguration.of(DISK_TYPE_ID); compareScratchDiskConfiguration(scratchDiskConfiguration, AttachedDisk.AttachedDiskConfiguration.<ScratchDiskConfiguration>fromPb(scratchDiskConfiguration.toPb())); compareScratchDiskConfiguration(SCRATCH_DISK_CONFIGURATION, AttachedDisk.AttachedDiskConfiguration.<ScratchDiskConfiguration>fromPb(SCRATCH_DISK_CONFIGURATION.toPb())); CreateDiskConfiguration createDiskConfiguration = CreateDiskConfiguration.of(IMAGE_ID); compareCreateDiskConfiguration(createDiskConfiguration, AttachedDisk.AttachedDiskConfiguration.<CreateDiskConfiguration>fromPb(createDiskConfiguration.toPb())); compareCreateDiskConfiguration(CREATE_DISK_CONFIGURATION, AttachedDisk.AttachedDiskConfiguration.<CreateDiskConfiguration>fromPb(CREATE_DISK_CONFIGURATION.toPb())); }
5. AttachedDiskTest#testConfigurationOf()
Project: gcloud-java
File: AttachedDiskTest.java
File: AttachedDiskTest.java
@Test public void testConfigurationOf() { PersistentDiskConfiguration persistentConfiguration = PersistentDiskConfiguration.of(DISK_ID); assertEquals(DISK_ID, persistentConfiguration.sourceDisk()); assertEquals(Type.PERSISTENT, persistentConfiguration.type()); assertNull(persistentConfiguration.autoDelete()); assertNull(persistentConfiguration.boot()); assertNull(persistentConfiguration.interfaceType()); ScratchDiskConfiguration scratchDiskConfiguration = ScratchDiskConfiguration.of(DISK_TYPE_ID); assertEquals(DISK_TYPE_ID, scratchDiskConfiguration.diskType()); assertNull(scratchDiskConfiguration.interfaceType()); assertEquals(Type.SCRATCH, scratchDiskConfiguration.type()); assertTrue(scratchDiskConfiguration.autoDelete()); assertFalse(scratchDiskConfiguration.boot()); assertNull(scratchDiskConfiguration.interfaceType()); CreateDiskConfiguration createDiskConfiguration = CreateDiskConfiguration.of(IMAGE_ID); assertEquals(IMAGE_ID, createDiskConfiguration.sourceImage()); assertNull(createDiskConfiguration.diskType()); assertNull(createDiskConfiguration.diskName()); assertNull(createDiskConfiguration.diskSizeGb()); assertNull(createDiskConfiguration.interfaceType()); assertEquals(Type.PERSISTENT, createDiskConfiguration.type()); assertNull(createDiskConfiguration.autoDelete()); assertTrue(createDiskConfiguration.boot()); assertNull(createDiskConfiguration.interfaceType()); }
6. AttachedDiskTest#testConfigurationToBuilder()
Project: gcloud-java
File: AttachedDiskTest.java
File: AttachedDiskTest.java
@Test public void testConfigurationToBuilder() { comparePersistentDiskConfiguration(PERSISTENT_DISK_CONFIGURATION, PERSISTENT_DISK_CONFIGURATION.toBuilder().build()); compareScratchDiskConfiguration(SCRATCH_DISK_CONFIGURATION, SCRATCH_DISK_CONFIGURATION.toBuilder().build()); compareCreateDiskConfiguration(CREATE_DISK_CONFIGURATION, CREATE_DISK_CONFIGURATION.toBuilder().build()); PersistentDiskConfiguration persistentDiskConfiguration = PERSISTENT_DISK_CONFIGURATION.toBuilder().autoDelete(false).build(); assertFalse(persistentDiskConfiguration.autoDelete()); persistentDiskConfiguration = persistentDiskConfiguration.toBuilder().autoDelete(AUTO_DELETE).build(); assertEquals(PERSISTENT_DISK_CONFIGURATION, persistentDiskConfiguration); ScratchDiskConfiguration scratchDiskConfiguration = SCRATCH_DISK_CONFIGURATION.toBuilder().interfaceType(InterfaceType.SCSI).build(); assertEquals(InterfaceType.SCSI, scratchDiskConfiguration.interfaceType()); scratchDiskConfiguration = scratchDiskConfiguration.toBuilder().interfaceType(INTERFACE_TYPE).build(); assertEquals(SCRATCH_DISK_CONFIGURATION, scratchDiskConfiguration); CreateDiskConfiguration createDiskConfiguration = CREATE_DISK_CONFIGURATION.toBuilder().autoDelete(false).build(); assertFalse(createDiskConfiguration.autoDelete()); createDiskConfiguration = createDiskConfiguration.toBuilder().autoDelete(AUTO_DELETE).build(); assertEquals(CREATE_DISK_CONFIGURATION, createDiskConfiguration); }