Search in sources :

Example 16 with DRLParser

use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.

the class DRLContextTest method testCheckLHSLocationDetermination_BEGIN_OF_CONDITION76.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_BEGIN_OF_CONDITION76() {
    String input = "rule MyRule \n" + "	when \n" + "		forall ( " + "           Class ( property == \"test\")" + "           C";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Also used : DRLParser(org.drools.drl.parser.lang.DRLParser) DroolsParserException(org.drools.drl.parser.DroolsParserException) RecognitionException(org.antlr.runtime.RecognitionException) Test(org.junit.Test)

Example 17 with DRLParser

use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_OPERATOR1.

/**
 * Inside of condition: Operator
 */
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_OPERATOR1() {
    String input = "rule MyRule \n" + "	when \n" + "		Class ( property ";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Also used : DRLParser(org.drools.drl.parser.lang.DRLParser) DroolsParserException(org.drools.drl.parser.DroolsParserException) RecognitionException(org.antlr.runtime.RecognitionException) Test(org.junit.Test)

Example 18 with DRLParser

use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.

the class DRLContextTest method testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_EXISTS2.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_EXISTS2() {
    String input = "rule MyRule \n" + "	when \n" + "		exists ( ";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Also used : DRLParser(org.drools.drl.parser.lang.DRLParser) DroolsParserException(org.drools.drl.parser.DroolsParserException) RecognitionException(org.antlr.runtime.RecognitionException) Test(org.junit.Test)

Example 19 with DRLParser

use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_EVAL7.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_EVAL7() {
    String input = "rule MyRule \n" + "	when \n" + "		eval( param.getMethod(\"someStringWith)))\").get";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_EVAL, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Also used : DRLParser(org.drools.drl.parser.lang.DRLParser) DroolsParserException(org.drools.drl.parser.DroolsParserException) RecognitionException(org.antlr.runtime.RecognitionException) Test(org.junit.Test)

Example 20 with DRLParser

use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.

the class DRLContextTest method testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_EXISTS4.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_EXISTS4() {
    String input = "rule MyRule \n" + "	when \n" + "		exists Cl";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Also used : DRLParser(org.drools.drl.parser.lang.DRLParser) DroolsParserException(org.drools.drl.parser.DroolsParserException) RecognitionException(org.antlr.runtime.RecognitionException) Test(org.junit.Test)

Aggregations

DRLParser (org.drools.drl.parser.lang.DRLParser)200 Test (org.junit.Test)197 DroolsParserException (org.drools.drl.parser.DroolsParserException)187 RecognitionException (org.antlr.runtime.RecognitionException)186 DroolsToken (org.drools.drl.parser.lang.DroolsToken)6 Ignore (org.junit.Ignore)2 LinkedList (java.util.LinkedList)1 Token (org.antlr.runtime.Token)1 InternalResource (org.drools.core.io.internal.InternalResource)1 Expander (org.drools.drl.parser.lang.Expander)1 DefaultExpander (org.drools.drl.parser.lang.dsl.DefaultExpander)1