Search in sources :

Example 6 with ActionSupport

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

the class TestContentViewerWidgetAction method testSave_2.

private void testSave_2(String contentId, String pageCode, int frame, String expectedResult) throws Throwable {
    try {
        this.intSaveViewerConfig(contentId, pageCode, frame);
        String result = this.executeAction();
        assertEquals(expectedResult, result);
        if (expectedResult.equals(Action.INPUT)) {
            ActionSupport action = this.getAction();
            assertEquals(1, action.getFieldErrors().size());
            assertEquals(1, action.getFieldErrors().get("contentId").size());
        }
    } catch (Throwable t) {
        throw t;
    } finally {
        IPage page = this._pageManager.getDraftPage(pageCode);
        page.getWidgets()[frame] = null;
        this._pageManager.updatePage(page);
    }
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 7 with ActionSupport

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

the class TestContentViewerWidgetAction method testFailureJoinContent_2.

public void testFailureJoinContent_2() throws Throwable {
    // ID di contenuto non pubblico
    String result = this.executeJoinContent("admin", "pagina_11", "1", "ART179");
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErrors = action.getFieldErrors();
    assertEquals(1, fieldErrors.size());
    List<String> contentIdFieldErrors = (List<String>) fieldErrors.get("contentId");
    assertEquals(1, contentIdFieldErrors.size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 8 with ActionSupport

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

the class TestResourceAction method testSaveNewResource_2.

public void testSaveNewResource_2() throws Throwable {
    String insertedDescr = "Description ";
    while (insertedDescr.length() < 300) insertedDescr += insertedDescr;
    this.setUserOnSession("admin");
    this.initAction("/do/jacms/Resource", "save");
    this.addParameter("strutsAction", String.valueOf(ApsAdminSystemConstants.ADD));
    this.addParameter("descr", insertedDescr);
    this.addParameter("mainGroup", Group.FREE_GROUP_NAME);
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> actionFieldErrors = action.getFieldErrors();
    assertEquals(3, actionFieldErrors.size());
    assertEquals(1, actionFieldErrors.get("resourceTypeCode").size());
    assertEquals(1, actionFieldErrors.get("descr").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) ArrayList(java.util.ArrayList) List(java.util.List)

Example 9 with ActionSupport

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

the class TestJacmsEntityAttributeConfigAction method testValidateAttribute_5.

public void testValidateAttribute_5() 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/0777/2010");
    this.addParameter("rangeEndDate", "gggggggg");
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    assertEquals(2, action.getFieldErrors().size());
    assertEquals(1, action.getFieldErrors().get("rangeStartDate").size());
    assertEquals(1, action.getFieldErrors().get("rangeEndDate").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 10 with ActionSupport

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

the class TestJacmsEntityAttributeConfigAction method testValidateAttribute_8.

public void testValidateAttribute_8() throws Throwable {
    this.executeEditEntityAttributePrototype("EVN", JacmsSystemConstants.CONTENT_MANAGER, "DataInizio");
    this.initAction("/do/Entity/Attribute", "saveAttribute");
    this.addParameter("attributeTypeCode", "Date");
    this.addParameter("strutsAction", ApsAdminSystemConstants.EDIT);
    this.addParameter("attributeName", "DataInizio");
    this.addParameter("rangeStartDate", "12/07/2004");
    this.addParameter("rangeEndDate", "12/04/2010");
    this.addParameter("rangeEndDateAttribute", "DataFine");
    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)

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