Search in sources :

Example 1 with Watchdog

use of org.ovirt.engine.api.model.Watchdog in project ovirt-engine by oVirt.

the class BackendInstanceTypeWatchdogResourceTest method getUpdate.

private Watchdog getUpdate() {
    Watchdog watchdog = new Watchdog();
    watchdog.setId(WATCHDOG_ID.toString());
    watchdog.setAction(WatchdogAction.RESET);
    watchdog.setModel(WatchdogModel.I6300ESB);
    return watchdog;
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Watchdog(org.ovirt.engine.api.model.Watchdog)

Example 2 with Watchdog

use of org.ovirt.engine.api.model.Watchdog in project ovirt-engine by oVirt.

the class BackendInstanceTypeWatchdogResourceTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    setUpEntityQueryExpectations(2);
    setUriInfo(setUpActionExpectations(ActionType.UpdateWatchdog, WatchdogParameters.class, new String[] { "Id" }, new Object[] { INSTANCE_TYPE_ID }, true, true));
    Watchdog wd = resource.update(getUpdate());
    assertTrue(wd.isSetAction());
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Watchdog(org.ovirt.engine.api.model.Watchdog) WatchdogParameters(org.ovirt.engine.core.common.action.WatchdogParameters) Test(org.junit.Test)

Example 3 with Watchdog

use of org.ovirt.engine.api.model.Watchdog in project ovirt-engine by oVirt.

the class BackendInstanceTypeWatchdogsResourceTest method getModel.

private Watchdog getModel() {
    Watchdog watchDog = new Watchdog();
    watchDog.setAction(WatchdogAction.RESET);
    watchDog.setModel(WatchdogModel.I6300ESB);
    watchDog.setId(WATCHDOG_ID.toString());
    return watchDog;
}
Also used : Watchdog(org.ovirt.engine.api.model.Watchdog) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 4 with Watchdog

use of org.ovirt.engine.api.model.Watchdog in project ovirt-engine by oVirt.

the class BackendInstanceTypeWatchdogsResourceTest method testAdd.

@Test
public void testAdd() {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddWatchdog, WatchdogParameters.class, new String[] {}, new Object[] {}, true, true, WATCHDOG_ID, QueryType.GetWatchdog, IdQueryParameters.class, new String[] { "Id" }, new Object[] { INSTANCE_TYPE_ID }, getEntity());
    Watchdog model = getModel();
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Watchdog);
    verifyModel((Watchdog) response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) Watchdog(org.ovirt.engine.api.model.Watchdog) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Test(org.junit.Test)

Example 5 with Watchdog

use of org.ovirt.engine.api.model.Watchdog in project ovirt-engine by oVirt.

the class WatchdogMapper method map.

@Mapping(from = VmWatchdog.class, to = Watchdog.class)
public static Watchdog map(VmWatchdog entity, Watchdog template) {
    Watchdog model = template == null ? new Watchdog() : template;
    if (entity.getAction() != null) {
        model.setAction(map(entity.getAction()));
    }
    if (entity.getModel() != null) {
        model.setModel(map(entity.getModel()));
    }
    model.setId(entity.getId().toString());
    return model;
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Watchdog(org.ovirt.engine.api.model.Watchdog)

Aggregations

Watchdog (org.ovirt.engine.api.model.Watchdog)19 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)18 Test (org.junit.Test)11 Response (javax.ws.rs.core.Response)3 WatchdogParameters (org.ovirt.engine.core.common.action.WatchdogParameters)3 Vms (org.ovirt.engine.api.model.Vms)1