@Test public void testUpdatePayload() { UpdateSnapshotRequestBinder binder = new UpdateSnapshotRequestBinder(); Snapshot.Request.UpdatePayload payload = Snapshot.Request.updatingBuilder() .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh") .description("description") .name("snapshot-name") .bootable(true) .osType(OsType.LINUX) .isCpuHotPlug(true) .isCpuHotUnPlug(true) .isRamHotPlug(true) .isRamHotUnPlug(true) .isNicHotPlug(true) .isNicHotUnPlug(true) .isDiscVirtioHotPlug(true) .isDiscVirtioHotUnPlug(true) .build(); String actual = binder.createPayload(payload); assertNotNull(actual, "Binder returned null payload"); assertEquals(actual, expectedPayload); }
@Override protected String createPayload(Snapshot.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateSnapshot>") .append("<request>") .append(format("<snapshotId>%s</snapshotId>", payload.id())) .append(format("<description>%s</description>", payload.description())) .append(format("<snapshotName>%s</snapshotName>", payload.name())) .append(formatIfNotEmpty("<bootable>%s</bootable>", payload.bootable())) .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) .append(formatIfNotEmpty("<cpuHotUnPlug>%s</cpuHotUnPlug>", payload.isCpuHotUnPlug())) .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) .append(formatIfNotEmpty("<ramHotUnPlug>%s</ramHotUnPlug>", payload.isRamHotUnPlug())) .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) .append("</request>") .append("</ws:updateSnapshot>"); return requestBuilder.toString(); }
UpdateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.UpdatePayload> { @Override protected String createPayload(Snapshot.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateSnapshot>") .append("<request>") .append(format("<snapshotId>%s</snapshotId>", payload.id())) .append(format("<description>%s</description>", payload.description())) .append(format("<snapshotName>%s</snapshotName>", payload.name())) .append(formatIfNotEmpty("<bootable>%s</bootable>", payload.bootable())) .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) .append(formatIfNotEmpty("<cpuHotUnPlug>%s</cpuHotUnPlug>", payload.isCpuHotUnPlug())) .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) .append(formatIfNotEmpty("<ramHotUnPlug>%s</ramHotUnPlug>", payload.isRamHotUnPlug())) .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) .append("</request>") .append("</ws:updateSnapshot>"); return requestBuilder.toString(); } }
UpdateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.UpdatePayload> { @Override protected String createPayload(Snapshot.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateSnapshot>") .append("<request>") .append(format("<snapshotId>%s</snapshotId>", payload.id())) .append(format("<description>%s</description>", payload.description())) .append(format("<snapshotName>%s</snapshotName>", payload.name())) .append(formatIfNotEmpty("<bootable>%s</bootable>", payload.bootable())) .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) .append(formatIfNotEmpty("<cpuHotUnPlug>%s</cpuHotUnPlug>", payload.isCpuHotUnPlug())) .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) .append(formatIfNotEmpty("<ramHotUnPlug>%s</ramHotUnPlug>", payload.isRamHotUnPlug())) .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) .append("</request>") .append("</ws:updateSnapshot>"); return requestBuilder.toString(); } protected  UpdateSnapshotRequestBinder(); }
UpdateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.UpdatePayload> { @Override protected String createPayload(Snapshot.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateSnapshot>") .append("<request>") .append(format("<snapshotId>%s</snapshotId>", payload.id())) .append(format("<description>%s</description>", payload.description())) .append(format("<snapshotName>%s</snapshotName>", payload.name())) .append(formatIfNotEmpty("<bootable>%s</bootable>", payload.bootable())) .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) .append(formatIfNotEmpty("<cpuHotUnPlug>%s</cpuHotUnPlug>", payload.isCpuHotUnPlug())) .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) .append(formatIfNotEmpty("<ramHotUnPlug>%s</ramHotUnPlug>", payload.isRamHotUnPlug())) .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) .append("</request>") .append("</ws:updateSnapshot>"); return requestBuilder.toString(); } protected  UpdateSnapshotRequestBinder();  }
UpdateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.UpdatePayload> { @Override protected String createPayload(Snapshot.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateSnapshot>") .append("<request>") .append(format("<snapshotId>%s</snapshotId>", payload.id())) .append(format("<description>%s</description>", payload.description())) .append(format("<snapshotName>%s</snapshotName>", payload.name())) .append(formatIfNotEmpty("<bootable>%s</bootable>", payload.bootable())) .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) .append(formatIfNotEmpty("<cpuHotUnPlug>%s</cpuHotUnPlug>", payload.isCpuHotUnPlug())) .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) .append(formatIfNotEmpty("<ramHotUnPlug>%s</ramHotUnPlug>", payload.isRamHotUnPlug())) .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) .append("</request>") .append("</ws:updateSnapshot>"); return requestBuilder.toString(); } protected  UpdateSnapshotRequestBinder();   }