Search in sources :

Example 1 with MacPool

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

the class BackendMacPoolsResourceTest method testAddIncompleteParameters.

@Test
public void testAddIncompleteParameters() throws Exception {
    MacPool model = createIncompleteMacPool();
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "MacPool", "add", getIncompleteFields());
    }
}
Also used : MacPool(org.ovirt.engine.api.model.MacPool) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 2 with MacPool

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

the class BackendMacPoolsResourceTest method getModel.

static MacPool getModel(int index) {
    MacPool model = new MacPool();
    model.setId(GUIDS[index].toString());
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    return model;
}
Also used : MacPool(org.ovirt.engine.api.model.MacPool)

Example 3 with MacPool

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

the class V3MacPoolInAdapter method adapt.

@Override
public MacPool adapt(V3MacPool from) {
    MacPool to = new MacPool();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAllowDuplicates()) {
        to.setAllowDuplicates(from.isAllowDuplicates());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDefaultPool()) {
        to.setDefaultPool(from.isDefaultPool());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetRanges()) {
        to.setRanges(new Ranges());
        to.getRanges().getRanges().addAll(adaptIn(from.getRanges().getRanges()));
    }
    return to;
}
Also used : Ranges(org.ovirt.engine.api.model.Ranges) V3MacPool(org.ovirt.engine.api.v3.types.V3MacPool) MacPool(org.ovirt.engine.api.model.MacPool)

Example 4 with MacPool

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

the class BackendMacPoolResourceTest method testConflictedUpdate.

@Test
public void testConflictedUpdate() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(1, 0, false);
    MacPool model = getModel(1);
    model.setId(GUIDS[1].toString());
    try {
        resource.update(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyImmutabilityConstraint(wae);
    }
}
Also used : MacPool(org.ovirt.engine.api.model.MacPool) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 5 with MacPool

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

the class BackendMacPoolResourceTest method getModel.

static MacPool getModel(int index) {
    MacPool model = new MacPool();
    model.setId(GUIDS[index].toString());
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    return model;
}
Also used : MacPool(org.ovirt.engine.api.model.MacPool)

Aggregations

MacPool (org.ovirt.engine.api.model.MacPool)8 WebApplicationException (javax.ws.rs.WebApplicationException)3 Test (org.junit.Test)3 Response (javax.ws.rs.core.Response)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 Ranges (org.ovirt.engine.api.model.Ranges)1 StorageFormat (org.ovirt.engine.api.model.StorageFormat)1 V3MacPool (org.ovirt.engine.api.v3.types.V3MacPool)1 MacPoolParameters (org.ovirt.engine.core.common.action.MacPoolParameters)1