Examples of MockValueExpression


Examples of org.apache.myfaces.test.el.MockValueExpression

        beanInCustomScope.setName("beanInCustomScope");
        beanInCustomScope.setScope("#{scopeBean}");
        runtimeConfig.addManagedBean("beanInCustomScope", beanInCustomScope);
       
        // resolve the managed bean
        Object resolvedBeanInCustomScope = new MockValueExpression("#{beanInCustomScope}", List.class)
                                                   .getValue(facesContext.getELContext());
       
        // get the custom scope
        Map resolvedScopeBean = (Map) new MockValueExpression("#{scopeBean}", Map.class)
                                              .getValue(facesContext.getELContext());
       
        // the custom scope has to contain the resolved bean
        assertTrue(resolvedScopeBean.containsKey("beanInCustomScope"));
        assertTrue(resolvedScopeBean.get("beanInCustomScope").equals(resolvedBeanInCustomScope));
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

        runtimeConfig.addManagedBean("beanInCustomScope", beanInCustomScope);
       
        // resolve the managed bean
        try
        {
            new MockValueExpression("#{beanInCustomScope}", List.class)
                    .getValue(facesContext.getELContext());
        }
        catch (FacesException fe)
        {
            // the message must contain ...
            final String message = fe.getMessage();
            // ... the expression string
            assertTrue(message.contains(beanInCustomScope.getManagedBeanScope()));
            Object resolvedScopeBean = new MockValueExpression("#{scopeBean}", List.class)
                                               .getValue(facesContext.getELContext());
            // ... the toString() of the value
            assertTrue(message.contains(resolvedScopeBean.toString()));
            // ... and the type of the value
            assertTrue(message.contains(resolvedScopeBean.getClass().getName()));
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

        runtimeConfig.addManagedBean("m2", m2);
       
        // try to resolve m1
        try
        {
            new MockValueExpression("#{m1}", TestBean.class).getValue(facesContext.getELContext());
        }
        catch (ELException e)
        {
            // success
            return;
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

        beanInViewScope.setName("beanInViewScope");
        beanInViewScope.setScope("view");
        runtimeConfig.addManagedBean("beanInViewScope", beanInViewScope);
       
        // resolve the managed bean
        Object resolvedBeanInCustomScope = new MockValueExpression("#{beanInViewScope}", List.class)
                                                   .getValue(facesContext.getELContext());
       
        // get the view map
        Map<String, Object> viewMap = facesContext.getViewRoot().getViewMap();
       
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

        requestBean.setScope("request");
        runtimeConfig.addManagedBean("requestBean", requestBean);
       
        try
        {
            new MockValueExpression("#{sessionBean}", TestBean.class).getValue(facesContext.getELContext());
        }
        catch (FacesException e)
        {
            // success --> the ManagedBeanBuilder discovered the reference to a shorter lifetime
            return;
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

        requestBean.setScope("request");
        runtimeConfig.addManagedBean("requestBean", requestBean);
       
        try
        {
            new MockValueExpression("#{sessionBean}", TestBean.class).getValue(facesContext.getELContext());
        }
        catch (FacesException e)
        {
            // success --> the ManagedBeanBuilder discovered the reference to a shorter lifetime
            return;
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

        requestBean.setScope("request");
        runtimeConfig.addManagedBean("requestBean", requestBean);
       
        try
        {
            new MockValueExpression("#{viewBean}", TestBean.class).getValue(facesContext.getELContext());
        }
        catch (FacesException e)
        {
            // success --> the ManagedBeanBuilder discovered the reference to a shorter lifetime
            return;
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

            root.setViewId(_viewId);
            UIComponent metadataFacet = new UIPanel();
            root.getFacets().put(UIViewRoot.METADATA_FACET_NAME, metadataFacet);
            UIViewParameter viewparam = new UIViewParameter();
            viewparam.setName("myparam");
            viewparam.setValueExpression("value", new MockValueExpression("#{paramvalue}", String.class));
            metadataFacet.getChildren().add(viewparam);
            return root;
        }
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePOJOArray()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoArrayValue}", POJO[].class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof POJO[]);
        POJO[] array = (POJO[]) target;
View Full Code Here

Examples of org.apache.myfaces.test.el.MockValueExpression

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePOJOCollectionWithoutCollectionType()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoCollectionValue}", Collection.class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof Collection);
        Collection collection = (Collection) target;
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.