@Test public void testAddIso() throws Throwable { IsoEntity isoEntity = new IsoEntity(); isoEntity.setId("iso-id"); isoEntity.setName("iso-name"); isoEntity.setSize(100L); vmDcpBackend.addIso(isoEntity, vm); VmEntity updatedVm = vmDcpBackend.findById(vmId); assertThat(updatedVm, CoreMatchers.notNullValue()); assertThat(updatedVm.getIsos().size(), is(1)); assertThat(updatedVm.getIsos().get(0), is(isoEntity)); }
@Test(dataProvider = "IsoFileNames") public void testPrepareVmAttachIso(String isoFileName) throws Throwable { TaskEntity task = vmDcpBackend.prepareVmAttachIso(vmId, inputStream, isoFileName); assertThat(task, is(notNullValue())); assertThat(task.getState(), is(TaskEntity.State.QUEUED)); assertThat(task.getSteps().size(), is(2)); assertThat( task.getSteps().get(0).getOperation(), is(com.vmware.photon.controller.api.Operation.UPLOAD_ISO)); IsoEntity iso = (IsoEntity) task.getSteps().get(0).getTransientResourceEntities().get(1); assertThat(iso.getName(), is(isoName)); assertThat(task.getToBeLockedEntityIds().size(), is(2)); assertThat(task.getToBeLockedEntityIds().get(0), is(iso.getId())); assertThat(task.getToBeLockedEntityIds().get(1), is(vmId)); }