use of org.whole.lang.tests.factories.TestsEntityFactory 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.factories.TestsEntityFactory 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.factories.TestsEntityFactory in project whole by wholeplatform.
the class TestsLearningInterpreterVisitor method createUsingFilter.
protected UsingFilter createUsingFilter(String filterName) {
TestsEntityFactory tef = TestsEntityFactory.instance;
UsingFilter usingFilter = tef.createUsingFilter();
usingFilter.setFilter(tef.createFilter(tef.createName(GENERATED_FAMILY_NAME + '.' + filterName)));
return usingFilter;
}
use of org.whole.lang.tests.factories.TestsEntityFactory in project whole by wholeplatform.
the class TestsLearningInterpreterVisitor method getFilterFamily.
protected FilterFamily getFilterFamily(TestSuite suite) {
FilterFamilies filterFamilies = suite.getFilterFamilies();
FilterFamily filterFamily = null;
for (int i = 0; i < filterFamilies.wSize(); i++) {
FilterFamily child = (FilterFamily) filterFamilies.wGet(i);
if (EntityUtils.isNotResolver(child) && GENERATED_FAMILY_NAME.equals(child.getName().getValue())) {
filterFamily = child;
break;
}
}
TestsEntityFactory tef = TestsEntityFactory.instance;
if (filterFamily == null) {
filterFamily = tef.createFilterFamily(CommonsEntityAdapterFactory.createResolver(TestsEntityDescriptorEnum.PackageName), tef.createDescription("Auto-generated filter family"), tef.createName(GENERATED_FAMILY_NAME), tef.createFilterRules(0));
}
return filterFamily;
}
Aggregations