/** * {@inheritDoc} */ @Override public Builder name(String name) { return Builder.class.cast(super.name(name)); }
/** * {@inheritDoc} */ @Override public Builder name(String name) { return Builder.class.cast(super.name(name)); }
/** * {@inheritDoc} */ @Override public Builder name(String name) { return Builder.class.cast(super.name(name)); }
.uuid("19163e1a-a6d6-4e73-8087-157dd302c373") .build())) .name("test") .size(new BigInteger("1024000000")) .status(DriveStatus.UNMOUNTED)
new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_0") .size(new BigInteger("1024000000")) .allowMultimount(false) new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_1") .size(new BigInteger("1024000000")) .allowMultimount(false) new DriveInfo.Builder() .media(org.jclouds.cloudsigma2.domain.MediaType.DISK) .name("test_drive_2") .size(new BigInteger("1024000000")) .allowMultimount(false)
@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); }
@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)); } }
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()); }
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); }
@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 { DriveInfo newDrive = new DriveInfo.Builder() .name("test drive") .size(new BigInteger("2073741824")) .media(MediaType.DISK) .build(); createdDrive = api.createDrive(newDrive); checkDrive(newDrive, createdDrive); }
@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)); }