use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentViewerWidgetAction method testInitConfigViewer_2.
public void testInitConfigViewer_2() throws Throwable {
String result = this.executeConfigViewer("admin", "homepage", "2", null);
assertEquals(Action.SUCCESS, result);
ContentViewerWidgetAction action = (ContentViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(2, props.size());
assertEquals("ART1", props.getProperty("contentId"));
assertEquals("2", props.getProperty("modelId"));
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentViewerWidgetAction method testInitConfigViewer_1.
public void testInitConfigViewer_1() throws Throwable {
String result = this.executeConfigViewer("admin", "homepage", "1", "content_viewer");
assertEquals(Action.SUCCESS, result);
ContentViewerWidgetAction action = (ContentViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
assertEquals(0, widget.getConfig().size());
}
use of com.agiletec.aps.system.services.page.Widget 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("Freme 0");
frame0.setMainFrame(true);
Frame frame1 = new Frame();
frame1.setPos(1);
frame1.setDescription("Freme 1");
Widget defWidg1 = new Widget();
defWidg1.setType(this._widgetTypeManager.getWidgetType("content_viewer_list"));
ApsProperties props1 = new ApsProperties();
props1.setProperty("contentType", "ART");
defWidg1.setConfig(props1);
frame1.setDefaultWidget(defWidg1);
Frame frame2 = new Frame();
frame2.setPos(1);
frame2.setDescription("Freme 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.system.services.page.Widget in project entando-core by entando.
the class TestPageConfigAction method testDeleteShowlet.
public void testDeleteShowlet() throws Throwable {
String pageCode = "contentview";
int frame = 1;
IPage contentview = this._pageManager.getDraftPage(pageCode);
Widget widget = contentview.getWidgets()[frame];
try {
assertNotNull(widget);
String result = this.executeDeleteShowlet(pageCode, frame, "pageManagerCoach");
assertEquals("pageTree", result);
assertEquals(1, this.getAction().getActionErrors().size());
result = this.executeDeleteShowlet(pageCode, frame, "admin");
assertEquals(Action.SUCCESS, result);
IPage modifiedContentview = this._pageManager.getDraftPage(pageCode);
Widget[] modifiedShowlets = modifiedContentview.getWidgets();
assertNull(modifiedShowlets[frame]);
} catch (Throwable t) {
throw t;
} finally {
contentview = this._pageManager.getDraftPage(pageCode);
contentview.getWidgets()[frame] = widget;
this._pageManager.updatePage(contentview);
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestWidgetTypeAction method testPasteNewUserWidgetType_1.
public void testPasteNewUserWidgetType_1() throws Throwable {
String widgetTypeCode = "randomShowletCode_1";
try {
assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
String result = this.executePasteUserWidgetType("admin", widgetTypeCode, "en", "it", "customers_page", "2");
assertEquals(Action.SUCCESS, result);
Widget copiedWidget = this._pageManager.getDraftPage("customers_page").getWidgets()[2];
assertNotNull(copiedWidget);
assertNotNull(copiedWidget.getConfig());
WidgetType addedType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(addedType);
ApsProperties config = addedType.getConfig();
Iterator<Object> keysIter = config.keySet().iterator();
while (keysIter.hasNext()) {
String key = (String) keysIter.next();
assertEquals(copiedWidget.getConfig().getProperty(key), config.getProperty(key));
}
} catch (Throwable t) {
throw t;
} finally {
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
}
}
Aggregations