Package org.drools.guvnor.client.modeldriven

Examples of org.drools.guvnor.client.modeldriven.SuggestionCompletionEngine


    }


     public void testGlobalCollections() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n global java.util.List ls", new ArrayList(), new ArrayList() );
        assertNotNull(eng);
        assertFalse(loader.hasErrors());

        assertEquals(1, eng.getGlobalVariables().length);
        assertEquals("ls", eng.getGlobalVariables()[0]);
        assertEquals("List", eng.globalTypes.get("ls"));

        assertNotNull(eng.globalCollections);
        assertEquals(1, eng.globalCollections.length);
         assertEquals("ls", eng.globalCollections[0]);
View Full Code Here


    }

    public void testSortOrderOfFields() throws Exception {

      SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
      SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.guvnor.server.rules.SomeFact", new ArrayList(), new ArrayList() );
      assertNotNull(eng);

      String[] fields = eng.getFieldCompletions("SomeFact");

      assertEquals("age", fields[0]);
      assertEquals("alive", fields[1]);
      assertEquals("bigDecimal", fields[2]);
View Full Code Here

    }

    public void testSortOrderOfFacts() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.guvnor.server.rules.SomeFact\n import org.drools.Person", new ArrayList(), new ArrayList() );
        assertNotNull(eng);
        String[] facts  = eng.getFactTypes();
        assertEquals(2, facts.length);

        assertEquals("Person", facts[0]);
        assertEquals("SomeFact", facts[1]);
View Full Code Here


    public void testLoaderWithExistingClassloader() throws Exception {
        MockClassLoader mcl = new MockClassLoader();
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader(mcl);
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.foo.Bar", new ArrayList(), new ArrayList() );
        assertNotNull(eng);
        assertNotNull(eng.dataEnumLists);
        assertTrue(mcl.called);

    }
View Full Code Here

    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"});


View Full Code Here

  }


  public void testNumeric() {
    SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
    sce.fieldTypes = new HashMap();
    sce.fieldTypes.put("Driver.age", SuggestionCompletionEngine.TYPE_NUMERIC);
    sce.fieldTypes.put("Driver.name", SuggestionCompletionEngine.TYPE_STRING);

    GuidedDecisionTable dt = new GuidedDecisionTable();
View Full Code Here

    c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
    c2.valueList = "a,b,c";
    dt.conditionCols.add(c2);


    SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
    sce.dataEnumLists.put("Driver.name", new String[] {"bob", "michael"});

    assertEquals(0, dt.getValueList(c1, sce).length);
    assertEquals(3, dt.getValueList(c2, sce).length);
View Full Code Here

    c1.boundName = "c1";
    c1.factType = "Driver";
    c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
    dt.conditionCols.add(c1);

    SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
    sce.fieldTypes = new HashMap();
    sce.fieldTypes.put("Driver.age", SuggestionCompletionEngine.TYPE_NUMERIC);
    sce.fieldTypes.put("Driver.name", SuggestionCompletionEngine.TYPE_STRING);

    assertFalse(dt.isNumeric(c1, sce));
View Full Code Here

    public void testAddDSLSentence() {
        final String input = "{This} is a {pattern} considered pretty \\{{easy}\\} by most \\{people\\}. What do you {say}?";
        this.builder.addDSLActionSentence( input );
        this.builder.addDSLConditionSentence( "foo bar" );
        final SuggestionCompletionEngine engine = this.builder.getInstance();

        assertEquals( 1, engine.actionDSLSentences.length );
        assertEquals( 1, engine.conditionDSLSentences.length );

    }
View Full Code Here

        this.builder.addDSLMapping(mapping1);
        this.builder.addDSLMapping(mapping2);
        this.builder.addDSLMapping(mapping3);
        this.builder.addDSLMapping(mapping4);

        final SuggestionCompletionEngine engine = this.builder.getInstance();

        assertEquals( 1, engine.actionDSLSentences.length );
        assertEquals( 1, engine.conditionDSLSentences.length );
        assertEquals( 1, engine.keywordDSLItems.length );
        assertEquals( 1, engine.anyScopeDSLItems.length );
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.modeldriven.SuggestionCompletionEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.