Search in sources :

Example 31 with Tags

use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.

the class TagDaoTest method testSave.

/**
 * Ensures that saving a tag works as expected.
 */
@Test
public void testSave() {
    dao.save(newTag);
    Tags result = dao.get(newTag.getTagId());
    assertNotNull(result);
    assertEquals(newTag, result);
}
Also used : Tags(org.ovirt.engine.core.common.businessentities.Tags) Test(org.junit.Test)

Example 32 with Tags

use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.

the class TagDaoTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getTagDao();
    existingTag = dao.get(EXISTING_TAG_ID);
    existingTag = dao.get(new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0c"));
    parent = FixturesTool.DATA_CENTER;
    user = new Guid("9bf7c640-b620-456f-a550-0348f366544a");
    vm = EXISTING_VM_ID;
    template = new Guid("77296e00-0cad-4e5a-9299-008a7b6f4355");
    vmPool = new Guid("103cfd1d-18b1-4790-8a0c-1e52621b0076");
    newTag = new Tags();
    newTag.setTagName("newtagname");
    newTag.setIsReadonly(true);
    newTag.setDescription("newtagdescription");
    newTag.setParentId(parent);
    existingUserGroupTag = dao.getTagUserGroupByGroupIdAndByTagId(EXISTING_TAG_ID, EXISTING_GROUP_ID);
    existingUserTag = dao.getTagUserByTagIdAndByuserId(EXISTING_TAG_ID, EXISTING_USER_ID);
    existingVdsTag = dao.getTagVdsByTagIdAndByVdsId(EXISTING_TAG_ID, FixturesTool.VDS_RHEL6_NFS_SPM);
    newVdsTag = new TagsVdsMap(EXISTING_TAG_ID, FixturesTool.HOST_ID);
    existingVmTag = dao.getTagVmByTagIdAndByVmId(EXISTING_TAG_ID, EXISTING_VM_ID);
    existingTemplateTag = dao.getTagTemplateByTagIdAndByTemplateId(EXISTING_TAG_ID, EXISTING_TEMPLATE_ID);
    newVmTag = new TagsVmMap(EXISTING_TAG_ID, FREE_VM_ID);
    newTemplateTag = new TagsTemplateMap(EXISTING_TAG_ID, FREE_TEMPLATE_ID);
}
Also used : TagsVdsMap(org.ovirt.engine.core.common.businessentities.TagsVdsMap) TagsVmMap(org.ovirt.engine.core.common.businessentities.TagsVmMap) TagsTemplateMap(org.ovirt.engine.core.common.businessentities.TagsTemplateMap) Guid(org.ovirt.engine.core.compat.Guid) Tags(org.ovirt.engine.core.common.businessentities.Tags) Before(org.junit.Before)

Example 33 with Tags

use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.

the class TagDaoTest method testGet.

/**
 * Ensures that getting a tag by id works as expected.
 */
@Test
public void testGet() {
    Tags result = dao.get(existingTag.getTagId());
    assertNotNull(result);
    assertEquals(existingTag, result);
}
Also used : Tags(org.ovirt.engine.core.common.businessentities.Tags) Test(org.junit.Test)

Example 34 with Tags

use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.

the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForTag.

@Test
public void testGetEntityNameByIdAndTypeForTag() {
    Tags tag = tagDao.get(TAG_ID);
    assertNotNull(tag);
    String name = tag.getTagName();
    assertEquals(name, underTest.getEntityNameByIdAndType(TAG_ID, VdcObjectType.Tags));
}
Also used : Tags(org.ovirt.engine.core.common.businessentities.Tags) Test(org.junit.Test)

Example 35 with Tags

use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.

the class BackendVmTagResourceTest method setUpTagsExpectations.

private List<Tags> setUpTagsExpectations() {
    List<Tags> tags = new ArrayList<>();
    for (int i = 0; i < GUIDS.length; i++) {
        Tags tag = setUpTagExpectations(GUIDS[i]);
        tags.add(tag);
    }
    return tags;
}
Also used : ArrayList(java.util.ArrayList) Tags(org.ovirt.engine.core.common.businessentities.Tags)

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