Search in sources :

Example 16 with Link

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

the class BackendHostNicsResource method addLinks.

@Override
protected HostNic addLinks(HostNic hostNic, String... subCollectionsToExclude) {
    if (hostNic.isSetVirtualFunctionsConfiguration()) {
        return super.addLinks(hostNic, subCollectionsToExclude);
    } else {
        final HostNic resultHostNic = super.addLinks(hostNic, ArrayUtils.concat(PF_SUB_COLLECTIONS, subCollectionsToExclude));
        final Iterator<Link> linkIterator = resultHostNic.getActions().getLinks().iterator();
        while (linkIterator.hasNext()) {
            final Link link = linkIterator.next();
            if (link.getRel().equals(UPDATE_VFS_CONFIG_ACTION)) {
                linkIterator.remove();
            }
        }
        if (isBond(resultHostNic)) {
            removeLldpLink(resultHostNic);
        }
        return resultHostNic;
    }
}
Also used : HostNic(org.ovirt.engine.api.model.HostNic) Link(org.ovirt.engine.api.model.Link)

Example 17 with Link

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

the class BackendHostNicsResource method masterLink.

private Link masterLink(String id) {
    Link master = new Link();
    master.setRel("master");
    master.setHref(idToHref(id));
    return master;
}
Also used : Link(org.ovirt.engine.api.model.Link)

Example 18 with Link

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

the class AbstractBackendBaseTest method verifyLinks.

protected void verifyLinks(BaseResource model) {
    assertNotNull(model.getHref());
    assertTrue(model.getHref().startsWith("/ovirt-engine/api"));
    for (Link link : model.getLinks()) {
        assertTrue(link.getHref().startsWith("/ovirt-engine/api"));
    }
}
Also used : Link(org.ovirt.engine.api.model.Link)

Example 19 with Link

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

the class BackendApiResourceTest method verifyApiGlusterOnly.

protected void verifyApiGlusterOnly(Api api) {
    assertNotNull(api);
    assertNotNull(api.getTime());
    assertNotNull(api.getLinks());
    assertEquals(relationshipsGlusterOnly.length, api.getLinks().size());
    for (int i = 0; i < relationshipsGlusterOnly.length; i++) {
        Link l = api.getLinks().get(i);
        assertNotNull(l);
        assertEquals(relationshipsGlusterOnly[i], l.getRel());
        assertEquals(hrefsGlusterOnly[i], l.getHref());
    }
    assertNotNull(api.getSpecialObjects());
    assertContainsRootTag(api.getSpecialObjects());
    assertNotNull(api.getProductInfo());
    assertNotNull(api.getProductInfo().getVersion());
    assertEquals(MAJOR, api.getProductInfo().getVersion().getMajor().intValue());
    assertEquals(MINOR, api.getProductInfo().getVersion().getMinor().intValue());
    assertEquals(BUILD, api.getProductInfo().getVersion().getBuild().intValue());
    assertEquals(REVISION, api.getProductInfo().getVersion().getRevision().intValue());
    assertNotNull(api.getSummary());
    assertEquals(TOTAL_HOSTS, api.getSummary().getHosts().getTotal().intValue());
    assertEquals(ACTIVE_HOSTS, api.getSummary().getHosts().getActive().intValue());
    assertEquals(TOTAL_USERS, api.getSummary().getUsers().getTotal().intValue());
    assertEquals(ACTIVE_USERS, api.getSummary().getUsers().getActive().intValue());
}
Also used : Link(org.ovirt.engine.api.model.Link)

Aggregations

Link (org.ovirt.engine.api.model.Link)19 List (java.util.List)5 HashSet (java.util.HashSet)4 Set (java.util.Set)4 Collectors.toList (java.util.stream.Collectors.toList)4 V3Adapter (org.ovirt.engine.api.v3.V3Adapter)4 V3OutAdapters.adaptOut (org.ovirt.engine.api.v3.adapters.V3OutAdapters.adaptOut)4 DetailedLink (org.ovirt.engine.api.model.DetailedLink)3 V3Link (org.ovirt.engine.api.v3.types.V3Link)3 V3Status (org.ovirt.engine.api.v3.types.V3Status)3 Method (java.lang.reflect.Method)2 TimeZone (org.ovirt.engine.api.model.TimeZone)2 Vm (org.ovirt.engine.api.model.Vm)2 V3CustomProperties (org.ovirt.engine.api.v3.types.V3CustomProperties)2 V3KatelloErrata (org.ovirt.engine.api.v3.types.V3KatelloErrata)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 LinkedList (java.util.LinkedList)1 Optional (java.util.Optional)1