Search in sources :

Example 11 with VnicProfile

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

the class AbstractBackendVnicProfilesResourceTest method testAddIncompleteParameters.

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

Example 12 with VnicProfile

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

the class AbstractBackendVnicProfilesResourceTest method doTestBadAddVnicProfile.

private void doTestBadAddVnicProfile(boolean valid, boolean success, String detail) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.AddVnicProfile, AddVnicProfileParameters.class, new String[] {}, new Object[] {}, valid, success));
    VnicProfile model = getModel(0);
    model.setNetwork(new Network());
    model.getNetwork().setId(NETWORK_ID.toString());
    try {
        collection.add(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyFault(wae, detail);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Network(org.ovirt.engine.api.model.Network) VnicProfile(org.ovirt.engine.api.model.VnicProfile) AddVnicProfileParameters(org.ovirt.engine.core.common.action.AddVnicProfileParameters)

Example 13 with VnicProfile

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

the class AbstractBackendVnicProfilesResourceTest method getModel.

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

Aggregations

VnicProfile (org.ovirt.engine.api.model.VnicProfile)13 Network (org.ovirt.engine.api.model.Network)5 WebApplicationException (javax.ws.rs.WebApplicationException)3 Test (org.junit.Test)3 CustomProperties (org.ovirt.engine.api.model.CustomProperties)2 Nic (org.ovirt.engine.api.model.Nic)2 Qos (org.ovirt.engine.api.model.Qos)2 Vm (org.ovirt.engine.api.model.Vm)2 VnicProfileResource (org.ovirt.engine.api.resource.VnicProfileResource)2 VnicProfilesResource (org.ovirt.engine.api.resource.VnicProfilesResource)2 BackendApiResource (org.ovirt.engine.api.restapi.resource.BackendApiResource)2 V3Network (org.ovirt.engine.api.v3.types.V3Network)2 V3Networks (org.ovirt.engine.api.v3.types.V3Networks)2 V3PortMirroring (org.ovirt.engine.api.v3.types.V3PortMirroring)2 Comparator.comparing (java.util.Comparator.comparing)1 HashMap (java.util.HashMap)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Response (javax.ws.rs.core.Response)1