use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorExpression method testSetWrongExpression_1.
public void testSetWrongExpression_1() throws Throwable {
NavigatorExpression navExpr = null;
try {
navExpr = new NavigatorExpression("wrongSpec.path");
} catch (RuntimeException e) {
assertTrue(e.getMessage().indexOf("wrongSpec") > 0);
} catch (Throwable e) {
fail();
}
assertNull(navExpr);
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorExpression method testGetExpression_3.
public void testGetExpression_3() throws Throwable {
NavigatorExpression navExpr = new NavigatorExpression();
navExpr.setSpecId(NavigatorExpression.SPEC_SUPER_ID);
navExpr.setSpecSuperLevel(2);
navExpr.setOperatorId(NavigatorExpression.OPERATOR_SUBTREE_ID);
navExpr.setOperatorSubtreeLevel(3);
String expression = navExpr.toString();
assertEquals("super(2).subtree(3)", expression);
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorExpression method testSetWrongExpression_2.
public void testSetWrongExpression_2() throws Throwable {
NavigatorExpression navExpr = null;
try {
navExpr = new NavigatorExpression("current.wrongOperat");
} catch (RuntimeException e) {
assertTrue(e.getMessage().indexOf("wrongOperat") > 0);
} catch (Throwable e) {
fail();
}
assertNull(navExpr);
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorExpression method testSetExpression_1.
public void testSetExpression_1() throws Throwable {
NavigatorExpression navExpr = new NavigatorExpression("super(3)");
assertEquals(NavigatorExpression.SPEC_SUPER_ID, navExpr.getSpecId());
assertEquals(3, navExpr.getSpecSuperLevel());
assertTrue(navExpr.getOperatorId() < 0);
}
use of com.agiletec.aps.system.services.page.widget.NavigatorExpression in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testExecuteMoveExpression_1.
public void testExecuteMoveExpression_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");
params.put("movement", ApsAdminSystemConstants.MOVEMENT_DOWN_CODE);
params.put("expressionIndex", "1");
String result = this.executeMoveExpression("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 + abs(1).subtree(2)", props.getProperty("navSpec"));
List<NavigatorExpression> expressions = action.getExpressions();
assertEquals(3, expressions.size());
NavigatorExpression expression1 = expressions.get(1);
assertEquals(NavigatorExpression.SPEC_CURRENT_PAGE_ID, expression1.getSpecId());
assertTrue(expression1.getOperatorId() < 0);
}
Aggregations