[jboss-dev-forums] [QA of JBoss Portal] - Re: Portlet Container test framework update

julien@jboss.com do-not-reply at jboss.com
Wed Oct 24 17:40:41 EDT 2007


Another example of a more complex test case using the "method" style:

@TCK({5,6,8})
  | public class ExceptionsOnInit
  | {
  | 
  |    @JoinPoint(portletId=PortletExceptionDuringInitPortlet.NAME)
  |    public DriverResponse a(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       PortletExceptionDuringInitPortlet.rendered = true;
  |       return null;
  |    }
  | 
  |    @JoinPoint(portletId= RuntimeExceptionDuringInitPortlet.NAME)
  |    public DriverResponse b(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       PortletExceptionDuringInitPortlet.rendered = true;
  |       return null;
  |    }
  | 
  |    @JoinPoint(portletId= UnavailableExceptionDuringInitPortlet.NAME)
  |    public DriverResponse c(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       UnavailableExceptionDuringInitPortlet.rendered = true;
  |       return null;
  |    }
  | 
  |    @JoinPoint(portletId= UTP1.NAME)
  |    public DriverResponse d(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       return new InvokeGetResponse(response.createRenderURL().toString());
  |    }
  | 
  |    @JoinPoint(count=1, portletId=UTP1.NAME)
  |    public DriverResponse e(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       return new InvokeGetResponse(response.createRenderURL().toString());
  |    }
  | 
  |    @JoinPoint(count=2, portletId=UTP1.NAME)
  |    public DriverResponse f(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       //portlets shouldn't render itself
  |       assertEquals(false, PortletExceptionDuringInitPortlet.rendered);
  |       assertEquals(false, UnavailableExceptionDuringInitPortlet.rendered);
  |       assertEquals(false, RuntimeExceptionDuringInitPortlet.rendered);
  | 
  |       //and shouldn't be destroyed as Exceptions on init() were throwed
  |       assertEquals(false, PortletExceptionDuringInitPortlet.destroyed);
  |       assertEquals(false, UnavailableExceptionDuringInitPortlet.destroyed);
  |       assertEquals(false, RuntimeExceptionDuringInitPortlet.destroyed);
  | 
  |       //
  |       return new EndTestResponse();
  |    }
  | }


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

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



More information about the jboss-dev-forums mailing list