/** * Start the creation of a new SuggestionCompletionEngine */ public void newCompletionEngine() { this.instance = new SuggestionCompletionEngine(); this.factTypes = new HashMap<String, FIELD_CLASS_TYPE>(); this.annotationsForType = new HashMap<String, Map<String, Map<String, String>>>(); this.fieldsForType = new HashMap<String, String[]>(); this.fieldTypes = new HashMap<String, String>(); this.fieldTypesField = new HashMap<String, FieldInfo>(); this.globalTypes = new HashMap<String, String>(); this.actionDSLSentences = new ArrayList<DSLSentence>(); this.conditionDSLSentences = new ArrayList<DSLSentence>(); this.keywordDSLItems = new ArrayList<DSLSentence>(); this.anyScopeDSLItems = new ArrayList<DSLSentence>(); this.globalCollections = new ArrayList<String>(); this.accessorsAndMutators = new HashMap<String, FieldAccessorsAndMutators>(); this.allDataEnumsList = new HashMap<String, String[]>(); }
/** * Start the creation of a new SuggestionCompletionEngine */ public void newCompletionEngine() { this.instance = new SuggestionCompletionEngine(); this.factTypes = new HashMap<String, FIELD_CLASS_TYPE>(); this.annotationsForType = new HashMap<String, Map<String, Map<String, String>>>(); this.fieldsForType = new HashMap<String, String[]>(); this.fieldTypes = new HashMap<String, String>(); this.fieldTypesField = new HashMap<String, FieldInfo>(); this.globalTypes = new HashMap<String, String>(); this.actionDSLSentences = new ArrayList<DSLSentence>(); this.conditionDSLSentences = new ArrayList<DSLSentence>(); this.keywordDSLItems = new ArrayList<DSLSentence>(); this.anyScopeDSLItems = new ArrayList<DSLSentence>(); this.globalCollections = new ArrayList<String>(); this.accessorsAndMutators = new HashMap<String, FieldAccessorsAndMutators>(); this.allDataEnumsList = new HashMap<String, String[]>(); }
public void testCEPParameterCompletions() { final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
@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 testGlobalAndFacts() { final SuggestionCompletionEngine com = new SuggestionCompletionEngine(); com.setGlobalVariables( new HashMap<String, String>() { { put( "y", "Foo" ); } } ); com.setFieldsForTypes( new HashMap<String, ModelField[]>() { { put( "Foo", new ModelField[]{ new ModelField( "a", String.class.getName(), FIELD_CLASS_TYPE.REGULAR_CLASS, "String" ) } ); } } ); assertFalse( com.isGlobalVariable( "x" ) ); assertTrue( com.isGlobalVariable( "y" ) ); }
@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 ); }
dt.getConditions().add( p1 ); SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
@Test public void testAdd() { final SuggestionCompletionEngine com = new SuggestionCompletionEngine(); com.setFactTypes( new String[]{"Foo"} ); com.setFieldsForTypes( new HashMap<String, ModelField[]>() { { put( "Foo", new ModelField[]{ new ModelField( "a", String.class.getName(), FIELD_CLASS_TYPE.REGULAR_CLASS, "String" ) } ); } } ); assertEquals( 1, com.getFactTypes().length ); assertEquals( "Foo", com.getFactTypes()[0] ); assertEquals( 1, com.getFieldCompletions( "Foo" ).length ); assertEquals( "a", com.getFieldCompletions( "Foo" )[0] ); }
dt.getConditions().add( p1 ); SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
@Test public void testFilter() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
@Test public void testSmartEnumsDependingOfSeveralFieldsTwo() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.field1",
@Test @SuppressWarnings("serial") public void testNumeric() { SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
@Test @SuppressWarnings("serial") public void testGetType() { SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
public void testCEPCompletions() { final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
dt.getConditions().add( p6 ); SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
@Test public void testSmarterLookupEnums() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type",
@Test public void testSmarterLookupEnumsDifferentOrder() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type",
@Test public void testSmartEnumsDependingOfSeveralFieldsFive() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.field1",
dt.getActionCols().add( asf__ ); SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.putDataEnumList( "Driver.name", new String[]{"bob", "michael"} );
@Test public void testSmartEnums() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type",