{
return new InvokeGetResponse(response.createActionURL().toString());
}
});
seq.bindAction(1, UTP4.ACTION_JOIN_POINT, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws ReadOnlyException, IOException, ValidatorException
{
// Get prefs
PortletPreferences prefs = request.getPreferences();
// Test the initial values does not exist
assertEquals("other", prefs.getValue("single_pref", "other"));
assertEquals(new String[]{"other"}, prefs.getValues("multi_pref", new String[]{"other"}));
// Set with new values
prefs.setValue("single_pref", "new_single_pref");
prefs.setValues("multi_pref", new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
// Test the values are good
assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
// Trigger store
prefs.store();
// Test the value are good after store
assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
}
});
seq.bindAction(1, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
return new InvokeGetResponse(response.createActionURL().toString());
}
});
seq.bindAction(2, UTP4.ACTION_JOIN_POINT, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws ReadOnlyException, IOException, ValidatorException
{
// Get prefs
PortletPreferences prefs = request.getPreferences();
// Test the values have been store in the persistent store
assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
// Reset
prefs.reset("single_pref");
prefs.reset("multi_pref");
// Test does not exist
assertEquals("other", prefs.getValue("single_pref", "other"));
assertEquals(new String[]{"other"}, prefs.getValues("multi_pref", new String[]{"other"}));
// Trigger store
prefs.store();
// Test does not exist after store
assertEquals("other", prefs.getValue("single_pref", "other"));
assertEquals(new String[]{"other"}, prefs.getValues("multi_pref", new String[]{"other"}));
}
});
seq.bindAction(2, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
return new InvokeGetResponse(response.createActionURL().toString());
}
});
seq.bindAction(3, UTP4.ACTION_JOIN_POINT, new PortletActionTestAction()
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context)
{
// Get prefs
PortletPreferences prefs = request.getPreferences();