Package org.kie.internal.utils

Examples of org.kie.internal.utils.KieHelper.addContent()


                     "when " +
                     "  String() @Outer( values = { @Inner( text = \"hello\" ), @Inner( text = \"world\" ) } ) " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );
        assertEquals( 0, helper.verify().getMessages().size() );

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        Map<String,AnnotationDefinition> defs = p.getAnnotations();
        assertEquals( 1, defs.size() );
View Full Code Here


                     "when " +
                     "  String() @Simple( numbers = { 1, 2, 3 } ) " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        Map<String,AnnotationDefinition> defs = p.getAnnotations();
        assertEquals( 1, defs.size() );
View Full Code Here

                     "@Inner( text=\"a\", test=\"b\" ) " +
                     "when " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        Rule rule = helper.build().getRule( "org.drools.test", "Foo" );
        assertTrue( rule.getMetaData().containsKey( Inner.class.getName().replace( "$", "." ) ) );

        Object obj = rule.getMetaData().get( Inner.class.getName().replace( "$", "." ) );
View Full Code Here

                     "when " +
                     "  String() @Outer( missing = 3 ) " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        assertEquals( 1, helper.verify().getMessages( Message.Level.ERROR ).size() );
    }

    @Test
View Full Code Here

                     "when " +
                     "  String() @Outer( klass = Foo.class ) " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        assertEquals( 1, helper.verify().getMessages( Message.Level.ERROR ).size() );
    }

    @Test
View Full Code Here

                     "when " +
                     "  String() @Outer( klass = String.class, klasses = { String.class, Integer.class } ) " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        AnnotationDefinition adef = p.getAnnotations().get( Outer.class.getName().replace( "$", "." ) );

        assertEquals( String.class, adef.getPropertyValue( "klass" ) );
View Full Code Here

                     "when " +
                     "  String() @Outer( value = @Inner( text = \"world\" ) ) " +
                     "then " +
                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        Map<String,AnnotationDefinition> defs = p.getAnnotations();
        assertEquals( 1, defs.size() );
View Full Code Here

                     "      System.out.println( 'At 2' ); " +
                     "      update( $thing2 ); " +
                     "end";

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

        session.insert( "hello" );
        session.insert( new Integer( 42 ) );
View Full Code Here

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

                "    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

TOP
Copyright © 2018 www.massapi.com. 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.