use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.
the class DataObjectModelServiceTest method should_raise_exception_on_delete_referenced_dataModel.
@Test(expected = ValidationConflictException.class)
public void should_raise_exception_on_delete_referenced_dataModel() throws Throwable {
DataObjectModel mockDataModel = new DataObjectModel();
mockDataModel.setId(234l);
when(this.dataObjectModelManager.getDataObjectModel(any(Long.class))).thenReturn(mockDataModel);
DataModelDto dto = new DataModelDto(mockDataModel);
when(this.dtoBuilder.convert(mockDataModel)).thenReturn(dto);
Map<String, List<IPage>> utilizers = new HashMap<>();
List<IPage> pages = new ArrayList<>();
Page referencedPage = new Page();
referencedPage.setCode("referenced");
pages.add(referencedPage);
utilizers.put("ABC123", pages);
when(this.dataObjectModelManager.getReferencingPages(any(Long.class))).thenReturn(utilizers);
this.dataObjectModelService.removeDataObjectModel(34l);
}
use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.
the class DataObjectMapperCacheWrapperTest method createMockPage.
private IPage createMockPage() {
Page root = new Page();
root.setCode("root_code");
root.setModel(this.createMockPageModel());
root.setGroup(Group.FREE_GROUP_NAME);
Widget[] widgets = new Widget[] { this.createMockWidget() };
root.setWidgets(widgets);
root.setChildrenCodes(new String[] {});
return root;
}
use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.
the class TestPageConfigAction method testUpdateConfig.
public void testUpdateConfig() throws Throwable {
String pageCode = "test_page";
assertNull(this._pageManager.getDraftPage(pageCode));
try {
IPage parentPage = _pageManager.getDraftRoot();
PageModel pageModel = parentPage.getMetadata().getModel();
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel, true, "pagina temporanea", null, null, false, null, null);
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage.getCode(), "free", metadata, pageModel.getDefaultWidget());
this._pageManager.addPage(pageToAdd);
IPage addedPage = this._pageManager.getDraftPage(pageCode);
assertNotNull(addedPage);
Date lastUpdate = addedPage.getMetadata().getUpdatedAt();
assertNotNull(lastUpdate);
synchronized (this) {
wait(1000);
}
String result = this.executeJoinWidget(pageCode, 0, "logic_type", "admin");
assertEquals(Action.SUCCESS, result);
IPage modifiedPage = this._pageManager.getDraftPage(pageCode);
assertNotNull(modifiedPage);
assertTrue(modifiedPage.getMetadata().getUpdatedAt().after(lastUpdate));
} catch (Throwable t) {
throw t;
} finally {
this._pageManager.deletePage(pageCode);
}
}
use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.
the class TestPageConfigAction method testTrashWidget.
public void testTrashWidget() 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.executeTrashWidget(pageCode, frame, "pageManagerCoach");
assertEquals("pageTree", result);
assertEquals(1, this.getAction().getActionErrors().size());
result = this.executeTrashWidget(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.IPage in project entando-core by entando.
the class TestPageConfigAction method testDeleteWidget.
public void testDeleteWidget() 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.executeDeleteWidget(pageCode, frame, "pageManagerCoach");
assertEquals("pageTree", result);
assertEquals(1, this.getAction().getActionErrors().size());
result = this.executeDeleteWidget(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);
}
}
Aggregations