JoinPoint p1actionjp,
JoinPoint p2renderjp,
final NavigationalStateConfigurator configurator)
{
//
seq.bindAction(0, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Content is not cached
calls.add("0");
// Create invalidating action url for later use
url = response.createActionURL().toString();
// Refresh
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
//
seq.bindAction(1, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should not be called
calls.add("1");
return null;
}
});
seq.bindAction(1, p2renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Invalidate with action
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(2, p1actionjp, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
{
calls.add("2_action");
}
});
seq.bindAction(2, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should be called
calls.add("2_render");
// Refresh with different URL
PortletURL url = configurator.createPortletURL(response);
return new InvokeGetResponse(url.toString());
}
});
//
seq.bindAction(3, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should be called
calls.add("3");
// Invoke with same different URL
PortletURL url = configurator.createPortletURL(response);
return new InvokeGetResponse(url.toString());
}
});
//
seq.bindAction(4, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should not be called
calls.add("4");
return null;
}
});
seq.bindAction(4, p2renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Invalidate with action
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(5, p1actionjp, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
{
calls.add("5_action");
// Configure the navitional state
configurator.configureNavigationalState(response);
}
});
seq.bindAction(5, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should be called
calls.add("5_render");
// Refresh with different navigational state to check it will be called in the next render phase
PortletURL url = response.createRenderURL();
url.setPortletMode(PortletMode.VIEW);
url.setWindowState(WindowState.NORMAL);
return new InvokeGetResponse(url.toString());
}
});
//
seq.bindAction(6, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
Set expected = Tools.toSet("0", "2_action", "2_render", "3", "5_action", "5_render");
assertEquals(expected, calls);