Search in sources :

Example 56 with DRLParser

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

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_END12.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_END12() {
    String input = "rule MyRule \n" + "	when \n" + "		Class ( property > 0 && < 10 ";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_END, 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 57 with DRLParser

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

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_ARGUMENT5.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_ARGUMENT5() {
    String input = "rule MyRule \n" + "	when \n" + "		Class ( name1 : property1, property2 == ";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, 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 58 with DRLParser

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

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_ARGUMENT21.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_ARGUMENT21() {
    String input = "rule MyRule \n" + "	when \n" + "		Class ( property > 0 ) from collect ( \n" + "			Cheese( type == ";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, 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 59 with DRLParser

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

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_START1.

/**
 * Inside of condition: start
 */
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_START1() {
    String input = "rule MyRule \n" + "	when \n" + "		Class (";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_START, 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 60 with DRLParser

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

the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_ARGUMENT8.

@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_ARGUMENT8() {
    String input = "rule MyRule \n" + "	when \n" + "		Class ( property == \"someth";
    DRLParser parser = getParser(input);
    parser.enableEditorInterface();
    try {
        parser.compilationUnit();
    } catch (Exception ex) {
    }
    assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, 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