@Override public Response remove() { get(); GlusterBrick brick = new GlusterBrick(); brick.setId(id); GlusterBricks bricks = new GlusterBricks(); bricks.getGlusterBricks().add(brick); Action action = new Action(); action.setBricks(bricks); return parent.remove(action); } }
@Test public void testUndelete() { setUriInfo(setUpActionExpectations(ActionType.DisplayAllAuditLogAlerts, ActionParametersBase.class, new String[] {}, new Object[] {}, true, true)); collection.undelete(new Action()); }
@Test public void testStop() { setUriInfo(setUpActionExpectations(ActionType.StopVm, StopVmParameters.class, new String[] { "VmId", "StopVmType" }, new Object[] { GUIDS[0], StopVmTypeEnum.NORMAL })); verifyActionResponse(resource.stop(new Action())); }
@Test public void testCancelMigration() { setUriInfo(setUpActionExpectations(ActionType.CancelMigrateVm, VmOperationParameterBase.class, new String[] { "VmId" }, new Object[] { GUIDS[0] })); verifyActionResponse(resource.cancelMigration(new Action())); }
@Test public void testThawFilesystems() { setUriInfo(setUpActionExpectations(ActionType.ThawVm, VmOperationParameterBase.class, new String[] { "VmId" }, new Object[] { GUIDS[0] })); Action action = new Action(); verifyActionResponse(resource.thawFilesystems(action)); }
@Test public void testIncompleteCopy() { setUriInfo(setUpBasicUriExpectations()); verifyIncompleteException( assertThrows(WebApplicationException.class, () -> resource.copy(new Action())), "Action", "copy", "storageDomain.id|name"); }
@Test public void testIncompleteImport() { setUriInfo(setUpBasicUriExpectations()); verifyIncompleteException( assertThrows(WebApplicationException.class, () -> resource.doImport(new Action())), "Action", "doImport", "storageDomain.id|name"); }
@Test public void testUpgrade() { setUriInfo(setUpActionExpectations(ActionType.UpgradeHost, UpgradeHostParameters.class, new String[] { "VdsId", "oVirtIsoFile" }, new Object[] { GUIDS[0], NAMES[0] })); Action action = new Action(); action.setImage(NAMES[0]); verifyActionResponse(resource.upgrade(action)); }
protected void doTestExport(StorageDomain storageDomain, boolean exclusive) { setUriInfo(setUpActionExpectations(ActionType.ExportVmTemplate, MoveOrCopyParameters.class, new String[]{"ContainerId", "StorageDomainId", "ForceOverride"}, new Object[]{GUIDS[0], GUIDS[2], exclusive})); Action action = new Action(); action.setStorageDomain(storageDomain); if (exclusive) { action.setExclusive(exclusive); } verifyActionResponse(resource.export(action)); }
public void doTestRegister(org.ovirt.engine.api.model.Cluster cluster, boolean importAsNewEntity) { setUriInfo(setUpActionExpectations(ActionType.ImportVmFromConfiguration, ImportVmFromConfParameters.class, new String[] { "ContainerId", "StorageDomainId", "ClusterId", "ImportAsNewEntity", "ImagesExistOnTargetStorageDomain" }, new Object[] { VM_ID, GUIDS[3], GUIDS[1], importAsNewEntity, true })); Action action = new Action(); action.setCluster(cluster); action.setClone(importAsNewEntity); verifyActionResponse(resource.register(action)); }
@Test public void testIncompleteImport() { setUriInfo(setUpBasicUriExpectations()); verifyIncompleteException( assertThrows(WebApplicationException.class, () -> resource.doImport(new Action())), "Action", "doImport", "storageDomain.id|name"); }
@Test public void testRestore() { setUriInfo(setUpBasicUriExpectations()); setUpTryBackExpectations(); setUpRestoreExpectations(); resource.restore(new Action()); }
@Test public void testIncompleteExport() { setUriInfo(setUpBasicUriExpectations()); verifyIncompleteException( assertThrows(WebApplicationException.class, () -> resource.export(new Action())), "Action", "export", "storageDomain.id|name"); }
@Test public void testMaintenance() { setUpGetEntityExpectations(1); setUriInfo(setUpActionExpectations(ActionType.SetHaMaintenance, SetHaMaintenanceParameters.class, new String[] { "IsEnabled" }, new Object[] { true })); Action action = new Action(); action.setMaintenanceEnabled(true); verifyActionResponse(resource.maintenance(action)); }
@Test public void testStart() { setupParentExpectations(); resource.setParent(volumesResourceMock); setUriInfo(setUpActionExpectations(ActionType.StartGlusterVolume, GlusterVolumeActionParameters.class, new String[] { "VolumeId" }, new Object[] { GUIDS[0] })); verifyActionResponse(resource.start(new Action())); }
@Test public void testRebalance() { setupParentExpectations(); resource.setParent(volumesResourceMock); setUriInfo(setUpActionExpectations(ActionType.StartRebalanceGlusterVolume, GlusterVolumeRebalanceParameters.class, new String[] { "VolumeId" }, new Object[] { GUIDS[0] })); verifyActionResponse(resource.rebalance(new Action())); }
public void doTestImport(StorageDomain storageDomain, org.ovirt.engine.api.model.Cluster cluster, boolean importAsNewEntity) { setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]); setUriInfo(setUpActionExpectations(ActionType.ImportVmTemplate, ImportVmTemplateParameters.class, new String[] { "ContainerId", "StorageDomainId", "SourceDomainId", "DestDomainId", "StoragePoolId", "ClusterId", "ImportAsNewEntity" }, new Object[] { TEMPLATE_ID, GUIDS[2], STORAGE_DOMAIN_ID, GUIDS[2], DATA_CENTER_ID, GUIDS[1], importAsNewEntity })); Action action = new Action(); action.setStorageDomain(storageDomain); action.setCluster(cluster); action.setClone(importAsNewEntity); verifyActionResponse(resource.doImport(action)); }
@Test public void testMigrateWithClusterId() { setUriInfo(setUpActionExpectations(ActionType.MigrateVm, MigrateVmParameters.class, new String[] { "VmId", "ForceMigrationForNonMigratableVm", "TargetClusterId"}, new Object[] { GUIDS[0], Boolean.FALSE, GUIDS[1]})); Action action = new Action(); org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster(); cluster.setId(GUIDS[1].toString()); action.setCluster(cluster); verifyActionResponse(resource.migrate(action)); }
@Test public void testExport() { setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[]{"ImageGroupID", "DestinationDomainId"}, new Object[]{DISK_ID, GUIDS[3]}, true, true, null, null, true)); Action action = new Action(); action.setStorageDomain(new StorageDomain()); action.getStorageDomain().setId(GUIDS[3].toString()); verifyActionResponse(resource.export(action)); }
@Test public void testImportNotFound() { Action action = new Action(); action.setStorageDomain(new StorageDomain()); action.getStorageDomain().setId(GUIDS[2].toString()); action.setCluster(new org.ovirt.engine.api.model.Cluster()); action.getCluster().setId(GUIDS[1].toString()); setUpGetEntityExpectations(StorageDomainType.ImportExport, GUIDS[2], true); setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID); verifyNotFoundException(assertThrows(WebApplicationException.class, () -> resource.doImport(action))); }