//
//
// }
public void testValueLists() {
GuidedDecisionTable dt = new GuidedDecisionTable();
//add cols for LHS
ConditionCol c1 = new ConditionCol();
c1.boundName = "c1";
c1.factType = "Driver";
c1.factField = "name";
c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
dt.conditionCols.add(c1);
ConditionCol c1_ = new ConditionCol();
c1_.boundName = "c1";
c1_.factType = "Driver";
c1_.factField = "name";
c1_.constraintValueType = ISingleFieldConstraint.TYPE_RET_VALUE;
dt.conditionCols.add(c1_);
ConditionCol c1__ = new ConditionCol();
c1__.boundName = "c1";
c1__.factType = "Driver";
c1__.factField = "name";
c1__.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
c1__.valueList = "one,two,three";
dt.conditionCols.add(c1__);
ConditionCol c2 = new ConditionCol();
c2.boundName = "c2";
c2.factType = "Driver";
c2.factField = "nothing";
c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
dt.conditionCols.add(c2);
ActionSetFieldCol asf = new ActionSetFieldCol();
asf.boundName = "c1";
asf.factField = "name";
dt.actionCols.add(asf);
ActionInsertFactCol ins = new ActionInsertFactCol();
ins.boundName = "x";
ins.factField = "rating";
ins.factType = "Person";
dt.actionCols.add(ins);
ActionInsertFactCol ins_ = new ActionInsertFactCol();
ins_.boundName = "x";
ins_.factField = "rating";
ins_.factType = "Person";
ins_.valueList = "one,two,three";
dt.actionCols.add(ins_);
ActionSetFieldCol asf_ = new ActionSetFieldCol();
asf_.boundName = "c1";
asf_.factField = "goo";
dt.actionCols.add(asf_);
ActionSetFieldCol asf__ = new ActionSetFieldCol();
asf__.boundName = "c1";
asf__.factField = "goo";
asf__.valueList = "one,two,three";
dt.actionCols.add(asf__);
SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
sce.dataEnumLists.put("Driver.name", new String[] {"bob", "michael"});
sce.dataEnumLists.put("Person.rating", new String[] {"1", "2"});
String[] r = dt.getValueList(c1, sce);
assertEquals(2, r.length);
assertEquals("bob", r[0]);
assertEquals("michael", r[1]);
assertEquals(0, dt.getValueList(c1_, sce).length);
r = dt.getValueList(c1__, sce);
assertEquals(3, r.length);
assertEquals("one", r[0]);
assertEquals("two", r[1]);
assertEquals("three", r[2]);
assertEquals(0, dt.getValueList(c2, sce).length);
r = dt.getValueList(asf, sce);
assertEquals(2, r.length);
assertEquals("bob", r[0]);
assertEquals("michael", r[1]);
r = dt.getValueList(ins, sce);
assertEquals(2, r.length);
assertEquals("1", r[0]);
assertEquals("2", r[1]);
r = dt.getValueList(ins_, sce);
assertEquals(3, r.length);
assertEquals("one", r[0]);
assertEquals("two", r[1]);
assertEquals("three", r[2]);
assertEquals(0, dt.getValueList(asf_, sce).length);
r = dt.getValueList(asf__, sce);
assertEquals(3, r.length);
assertEquals("one", r[0]);
assertEquals("two", r[1]);
assertEquals("three", r[2]);
AttributeCol at = new AttributeCol();
at.attr = "no-loop";
dt.attributeCols.add(at);
r = dt.getValueList(at, sce);
assertEquals(2, r.length);
assertEquals("true", r[0]);
assertEquals("false", r[1]);
at.attr = "enabled";
assertEquals(2, dt.getValueList(at, sce).length);
at.attr = "salience";
assertEquals(0, dt.getValueList(at, sce).length);
}