use of com.opensymphony.xwork2.Action in project entando-core by entando.
the class TestContentGroupAction method testInsertOnLineContents_3.
public void testInsertOnLineContents_3() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTO FREE con errori di validazione
String[] masterContentIds = { "ART179" };
String[] newContentIds = null;
try {
newContentIds = this.addDraftContentsForTest(masterContentIds, false);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertFalse(content.isOnLine());
}
this.initAction("/do/jacms/Content", "approveContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(0, messages.size());
Collection<String> errors = action.getActionErrors();
assertEquals(1, errors.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.opensymphony.xwork2.Action 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.Action 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.Action 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.Action 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;
}
}
Aggregations