use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class DataObjectMapperCacheWrapperTest method createMockWidget.
private Widget createMockWidget() {
Widget widget = new Widget();
WidgetType type = new WidgetType();
type.setCode("type");
WidgetTypeParameter param1 = new WidgetTypeParameter();
param1.setName("dataId");
WidgetTypeParameter param2 = new WidgetTypeParameter();
param2.setName("testParam");
List<WidgetTypeParameter> params = Arrays.asList(param1, param2);
type.setTypeParameters(params);
widget.setType(type);
ApsProperties props = new ApsProperties();
props.put("dataId", "id1");
props.put("testParam", "test");
widget.setConfig(props);
return widget;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class AbstractTestPageModelAction method createMockPageModel.
protected PageModel createMockPageModel(String code) {
PageModel model = new PageModel();
model.setCode(code);
model.setDescription("Description of model " + code);
Frame frame0 = new Frame();
frame0.setPos(0);
frame0.setDescription("Frame 0");
frame0.setMainFrame(true);
Frame frame1 = new Frame();
frame1.setPos(1);
frame1.setDescription("Frame 1");
Widget defWidg1 = new Widget();
defWidg1.setType(this._widgetTypeManager.getWidgetType("formAction"));
ApsProperties props1 = new ApsProperties();
props1.setProperty("actionPath", "/do/login");
defWidg1.setConfig(props1);
frame1.setDefaultWidget(defWidg1);
Frame frame2 = new Frame();
frame2.setPos(1);
frame2.setDescription("Frame 2");
Widget defWidg2 = new Widget();
defWidg2.setType(this._widgetTypeManager.getWidgetType("login_form"));
frame2.setDefaultWidget(defWidg2);
Frame[] configuration = { frame0, frame1, frame2 };
model.setConfiguration(configuration);
model.setTemplate("<strong>Freemarker template content</strong>");
return model;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestWidgetTypeAction method testAddNewUserWidgetType.
public void testAddNewUserWidgetType() throws Throwable {
String widgetTypeCode = "randomWidgetCode_3";
try {
this.setUserOnSession("admin");
this.initAction("/do/Portal/WidgetType", "save");
this.addParameter("widgetTypeCode", widgetTypeCode);
this.addParameter("englishTitle", "en");
this.addParameter("italianTitle", "it");
this.addParameter("parentWidgetTypeCode", "formAction");
this.addParameter("strutsAction", WidgetTypeAction.NEW_USER_WIDGET);
this.addParameter("actionPath", "/myjsp.jsp");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
WidgetType addedType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(addedType);
ApsProperties config = addedType.getConfig();
assertEquals(1, config.size());
assertEquals("/myjsp.jsp", config.getProperty("actionPath"));
} catch (Throwable t) {
throw t;
} finally {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestWidgetTypeAction method testUpdate_3.
public void testUpdate_3() throws Throwable {
String widgetTypeCode = "test_widgetType_Upd3";
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
try {
WidgetType type = this.createNewLogicWidgetType(widgetTypeCode);
this._widgetTypeManager.addWidgetType(type);
ApsProperties newProperties = new ApsProperties();
newProperties.put("actionPath", "/do/dologin");
String result = this.executeUpdate(widgetTypeCode, "Titolo modificato", "Modified title", "admin", newProperties, "**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"));
assertEquals("/do/dologin", extracted.getConfig().getProperty("actionPath"));
newProperties.put("actionPath", "/do/api/dologin");
result = this.executeUpdate(widgetTypeCode, "Titolo modificato 2", "Modified title 2", "pageManagerCoach", newProperties, "*GUI*");
assertEquals(Action.SUCCESS, result);
extracted = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(extracted);
assertEquals("Titolo modificato 2", extracted.getTitles().get("it"));
assertEquals("Modified title 2", extracted.getTitles().get("en"));
assertEquals("/do/dologin", extracted.getConfig().getProperty("actionPath"));
} catch (Throwable t) {
throw t;
} finally {
this.cleanDatabase(widgetTypeCode);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestWidgetTypeAction method createNewLogicWidgetType.
private WidgetType createNewLogicWidgetType(String code) {
WidgetType type = this.createNewWidgetType(code);
WidgetType parent = this._widgetTypeManager.getWidgetType("formAction");
assertNotNull(parent);
type.setParentType(parent);
ApsProperties config = new ApsProperties();
config.put("actionPath", "/do/login");
type.setConfig(config);
return type;
}
Aggregations