Package com.sun.faces.mgbean

Examples of com.sun.faces.mgbean.BeanManager


                                                   "session",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        assertTrue(testBean.getOne().equals("one"));

        //make sure scope is stored properly
        BeanBuilder builder = beanManager.getBuilder(beanName);
        assertTrue(builder.getScope() == ELUtils.Scope.SESSION);
    }
View Full Code Here


                                                   "session",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        assertTrue(testBean.getBoolProp() == testBoolean);
        assertTrue(testBean.getByteProp() == testByte);
        assertTrue(testBean.getCharProp() == testChar);
        assertTrue(testBean.getDoubleProp() == testDouble);
        assertTrue(testBean.getFloatProp() == testFloat);
        assertTrue(testBean.getIntProp() == testInt);
        assertTrue(testBean.getLongProp() == testLong);
        assertTrue(testBean.getShortProp() == testShort);

        //make sure scope is stored properly
        BeanBuilder builder = beanManager.getBuilder(beanName);
        assertTrue(builder.getScope() == ELUtils.Scope.SESSION);
    }
View Full Code Here

                                                   "session",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));
                
        assertTrue(testBean.getByteProp() == 0);
        assertTrue(testBean.getCharProp() == 0);
        assertTrue(testBean.getDoubleProp() == 0);
View Full Code Here

                                                   "request",
                                                   null,
                                                   null,
                                                   properties,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        ArrayList props = (ArrayList) testBean.getIndexProperties();
        assertTrue(props.get(5).equals("foo"));
        assertTrue(props.get(6).equals("bar"));

        // setter shouldn't be called if bean getter returns List
        assertTrue(!testBean.getListSetterCalled());

        // setter should be called if bean getter returned null
        assertTrue(testBean.getListNullSetterCalled());

        //make sure scope is stored properly
        BeanBuilder builder = beanManager.getBuilder(beanName);
        assertTrue(builder.getScope() == ELUtils.Scope.REQUEST);
    }
View Full Code Here

                                                   null,
                                                   properties,
                                                   null);


        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        HashMap mapProperty = (HashMap)
            testBean.getMapProperty();
        assertTrue(((String) mapProperty.get("name")).equals("Justyna"));

        // setter shouldn't be called if bean getter returns Map
        assertTrue(!testBean.getMapPropertySetterCalled());

        // setter should be called if bean getter returned null
        assertTrue(testBean.getMapPropertyNullSetterCalled());

        //make sure scope is stored properly
        BeanBuilder builder = beanManager.getBuilder(beanName);
        assertTrue(builder.getScope() == ELUtils.Scope.REQUEST);
    }
View Full Code Here

                                                   "session",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        ArrayList properties = (ArrayList) testBean.getIndexIntegerProperties();
        assertTrue(properties.get(1) instanceof Integer);
View Full Code Here

                                                   null,
                                                   properties,
                                                   null);


        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        HashMap mapProperty = (HashMap)
            testBean.getMapProperty();
View Full Code Here

                                                   "session",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        assertTrue(testBean.getOne().equals("one"));
View Full Code Here

                                                   "session",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);

        //testing with a property set
        assertNotNull(testBean = (TestBean) beanManager.create(beanName,
                                                               getFacesContext()));

        //make sure bean instantiated properly. Get property back from bean.
        assertTrue(testBean.getOne().equals("one"));


        //testing with:
        //  valueref in request scope
        //  managed bean in application scope
        getFacesContext().getExternalContext().getApplicationMap()
             .remove("TestRefBean");
        getFacesContext().getExternalContext().getRequestMap().put(
            "TestRefBean", testBean);

        bean = new ManagedBeanInfo(beanName,
                                   beanName,
                                   "application",
                                   null,
                                   null,
                                   list,
                                   null);
        beanManager.register(bean);

        exceptionThrown = false;
        try {
            //testing with a property set
            beanManager.create(beanName, getFacesContext());
            fail("Should have thrown FacesException");
        } catch (FacesException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);

        //cleanup
        getFacesContext().getExternalContext().getRequestMap().remove(
            "TestRefBean");

        //testing with:
        //  valueref in session scope
        //  managed bean in no scope
        getFacesContext().getExternalContext().getSessionMap().put(
            "TestRefBean", testBean);

       bean = new ManagedBeanInfo(beanName,
                                   beanName,
                                   "none",
                                   null,
                                   null,
                                   list,
                                   null);
        beanManager.register(bean);

        exceptionThrown = false;
        try {
            beanManager.create(beanName, getFacesContext());
            fail("Should have thrown FacesException");
        } catch (FacesException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
View Full Code Here

                                                   "none",
                                                   null,
                                                   null,
                                                   list,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);


        exceptionThrown = false;
        try {
            beanManager.create(beanName, getFacesContext());
            fail("Should have thrown FacesException");
        } catch (FacesException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
View Full Code Here

TOP

Related Classes of com.sun.faces.mgbean.BeanManager

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.