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());
}
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);
}
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());
}
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;
}
}
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());
}
Aggregations