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