Search in sources :

Example 1 with NavigatorExpression

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);
}
Also used : NavigatorExpression(com.agiletec.aps.system.services.page.widget.NavigatorExpression)

Example 2 with NavigatorExpression

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);
}
Also used : NavigatorExpression(com.agiletec.aps.system.services.page.widget.NavigatorExpression)

Example 3 with NavigatorExpression

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);
}
Also used : NavigatorExpression(com.agiletec.aps.system.services.page.widget.NavigatorExpression)

Example 4 with NavigatorExpression

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);
}
Also used : NavigatorExpression(com.agiletec.aps.system.services.page.widget.NavigatorExpression)

Example 5 with NavigatorExpression

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);
}
Also used : NavigatorExpression(com.agiletec.aps.system.services.page.widget.NavigatorExpression) HashMap(java.util.HashMap) Widget(com.agiletec.aps.system.services.page.Widget) ApsProperties(com.agiletec.aps.util.ApsProperties)

Aggregations

NavigatorExpression (com.agiletec.aps.system.services.page.widget.NavigatorExpression)20 Widget (com.agiletec.aps.system.services.page.Widget)6 ApsProperties (com.agiletec.aps.util.ApsProperties)6 HashMap (java.util.HashMap)5