Examples of EasyBeansSFSBLifeCycle


Examples of org.ow2.easybeans.api.bean.lifecycle.EasyBeansSFSBLifeCycle

    /**
     * Test the stateful bean callbacks.
     */
    @Test
    public void testStatefulBeanCallbacks() {
        EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();

        int internalCounter = 0;
        assertEquals(internalCounter++, statefulBean.getCounter());
        if (statefulBean instanceof EasyBeansSFSBLifeCycle) {
            lifeCycle = (EasyBeansSFSBLifeCycle) statefulBean;
        }

        // postConstruct should increment the counter
        lifeCycle.postConstructEasyBeansLifeCycle();
        assertEquals(internalCounter++, statefulBean.getCounter());

        // preDestroy should increment counter
        lifeCycle.preDestroyEasyBeansLifeCycle();
        assertEquals(internalCounter++, statefulBean.getCounter());

        // prePassivate should increment counter
        lifeCycle.prePassivateEasyBeansLifeCycle();
        assertEquals(internalCounter++, statefulBean.getCounter());

        // postActivate should increment counter
        lifeCycle.postActivateEasyBeansLifeCycle();
        assertEquals(internalCounter++, statefulBean.getCounter());

    }
View Full Code Here

Examples of org.ow2.easybeans.api.bean.lifecycle.EasyBeansSFSBLifeCycle

     * Test the postConstruct on stateful bean.
     */
    @Test
    public void testStatefulPostConstruct() {
        assertFalse(statefulBean.isPostConstructCalled());
        EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();
        lifeCycle.postConstructEasyBeansLifeCycle();
        assertTrue(statefulBean.isPostConstructCalled());
    }
View Full Code Here

Examples of org.ow2.easybeans.api.bean.lifecycle.EasyBeansSFSBLifeCycle

     * Test the preDestroy on stateful bean.
     */
    @Test
    public void testStatefulPreDestroy() {
        assertFalse(statefulBean.isPreDestroyCalled());
        EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();
        lifeCycle.preDestroyEasyBeansLifeCycle();
        assertTrue(statefulBean.isPreDestroyCalled());
    }
View Full Code Here

Examples of org.ow2.easybeans.api.bean.lifecycle.EasyBeansSFSBLifeCycle

     * Test the prePassivate on stateful bean.
     */
    @Test
    public void testStatefulPrePassivate() {
        assertFalse(statefulBean.isprePassivateCalled());
        EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();
        lifeCycle.prePassivateEasyBeansLifeCycle();
        assertTrue(statefulBean.isprePassivateCalled());
    }
View Full Code Here

Examples of org.ow2.easybeans.api.bean.lifecycle.EasyBeansSFSBLifeCycle

     * Test the PostActivate on stateful bean.
     */
    @Test
    public void testStatefulPostActivate() {
        assertFalse(statefulBean.isPostActivateCalled());
        EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();
        lifeCycle.postActivateEasyBeansLifeCycle();
        assertTrue(statefulBean.isPostActivateCalled());
    }
View Full Code Here

Examples of org.ow2.easybeans.api.bean.lifecycle.EasyBeansSFSBLifeCycle

    @Test
    public void testInheritanceBeanLifeCycleStateful() {
        assertEquals(0, statefulBean.getCounter());
        assertEquals(0, statefulBean.getSuperLifeCycleCounter());

        EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();

        // postActivate should increment the counter
        lifeCycle.postActivateEasyBeansLifeCycle();
        assertEquals(1, statefulBean.getCounter());
        // and the counter of the super class
        assertEquals(1, statefulBean.getSuperLifeCycleCounter());

        // increment counter of default class
        lifeCycle.prePassivateEasyBeansLifeCycle();
        assertEquals(2, statefulBean.getCounter());
        // prePassivate should decrement the counter
        assertEquals(0, statefulBean.getSuperLifeCycleCounter());
    }
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.