Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6544

Map comparison fails in the executable model

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • None
    • executable model
    • None
    • Undefined
    • NEW
    • NEW

    Description

      This test fails

          @Test
          public void testBetaMap() {
      
              String str =
                      "import " + Result.class.getCanonicalName() + ";" +
                      "import " + Map.class.getCanonicalName() + ";" +
                      "rule R when\n" +
                      "  $r : Result()\n" +
                      "  $markV : Map(this['name'] == 'Mark')\n" +
                      "  $olderV : Map(this['name'] != 'Mark', this['age'] > $markV['age'])\n" +
                      "then\n" +
                      "  $r.setValue($olderV.get(\"name\") + \" is older than \" + $markV.get(\"name\"));\n" +
                      "end";
      
              KieSession ksession = getKieSession( str );
      
              Result result = new Result();
              ksession.insert( result );
      
      
              Map mark = mapPerson("Mark", 37);
              Map edson = mapPerson("Edson", 35);
              Map mario = mapPerson("Mario", 40);
      
              FactHandle markFH = ksession.insert(mark);
              FactHandle edsonFH = ksession.insert(edson);
              FactHandle marioFH = ksession.insert(mario);
      
              ksession.fireAllRules();
              assertEquals("Mario is older than Mark", result.getValue());
      
              result.setValue( null );
              ksession.delete( marioFH );
              ksession.fireAllRules();
              assertNull(result.getValue());
      
              mark.put("age", 34 );
      //        ksession.update( markFH, mark, "age" );
      
          }
      

      Attachments

        Activity

          People

            lmolteni@redhat.com Luca Molteni
            lmolteni@redhat.com Luca Molteni
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: