use of org.openstack4j.model.storage.block.VolumeBackupCreate in project openstack4j by ContainX.
the class VolumeBackupTests method createVolumeBackupFromSnapshotV1.
@Test
public void createVolumeBackupFromSnapshotV1() throws Exception {
respondWith("/storage/v1/volumebackup_create_response.json");
final String name = "backup1122";
VolumeBackupCreate create = Builders.volumeBackupCreate().volumeId("999b49ff-a813-45cc-aef3-3ec82f089490").container("container123").description("description123").name(name).incremental(false).snapshotId("b4b3258d-555a-4fce-8f53-69cc2ae96d3c").build();
VolumeBackup backup = osv3().blockStorage().backups().create(create);
RecordedRequest request = server.takeRequest();
assertNotNull(request.getHeader("X-Auth-Token"));
assertTrue(request.getPath().matches("/v[123]/\\p{XDigit}*/backups"));
assertEquals(request.getMethod(), "POST");
String requestBody = request.getBody().readUtf8();
assertTrue(requestBody.contains("\"volume_id\" : \"999b49ff-a813-45cc-aef3-3ec82f089490\""));
assertTrue(requestBody.contains("\"snapshot_id\" : \"b4b3258d-555a-4fce-8f53-69cc2ae96d3c\""));
assertEquals(backup.getName(), name);
assertNotNull(backup.getId());
assertEquals(backup.getId(), "7069c687-c85c-45ca-befa-aa78a971fdfe");
}
use of org.openstack4j.model.storage.block.VolumeBackupCreate in project openstack4j by ContainX.
the class VolumeBackupTests method createVolumeBackupV1.
@Test
public void createVolumeBackupV1() throws Exception {
respondWith("/storage/v1/volumebackup_create_response.json");
final String name = "backup1122";
VolumeBackupCreate create = Builders.volumeBackupCreate().volumeId("999b49ff-a813-45cc-aef3-3ec82f089490").container("container123").description("description123").name(name).incremental(false).build();
VolumeBackup backup = osv3().blockStorage().backups().create(create);
RecordedRequest request = server.takeRequest();
assertNotNull(request.getHeader("X-Auth-Token"));
assertTrue(request.getPath().matches("/v[123]/\\p{XDigit}*/backups"));
assertEquals(request.getMethod(), "POST");
String requestBody = request.getBody().readUtf8();
assertTrue(requestBody.contains("\"volume_id\" : \"999b49ff-a813-45cc-aef3-3ec82f089490\""));
assertEquals(backup.getName(), name);
assertNotNull(backup.getId());
assertEquals(backup.getId(), "7069c687-c85c-45ca-befa-aa78a971fdfe");
}
Aggregations