Search in sources :

Example 11 with Tag

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

the class LinkHelperTest method testVmTagLinks.

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

Example 12 with Tag

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

the class TagMapper method parent.

private static Tag parent(Tags entity) {
    if (entity.getParentId() != null) {
        Tag parent = new Tag();
        parent.setId(entity.getParentId().toString());
        return parent;
    } else {
        return null;
    }
}
Also used : Tag(org.ovirt.engine.api.model.Tag)

Example 13 with Tag

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

the class BackendTagResourceTest method testMoveNamedParent.

@Test
public void testMoveNamedParent() throws Exception {
    setUpEntityQueryExpectations(QueryType.GetTagByTagName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[PARENT_IDX] }, getEntity(NEW_PARENT_IDX));
    Tag model = getModel(0);
    model.getParent().setId(null);
    model.getParent().setName(NAMES[PARENT_IDX]);
    doTestMove(model, 0);
}
Also used : Tag(org.ovirt.engine.api.model.Tag) Test(org.junit.Test)

Example 14 with Tag

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

the class BackendTagResourceTest method testConflictedUpdate.

@Test
public void testConflictedUpdate() throws Exception {
    setUpGetEntityExpectations(0);
    setUpGetEntityExpectations(0);
    setUriInfo(setUpBasicUriExpectations());
    Tag model = getModel(1, false);
    model.setId(NEW_PARENT_ID.toString());
    try {
        resource.update(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyImmutabilityConstraint(wae);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Tag(org.ovirt.engine.api.model.Tag) Test(org.junit.Test)

Example 15 with Tag

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

the class BackendTagsResourceTest method getModel.

static Tag getModel(int index, boolean includeParent) {
    Tag model = new Tag();
    model.setId(GUIDS[index].toString());
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    if (includeParent) {
        model.setParent(new Tag());
        model.getParent().setId(PARENT_GUID.toString());
    }
    return model;
}
Also used : Tag(org.ovirt.engine.api.model.Tag)

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