Search in sources :

Example 11 with ActionSupport

use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.

the class TestJacmsEntityAttributeConfigAction method testValidateAttribute_6.

public void testValidateAttribute_6() throws Throwable {
    this.executeEditEntityAttributePrototype("ART", JacmsSystemConstants.CONTENT_MANAGER, "Data");
    this.initAction("/do/Entity/Attribute", "saveAttribute");
    this.addParameter("attributeTypeCode", "Date");
    this.addParameter("strutsAction", ApsAdminSystemConstants.EDIT);
    this.addParameter("attributeName", "Data");
    this.addParameter("rangeStartDate", "12/07/2010");
    this.addParameter("rangeEndDate", "12/04/2010");
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    assertEquals(1, action.getFieldErrors().size());
    assertEquals(1, action.getFieldErrors().get("rangeEndDate").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 12 with ActionSupport

use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.

the class TestPageModelAction method testValidate_1.

public void testValidate_1() throws Throwable {
    String testPageModelCode = "test_pagemodel";
    assertNull(this._pageModelManager.getPageModel(testPageModelCode));
    try {
        this.setUserOnSession("admin");
        this.initAction("/do/PageModel", "save");
        super.addParameter("code", testPageModelCode);
        super.addParameter("strutsAction", ApsAdminSystemConstants.ADD);
        String result = this.executeAction();
        ActionSupport action = super.getAction();
        assertEquals(Action.INPUT, result);
        assertEquals(3, action.getFieldErrors().size());
        assertNotNull(action.getFieldErrors().get("description"));
        assertNotNull(action.getFieldErrors().get("template"));
        assertNotNull(action.getFieldErrors().get("xmlConfiguration"));
    } catch (Exception e) {
        this._pageModelManager.deletePageModel(testPageModelCode);
        assertNull(this._pageModelManager.getPageModel(testPageModelCode));
        throw e;
    }
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 13 with ActionSupport

use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.

the class TestPageModelAction method testValidate_2.

public void testValidate_2() throws Throwable {
    String testPageModelCode = "internal";
    PageModel model = this._pageModelManager.getPageModel(testPageModelCode);
    assertNotNull(model);
    try {
        this.setUserOnSession("admin");
        this.initAction("/do/PageModel", "save");
        super.addParameter("code", testPageModelCode);
        super.addParameter("description", "Description");
        super.addParameter("strutsAction", ApsAdminSystemConstants.ADD);
        String result = this.executeAction();
        ActionSupport action = super.getAction();
        assertEquals(Action.INPUT, result);
        assertEquals(3, action.getFieldErrors().size());
        assertNotNull(action.getFieldErrors().get("code"));
        assertNotNull(action.getFieldErrors().get("template"));
        assertNotNull(action.getFieldErrors().get("xmlConfiguration"));
    } catch (Exception e) {
        this._pageModelManager.updatePageModel(model);
        throw e;
    }
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) PageModel(com.agiletec.aps.system.services.pagemodel.PageModel)

Example 14 with ActionSupport

use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.

the class TestWidgetTypeAction method testUpdate_2.

public void testUpdate_2() throws Throwable {
    String widgetTypeCode = "test_widgetType_Upd2";
    assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
    List<String> fragmentCodes = this._guiFragmentManager.getGuiFragmentCodesByWidgetType(widgetTypeCode);
    assertEquals(0, fragmentCodes.size());
    try {
        WidgetType type = this.createNewWidgetType(widgetTypeCode);
        this._widgetTypeManager.addWidgetType(type);
        String result = this.executeUpdate(widgetTypeCode, "", "", "admin", null);
        assertEquals(Action.INPUT, result);
        fragmentCodes = this._guiFragmentManager.getGuiFragmentCodesByWidgetType(widgetTypeCode);
        assertEquals(0, fragmentCodes.size());
        ActionSupport action = this.getAction();
        assertEquals(3, action.getFieldErrors().size());
        assertEquals(1, action.getFieldErrors().get("gui").size());
        result = this.executeUpdate(widgetTypeCode, "Titolo modificato", "Modified title", "admin", "** GUI **");
        assertEquals(Action.SUCCESS, result);
        WidgetType extracted = this._widgetTypeManager.getWidgetType(widgetTypeCode);
        assertNotNull(extracted);
        assertEquals("Titolo modificato", extracted.getTitles().get("it"));
        assertEquals("Modified title", extracted.getTitles().get("en"));
        fragmentCodes = this._guiFragmentManager.getGuiFragmentCodesByWidgetType(widgetTypeCode);
        assertEquals(1, fragmentCodes.size());
    } catch (Throwable t) {
        throw t;
    } finally {
        this.cleanDatabase(widgetTypeCode);
    }
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Example 15 with ActionSupport

use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.

the class TestWidgetTypeAction method testFailureTrashType_2.

public void testFailureTrashType_2() throws Throwable {
    String widgetTypeCode = "test_widgetType_trash2";
    assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
    try {
        WidgetType type = this.createNewLogicWidgetType(widgetTypeCode);
        type.setLocked(true);
        this._widgetTypeManager.addWidgetType(type);
        assertNotNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
        String result = this.executeTrash(widgetTypeCode, "admin");
        assertEquals("inputWidgetTypes", result);
        ActionSupport action = this.getAction();
        assertEquals(1, action.getActionErrors().size());
        assertNotNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
    } catch (Throwable t) {
        throw t;
    } finally {
        if (null != this._widgetTypeManager.getWidgetType(widgetTypeCode)) {
            this._mockWidgetTypeDAO.deleteWidgetType(widgetTypeCode);
        }
        ((IManager) this._widgetTypeManager).refresh();
        assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
    }
}
Also used : IManager(com.agiletec.aps.system.common.IManager) ActionSupport(com.opensymphony.xwork2.ActionSupport) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

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