use of org.whole.lang.tests.reflect.TestsEntityDescriptorEnum.FilterRule in project whole by wholeplatform.
the class TestsHelpers method createFilterRule.
public static FilterRule createFilterRule(Collection<IEntity> entities) {
// create the filter logic
QueriesEntityFactory qef = QueriesEntityFactory.instance;
Sequence sequence = qef.createSequence(0);
Iterator<IEntity> iterator = entities.iterator();
IEntity baseEntity = iterator.next();
while (iterator.hasNext()) updateFilterBody(baseEntity, iterator.next(), sequence);
if (sequence.wIsEmpty())
return createResolver(FilterRule);
// create the filter rule
TestsEntityFactory tef = TestsEntityFactory.instance;
FilterRule filterRule = tef.createFilterRule(tef.createDescription("Auto-generated filter rule"), createVariable(Name, "filterName"), sequence.wGetAdapter(Statement));
return filterRule;
}
use of org.whole.lang.tests.reflect.TestsEntityDescriptorEnum.FilterRule in project whole by wholeplatform.
the class TestsHelpers method createFilterRulesMap.
public static Map<String, FilterRule> createFilterRulesMap(ITemplateManager templateManager) {
Map<String, FilterRule> filterRulesMap = new HashMap<String, FilterRule>();
TestsEntityFactory ef = TestsEntityFactory.instance;
Class<? extends ITemplateManager> templateManagerClass = templateManager.getClass();
for (String name : templateManager.names()) {
FilterRule filterRule = ef.createFilterRule();
filterRule.setName(ef.createName(name));
filterRule.setBody(templateManager.create(name).wGetAdapter(Statement));
filterRulesMap.put(templateManagerClass.getSimpleName() + "." + name, filterRule);
filterRulesMap.put(templateManagerClass.getName() + "." + name, filterRule);
}
return filterRulesMap;
}
use of org.whole.lang.tests.reflect.TestsEntityDescriptorEnum.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;
}
Aggregations