use of org.ovirt.engine.api.model.MacPool in project ovirt-engine by oVirt.
the class BackendMacPoolsResourceTest method doTestBadAddMacPool.
private void doTestBadAddMacPool(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddMacPool, MacPoolParameters.class, new String[] {}, new Object[] {}, valid, success));
MacPool model = getModel(0);
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
use of org.ovirt.engine.api.model.MacPool in project ovirt-engine by oVirt.
the class BackendMacPoolsResourceTest method testAddMacPool.
@Test
public void testAddMacPool() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AddMacPool, MacPoolParameters.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetMacPoolById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, getEntity(0));
MacPool model = getModel(0);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof MacPool);
verifyModel((MacPool) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.MacPool in project ovirt-engine by oVirt.
the class DataCenterMapper method map.
@Mapping(from = StoragePool.class, to = DataCenter.class)
public static DataCenter map(StoragePool entity, DataCenter template) {
DataCenter model = template != null ? template : new DataCenter();
model.setId(entity.getId().toString());
model.setName(entity.getName());
model.setLocal(entity.isLocal());
if (!StringUtils.isEmpty(entity.getdescription())) {
model.setDescription(entity.getdescription());
}
if (!StringUtils.isEmpty(entity.getComment())) {
model.setComment(entity.getComment());
}
if (entity.getStatus() != null) {
model.setStatus(mapDataCenterStatus(entity.getStatus()));
}
if (entity.getCompatibilityVersion() != null) {
model.setVersion(VersionMapper.map(entity.getCompatibilityVersion()));
}
if (entity.getStoragePoolFormatType() != null) {
StorageFormat storageFormat = StorageFormatMapper.map(entity.getStoragePoolFormatType(), null);
if (storageFormat != null) {
model.setStorageFormat(storageFormat);
}
}
if (entity.getMacPoolId() != null) {
model.setMacPool(new MacPool());
model.getMacPool().setId(entity.getMacPoolId().toString());
}
if (entity.getQuotaEnforcementType() != null) {
model.setQuotaMode(map(entity.getQuotaEnforcementType()));
}
return model;
}
Aggregations