Search in sources :

Example 6 with Tag

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

the class V3SpecialObjectsOutAdapter method adapt.

@Override
public V3SpecialObjects adapt(SpecialObjects from) {
    V3SpecialObjects to = new V3SpecialObjects();
    Template blankTemplate = from.getBlankTemplate();
    if (blankTemplate != null) {
        V3Link blankTemplateLink = new V3Link();
        blankTemplateLink.setRel("templates/blank");
        blankTemplateLink.setHref(blankTemplate.getHref());
        to.getLinks().add(blankTemplateLink);
    }
    Tag rootTag = from.getRootTag();
    if (rootTag != null) {
        V3Link rootTagLink = new V3Link();
        rootTagLink.setRel("tags/root");
        rootTagLink.setHref(rootTag.getHref());
        to.getLinks().add(rootTagLink);
    }
    return to;
}
Also used : V3Link(org.ovirt.engine.api.v3.types.V3Link) V3SpecialObjects(org.ovirt.engine.api.v3.types.V3SpecialObjects) Tag(org.ovirt.engine.api.model.Tag) Template(org.ovirt.engine.api.model.Template)

Example 7 with Tag

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

the class LinkHelperTest method testTemplateTagLinks.

@Test
public void testTemplateTagLinks() throws Exception {
    Tag tag = new Tag();
    tag.setId(TAG_ID);
    tag.setTemplate(new Template());
    tag.getTemplate().setId(TEMPLATE_ID);
    LinkHelper.addLinks(tag);
    assertEquals(TEMPLATE_TAG_HREF, tag.getHref());
}
Also used : Tag(org.ovirt.engine.api.model.Tag) Template(org.ovirt.engine.api.model.Template) Test(org.junit.Test)

Example 8 with Tag

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

the class LinkHelperTest method testUserTagLinks.

@Test
public void testUserTagLinks() throws Exception {
    Tag tag = new Tag();
    tag.setId(TAG_ID);
    tag.setUser(new User());
    tag.getUser().setId(USER_ID);
    LinkHelper.addLinks(tag);
    assertEquals(USER_TAG_HREF, tag.getHref());
}
Also used : User(org.ovirt.engine.api.model.User) Tag(org.ovirt.engine.api.model.Tag) Test(org.junit.Test)

Example 9 with Tag

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

the class LinkHelperTest method testTagLinks.

@Test
public void testTagLinks() throws Exception {
    Tag tag = new Tag();
    tag.setId(TAG_ID);
    LinkHelper.addLinks(tag);
    assertEquals(TAG_HREF, tag.getHref());
}
Also used : Tag(org.ovirt.engine.api.model.Tag) Test(org.junit.Test)

Example 10 with Tag

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

the class LinkHelperTest method testHostTagLinks.

@Test
public void testHostTagLinks() throws Exception {
    Tag tag = new Tag();
    tag.setId(TAG_ID);
    tag.setHost(new Host());
    tag.getHost().setId(HOST_ID);
    LinkHelper.addLinks(tag);
    assertEquals(HOST_TAG_HREF, tag.getHref());
}
Also used : Host(org.ovirt.engine.api.model.Host) Tag(org.ovirt.engine.api.model.Tag) Test(org.junit.Test)

Aggregations

Tag (org.ovirt.engine.api.model.Tag)21 Test (org.junit.Test)15 Response (javax.ws.rs.core.Response)5 WebApplicationException (javax.ws.rs.WebApplicationException)4 Template (org.ovirt.engine.api.model.Template)2 UriInfo (javax.ws.rs.core.UriInfo)1 Host (org.ovirt.engine.api.model.Host)1 User (org.ovirt.engine.api.model.User)1 Vm (org.ovirt.engine.api.model.Vm)1 V3Link (org.ovirt.engine.api.v3.types.V3Link)1 V3SpecialObjects (org.ovirt.engine.api.v3.types.V3SpecialObjects)1 Tags (org.ovirt.engine.core.common.businessentities.Tags)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1