use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestPageAction method testDetailPageForAdmin.
public void testDetailPageForAdmin() throws Throwable {
// PAGINA PREDISPOSTA PER LA
String selectedPageCode = "contentview";
// PUBBLICAZIONE VOLANTE
String result = this.executeActionOnPage(selectedPageCode, "admin", "detail");
assertEquals(Action.SUCCESS, result);
IPage page = this._pageManager.getDraftPage(selectedPageCode);
PageAction action = (PageAction) this.getAction();
IPage pageToShow = action.getPageToShow();
assertEquals(page.getCode(), pageToShow.getCode());
assertEquals(page.getParentCode(), pageToShow.getParentCode());
assertEquals(page.getModel().getCode(), pageToShow.getModel().getCode());
assertEquals(page.getGroup(), pageToShow.getGroup());
assertEquals(page.isShowable(), pageToShow.isShowable());
assertEquals("Publicazione Contenuto", pageToShow.getTitles().getProperty("it"));
assertEquals("Content Publishing", pageToShow.getTitles().getProperty("en"));
Widget widget = page.getWidgets()[page.getModel().getMainFrame()];
if (null != widget) {
assertEquals("content_viewer", widget.getType().getCode());
assertTrue(null == widget.getConfig() || widget.getConfig().isEmpty());
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestPageConfigAction method testTrashShowlet.
public void testTrashShowlet() 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.executeTrashShowlet(pageCode, frame, "pageManagerCoach");
assertEquals("pageTree", result);
assertEquals(1, this.getAction().getActionErrors().size());
result = this.executeTrashShowlet(pageCode, frame, "admin");
assertEquals(Action.SUCCESS, result);
IPage modifiedContentview = this._pageManager.getDraftPage(pageCode);
Widget[] modifiedShowlets = modifiedContentview.getWidgets();
assertNotNull(modifiedShowlets[frame]);
} catch (Throwable t) {
contentview = this._pageManager.getDraftPage(pageCode);
contentview.getWidgets()[frame] = widget;
this._pageManager.updatePage(contentview);
throw t;
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestPageTreeAction method testMoveWidgetUp.
public void testMoveWidgetUp() throws Throwable {
IPage page = this._pageManager.getDraftRoot();
String pageCode = page.getCode();
try {
Widget configWidget = page.getWidgets()[0];
Widget nullWidget = page.getWidgets()[1];
assertNotNull(configWidget);
assertNull(nullWidget);
String result = this.executeMoveDown(pageCode, 0, "admin");
assertEquals(Action.SUCCESS, result);
IPage updatedPage = this._pageManager.getDraftRoot();
Widget w00 = updatedPage.getWidgets()[0];
Widget w11 = updatedPage.getWidgets()[1];
assertNull(w00);
assertEquals(w11.getType().getCode(), configWidget.getType().getCode());
result = this.executeMoveUp(pageCode, 1, "admin");
assertEquals(Action.SUCCESS, result);
updatedPage = this._pageManager.getDraftRoot();
w00 = updatedPage.getWidgets()[0];
w11 = updatedPage.getWidgets()[1];
assertEquals(w00.getType().getCode(), configWidget.getType().getCode());
assertNull(w11);
} finally {
this._pageManager.updatePage(page);
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestWidgetTypeAction method testPasteNewWidgetType_2.
public void testPasteNewWidgetType_2() throws Throwable {
String widgetTypeCode = "randomWidgetCode-2";
String pageDest = "pagina_1";
int frameDest = 1;
Widget temp = this._pageManager.getDraftPage("pagina_11").getWidgets()[2];
assertNotNull(temp);
assertEquals("content_viewer", temp.getType().getCode());
IPage page = this._pageManager.getDraftPage(pageDest);
try {
assertNull(page.getWidgets()[frameDest]);
page.getWidgets()[frameDest] = temp;
this._pageManager.updatePage(page);
this.setUserOnSession("admin");
this.initAction("/do/Portal/WidgetType", "save");
this.addParameter("widgetTypeCode", widgetTypeCode);
this.addParameter("englishTitle", "en");
this.addParameter("italianTitle", "it");
this.addParameter("pageCode", pageDest);
this.addParameter("framePos", frameDest);
this.addParameter("strutsAction", ApsAdminSystemConstants.PASTE);
this.addParameter("replaceOnPage", "true");
String result = this.executeAction();
assertEquals("replaceOnPage", result);
Widget newWidget = this._pageManager.getDraftPage(pageDest).getWidgets()[frameDest];
assertNotNull(newWidget);
assertNotNull(newWidget.getConfig());
WidgetType addedType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
assertNotNull(addedType);
assertEquals(newWidget.getType().getCode(), addedType.getCode());
ApsProperties config = addedType.getConfig();
Iterator<Object> keysIter = config.keySet().iterator();
while (keysIter.hasNext()) {
String key = (String) keysIter.next();
assertEquals(newWidget.getConfig().getProperty(key), config.getProperty(key));
}
} catch (Throwable t) {
throw t;
} finally {
page.getWidgets()[frameDest] = null;
this._pageManager.updatePage(page);
this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
}
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestSimpleWidgetConfigAction method testInitConfigSimpleParameter_1.
public void testInitConfigSimpleParameter_1() throws Throwable {
String result = this.executeConfigSimpleParameter("admin", "homepage", "1", "formAction");
assertEquals(Action.SUCCESS, result);
SimpleWidgetConfigAction action = (SimpleWidgetConfigAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
assertEquals(0, widget.getConfig().size());
}
Aggregations