use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagsDirector method init.
/**
* In memory tree initialized during initialization
*/
@PostConstruct
protected void init() {
log.info("Start initializing {}", getClass().getSimpleName());
tagsMapByID.clear();
tagsMapByName.clear();
Tags root = new Tags("root", null, true, ROOT_TAG_ID, "root");
addTagToHash(root);
addChildren(root);
log.info("Finished initializing {}", getClass().getSimpleName());
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class TagMapper method map.
@Mapping(from = Tag.class, to = Tags.class)
public static Tags map(Tag model, Tags template) {
Tags entity = template != null ? template : new Tags();
entity.setParentId(parent(model, entity.getParentId()));
if (model.isSetId()) {
entity.setTagId(GuidUtils.asGuid(model.getId()));
}
if (model.isSetName()) {
entity.setTagName(model.getName());
}
if (model.isSetDescription()) {
entity.setDescription(model.getDescription());
}
return entity;
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class BatchProcedureCallTest method testBatch.
@Test
public void testBatch() {
List<Tags> tags = dao.getAll();
for (Tags tag : tags) {
dao.remove(tag.getTagId());
}
List<Tags> data = new ArrayList<>();
data.add(new Tags("a", Guid.Empty, true, Guid.newGuid(), "a"));
data.add(new Tags("b", Guid.Empty, true, Guid.newGuid(), "b"));
List<MapSqlParameterSource> executions = data.stream().map(this::getParamsSource).collect(Collectors.toList());
jdbcCallsHandler.executeStoredProcAsBatch("Inserttags", executions);
List<Tags> tagsAfterInsert = dao.getAll();
assertNotNull(tagsAfterInsert);
assertEquals(data.size(), tagsAfterInsert.size());
assertTrue(data.containsAll(tagsAfterInsert));
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class BackendTemplateTagResourceTest 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;
}
use of org.ovirt.engine.core.common.businessentities.Tags in project ovirt-engine by oVirt.
the class BackendTemplateTagResourceTest method setUpTagExpectations.
private Tags setUpTagExpectations(Guid tagId) {
Tags tags = mock(Tags.class);
when(tags.getTagId()).thenReturn(tagId);
when(tags.getParentId()).thenReturn(TEMPLATE_ID);
return tags;
}
Aggregations