use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.
the class PageAuthorizationServiceIntegrationTest method testFilteredPageTree.
@Test
public void testFilteredPageTree() throws Throwable {
UserDetails admin = this.getUser("admin");
UserDetails customer = this.getUser("editorCustomers");
List<PageDto> pages = this.pageService.getPages("homepage");
List<PageDto> pagesForAdmin = this.authorizationService.filterList(admin, pages);
List<PageDto> pagesForCustomer = this.authorizationService.filterList(customer, pages);
assertEquals(7, pagesForAdmin.size());
assertEquals(5, pagesForCustomer.size());
pagesForCustomer.forEach(page -> assertTrue((page.getOwnerGroup().equals(Group.FREE_GROUP_NAME) || page.getOwnerGroup().equals("customers"))));
}
use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.
the class PageServiceIntegrationTest method testGetPage.
@Test
public void testGetPage() {
PageDto page = pageService.getPage("pagina_1", IPageService.STATUS_ONLINE);
assertNotNull(page);
assertEquals(IPageService.STATUS_ONLINE, page.getStatus());
}
use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.
the class PageServiceIntegrationTest method testAddAndRemovePage.
@Test
public void testAddAndRemovePage() throws Throwable {
PageDto pageToClone = pageService.getPage("pagina_11", "draft");
assertNotNull(pageToClone);
PageRequest pageRequest = this.createRequestFromDto(pageToClone);
pageRequest.setCode("pagina_13");
PageDto addedPage = pageService.addPage(pageRequest);
assertNotNull(addedPage);
assertEquals("pagina_13", addedPage.getCode());
assertEquals("pagina_1", addedPage.getParentCode());
addedPage = pageService.getPage("pagina_13", "draft");
assertNotNull(addedPage);
assertEquals("pagina_13", addedPage.getCode());
assertEquals("pagina_1", addedPage.getParentCode());
pageService.removePage("pagina_13");
try {
addedPage = null;
addedPage = pageService.getPage("pagina_13", "draft");
fail("RestRourceNotFoundException not thrown");
} catch (RestRourceNotFoundException e) {
assertNull(addedPage);
}
}
use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.
the class PageServiceIntegrationTest method testUpdatePage.
@Test
public void testUpdatePage() {
PageDto oldPages = pageService.getPage("pagina_12", "draft");
assertNotNull(oldPages);
assertEquals(2, oldPages.getTitles().size());
assertEquals("Pagina 1-2", oldPages.getTitles().get("it"));
PageRequest pageRequest = this.createRequestFromDto(oldPages);
pageRequest.getTitles().put("it", "Pagina 1-2 mod");
PageDto modPage = pageService.updatePage("pagina_12", pageRequest);
assertNotNull(modPage);
assertEquals(2, modPage.getTitles().size());
assertEquals("Pagina 1-2 mod", modPage.getTitles().get("it"));
modPage = pageService.getPage("pagina_12", "draft");
assertNotNull(modPage);
assertEquals(2, modPage.getTitles().size());
assertEquals("Pagina 1-2 mod", modPage.getTitles().get("it"));
pageRequest.getTitles().put("it", "Pagina 1-2");
modPage = pageService.updatePage("pagina_12", pageRequest);
modPage = pageService.getPage("pagina_12", "draft");
assertNotNull(modPage);
assertEquals(2, modPage.getTitles().size());
assertEquals("Pagina 1-2", modPage.getTitles().get("it"));
}
use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.
the class PageServiceIntegrationTest method testChangeNode.
@Test
public void testChangeNode() {
PageDto pageToClone = pageService.getPage("pagina_11", "draft");
assertNotNull(pageToClone);
PageRequest pageRequest = this.createRequestFromDto(pageToClone);
pageRequest.setCode("pagina_13");
PageDto addedPage = pageService.addPage(pageRequest);
assertNotNull(addedPage);
assertEquals("pagina_1", addedPage.getParentCode());
assertEquals(3, addedPage.getPosition());
PagePositionRequest pagePosRequest = new PagePositionRequest();
pagePosRequest.setCode("pagina_13");
pagePosRequest.setParentCode("pagina_2");
pagePosRequest.setPosition(1);
addedPage = pageService.movePage("pagina_13", pagePosRequest);
assertNotNull(addedPage);
assertEquals("pagina_2", addedPage.getParentCode());
assertEquals(1, addedPage.getPosition());
List<PageDto> pages = pageService.getPages("pagina_2");
assertNotNull(pages);
assertEquals(1, pages.size());
assertEquals("pagina_13", pages.get(0).getCode());
pageService.removePage("pagina_13");
}
Aggregations