Search in sources :

Example 6 with NetworkLabel

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

the class BackendHostNicLabelsResourceTest method testAdd.

@Test
public void testAdd() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.LabelNic, LabelNicParameters.class, new String[] { "NicId", "Label" }, new Object[] { nicId, LABELS[0] }, true, true, LABELS[0], QueryType.GetNetworkLabelsByHostNicId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { nicId }, asList(getEntity(0)));
    Response response = collection.add(getModel(0));
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof NetworkLabel);
    verifyModel((NetworkLabel) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) NetworkLabel(org.ovirt.engine.api.model.NetworkLabel) Test(org.junit.Test)

Example 7 with NetworkLabel

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

the class AbstractBaseHostNicLabelsResource method addLinks.

@Override
protected NetworkLabel addLinks(NetworkLabel label, Class<? extends BaseResource> suggestedParent, String... excludeSubCollectionMembers) {
    NetworkLabel resultLabel = super.addLinks(label, HostNic.class);
    final AbstractBaseHostNicLabelResource labelResource = createSingularResource(resultLabel.getId());
    labelResource.overrideHref(resultLabel);
    return resultLabel;
}
Also used : NetworkLabel(org.ovirt.engine.api.model.NetworkLabel)

Example 8 with NetworkLabel

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

the class BackendNetworkLabelsResourceTest method getModel.

private NetworkLabel getModel(int i) {
    NetworkLabel model = new NetworkLabel();
    model.setId(LABELS[i]);
    return model;
}
Also used : NetworkLabel(org.ovirt.engine.api.model.NetworkLabel)

Example 9 with NetworkLabel

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

the class BackendNetworkLabelsResourceTest method testAdd.

@Test
public void testAdd() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.LabelNetwork, LabelNetworkParameters.class, new String[] { "NetworkId", "Label" }, new Object[] { NETWORK_ID, LABELS[0] }, true, true, LABELS[0], QueryType.GetNetworkLabelsByNetworkId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { NETWORK_ID }, asList(getEntity(0)));
    Response response = collection.add(getModel(0));
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof NetworkLabel);
    verifyModel((NetworkLabel) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) NetworkLabel(org.ovirt.engine.api.model.NetworkLabel) Test(org.junit.Test)

Example 10 with NetworkLabel

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

the class BackendNetworkLabelResourceTest method testGet.

@Test
public void testGet() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(getEntityList());
    NetworkLabel model = resource.get();
    assertEquals(LABELS[0], model.getId());
    verifyLinks(model);
}
Also used : NetworkLabel(org.ovirt.engine.api.model.NetworkLabel) Test(org.junit.Test)

Aggregations

NetworkLabel (org.ovirt.engine.api.model.NetworkLabel)13 Test (org.junit.Test)6 NetworkLabels (org.ovirt.engine.api.model.NetworkLabels)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 Response (javax.ws.rs.core.Response)2 HostNic (org.ovirt.engine.api.model.HostNic)1 Network (org.ovirt.engine.api.model.Network)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)1 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)1 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)1 NicLabel (org.ovirt.engine.core.common.businessentities.network.NicLabel)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 Guid (org.ovirt.engine.core.compat.Guid)1