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

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


                      "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,
View Full Code Here


                      facts[1] );
    }

    @Test
    public void testTypeDeclarations() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();

        String header = "";
        header += "package foo\n";

        header += "declare Applicant\n";
        header += "     creditRating: String\n";
        header += "     approved: Boolean\n";
        header += "     applicationDate: java.util.Date\n";
        header += "     age: Integer\n";
        header += "     name: String\n";
        header += "end\n";

        header += "declare LoanApplication\n";
        header += "     amount: Integer\n";
        header += "     approved: Boolean\n";
        header += "     deposit: Integer\n";
        header += "     approvedRate: Integer\n";
        header += "     lengthYears: Integer\n";
        header += "     explanation: String\n";
        header += "     insuranceCost: Integer\n";
        header += "     applicant: Applicant\n";
        header += "end\n";

        SuggestionCompletionEngine eng = loader.getSuggestionEngine( header,
                                                                     new ArrayList(),
                                                                     new ArrayList() );
        assertNotNull( eng );

        assertEquals( SuggestionCompletionEngine.TYPE_STRING,
View Full Code Here

    }

    @Test
    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

    }

    @Test
    public void testTypeDeclarationsAnnotations() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();

        String header = "";
        header += "package foo\n";

        header += "declare Applicant\n";
        header += "@role( event )\n";
        header += "end\n";

        SuggestionCompletionEngine eng = loader.getSuggestionEngine( header,
                                                                     new ArrayList(),
                                                                     new ArrayList() );
        assertNotNull( eng );

        assertNotNull( eng.getAnnotations() );
View Full Code Here

    }

    @Test
    public void testTypeDeclarationsMultipleAnnotations() throws Exception {
        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();

        String header = "";
        header += "package foo\n";

        header += "declare Applicant\n";
        header += "@role( event )\n";
        header += "@smurf( name = Pupa)\n";
        header += "end\n";

        SuggestionCompletionEngine eng = loader.getSuggestionEngine( header,
                                                                     new ArrayList(),
                                                                     new ArrayList() );
        assertNotNull( eng );

        assertNotNull( eng.getAnnotations() );
View Full Code Here

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

        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg,
                                                                        new ArrayList<JarInputStream>(),
                                                                        new ArrayList<DSLTokenizedMappingFile>() );

        assertEquals( "String",
                      engine.getFieldType( "SuggestionCompletionEngineTest$NestedClass",
View Full Code Here

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

        SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
        SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg,
                                                                        new ArrayList<JarInputStream>(),
                                                                        new ArrayList<DSLTokenizedMappingFile>() );

        assertEquals( SuggestionCompletionEngine.TYPE_STRING,
                      engine.getFieldType( "Alert",
View Full Code Here

    @Test
    public void testDataEnums() {
        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( "'Person.age' : [42, 43] \n 'Person.sex' : ['M', 'F']" );
        enums.add( "'Driver.sex' : ['M', 'F']" );

        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 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

TOP

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

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.