/** * Create an instance of {@link Cluster } * */ public Cluster createCluster() { return new Cluster(); }
@Override public Network addParents(Network network) { network.setCluster(new org.ovirt.engine.api.model.Cluster()); network.getCluster().setId(clusterId); return network; }
@Override protected GlusterVolume addParents(GlusterVolume volume) { volume.setCluster(new Cluster()); volume.getCluster().setId(clusterId); return volume; }
private void setupListExpectations() { Cluster cluster = new Cluster(); cluster.setName(defaultClusterName); cluster.setId(clusterId.toString()); parentMock = mock(ClusterResource.class); when(parentMock.get()).thenReturn(cluster); }
@Override public Response add(CpuProfile cpuProfile) { if (!cpuProfile.isSetCluster() || !cpuProfile.getCluster().isSetId()) { cpuProfile.setCluster(new Cluster()); cpuProfile.getCluster().setId(clusterId); } return super.add(cpuProfile); }
private Host setCluster(Host host, org.ovirt.engine.api.model.Cluster cluster) { if (cluster.isSetId()) { host.setCluster(cluster); } else { host.setCluster(new org.ovirt.engine.api.model.Cluster()); host.getCluster().setId(lookupClusterByName(cluster.getName()).getId().toString()); } return host; }
@Test public void testRegisterVM() { org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster(); cluster.setId(GUIDS[1].toString()); doTestRegister(cluster, false); }
@Test public void testRegisterTemplateAsNewEntity() { org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster(); cluster.setId(GUIDS[1].toString()); doTestRegister(cluster, true); }
@Test public void testRegisterAsNewEntity() { org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster(); cluster.setId(GUIDS[1].toString()); doTestRegister(cluster, true); }
@Test public void testAddIncompleteParameters() { org.ovirt.engine.api.model.Cluster model = new org.ovirt.engine.api.model.Cluster(); setUriInfo(setUpBasicUriExpectations()); verifyIncompleteException( assertThrows(WebApplicationException.class, () -> collection.add(model)), "Cluster", "add", "name"); }
@Test public void testAddIncompleteParameters() { org.ovirt.engine.api.model.Cluster model = new org.ovirt.engine.api.model.Cluster(); model.setName(NAMES[0]); setUriInfo(setUpBasicUriExpectations()); verifyIncompleteException( assertThrows(WebApplicationException.class, () -> collection.add(model)), "Cluster", "add", "dataCenter.name|id"); }
static org.ovirt.engine.api.model.Cluster getModel(int index) { org.ovirt.engine.api.model.Cluster model = new org.ovirt.engine.api.model.Cluster(); model.setName(NAMES[index]); model.setDescription(DESCRIPTIONS[index]); model.setDataCenter(new DataCenter()); model.setCpu(new Cpu()); model.getCpu().setType("Intel Xeon"); return model; }
@Test public void testImportCollapseSnapshots() { StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(GUIDS[2].toString()); org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster(); cluster.setId(GUIDS[1].toString()); setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID); doTestImport(storageDomain, cluster, true, false); }
@Test public void testImportAsNewEntity() { StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(GUIDS[2].toString()); org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster(); cluster.setId(GUIDS[1].toString()); setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID); doTestImport(storageDomain, cluster, false, true); }
static org.ovirt.engine.api.model.Cluster getModel(int index) { org.ovirt.engine.api.model.Cluster model = new org.ovirt.engine.api.model.Cluster(); model.setName(NAMES[index]); model.setDescription(DESCRIPTIONS[index]); model.setDataCenter(new DataCenter()); model.setCpu(new Cpu()); model.getCpu().setType("Intel Xeon"); return model; }
@Test public void testBadGuidValidation() { setUpGetEntityExpectations(false); Host host = new Host(); host.setCluster(new Cluster()); host.getCluster().setId("!!!"); assertThrows(MalformedIdException.class, () -> resource.update(host)); }
private GlusterVolume createModel() { GlusterVolume volume = new GlusterVolume(); volume.setName("testVol1"); volume.setCluster(new Cluster()); volume.getCluster().setId(clusterId.toString()); volume.setVolumeType(org.ovirt.engine.api.model.GlusterVolumeType.DISTRIBUTE); volume.setBricks(new GlusterBricks()); volume.getBricks().getGlusterBricks().add(createBrick("/export/vol1/brick1")); return volume; }
private void doTestBadAddCpuProfile(boolean valid, boolean success, String detail) { setUriInfo(setUpActionExpectations(ActionType.AddCpuProfile, CpuProfileParameters.class, new String[] {}, new Object[] {}, valid, success)); CpuProfile model = getModel(0); model.setCluster(new Cluster()); model.getCluster().setId(CLUSTER_ID.toString()); verifyFault(assertThrows(WebApplicationException.class, () -> collection.add(model)), detail); }
private VmPool getModel(int index) { VmPool model = new VmPool(); model.setName(NAMES[index]); model.setDescription(DESCRIPTIONS[index]); model.setId(GUIDS[index].toString()); model.setCluster(new Cluster()); model.getCluster().setId(GUIDS[2].toString()); model.setTemplate(new Template()); model.getTemplate().setId(GUIDS[1].toString()); return model; }
@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))); }