[jboss-user] [JBoss Seam] - page parameters broken in integration tests?

matt.drees do-not-reply at jboss.com
Tue Apr 10 16:29:05 EDT 2007


I think that page parameters do not work in integration tests.

I have the following test:

ItemTest.java

  | public class ItemTest extends SeamTest {
  | 
  | 	@Test
  | 	public void testRequestParameterAnnotation() throws Exception {
  | 		new NonFacesRequest("/item.xhtml") {
  | 
  | 			@Override
  | 			protected void beforeRequest() {
  | 				setParameter("itemId", "1");
  | 			}
  | 
  | 			@Override
  | 			protected void renderResponse() throws Exception {
  | 				checkItemRetrieval(getValue("#{itemHome}"));
  | 			}
  | 		}.run();
  | 	}
  | 	
  | 	@Test
  | 	public void testPageParameter() throws Exception {
  | 		new NonFacesRequest("/item.xhtml") {
  | 
  | 			@Override
  | 			protected void beforeRequest() {
  | 				setParameter("id", "1");
  | 			}
  | 
  | 			@Override
  | 			protected void renderResponse() throws Exception {
  | 				checkItemRetrieval(getValue("#{itemHome}"));
  | 			}
  | 		}.run();
  | 	}
  | 
  | 	private void checkItemRetrieval(Object object) {
  | 		ItemHome itemHome = (ItemHome) object;
  | 		assert itemHome.getInstance().getId() != null;
  | 	}
  | }
  | 

ItemHome.java

  | 
  | @Name("itemHome")
  | public class ItemHome extends EntityHome<Item>
  | {
  | 
  |     @RequestParameter 
  |     Long itemId;
  |     
  |     @Override
  |     public Object getId() 
  |     { 
  |         if (itemId==null)
  |         {
  |             return super.getId();
  |         }
  |         else
  |         {
  |             return itemId;
  |         }
  |     }
  | }
  | 

pages.xml

  | <page view-id="/item.xhtml">
  |   <param name="id" 
  |     value="#{itemHome.id}" 
  |     converterId="javax.faces.Long"/>
  | </page>
  | 

The first test passes, but the second one fails.  Am I doing this correctly?
If so, I'll open a jira issue.  
I'm using cvs HEAD.
Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036121#4036121

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036121



More information about the jboss-user mailing list