use of org.whole.lang.tests.model.FilterRule in project whole by wholeplatform.
the class TestsInterpreterVisitor method applyFilterRule.
protected IEntity applyFilterRule(IEntity entity) {
FilterRule filterRule = (FilterRule) getBindings().wGet("activeFilterRule");
if (filterRule == null)
return entity;
IEntity filteredEntity = EntityUtils.clone(entity);
getBindings().wDef("self", filteredEntity);
stagedVisit(filterRule.getBody());
getResult();
return filteredEntity;
}
use of org.whole.lang.tests.model.FilterRule in project whole by wholeplatform.
the class TestsHelpers method createFilterRulesMap.
public static Map<String, FilterRule> createFilterRulesMap(TestSuite testSuite) {
Map<String, FilterRule> filterRulesMap = new HashMap<String, FilterRule>();
IEntityIterator<FilterFamily> filterFamilies = IteratorFactory.childIterator();
filterFamilies.reset(testSuite.getFilterFamilies());
for (FilterFamily filterFamily : filterFamilies) {
IEntityIterator<FilterRule> filterRules = IteratorFactory.childIterator();
filterRules.reset(filterFamily.getFilterRules());
for (FilterRule filterRule : filterRules) {
String name = filterFamily.getName().getValue() + '.' + filterRule.getName().getValue();
if (filterRulesMap.get(name) != null)
filterRulesMap.remove(name);
else
filterRulesMap.put(name, filterRule);
PackageName packageName = filterFamily.getPackageName();
if (DataTypeUtils.getDataKind(packageName).isString()) {
String qualifiedName = packageName.wStringValue() + '.' + name;
filterRulesMap.put(qualifiedName, filterRule);
}
}
}
return filterRulesMap;
}
use of org.whole.lang.tests.model.FilterRule in project whole by wholeplatform.
the class TestsContentAssistVisitor method findContentAssistValues.
protected boolean findContentAssistValues(IEntity entity) {
if (!Matcher.match(TestsEntityDescriptorEnum.Name, entity) || !EntityUtils.hasParent(entity) || !Matcher.match(TestsEntityDescriptorEnum.Filter, entity.wGetParent()))
return false;
TestSuite testSuite = Matcher.findAncestor(TestsEntityDescriptorEnum.TestSuite, entity);
if (testSuite == null)
return false;
Map<String, FilterRule> rulesMap = TestsHelpers.createFilterRulesMap(testSuite);
List<Name> names = new ArrayList<Name>();
for (String key : rulesMap.keySet()) names.add(TestsEntityFactory.instance.createName(key));
setResult(names.toArray(new Name[names.size()]));
return true;
}
Aggregations