Search in sources :

Example 41 with ActionSupport

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

the class TestIntroNewContentAction method testCreateNewVoid_3.

public void testCreateNewVoid_3() throws Throwable {
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.setUserOnSession("admin");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "");
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErros = action.getFieldErrors();
    assertEquals(2, fieldErros.size());
    assertEquals(1, fieldErros.get("contentDescription").size());
    assertEquals(1, fieldErros.get("contentMainGroup").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 42 with ActionSupport

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

the class TestIntroNewContentAction method testCreateNewVoid_5.

public void testCreateNewVoid_5() throws Throwable {
    this.setUserOnSession("editorCustomers");
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "Description");
    this.addParameter("contentMainGroup", Group.FREE_GROUP_NAME);
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErros = action.getFieldErrors();
    assertEquals(1, fieldErros.size());
    assertEquals(1, fieldErros.get("contentMainGroup").size());
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "Description");
    this.addParameter("contentMainGroup", "customers");
    result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 43 with ActionSupport

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

the class TestIntroNewContentAction method testCreateNewVoid_4.

public void testCreateNewVoid_4() throws Throwable {
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.setUserOnSession("admin");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "Description");
    this.addParameter("contentMainGroup", "invalidGroupCode");
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErros = action.getFieldErrors();
    assertEquals(1, fieldErros.size());
    assertEquals(1, fieldErros.get("contentMainGroup").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 44 with ActionSupport

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

the class TestPageAction method testSavePage.

public void testSavePage() throws Throwable {
    String pageCode = "customer_subpage_2";
    IPage page = this._pageManager.getDraftPage(pageCode);
    assertNotNull(page);
    try {
        PageMetadata metadata = page.getMetadata();
        this.setUserOnSession("admin");
        this.initAction("/do/Page", "save");
        this.addParameter("strutsAction", String.valueOf(ApsAdminSystemConstants.EDIT));
        this.addParameter("langit", "");
        this.addParameter("langen", metadata.getTitle("en"));
        this.addParameter("model", metadata.getModel().getCode());
        this.addParameter("group", page.getGroup());
        this.addParameter("pageCode", pageCode);
        Collection<String> extraGroups = metadata.getExtraGroups();
        if (null != extraGroups) {
            Iterator<String> extraGroupIter = extraGroups.iterator();
            while (extraGroupIter.hasNext()) {
                String extraGroup = (String) extraGroupIter.next();
                this.addParameter("extraGroups", extraGroup);
            }
        }
        this.addParameter("extraGroups", "management");
        String result = this.executeAction();
        assertEquals(Action.INPUT, result);
        ActionSupport action = this.getAction();
        assertEquals(2, action.getFieldErrors().size());
        assertEquals(1, action.getFieldErrors().get("langit").size());
        assertEquals(1, action.getFieldErrors().get("extraGroups").size());
    } catch (Throwable t) {
        this._pageManager.updatePage(page);
        throw t;
    }
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 45 with ActionSupport

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

the class TestDateAttributeFilterAction method testFailureAddRangeDateFilter_3.

public void testFailureAddRangeDateFilter_3() throws Throwable {
    String result = // Data Start inserita
    this.executeSaveRangeDateFilter(// Data Start inserita
    IContentListFilterAction.INSERTED_DATE_FILTER, // Data Start inserita
    "25/09/1972", IContentListFilterAction.INSERTED_DATE_FILTER, // Data End Inserita
    "wrongFormat");
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldsErrors = action.getFieldErrors();
    assertEquals(1, fieldsErrors.size());
    List<String> dateValueErrors = fieldsErrors.get("dateEnd");
    // dateEnd Wrong Format and dateEnd required
    assertEquals(2, dateValueErrors.size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

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