RE: NullPointerException in UIComponentBase decode using Shale test framework

2008-04-16 Thread Zhen, Jane
I figured that problem out, I needed to setRendererType, although just need to 
be null. Could anyone tell me why a component needs a null renderer?

I have a general question though. I am trying to create a view from a jsp page, 
normally you would do it in a backing bean in running environment where request 
and everything are set. All you need to do is to call ViewHandler.createView. 
But in shale framework, how would i set up everything in order to make it work? 
Is it even possible?
thanks
Jane


RE: NullPointerException in UIComponentBase decode using Shale test framework

2008-04-15 Thread Kito D. Mann
Jane,

Can you give us a full stack trace (not sure which line threw the exception)
and the snippet of code where you initialize the components that you're
testing? I'm guessing that you just didn't initialize the components
properly -- Shale Test leaves that all up to the developer.

~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
phone: +1 203-653-2989
fax: +1 203-653-2988


> -Original Message-
> From: Zhen, Jane [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 15, 2008 9:22 AM
> To: user@shale.apache.org
> Subject: NullPointerException in UIComponentBase decode using Shale
> test framework
> 
> I simply created a Form and inside an inputTextField and tried to do
> decoding. But I got a java.lang.NullPointerException
> 
> at
> javax.faces.component.UIComponentBase.decode(UIComponentBase.java:685)
> 
> at javax.faces.component.UIInput.decode(UIInput.java:484)
> 
> at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.ja
> va:905)
> 
> at javax.faces.component.UIInput.processDecodes(UIInput.java:400)
> 
> at
> com.hp.ed.configui.credential.CredentialBeanTest.testLabelUpdate(Creden
> tialBeanTest.java:70)
> 
> 
> 
> This has happened before, but I couldn't find an answer for that. I'm
> just giving it another try, as Shale test framework is really not well
> documented.
> 
> 
> 
> <>
> 
> UIViewRoot root=facesContext.getViewRoot();
> 
> List children = root.getChildren();
> 
> UIForm credForm = new HtmlForm();
> 
> credForm.setId("credForm");
> 
> credForm.setParent(root);
> 
> 
> 
> UIInput label = new HtmlInputText();
> 
> label.setId("label");
> 
> label.setParent(credForm);
> 
> ValueBinding vb =
> facesContext.getApplication().createValueBinding("#{credentialBean.pass
> wordAgain}");
> 
> label.setValueBinding("value", vb);
> 
> 
> 
> facesContext.getExternalContext().getRequestMap().put("credentialBean",
> vc);
> 
> facesContext.getExternalContext().getRequestParameterMap().put("credFor
> m.label","myLabel");
> 
> label.processDecodes(facesContext);  //if I don't call
> label.processDecodes, but root.processDecodes, then I don't get the
> exception, however, the submittedValue of inputText is null.
> 
> 
> 
> thanks for any help
> 
> 
> 
> Jane