Package org.drools.ide.common.server.rules

Examples of org.drools.ide.common.server.rules.SuggestionCompletionLoader$MethodSignature


   
    @Test
    public void testDataEnums3() {
        String pkg = "package org.test\n import org.drools.ide.common.client.modeldriven.SuggestionCompletionEngineTest.NestedClass";

        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();

        List<String> enums = new ArrayList<String>();

        enums.add( "'Fact.f1' : ['a1', 'a2'] \n 'Fact.f2' : ['def1', 'def2', 'def3'] \n 'Fact.f2[f1=a2]' : ['c1', 'c2']" );

        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg,
                                                                        new ArrayList<JarInputStream>(),
                                                                        new ArrayList<DSLTokenizedMappingFile>(),
                                                                        enums );
        assertEquals( "String",
                      engine.getFieldType( "SuggestionCompletionEngineTest$NestedClass",
View Full Code Here


    @Test
    public void testDataEnums2() {
        String pkg = "package org.test\n import org.drools.ide.common.client.modeldriven.SuggestionCompletionEngineTest.Fact";

        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();

        List<String> enums = new ArrayList<String>();

        enums.add( "'Fact.field1' : ['val1', 'val2'] 'Fact.field2' : ['val3', 'val4'] 'Fact.field2[field1=val1]' : ['f1val1a', 'f1val1b'] 'Fact.field2[field1=val2]' : ['f1val2a', 'f1val2b']" );

        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg,
                                                                        new ArrayList<JarInputStream>(),
                                                                        new ArrayList<DSLTokenizedMappingFile>(),
                                                                        enums );
        assertEquals( "String",
                      engine.getFieldType( "SuggestionCompletionEngineTest$Fact",
View Full Code Here

        assertTrue(err.startsWith("Unable"));
    }

    @Test
    public void testLoadDifferentFieldTypes() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.ide.common.server.rules.SomeFact", new ArrayList(), new ArrayList() );
        assertNotNull(eng);

        assertEquals(SuggestionCompletionEngine.TYPE_NUMERIC, eng.getFieldType( "SomeFact", "age" ));
        assertEquals(SuggestionCompletionEngine.TYPE_STRING, eng.getFieldType( "SomeFact", "likes"));
        assertEquals(SuggestionCompletionEngine.TYPE_STRING, eng.getFieldType( "SomeFact","name"));
View Full Code Here

        assertEquals("String",eng.getParametricFieldType("SomeFact", "factListString"));
    }

    @Test
    public void testLoadDifferentMethodTypes() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.ide.common.server.rules.SomeFact", new ArrayList(), new ArrayList() );
        assertNotNull(eng);

        assertEquals(List.class.getName(), eng.getMethodClassType("SomeFact", "aMethod(int)"));
        assertEquals("SomeFact", eng.getParametricFieldType("SomeFact", "aMethod(int)"));
    }
View Full Code Here

        assertEquals("SomeFact", eng.getParametricFieldType("SomeFact", "aMethod(int)"));
    }

    @Test
    public void testGeneratedBeans() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n declare GenBean \n   id: int \n name : String \n end \n declare GenBean2 \n list: java.util.List \n gb: GenBean \n end", new ArrayList(), new ArrayList() );
        assertFalse(loader.hasErrors());
        assertNotNull(eng);

        assertEquals(2, eng.getFactTypes().length);
        assertEquals("GenBean", eng.getFactTypes()[0]);
        assertEquals("GenBean2", eng.getFactTypes()[1]);
View Full Code Here

        assertEquals("GenBean", eng.getFieldType("GenBean2", "gb"));
    }

    @Test
    public void testGlobal() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n global org.drools.Person p", new ArrayList(), new ArrayList() );
        assertNotNull(eng);
        assertFalse(loader.hasErrors());

        assertEquals(1, eng.getGlobalVariables().length);
        assertEquals("p", eng.getGlobalVariables()[0]);
        assertEquals("Person", eng.getGlobalVariable("p"));
        String[] flds = (String[]) eng.getModelFields("Person");
View Full Code Here

        assertEquals(0, eng.getGlobalCollections().length);
    }

    @Test
    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.getGlobalVariable("ls"));
View Full Code Here

    }

    @Test
    public void testSortOrderOfFields() throws Exception {

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

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

      assertEquals("age", fields[0]);
View Full Code Here

      assertEquals("bigDecimal", fields[3]);
    }

    @Test
    public void testEnumFields() throws Exception {
      SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
      SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.ide.common.server.rules.SomeFact", new ArrayList(), new ArrayList() );
      assertNotNull(eng);
        assertTrue(eng.hasDataEnumLists());
        assertEquals(eng.getDataEnumList("SomeFact.anEnum").length,3);
        String a[] = eng.getDataEnumList("SomeFact.anEnum") ;
        assertEquals(a[0],"EnumClass.v1=EnumClass.v1");
View Full Code Here

        assertEquals(a[2],"EnumClass.v3=EnumClass.v3");
    }

    @Test
    public void testSortOrderOfFacts() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.ide.common.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]);
View Full Code Here

TOP

Related Classes of org.drools.ide.common.server.rules.SuggestionCompletionLoader$MethodSignature

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.