Package org.kie.internal.utils

Examples of org.kie.internal.utils.KieHelper


                     "    then\n" +
                     "        System.out.println( \"[rfgroup2] insert new trailers\");\n" +
                     "        insert(new Trailer(Trailer.TypeStatus.WAITING));\n" +
                     "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        KieSession ksession = helper.build().newKieSession();

        ArrayList<Trailer> trailerList = new ArrayList<Trailer>();
        ksession.setGlobal("trailerList", trailerList);

        Trailer trailer1 = new Trailer(Trailer.TypeStatus.WAITING);
View Full Code Here


                "    $s: String()" +
                "    Host($s == this)\n" +
                "then\n" +
                "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        KieSession ksession = helper.build().newKieSession();

        ksession.insert(new Host());
        ksession.insert("host");
        ksession.fireAllRules();
    }
View Full Code Here

                "    )\n" +
                "then\n" +
                "    $d.setValue($result.intValue());\n" +
                "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        KieSession ksession = helper.build().newKieSession();

        ksession.insert(new TypeA());
        ksession.insert(new TypeB());
        ksession.insert(new TypeC());
        TypeD d = new TypeD();
View Full Code Here

                "    System.out.println(kcontext.getRule().getName());" +
                "    alarm.setLevel( \"ABNORMAL\" );\n" +
                "    update(alarm);\n" +
                "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        KieSession ksession = helper.build().newKieSession();

        ksession.insert("t1");

        ksession.insert(new Reading("t1", 12));
        ksession.fireAllRules();
View Full Code Here

                "then\n" +
                "    $c1.setCounter($c1.getCounter() + 1);\n" +
                "    update( $c1 );\n" +
                "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        KieSession ksession = helper.build().newKieSession();

        ksession.insert(new C1());
        ksession.fireAllRules();
    }
View Full Code Here

                "rule R1 when\n" +
                "    I1 ( value == \"x\" )\n" +
                "then\n" +
                "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        KieSession ksession = helper.build().newKieSession();

        ksession.insert(new Y());
        ksession.fireAllRules();
        ksession.insert(new Z());
        ksession.fireAllRules();
View Full Code Here

                      " $f : Foo( name == 'bar' ) " +
                      "then " +
                      " modify( $f ) { setAge( 99 ); } " +
                      "end ";

        KieHelper helper = new KieHelper();
        helper.addContent( str1, ResourceType.DRL );
        helper.addContent( str2, ResourceType.DRL );
        helper.addContent( str3, ResourceType.DRL );
        helper.addContent( str4, ResourceType.DRL );

        List<Message> msg = helper.verify().getMessages( Message.Level.ERROR );
        System.out.println( msg );
        assertEquals( 0, msg.size() );

        KieBase kieBase = helper.build();
        FactType type = kieBase.getFactType( "org.kie1", "Foo" );
        assertEquals( 2, type.getFields().size() );

        Object foo = null;
        try {
View Full Code Here

                     "  $i : Integer() " +
                     "  foo( $i, $x, $i ; ) " +
                     "then\n" +
                     "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        Results results = helper.verify();
        assertTrue( results.hasMessages( Message.Level.ERROR ) );
        assertEquals( 2, results.getMessages( Message.Level.ERROR ).size() );
    }
View Full Code Here

                     "  $i : Integer() " +
                     "  foo( $i ) " +   // missing ";" should result in 1 compilation error
                     "then\n" +
                     "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        Results results = helper.verify();
        assertTrue( results.hasMessages( Message.Level.ERROR ) );
        assertEquals( 1, results.getMessages( Message.Level.ERROR ).size() );
    }
View Full Code Here

                     "  $j : Integer() " +
                     "  foo( $i, $j ; ) " +
                    "then\n" +
                     "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        Results results = helper.verify();
        assertTrue( results.hasMessages( Message.Level.ERROR ) );
        assertEquals( 1, results.getMessages( Message.Level.ERROR ).size() );
    }
View Full Code Here

TOP

Related Classes of org.kie.internal.utils.KieHelper

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.