@Test public void testCreateDrives() throws Exception { List<DriveInfo> newDrives = ImmutableList.of( new DriveInfo.Builder() .name("New Drive") .size(new BigInteger("2073741824")) .media(MediaType.DISK) .build(), new DriveInfo.Builder() .name("Test Drive") .size(new BigInteger("6073741824")) .media(MediaType.DISK) .build()); createdDrives = api.createDrives(newDrives); assertEquals(newDrives.size(), createdDrives.size()); for (int i = 0; i < newDrives.size(); i++) { checkDrive(newDrives.get(i), createdDrives.get(i)); } }
.build()) .build())) .media(MediaType.DISK) .meta(metaMap) .mountedOn(ImmutableList.of(new Server.Builder()
@Test public void testCreateDrive() throws Exception { DriveInfo newDrive = new DriveInfo.Builder() .name("test drive") .size(new BigInteger("2073741824")) .media(MediaType.DISK) .build(); createdDrive = api.createDrive(newDrive); checkDrive(newDrive, createdDrive); }
.media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_0") .size(new BigInteger("1024000000")) .build(), new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_1") .size(new BigInteger("1024000000")) .build(), new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_2") .size(new BigInteger("1024000000"))
@Test public void testCloneDrive() throws Exception { String uuid = "92ca1450-417e-4cc1-983b-1015777e2591"; CloudSigma2Api api = requestSendsResponse( postBuilder() .payload(payloadFromResourceWithContentType("/drives-create-request.json", MediaType.APPLICATION_JSON)) .endpoint(endpoint + "drives/" + uuid + "/action/?do=clone") .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/drive-cloned.json", MediaType.APPLICATION_JSON)) .build()); DriveInfo result = api.cloneDrive(uuid, new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_0") .size(new BigInteger("1024000000")) .allowMultimount(false) .build()); assertNotNull(result); }
public static Builder fromDriveInfo(DriveInfo in) { return new Builder() .uuid(in.getUuid()) .name(in.getName()) .resourceUri(in.getResourceUri()) .owner(in.getOwner()) .status(in.getStatus()) .size(in.getSize()) .allowMultimount(in.isAllowMultimount()) .affinities(in.getAffinities()) .jobs(in.getJobs()) .licenses(in.getLicenses()) .media(in.getMedia()) .meta(in.getMeta()) .mountedOn(in.getMountedOn()) .tags(in.getTags()); }
@Test public void testEditDrive() throws Exception { String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32"; CloudSigma2Api api = requestSendsResponse( putBuilder() .payload(payloadFromResourceWithContentType("/drives-create-request.json", MediaType.APPLICATION_JSON)) .endpoint(endpoint + "drives/" + uuid + "/") .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON)) .build()); DriveInfo result = api.editDrive(uuid, new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_0") .size(new BigInteger("1024000000")) .allowMultimount(false) .build()); assertNotNull(result); }
public static Builder fromDriveInfo(DriveInfo in) { return new Builder() .uuid(in.getUuid()) .name(in.getName()) .resourceUri(in.getResourceUri()) .owner(in.getOwner()) .status(in.getStatus()) .size(in.getSize()) .allowMultimount(in.isAllowMultimount()) .affinities(in.getAffinities()) .jobs(in.getJobs()) .licenses(in.getLicenses()) .media(in.getMedia()) .meta(in.getMeta()) .mountedOn(in.getMountedOn()) .tags(in.getTags()); }
@Test public void testCreateDrive() throws Exception { CloudSigma2Api api = requestSendsResponse( postBuilder() .payload(payloadFromResourceWithContentType("/drives-create-request.json", MediaType.APPLICATION_JSON)) .endpoint(endpoint + "drives/") .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/drives-single.json", MediaType.APPLICATION_JSON)) .build()); DriveInfo result = api.createDrive(new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_0") .size(new BigInteger("1024000000")) .allowMultimount(false) .build()); assertNotNull(result); }
public static Builder fromDriveInfo(DriveInfo in) { return new Builder() .uuid(in.getUuid()) .name(in.getName()) .resourceUri(in.getResourceUri()) .owner(in.getOwner()) .status(in.getStatus()) .size(in.getSize()) .allowMultimount(in.isAllowMultimount()) .affinities(in.getAffinities()) .jobs(in.getJobs()) .licenses(in.getLicenses()) .media(in.getMedia()) .meta(in.getMeta()) .mountedOn(in.getMountedOn()) .tags(in.getTags()); }
@Test(dependsOnMethods = {"testCreateDrive"}) public void testEditDrive() throws Exception { DriveInfo editedDrive = new DriveInfo.Builder() .name("Edited Drive") .size(createdDrive.getSize()) .media(MediaType.DISK) .build(); checkDrive(editedDrive, api.editDrive(createdDrive.getUuid(), editedDrive)); }