use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestSimpleWidgetConfigAction method testSave.
public void testSave() throws Throwable {
String pageCode = "pagina_2";
int frame = 3;
IPage page = this._pageManager.getDraftPage(pageCode);
Widget widget = page.getWidgets()[frame];
assertNull(widget);
try {
this.setUserOnSession("admin");
this.initAction("/do/Page/SpecialWidget", "saveConfigSimpleParameter");
this.addParameter("pageCode", pageCode);
this.addParameter("frame", String.valueOf(frame));
this.addParameter("widgetTypeCode", "formAction");
this.addParameter("actionPath", "/WEB-INF/pippo.jsp");
String result = this.executeAction();
assertEquals("configure", result);
page = this._pageManager.getDraftPage(pageCode);
widget = page.getWidgets()[frame];
assertNotNull(widget);
assertEquals("formAction", widget.getType().getCode());
assertEquals(1, widget.getConfig().size());
assertEquals("/WEB-INF/pippo.jsp", widget.getConfig().getProperty("actionPath"));
} catch (Throwable t) {
throw t;
} finally {
page = this._pageManager.getDraftPage(pageCode);
page.getWidgets()[frame] = null;
this._pageManager.updatePage(page);
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestSimpleWidgetConfigAction method testInitConfigSimpleParameter_2.
public void testInitConfigSimpleParameter_2() throws Throwable {
String result = this.executeConfigSimpleParameter("admin", "pagina_2", "2", null);
assertEquals(Action.SUCCESS, result);
SimpleWidgetConfigAction action = (SimpleWidgetConfigAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(1, props.size());
String value = props.getProperty("actionPath");
assertEquals("/do/login", value);
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testInitConfigNavigator_2.
public void testInitConfigNavigator_2() throws Throwable {
String result = this.executeConfigNavigator("admin", "pagina_1", "2", null);
assertEquals(Action.SUCCESS, result);
NavigatorWidgetConfigAction action = (NavigatorWidgetConfigAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(1, props.size());
assertEquals("abs(1).subtree(2)", props.getProperty("navSpec"));
List<NavigatorExpression> expressions = action.getExpressions();
assertEquals(1, expressions.size());
NavigatorExpression expression = expressions.get(0);
assertEquals(NavigatorExpression.SPEC_ABS_ID, expression.getSpecId());
assertEquals(1, expression.getSpecAbsLevel());
assertEquals(NavigatorExpression.OPERATOR_SUBTREE_ID, expression.getOperatorId());
assertEquals(2, expression.getOperatorSubtreeLevel());
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testSave.
public void testSave() throws Throwable {
String pageCode = "pagina_2";
int frame = 3;
IPage page = this._pageManager.getDraftPage(pageCode);
Widget widget = page.getWidgets()[frame];
assertNull(widget);
try {
this.setUserOnSession("admin");
this.initAction("/do/Page/SpecialWidget/Navigator", "saveNavigatorConfig");
this.addParameter("pageCode", pageCode);
this.addParameter("frame", String.valueOf(frame));
this.addParameter("widgetTypeCode", "leftmenu");
this.addParameter("navSpec", "parent.subtree(2)");
String result = this.executeAction();
assertEquals("configure", result);
page = this._pageManager.getDraftPage(pageCode);
widget = page.getWidgets()[frame];
assertNotNull(widget);
assertEquals("leftmenu", widget.getType().getCode());
assertEquals(1, widget.getConfig().size());
assertEquals("parent.subtree(2)", widget.getConfig().getProperty("navSpec"));
} catch (Throwable t) {
throw t;
} finally {
page = this._pageManager.getDraftPage(pageCode);
page.getWidgets()[frame] = null;
this._pageManager.updatePage(page);
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testExecuteRemoveExpression_1.
public void testExecuteRemoveExpression_1() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "0");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "parent.subtree(2)+abs(1).subtree(2)+current");
params.put("expressionIndex", "1");
String result = this.executeRemoveExpression("admin", params);
assertEquals(Action.SUCCESS, result);
NavigatorWidgetConfigAction action = (NavigatorWidgetConfigAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(1, props.size());
assertEquals("parent.subtree(2) + current", props.getProperty("navSpec"));
List<NavigatorExpression> expressions = action.getExpressions();
assertEquals(2, expressions.size());
NavigatorExpression expression1 = expressions.get(1);
assertEquals(NavigatorExpression.SPEC_CURRENT_PAGE_ID, expression1.getSpecId());
assertTrue(expression1.getOperatorId() < 0);
}
Aggregations