Search in sources :

Example 1 with HostedEngine

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());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) HostedEngine(org.ovirt.engine.api.model.HostedEngine) Test(org.junit.Test)

Example 2 with HostedEngine

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;
}
Also used : HostedEngine(org.ovirt.engine.api.model.HostedEngine)

Example 3 with 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;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) HostedEngine(org.ovirt.engine.api.model.HostedEngine)

Aggregations

HostedEngine (org.ovirt.engine.api.model.HostedEngine)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 Test (org.junit.Test)1