i++; this.instance.putDataEnumList(fieldName, a);
i++; this.instance.putDataEnumList(fieldName, a);
final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.field1", new String[]{"a1", "a2"} ); sce.putDataEnumList( "Fact.field2", new String[]{"b1", "b2"} ); sce.putDataEnumList( "Fact.field3[field1=a1,field2=b1]", new String[]{"c1", "c2", "c3"} ); sce.putDataEnumList( "Fact.field4[field1=a1]", new String[]{"d1", "d2"} );
final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.field1", new String[]{"a1", "a2"} ); sce.putDataEnumList( "Fact.field2", new String[]{"b1", "b2"} ); sce.putDataEnumList( "Fact.field3", new String[]{"c1", "c2", "c3"} ); sce.putDataEnumList( "Fact.longerField4", new String[]{"d1", "d2"} ); sce.putDataEnumList( "Fact.field5", new String[]{"e1", "e2"} ); sce.putDataEnumList( "Fact.field6[field1=a1, field2=b2, field3=c3,longerField4=d1,field5=e2]", new String[]{"f1", "f2"} );
@Test public void testSimpleEnums() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type", new String[]{"sex", "colour"} ); assertEquals( 2, sce.getEnumValues( "Fact", "type" ).length ); assertEquals( "sex", sce.getEnumValues( "Fact", "type" )[0] ); assertEquals( "colour", sce.getEnumValues( "Fact", "type" )[1] ); }
@Test public void testNoConstraintLists() { GuidedDecisionTable52 dt = new GuidedDecisionTable52(); // add cols for LHS ConditionCol52 c1 = new ConditionCol52(); Pattern52 p1 = new Pattern52(); p1.setBoundName( "c1" ); p1.setFactType( "Driver" ); c1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL ); p1.getChildColumns().add( c1 ); dt.getConditions().add( p1 ); ConditionCol52 c2 = new ConditionCol52(); Pattern52 p2 = new Pattern52(); p2.setBoundName( "c2" ); p2.setFactType( "Driver" ); c2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL ); c2.setValueList( "a,b,c" ); p2.getChildColumns().add( c2 ); dt.getConditions().add( p1 ); SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.putDataEnumList( "Driver.name", new String[]{"bob", "michael"} ); assertEquals( 0, dt.getValueList( c1 ).length ); assertEquals( 3, dt.getValueList( c2 ).length ); }
final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type", new String[]{"sex", "colour"} ); sce.putDataEnumList( "Fact.value[e1, e2]", new String[]{"select something from database where x=@{e1} and y=@{e2}"} ); sce.putDataEnumList( "Fact.value[f1, f2]", new String[]{"select something from database where x=@{f1} and y=@{f2}"} );
final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type", new String[]{"sex", "colour"} ); sce.putDataEnumList( "Fact.value[type=sex]", new String[]{"M", "F"} ); sce.putDataEnumList( "Fact.value[type=colour]", new String[]{"RED", "WHITE", "BLUE"} );
final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type", new String[]{"sex", "colour"} ); sce.putDataEnumList( "Fact.value[f1, f2]", new String[]{"select something from database where x=@{f1} and y=@{f2}"} );
sce.putDataEnumList( "Driver.name", new String[]{"bob", "michael"} ); sce.putDataEnumList( "Person.rating", new String[]{"1", "2"} );