Package org.kie.api

Examples of org.kie.api.KieBase


    private KieSession ksession;

    @Before
    public void setup() {
        KieBase kbase = new KieHelper().addFromClassPath(DRL_FILE).build();
        this.ksession = kbase.newKieSession();
    }
View Full Code Here


    /**
     * Performs the actual test on given KieSession.
     */
    private void performTest(final KieSession ksession) throws Exception {
        final KieBase kbase = ksession.getKieBase();

        // fact types
        FactType manType = kbase.getFactType(PACKAGE, "Man");
        FactType womanType = kbase.getFactType(PACKAGE, "Woman");
        FactType parentType = kbase.getFactType(PACKAGE, "Parent");

        // ksession.addEventListener(arg0)

        // create working memory objects
        List<Command<?>> commands = new ArrayList<Command<?>>();
View Full Code Here

        Resource jarRes = ks.getResources().newByteArrayResource( jar );
        KieModule km = ks.getRepository().addKieModule( jarRes );
        KieContainer kc = ks.newKieContainer( km.getReleaseId() );
       
        KieBase kbase = kc.getKieBase();
        FactType type = kbase.getFactType( "org.drools.compiler", "X" );
        FactField foo = type.getField( "foo" );
        Object x = type.newInstance();
        foo.set( x, "Hello World" );
       
        KieSession ksession = kc.newKieSession();
View Full Code Here

        ks.getRepository().addKieModule(builder.getKieModule());

        KieSession kieSession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession(KSESSION_NAME);
        assertNotNull(kieSession);

        KieBase kieBase = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).getKieBase(KBASE_NAME);
        assertNotNull(kieBase);
    }
View Full Code Here

    @Test(timeout = 20000 )
    public void testWaltz() {
        try {
            //load up the rulebase
            final KieBase kBase = readKnowledegBase();
            for ( int i = 0; i < 50; i++ ) {
                KieSession kSession = kBase.newKieSession();
   
    //            workingMemory.setGlobal( "sysout",
    //                                     System.out );
   
                //            DebugWorkingMemoryEventListener wmListener = new DebugWorkingMemoryEventListener();
View Full Code Here

   
    @Test
    public void testCollect() throws Exception {
        List results = new ArrayList();

        KieBase kbase = loadKnowledgeBase("test_Collect.drl");
        StatefulKnowledgeSession wm = createKnowledgeSession((KnowledgeBase) kbase);

        wm.setGlobal( "results",
                      results );
View Full Code Here

                             results.get( 0 ).getClass().getName() );
    }

    @Test
    public void testCollectNodeSharing() throws Exception {
        KieBase kbase = loadKnowledgeBase("test_collectNodeSharing.drl");
        StatefulKnowledgeSession wm = createKnowledgeSession((KnowledgeBase) kbase);

        List results = new ArrayList();
        wm.setGlobal( "results",
                                 results );
View Full Code Here

                      ((List) results.get( 0 )).size() );
    }

    @Test
    public void testCollectModify() throws Exception {
        KieBase kbase = loadKnowledgeBase("test_Collect.drl");
        StatefulKnowledgeSession wm = createKnowledgeSession((KnowledgeBase) kbase);

        List results = new ArrayList();

        wm.setGlobal( "results",
View Full Code Here

                             results.size() );
    }

    @Test
    public void testCollectResultConstraints() throws Exception {
        KieBase kbase = loadKnowledgeBase("test_CollectResultConstraints.drl");
        StatefulKnowledgeSession wm = createKnowledgeSession((KnowledgeBase) kbase);
        List results = new ArrayList();

        wm.setGlobal( "results",
                      results );
View Full Code Here

                      results.get( 0 ).getClass().getName() );
    }

    @Test
    public void testExistsWithBinding() throws Exception {
        KieBase kbase = loadKnowledgeBase("test_ExistsWithBindings.drl");
        StatefulKnowledgeSession wm = createKnowledgeSession((KnowledgeBase) kbase);

        final List list = new ArrayList();
        wm.setGlobal( "results",
                                 list );
View Full Code Here

TOP

Related Classes of org.kie.api.KieBase

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.