You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Mohan Radhakrishnan <ra...@gmail.com> on 2007/10/11 15:31:07 UTC

Shale test framework - Update model bean

Hi,
      I am trying to user the shale test framework to test model updates.
Now the code is like this but it doesn't work. Does anyone know how the code
should be ?

        UIViewRoot root = facesContext.getViewRoot();
        assertNotNull(root);
        UIComponent form1 = this.createForm("form1", root);
        HtmlInputText component = createInputText("pin", form1);
        ValueBinding valueBinding = facesContext.getApplication().
        					createValueBinding( "pin.currentPin");
        component.setValueBinding( "value", valueBinding );
        component.setSubmittedValue("blue");
        facesContext.
        	getExternalContext().
        		getRequestMap().
        			put( "pin", new Pin());
        facesContext.
        	getExternalContext().
        		getRequestParameterMap().
        			put( "form1:currentPin", "blue" );
        Pin pin = ( Pin )facesContext.
        				getApplication().
        					getVariableResolver().
        						resolveVariable(facesContext, "pin" );
        assertNotNull( pin.getCurrentPin() );


Thanks,
Mohan

-- 
View this message in context: http://www.nabble.com/Shale-test-framework---Update-model-bean-tf4607288.html#a13155918
Sent from the Shale - User mailing list archive at Nabble.com.


Re: Shale test framework - Update model bean

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Yes. I did that too. Actually if I use        
root.processDecodes(facesContext); 
 I get this exception.

Actually I am trying to run all the phases including Apply Request Values
phase( Create form etc. ). The idea is to finally get
the value in the managed bean.

1)
testSetUpDataBean(com.test.mock.PinValidatorTestCase)java.lang.NullPointerException
	at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:707)
	at javax.faces.component.UIForm.processDecodes(UIForm.java:128)
	at
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:922)
	at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:341)
	at
com.test.mock.PinValidatorTestCase.testSetUpDataBean(PinValidatorTestCase.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
	at com.test.mock.PinValidatorTestCase.main(PinValidatorTestCase.java:154)

Thanks,
Mohan
-- 
View this message in context: http://www.nabble.com/Shale-test-framework---Update-model-bean-tf4607288.html#a13157454
Sent from the Shale - User mailing list archive at Nabble.com.