use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestPageAction method testTrashPage.
public void testTrashPage() throws Throwable {
String result = this.executeTrashPage(this._pageManager.getDraftRoot().getCode(), "admin");
assertEquals("pageTree", result);
ActionSupport action = this.getAction();
assertEquals(1, action.getActionErrors().size());
result = this.executeTrashPage("pagina_1", "admin");
assertEquals("pageTree", result);
action = this.getAction();
assertEquals(1, action.getActionErrors().size());
result = this.executeTrashPage("pagina_12", "admin");
assertEquals(Action.SUCCESS, result);
action = this.getAction();
assertEquals(0, action.getActionErrors().size());
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestWidgetTypeAction method testTrashType.
public void testTrashType() throws Throwable {
String pageCode = "pagina_1";
int frame = 1;
String widgetTypeCode = "test_widgetType_trash3";
try {
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
WidgetType type = this.createNewWidgetType(widgetTypeCode);
this._widgetTypeManager.addWidgetType(type);
assertNotNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
IPage pagina_1 = this._pageManager.getDraftPage(pageCode);
assertNull(pagina_1.getWidgets()[frame]);
String result = this.executeJoinWidget(pageCode, frame, widgetTypeCode, "admin");
assertEquals(Action.SUCCESS, result);
pagina_1 = this._pageManager.getDraftPage(pageCode);
assertNotNull(pagina_1.getWidgets()[frame]);
result = this.executeTrash(widgetTypeCode, "admin");
assertEquals("inputWidgetTypes", result);
ActionSupport action = this.getAction();
assertEquals(1, action.getActionErrors().size());
result = this.executeDeleteWidgetFromPage(pageCode, frame, "admin");
assertEquals(Action.SUCCESS, result);
result = this.executeTrash(widgetTypeCode, "admin");
assertEquals(Action.SUCCESS, result);
result = this.executeDelete(widgetTypeCode, "admin");
assertEquals(Action.SUCCESS, result);
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
} catch (Throwable t) {
throw t;
} finally {
IPage pagina_1 = this._pageManager.getDraftPage(pageCode);
pagina_1.getWidgets()[frame] = null;
this._pageManager.updatePage(pagina_1);
if (null != this._widgetTypeManager.getWidgetType(widgetTypeCode)) {
this._mockWidgetTypeDAO.deleteWidgetType(widgetTypeCode);
}
((IManager) this._widgetTypeManager).refresh();
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testFailureAddExpression_1.
public void testFailureAddExpression_1() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "3");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "parent.subtree(2)+abs(1).subtree(2)+current");
String result = this.executeAddExpression("admin", params);
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
Map<String, List<String>> fieldErrors = action.getFieldErrors();
assertEquals(1, fieldErrors.size());
assertEquals(1, fieldErrors.get("specId").size());
NavigatorWidgetConfigAction navAction = (NavigatorWidgetConfigAction) action;
Widget widget = navAction.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
assertEquals("parent.subtree(2)+abs(1).subtree(2)+current", navAction.getNavSpec());
assertEquals(3, navAction.getExpressions().size());
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testFailureAddExpression_4.
public void testFailureAddExpression_4() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "3");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "");
params.put("specId", "5");
params.put("specCode", " ");
params.put("operatorId", "3");
params.put("operatorSubtreeLevel", "-1");
String result = this.executeAddExpression("admin", params);
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
assertEquals(2, action.getActionErrors().size());
NavigatorWidgetConfigAction navAction = (NavigatorWidgetConfigAction) action;
Widget widget = navAction.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
assertEquals("", navAction.getNavSpec());
assertEquals(0, navAction.getExpressions().size());
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testFailureAddExpression_3.
public void testFailureAddExpression_3() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "3");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "parent.subtree(2)+current");
params.put("specId", "4");
params.put("specAbsLevel", "-1");
String result = this.executeAddExpression("admin", params);
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
assertEquals(1, action.getActionErrors().size());
NavigatorWidgetConfigAction navAction = (NavigatorWidgetConfigAction) action;
Widget widget = navAction.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
assertEquals("parent.subtree(2)+current", navAction.getNavSpec());
assertEquals(2, navAction.getExpressions().size());
}
Aggregations