@Override protected Tags getEntity(int index) { return new Tags(DESCRIPTIONS[index], null, false, GUIDS[index], NAMES[index]); }
@Override protected Tags getEntity(int index) { return new Tags(DESCRIPTIONS[index], PARENT_GUID, false, GUIDS[index], NAMES[index]); }
static Tags setUpRootTag() { return new Tags("root", null, true, Guid.Empty, "root"); }
static List<Tags> setUpTags() { List<Tags> tags = new ArrayList<>(); for (int i = 0; i < NAMES.length; i++) { tags.add(new Tags(DESCRIPTIONS[i], null, false, GUIDS[i], NAMES[i])); } return tags; }
static List<Tags> setUpTags() { List<Tags> tags = new ArrayList<>(); for (int i = 0; i < NAMES.length; i++) { tags.add(new Tags(DESCRIPTIONS[i], PARENT_GUID, false, GUIDS[i], NAMES[i])); } return tags; }
@BeforeEach public void setup() { BaseConditionFieldAutoCompleter.tagsHandler = mock(ITagsHandler.class); Tags tags = new Tags(); tags.setTagName(TAG_NAME); when(BaseConditionFieldAutoCompleter.tagsHandler.getTagByTagName(any())).thenReturn(tags); when(BaseConditionFieldAutoCompleter.tagsHandler.getTagNamesAndChildrenNamesByRegExp(any())) .thenReturn(TAG_NAME_WITH_CHILDREN); }
@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)); } }
public void getRootTag(AsyncQuery<Tags> aQuery) { aQuery.converterCallback = source -> { if (source != null) { Tags tag = (Tags) source; Tags root = new Tags(tag.getDescription(), tag.getParentId(), tag.getIsReadonly(), tag.getTagId(), tag.getTagName()); if (tag.getChildren() != null) { fillTagsRecursive(root, tag.getChildren()); } return root; } return new Tags(); }; Frontend.getInstance().runQuery(QueryType.GetRootTag, new QueryParametersBase(), aQuery); }
private Tags createTag(String name, String desc) { Tags tag = new Tags(); tag.setChildren(new ArrayList<>()); tag.setDescription(desc); tag.setTagName(name); tag.setIsReadonly(true); tag.setParentId(Guid.Empty); tag.setType(TagsType.GeneralTag); return tag; }
@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; }
public void onSave() { TagModel model = (TagModel) getWindow(); if (model.getProgress() != null) { return; } if (!model.validate()) { return; } Tags tempVar = new Tags(); tempVar.setTagId(model.getIsNew() ? Guid.Empty : getSelectedItem().getId()); tempVar.setParentId(model.getIsNew() ? getSelectedItem().getId() : getSelectedItem().getParentId()); tempVar.setTagName(model.getName().getEntity()); tempVar.setDescription(model.getDescription().getEntity()); Tags tag = tempVar; model.startProgress(); Frontend.getInstance().runAction(model.getIsNew() ? ActionType.AddTag : ActionType.UpdateTag, new TagsOperationParameters(tag), result -> { TagListModel localModel = (TagListModel) result.getState(); localModel.postOnSave(result.getReturnValue()); }, this); }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); 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); }