Search in sources :

Example 1 with NetworkFilterParameter

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

the class BackendVmNicFilterParameterResourceTest method getParameter.

protected NetworkFilterParameter getParameter() {
    NetworkFilterParameter parameter = new NetworkFilterParameter();
    parameter.setId(PARAMETER_ID.toString());
    // parameter.setVmInterfaceId(VM_NIC_ID);
    parameter.setValue(VALUES[DEFAULT_INDEX]);
    parameter.setName(NAMES[DEFAULT_INDEX]);
    return parameter;
}
Also used : NetworkFilterParameter(org.ovirt.engine.api.model.NetworkFilterParameter)

Example 2 with NetworkFilterParameter

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

the class BackendVmNicFilterParametersResourceTest method testAddParameter.

@Test
public void testAddParameter() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddVmNicFilterParameter, VmNicFilterParameterParameters.class, new String[] { "VmId" }, new Object[] { VM_ID }, true, true, PARAMETER_ID, QueryType.GetVmInterfaceFilterParameterById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { PARAMETER_ID }, asList(getEntity(0)));
    NetworkFilterParameter model = getModel(0);
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof NetworkFilterParameter);
    verifyModel((NetworkFilterParameter) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) NetworkFilterParameter(org.ovirt.engine.api.model.NetworkFilterParameter) Test(org.junit.Test)

Example 3 with NetworkFilterParameter

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

the class BackendVmNicFilterParametersResourceTest method doTestBadAddNic.

private void doTestBadAddNic(boolean valid, boolean success, String detail) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.AddVmNicFilterParameter, VmNicFilterParameterParameters.class, new String[] { "VmId" }, new Object[] { VM_ID }, valid, success));
    NetworkFilterParameter model = getModel(0);
    try {
        collection.add(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyFault(wae, detail);
    }
}
Also used : VmNicFilterParameterParameters(org.ovirt.engine.core.common.action.VmNicFilterParameterParameters) WebApplicationException(javax.ws.rs.WebApplicationException) NetworkFilterParameter(org.ovirt.engine.api.model.NetworkFilterParameter)

Example 4 with NetworkFilterParameter

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

the class BackendVmNicFilterParametersResource method list.

@Override
public NetworkFilterParameters list() {
    NetworkFilterParameters parameters = new NetworkFilterParameters();
    List<VmNicFilterParameter> entities = getBackendCollection(QueryType.GetVmInterfaceFilterParametersByVmInterfaceId, new IdQueryParameters(nicId));
    for (VmNicFilterParameter entity : entities) {
        NetworkFilterParameter parameter = populate(map(entity), entity);
        parameters.getNetworkFilterParameters().add(addLinks(parameter));
    }
    return parameters;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) NetworkFilterParameters(org.ovirt.engine.api.model.NetworkFilterParameters) NetworkFilterParameter(org.ovirt.engine.api.model.NetworkFilterParameter) VmNicFilterParameter(org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)

Example 5 with NetworkFilterParameter

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

the class BackendVmNicFilterParameterResourceTest method testGet.

@Test
public void testGet() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(1);
    NetworkFilterParameter parameter = resource.get();
    verifyModel(parameter, DEFAULT_INDEX);
}
Also used : NetworkFilterParameter(org.ovirt.engine.api.model.NetworkFilterParameter) Test(org.junit.Test)

Aggregations

NetworkFilterParameter (org.ovirt.engine.api.model.NetworkFilterParameter)8 Test (org.junit.Test)4 WebApplicationException (javax.ws.rs.WebApplicationException)2 VmNicFilterParameterParameters (org.ovirt.engine.core.common.action.VmNicFilterParameterParameters)2 Response (javax.ws.rs.core.Response)1 NetworkFilterParameters (org.ovirt.engine.api.model.NetworkFilterParameters)1 RemoveVmNicFilterParameterParameters (org.ovirt.engine.core.common.action.RemoveVmNicFilterParameterParameters)1 VmNicFilterParameter (org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1