use of org.ovirt.engine.api.model.HostedEngine in project ovirt-engine by oVirt.
the class HostMapperTest method testHostedEngineMapping.
@Test
public void testHostedEngineMapping() {
VDS vds = new VDS();
vds.setId(Guid.Empty);
vds.setHighlyAvailableIsConfigured(true);
vds.setHighlyAvailableIsActive(false);
vds.setHighlyAvailableScore(123);
vds.setHighlyAvailableGlobalMaintenance(true);
vds.setHighlyAvailableLocalMaintenance(false);
HostedEngine hostedEngine = HostMapper.map(vds, (HostedEngine) null);
assertNotNull(hostedEngine);
assertEquals(Boolean.TRUE, hostedEngine.isConfigured());
assertEquals(Boolean.FALSE, hostedEngine.isActive());
assertEquals(Integer.valueOf(123), hostedEngine.getScore());
assertEquals(Boolean.TRUE, hostedEngine.isGlobalMaintenance());
assertEquals(Boolean.FALSE, hostedEngine.isLocalMaintenance());
}
use of org.ovirt.engine.api.model.HostedEngine in project ovirt-engine by oVirt.
the class HostMapper method map.
@Mapping(from = VDS.class, to = HostedEngine.class)
public static HostedEngine map(VDS entity, HostedEngine template) {
HostedEngine hostedEngine = template != null ? template : new HostedEngine();
hostedEngine.setConfigured(entity.getHighlyAvailableIsConfigured());
hostedEngine.setActive(entity.getHighlyAvailableIsActive());
hostedEngine.setScore(entity.getHighlyAvailableScore());
hostedEngine.setGlobalMaintenance(entity.getHighlyAvailableGlobalMaintenance());
hostedEngine.setLocalMaintenance(entity.getHighlyAvailableLocalMaintenance());
return hostedEngine;
}
use of org.ovirt.engine.api.model.HostedEngine in project ovirt-engine by oVirt.
the class BackendHostsResource method addHostedEngineIfConfigured.
Host addHostedEngineIfConfigured(Host host, VDS entity) {
/* Add entity data only if the hosted engine agent is configured on this host */
if (entity.getHighlyAvailableIsConfigured()) {
HostedEngine hostedEngine = getMapper(VDS.class, HostedEngine.class).map(entity, null);
host.setHostedEngine(hostedEngine);
}
return host;
}
Aggregations