Examples of MockValueExpression


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

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePOJOCollectionWithCollectionType()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoCollectionValue}", Collection.class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        uiSelectMany.getAttributes().put("collectionType", "java.util.HashSet");
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof HashSet);
View Full Code Here

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

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValueNoConverter()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoArrayValue}", POJO[].class);
        uiSelectMany.setValueExpression("value", expr);
        try
        {
            _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
            fail();
View Full Code Here

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

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValueWrongCollectionType()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoCollectionValue}", Collection.class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        uiSelectMany.getAttributes().put("collectionType", "java.util.Collection");
        try
        {
View Full Code Here

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

        value.add("#3");
       
        UISelectItems selectItems = new UISelectItems();
        selectItems.setValue(value);
        selectItems.getAttributes().put("var", "item");
        ValueExpression itemValue = new MockValueExpression("#{item}", Object.class);
        selectItems.setValueExpression("itemValue" , itemValue);
       
        UISelectOne selectOne = new UISelectOne();
        selectOne.getChildren().add(selectItems);
       
View Full Code Here

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

        value[2] = 3;
       
        UISelectItems selectItems = new UISelectItems();
        selectItems.setValue(value);
        selectItems.getAttributes().put("var", "item");
        ValueExpression itemValue = new MockValueExpression("#{item}", Object.class);
        selectItems.setValueExpression("itemValue" , itemValue);
       
        UISelectOne selectOne = new UISelectOne();
        selectOne.getChildren().add(selectItems);
       
View Full Code Here

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

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

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

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

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

            }
        };
       
        inputText.setConverter(converter);
       
        ValueExpression expression = new MockValueExpression("#{requestScope.someDefaultValueOnBean}",String.class);
        expression.setValue(facesContext.getELContext(), "defaultValue");
        inputText.setValueExpression("value", expression);
       
        // 1) user enters an empty string in an input-component: ""
        //Call to setSubmittedValue on HtmlRendererUtils.decodeUIInput(facesContext, component),
        //that is called from renderer decode()
        externalContext.addRequestParameterMap(inputText.getClientId(facesContext), "");
       
        inputText.decode(facesContext);
       
        // 2) conversion and validation phase: "" --> setValue(null);
        // isLocalValueSet = true; setSubmittedValue(null);
        inputText.validate(facesContext);
       
        // 3) validation fails in some component on the page --> update model
        // phase is skipped
        // No OP
       
        // 4) renderer calls getValue(); --> getValue() evaluates the
        // value-binding, as the local-value is 'null', and I get the
        // default-value of the bean shown again
        assertNotSame(expression.getValue(facesContext.getELContext()), inputText.getValue());
        assertNull(inputText.getValue());
    }
View Full Code Here

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

   * Test method for {@link org.richfaces.taglib.PanelTag#setProperties(javax.faces.component.UIComponent)}.
   * @throws JspException
   */
  public void testSetPropertiesUIComponent() throws JspException {
    HtmlPanel panel = new HtmlPanel();
    panelTag.setBodyClass(new MockValueExpression("panel", String.class));
    panelTag.setHeaderClass(new MockValueExpression("headClass", String.class));
    panelTag.setProperties(panel);
    assertEquals("panel", panel.getBodyClass());
    assertEquals("headClass", panel.getHeaderClass());
  }
View Full Code Here

Examples of org.araneaframework.uilib.widgets.lists.tests.mock.MockValueExpression

  private Value tm;

  public void setUp() {
    this.resolver = new MockVariableResolver();
   
    this.tom = new MockValueExpression("Tom");
    this.jerry = new MockValueExpression("Jerry");
    this.om = new MockValueExpression("om");
    this.tm = new MockValueExpression("t.m");
  }
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.