Search in sources :

Example 26 with ActionSupport

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());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 27 with ActionSupport

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));
    }
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) IManager(com.agiletec.aps.system.common.IManager) ActionSupport(com.opensymphony.xwork2.ActionSupport) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Example 28 with ActionSupport

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

Example 29 with ActionSupport

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

Example 30 with ActionSupport

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

Aggregations

ActionSupport (com.opensymphony.xwork2.ActionSupport)56 List (java.util.List)28 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)14 Widget (com.agiletec.aps.system.services.page.Widget)4 ApsProperties (com.agiletec.aps.util.ApsProperties)4 HashMap (java.util.HashMap)4 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)4 IPage (com.agiletec.aps.system.services.page.IPage)3 ArrayList (java.util.ArrayList)3 IManager (com.agiletec.aps.system.common.IManager)2 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)2 BooleanAttribute (com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute)1 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)1 Lang (com.agiletec.aps.system.services.lang.Lang)1 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)1 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)1 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)1 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)1 ActionProxyFactory (com.opensymphony.xwork2.ActionProxyFactory)1