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());
}
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;
}
}
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);
}
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);
}
}
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;
}
Aggregations