boolean actionInvoked;
public InvokeRenderAfterActionURL(PortletTestCase seq)
{
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
seq.bindAction(0, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
//pass action url
UTP2.holder = response.createActionURL().toString();
return null;
}
});
seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
//get portlet b action url and invoke
assertNotNull(UTP2.holder);
return new InvokeGetResponse((String)UTP2.holder);
}
});
seq.bindAction(2, UTP2.ACTION_JOIN_POINT, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context)
{
//mark action phase invokation
actionInvoked = true;
}
});
seq.bindAction(2, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
//assert that render is after Portlet B action
assertEquals(true, actionInvoked);
return null;
}
});
seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
//assert that render is after Portlet B action
assertEquals(true, actionInvoked);
//and reinvoke itself
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
return new EndTestResponse();
}