Search in sources :

Example 56 with Tags

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()));
}
Also used : Tags(org.ovirt.engine.core.common.businessentities.Tags) Test(org.junit.Test)

Example 57 with Tags

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);
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) Tags(org.ovirt.engine.core.common.businessentities.Tags) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 58 with Tags

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;
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) Tags(org.ovirt.engine.core.common.businessentities.Tags)

Example 59 with Tags

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);
}
Also used : Tags(org.ovirt.engine.core.common.businessentities.Tags) Test(org.junit.Test)

Example 60 with Tags

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());
}
Also used : Tags(org.ovirt.engine.core.common.businessentities.Tags) Test(org.junit.Test)

Aggregations

Tags (org.ovirt.engine.core.common.businessentities.Tags)68 Test (org.junit.Test)34 ArrayList (java.util.ArrayList)8 Guid (org.ovirt.engine.core.compat.Guid)5 HashSet (java.util.HashSet)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Before (org.junit.Before)2 TagsTemplateMap (org.ovirt.engine.core.common.businessentities.TagsTemplateMap)2 TagsVdsMap (org.ovirt.engine.core.common.businessentities.TagsVdsMap)2 TagsVmMap (org.ovirt.engine.core.common.businessentities.TagsVmMap)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)2 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Date (java.util.Date)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1 Response (javax.ws.rs.core.Response)1 Tag (org.ovirt.engine.api.model.Tag)1