/** * @param bootOrder drive boot order * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc. * @param deviceEmulationType device emulation type * @param drive drive to attach. UUID Required. */ @ConstructorProperties({ "boot_order", "dev_channel", "device", "drive" }) public ServerDrive(Integer bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, Drive drive) { this.bootOrder = bootOrder; this.deviceChannel = deviceChannel; this.deviceEmulationType = deviceEmulationType; this.drive = drive; this.driveUuid = drive.getUuid(); }
public Drive build() { return new Drive(uuid, name, resourceUri, owner, status); }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ServerDrive)) return false; ServerDrive that = (ServerDrive) o; if (bootOrder != that.bootOrder) return false; if (deviceChannel != null ? !deviceChannel.equals(that.deviceChannel) : that.deviceChannel != null) return false; if (deviceEmulationType != that.deviceEmulationType) return false; if (drive != null ? !drive.equals(that.drive) : that.drive != null) return false; return true; }
@Override public int hashCode() { int result = bootOrder; result = 31 * result + (deviceChannel != null ? deviceChannel.hashCode() : 0); result = 31 * result + (deviceEmulationType != null ? deviceEmulationType.hashCode() : 0); result = 31 * result + (drive != null ? drive.hashCode() : 0); return result; }
@Test public void testCreateServer() throws Exception { ServerInfo serverInfo = new ServerInfo.Builder() .name("New Server") .memory(new BigInteger("5368709120")) .cpu(3000) .vncPassword("new_password") .drives(ImmutableList.of(api.listDrives().concat().get(0).toServerDrive(1, "0:1", DeviceEmulationType.IDE))) .build(); createdServer = api.createServer(serverInfo); checkServer(serverInfo, createdServer); }
@Override public int hashCode() { int result = bootOrder != null ? bootOrder.hashCode() : 0; result = 31 * result + (deviceChannel != null ? deviceChannel.hashCode() : 0); result = 31 * result + (deviceEmulationType != null ? deviceEmulationType.hashCode() : 0); result = 31 * result + (drive != null ? drive.hashCode() : 0); result = 31 * result + (driveUuid != null ? driveUuid.hashCode() : 0); return result; }
.uuid("ae78e68c-9daa-4471-8878-0bb87fa80260") .resourceUri(new URI("/api/2.0/drives/ae78e68c-9daa-4471-8878-0bb87fa80260/")) .build().toServerDrive(0, "0:0", DeviceEmulationType.IDE), new Drive.Builder() .uuid("22826af4-d6c8-4d39-bd41-9cea86df2976") .resourceUri(new URI("/api/2.0/drives/22826af4-d6c8-4d39-bd41-9cea86df2976/")) .build().toServerDrive(1, "0:0", DeviceEmulationType.VIRTIO))) .nics(ImmutableList.of(new NIC.Builder() .ipV4Configuration(new IPConfiguration.Builder()
/** * @param bootOrder drive boot order * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc. * @param deviceEmulationType device emulation type * @param drive drive to attach. UUID Required. */ @ConstructorProperties({ "boot_order", "dev_channel", "device", "drive" }) public ServerDrive(Integer bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, Drive drive) { this.bootOrder = bootOrder; this.deviceChannel = deviceChannel; this.deviceEmulationType = deviceEmulationType; this.drive = drive; this.driveUuid = drive.getUuid(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ServerDrive that = (ServerDrive) o; if (bootOrder != null ? !bootOrder.equals(that.bootOrder) : that.bootOrder != null) return false; if (deviceChannel != null ? !deviceChannel.equals(that.deviceChannel) : that.deviceChannel != null) return false; if (deviceEmulationType != that.deviceEmulationType) return false; if (drive != null ? !drive.equals(that.drive) : that.drive != null) return false; if (driveUuid != null ? !driveUuid.equals(that.driveUuid) : that.driveUuid != null) return false; return true; }
@Override public int hashCode() { int result = bootOrder != null ? bootOrder.hashCode() : 0; result = 31 * result + (deviceChannel != null ? deviceChannel.hashCode() : 0); result = 31 * result + (deviceEmulationType != null ? deviceEmulationType.hashCode() : 0); result = 31 * result + (drive != null ? drive.hashCode() : 0); result = 31 * result + (driveUuid != null ? driveUuid.hashCode() : 0); return result; }
public Drive build() { return new Drive(uuid, name, resourceUri, owner, status); }
/** * @param bootOrder drive boot order * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc. * @param deviceEmulationType device emulation type * @param drive drive to attach. UUID Required. */ @ConstructorProperties({ "boot_order", "dev_channel", "device", "drive" }) public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, Drive drive) { this.bootOrder = bootOrder; this.deviceChannel = deviceChannel; this.deviceEmulationType = deviceEmulationType; this.drive = drive; this.driveUuid = drive.getUuid(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ServerDrive that = (ServerDrive) o; if (bootOrder != null ? !bootOrder.equals(that.bootOrder) : that.bootOrder != null) return false; if (deviceChannel != null ? !deviceChannel.equals(that.deviceChannel) : that.deviceChannel != null) return false; if (deviceEmulationType != that.deviceEmulationType) return false; if (drive != null ? !drive.equals(that.drive) : that.drive != null) return false; if (driveUuid != null ? !driveUuid.equals(that.driveUuid) : that.driveUuid != null) return false; return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (size != null ? size.hashCode() : 0); result = 31 * result + (allowMultimount ? 1 : 0); result = 31 * result + (affinities != null ? affinities.hashCode() : 0); result = 31 * result + (jobs != null ? jobs.hashCode() : 0); result = 31 * result + (licenses != null ? licenses.hashCode() : 0); result = 31 * result + (media != null ? media.hashCode() : 0); result = 31 * result + (meta != null ? meta.hashCode() : 0); result = 31 * result + (mountedOn != null ? mountedOn.hashCode() : 0); result = 31 * result + (tags != null ? tags.hashCode() : 0); return result; }
public Drive build() { return new Drive(uuid, name, resourceUri, owner, status); }
@Test(dependsOnMethods = {"testCreateDrives"}) public void testGetDriveInfo() throws Exception { for (Drive driveInfo : api.listDrives().concat()) { assertNotNull(api.getDriveInfo(driveInfo.getUuid())); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof DriveInfo)) return false; if (!super.equals(o)) return false; DriveInfo driveInfo = (DriveInfo) o; if (allowMultimount != driveInfo.allowMultimount) return false; if (affinities != null ? !affinities.equals(driveInfo.affinities) : driveInfo.affinities != null) return false; if (jobs != null ? !jobs.equals(driveInfo.jobs) : driveInfo.jobs != null) return false; if (licenses != null ? !licenses.equals(driveInfo.licenses) : driveInfo.licenses != null) return false; if (media != driveInfo.media) return false; if (meta != null ? !meta.equals(driveInfo.meta) : driveInfo.meta != null) return false; if (mountedOn != null ? !mountedOn.equals(driveInfo.mountedOn) : driveInfo.mountedOn != null) return false; if (size != null ? !size.equals(driveInfo.size) : driveInfo.size != null) return false; if (tags != null ? !tags.equals(driveInfo.tags) : driveInfo.tags != null) return false; return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (size != null ? size.hashCode() : 0); result = 31 * result + (allowMultimount ? 1 : 0); result = 31 * result + (affinities != null ? affinities.hashCode() : 0); result = 31 * result + (jobs != null ? jobs.hashCode() : 0); result = 31 * result + (licenses != null ? licenses.hashCode() : 0); result = 31 * result + (media != null ? media.hashCode() : 0); result = 31 * result + (meta != null ? meta.hashCode() : 0); result = 31 * result + (mountedOn != null ? mountedOn.hashCode() : 0); result = 31 * result + (tags != null ? tags.hashCode() : 0); return result; }
public void testConvertServerDrive() { CloudSigma2Api api = EasyMock.createMock(CloudSigma2Api.class); DriveInfo mockDrive = new DriveInfo.Builder() .uuid(input.getDrive().getUuid()) .size(new BigInteger("1024000000")) .build(); expect(api.getDriveInfo(input.getDrive().getUuid())).andReturn(mockDrive); replay(api); ServerDriveToVolume function = new ServerDriveToVolume(api); assertEquals(function.apply(input), expected); verify(api); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof DriveInfo)) return false; if (!super.equals(o)) return false; DriveInfo driveInfo = (DriveInfo) o; if (allowMultimount != driveInfo.allowMultimount) return false; if (affinities != null ? !affinities.equals(driveInfo.affinities) : driveInfo.affinities != null) return false; if (jobs != null ? !jobs.equals(driveInfo.jobs) : driveInfo.jobs != null) return false; if (licenses != null ? !licenses.equals(driveInfo.licenses) : driveInfo.licenses != null) return false; if (media != driveInfo.media) return false; if (meta != null ? !meta.equals(driveInfo.meta) : driveInfo.meta != null) return false; if (mountedOn != null ? !mountedOn.equals(driveInfo.mountedOn) : driveInfo.mountedOn != null) return false; if (size != null ? !size.equals(driveInfo.size) : driveInfo.size != null) return false; if (tags != null ? !tags.equals(driveInfo.tags) : driveInfo.tags != null) return false; return true; }