コード例 #1
0
 private static void verifyModelWithIso(Cdrom model, String isoPath) {
   assertEquals(Guid.Empty.toString(), model.getId());
   assertTrue(model.isSetVm());
   assertEquals(VM_ID.toString(), model.getVm().getId());
   assertTrue(model.isSetFile());
   assertEquals(isoPath, model.getFile().getId());
 }
コード例 #2
0
  @Test
  public void testCdRomLinks() throws Exception {
    Cdrom cdrom = new Cdrom();
    cdrom.setId(CDROM_ID);

    cdrom.setVm(new Vm());
    cdrom.getVm().setId(VM_ID);

    LinkHelper.addLinks(cdrom);

    assertEquals(CDROM_HREF, cdrom.getHref());
  }
コード例 #3
0
 @Test
 public void testAddIncompleteParameters() throws Exception {
   Cdrom model = new Cdrom();
   model.setName(NAMES[0]);
   model.setFile(new File());
   setUriInfo(setUpBasicUriExpectations());
   try {
     collection.add(model);
     fail("expected WebApplicationException on incomplete parameters");
   } catch (WebApplicationException wae) {
     verifyIncompleteException(wae, "Cdrom", "add", "file.id");
   }
 }
コード例 #4
0
 @Override
 public Cdrom addParents(Cdrom entity) {
   Vm vm = new Vm();
   vm.setId(vmId.toString());
   entity.setVm(vm);
   return entity;
 }
コード例 #5
0
 @Override
 public Cdrom update(Cdrom cdrom) {
   validateParameters(cdrom, "file");
   boolean current =
       ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CURRENT, true, false);
   if (current) {
     ChangeDiskCommandParameters parameters =
         new ChangeDiskCommandParameters(vmId, cdrom.getFile().getId());
     performAction(VdcActionType.ChangeDisk, parameters);
   } else {
     VM vm = getVm();
     vm = map(cdrom, vm);
     VmManagementParametersBase parameters = new VmManagementParametersBase(vm);
     performAction(VdcActionType.UpdateVm, parameters);
   }
   return get();
 }
コード例 #6
0
 private Cdrom getCdrom() {
   Cdrom model = new Cdrom();
   model.setFile(new File());
   model.getFile().setId(ISO_PATH);
   return model;
 }