Search in sources :

Example 11 with Watchdog

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

the class BackendVmWatchdogsResourceTest 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[] { VM_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 12 with Watchdog

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

the class BackendVmWatchdogResourceTest 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 13 with Watchdog

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

the class BackendVmWatchdogsResourceTest 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 14 with Watchdog

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

the class V3WatchDogInAdapter method adapt.

@Override
public Watchdog adapt(V3WatchDog from) {
    Watchdog to = new Watchdog();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAction()) {
        to.setAction(WatchdogAction.fromValue(from.getAction()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInstanceType()) {
        to.setInstanceType(adaptIn(from.getInstanceType()));
    }
    if (from.isSetModel()) {
        to.setModel(WatchdogModel.fromValue(from.getModel()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptIn(from.getTemplate()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    if (from.isSetVms()) {
        to.setVms(new Vms());
        to.getVms().getVms().addAll(adaptIn(from.getVms().getVMs()));
    }
    return to;
}
Also used : Watchdog(org.ovirt.engine.api.model.Watchdog) Vms(org.ovirt.engine.api.model.Vms)

Example 15 with Watchdog

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

the class BackendInstanceTypeWatchdogResourceTest method testGet.

@Test
public void testGet() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(1);
    Watchdog watchdog = resource.get();
    verifyModel(watchdog);
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Watchdog(org.ovirt.engine.api.model.Watchdog) Test(org.junit.Test)

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