use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagsDirectorTest method testNotDescetor.
@Test
public void testNotDescetor() {
Tags tag1 = createTag("tag1", "desc1");
Tags tag2 = createTag("tag2", "desc2");
assertFalse(tagsDirector.isTagDescestorOfTag(tag1.getTagId(), tag2.getTagId()));
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagsDirectorTest method testGetTagIdAndChildrenIdsAsSet.
@Test
public void testGetTagIdAndChildrenIdsAsSet() {
Tags tag = createTag("tag1", "desc1");
Tags tag2 = createTag("tag2", "desc2");
tag.getChildren().add(tag2);
tag2.setParentId(tag.getParentId());
tagsDirector.addTag(tag);
Set<Guid> idsToCheck = new HashSet<>();
idsToCheck.add(tag.getTagId());
idsToCheck.add(tag2.getTagId());
HashSet<Guid> idsFromTagsDirector = tagsDirector.getTagIdAndChildrenIdsAsSet(tag.getTagId());
assertEquals(idsToCheck, idsFromTagsDirector);
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagsDirectorTest method createTag.
protected Tags createTag(String name, String description) {
Guid tagId = Guid.newGuid();
Tags tag = new Tags();
tag.setDescription(description);
tag.setTagId(tagId);
tag.setTagName(name);
tag.setType(TagsType.GeneralTag);
tag.setParentId(tagsDirector.getRootTag().getTagId());
return tag;
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagsDirectorTest method testAddTag.
@Test
public void testAddTag() {
Tags tag = createTag("tag1", "desc1");
Tags tagFromDirector = tagsDirector.getTagById(tag.getTagId());
assertNull(tagFromDirector);
tagsDirector.addTag(tag);
tagFromDirector = tagsDirector.getTagById(tag.getTagId());
assertNotNull(tagFromDirector);
assertEquals(tag, tagFromDirector);
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagsDirectorTest method testChangeValueAfterAdd.
@Test
public void testChangeValueAfterAdd() {
Tags tag = createTag("tag1", "desc1");
tagsDirector.addTag(tag);
tag.setTagName("tag2");
Tags tagFromDirector = tagsDirector.getTagById(tag.getTagId());
assertNotNull(tagFromDirector);
assertEquals("tag1", tagFromDirector.getTagName());
}
Aggregations