// Should be called
calls.add("0");
// Refresh
url = response.createRenderURL().toString();
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(1, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should be called
calls.add("1");
response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
// Refresh
return new InvokeGetResponse(url);
}
});
//
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");
response.setProperty(RenderResponse.EXPIRATION_CACHE, "5");
response.setProperty(RenderResponse.ETAG, "xyz");
// Refresh
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(3, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should not be called
calls.add("3");
return null;
}
});
seq.bindAction(3, p2renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Refresh
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(4, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Could be called or not depending on the page rendering ordre
return null;
}
});
seq.bindAction(4, p2renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
try
{
// Wait 5 seconds for the cache entry to be invalid
Thread.sleep(5 * 1000);
// Refresh
return new InvokeGetResponse(url);
}
catch (InterruptedException e)
{
return new FailureResponse(Failure.createFailure(e));
}
}
});
//
seq.bindAction(5, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
assertEquals("xyz", request.getETag());
assertTrue(Tools.toSet(request.getPropertyNames()).contains(RenderRequest.ETAG));
assertEquals("xyz", request.getProperty(RenderRequest.ETAG));
// Record we were called
calls.add("5");
// Revalidate existing content
response.setProperty(RenderResponse.EXPIRATION_CACHE, "5");
response.setProperty(RenderResponse.USE_CACHED_CONTENT, "foo");
//
url = response.createRenderURL().toString();
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(6, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should not be called
calls.add("6");
return null;
}
});
seq.bindAction(6, p2renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Refresh
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(7, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Could be called or not depending on the page rendering ordre
return null;
}
});
seq.bindAction(7, p2renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
try
{
// Wait 5 seconds for the cache entry to be invalid
Thread.sleep(5 * 1000);
// Refresh
return new InvokeGetResponse(url);
}
catch (InterruptedException e)
{
return new FailureResponse(Failure.createFailure(e));
}
}
});
//
seq.bindAction(8, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
assertEquals("xyz", request.getETag());
assertTrue(Tools.toSet(request.getPropertyNames()).contains(RenderRequest.ETAG));
assertEquals("xyz", request.getProperty(RenderRequest.ETAG));
// Record we were called
calls.add("8");
url = response.createActionURL().toString();
return new InvokeGetResponse(url);
}
});
//
seq.bindAction(9, p1actionjp, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
{
// Should be called
calls.add("9_action");
}
});
seq.bindAction(9, p1renderjp, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
// Should be called
calls.add("9_render");
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
//
seq.bindAction(10, p1renderjp, new PortletRenderTestAction()