Package org.kie.runtime

Examples of org.kie.runtime.StatelessKieSession


        assertEquals(2, counterFromListener);
    }

    @Test
    public void testStatelessAgendaEventListener() throws Exception {
        StatelessKieSession StatelessKieSession = (StatelessKieSession) context.getBean("statelessSession");
        assertEquals(1, StatelessKieSession.getAgendaEventListeners().size());
        assertTrue(StatelessKieSession.getAgendaEventListeners().toArray()[0] instanceof MockAgendaEventListener);
    }
View Full Code Here


        assertTrue(StatelessKieSession.getAgendaEventListeners().toArray()[0] instanceof MockAgendaEventListener);
    }

    @Test
    public void testStatelessProcessEventListener() throws Exception {
        StatelessKieSession kstateless = (StatelessKieSession) context.getBean("statelessSession");
        assertEquals(1, kstateless.getProcessEventListeners().size());
        assertTrue(kstateless.getProcessEventListeners().toArray()[0] instanceof MockProcessEventListener);
    }
View Full Code Here

        assertTrue(kstateless.getProcessEventListeners().toArray()[0] instanceof MockProcessEventListener);
    }

    @Test
    public void testStatelessWMEventListener() throws Exception {
        StatelessKieSession kstateless = (StatelessKieSession) context.getBean("statelessSession");
        assertEquals(1, kstateless.getWorkingMemoryEventListeners().size());
        assertTrue(kstateless.getWorkingMemoryEventListeners().toArray()[0] instanceof MockWorkingMemoryEventListener);

        kstateless.setGlobal("list", list);
        kstateless.execute(new Person());
        //this assert to show that our listener was called X number of times.
        // once from agenda listener, and second from working memory event listener
        assertEquals(2, counterFromListener);
    }
View Full Code Here

    }

    //stateless
    @Test
    public void testStatelessWithNestedBean() throws Exception {
        StatelessKieSession StatelessKieSession = (StatelessKieSession) context.getBean("statelessWithNestedBean");
        assertEquals(1, StatelessKieSession.getWorkingMemoryEventListeners().size());

        StatelessKieSession.setGlobal("list", list);
        StatelessKieSession.execute(new Person());
        //this assert to show that our listener was called X number of times.
        assertEquals(1, counterFromListener);
    }
View Full Code Here

        assertEquals(1, counterFromListener);
    }

    @Test
    public void testStatelessWithRef() throws Exception {
        StatelessKieSession StatelessKieSession = (StatelessKieSession) context.getBean("statelessWithRef");
        assertEquals(1, StatelessKieSession.getWorkingMemoryEventListeners().size());

        StatelessKieSession.setGlobal("list", list);
        StatelessKieSession.execute(new Person());
        //this assert to show that our listener was called X number of times.
        assertEquals(1, counterFromListener);
    }
View Full Code Here

        assertEquals(1, counterFromListener);
    }

    @Test
    public void testStatelessWithMultipleSameType() throws Exception {
        StatelessKieSession StatelessKieSession = (StatelessKieSession) context.getBean("statelessWithMultipleSameType");
        assertEquals(2, StatelessKieSession.getWorkingMemoryEventListeners().size());

        StatelessKieSession.setGlobal("list", list);
        StatelessKieSession.execute(new Person());
        // this assert to show that our listener was called X number of times.
        // two working memory listeners were added!
        assertEquals(2, counterFromListener);
    }
View Full Code Here

        assertEquals(2, counterFromListener);
    }

    @Test
    public void testStatelessWithDefault() throws Exception {
        StatelessKieSession StatelessKieSession = (StatelessKieSession) context.getBean("statelessWithDefault");
        assertEquals(1, StatelessKieSession.getWorkingMemoryEventListeners().size());
        assertTrue(StatelessKieSession.getWorkingMemoryEventListeners().toArray()[0] instanceof DebugWorkingMemoryEventListener);
    }
View Full Code Here

        assertTrue(StatelessKieSession.getWorkingMemoryEventListeners().toArray()[0] instanceof DebugWorkingMemoryEventListener);
    }

    @Test
    public void testStatelessWithGroupedListeners() throws Exception {
        StatelessKieSession StatelessKieSession = (StatelessKieSession) context.getBean("statelessWithGroupedListeners");
        assertEquals(1, StatelessKieSession.getWorkingMemoryEventListeners().size());

        StatelessKieSession.setGlobal("list", list);
        StatelessKieSession.execute(new Person());
        // this assert to show that our listener was called X number of times.
        // once from agenda listener, and second from working memory event listener
        assertEquals(2, counterFromListener);
    }
View Full Code Here

    @Test
    public void testNoNodeKSessions() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/drools/container/spring/no-node-beans.xml");

        List<String> list = new ArrayList<String>();
        StatelessKieSession kstateless = (StatelessKieSession) context.getBean( "ksession1" );
        kstateless.setGlobal( "list",
                              list );
        kstateless.execute( new Person( "Darth",
                                        "Cheddar",
                                        50 ) );
        assertEquals( 1,
                      list.size() );
View Full Code Here

    @Test
    public void testSimpleKSessions() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/drools/container/spring/beans.xml");

        List<String> list = new ArrayList<String>();
        StatelessKieSession kstateless = (StatelessKieSession) context.getBean( "ksession1" );
        kstateless.setGlobal( "list",
                              list );
        kstateless.execute( new Person( "Darth",
                                        "Cheddar",
                                        50 ) );
        assertEquals( 2,
                      list.size() );
View Full Code Here

TOP

Related Classes of org.kie.runtime.StatelessKieSession

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.