Search in sources :

Example 16 with PageDto

use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.

the class PageServiceIntegrationTest method testChangeOnlyPosition.

@Test
public void testChangeOnlyPosition() {
    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_1");
    pagePosRequest.setPosition(1);
    addedPage = pageService.movePage("pagina_13", pagePosRequest);
    assertNotNull(addedPage);
    assertEquals("pagina_1", addedPage.getParentCode());
    assertEquals(1, addedPage.getPosition());
    pageService.removePage("pagina_13");
}
Also used : PageRequest(org.entando.entando.web.page.model.PageRequest) PageDto(org.entando.entando.aps.system.services.page.model.PageDto) PagePositionRequest(org.entando.entando.web.page.model.PagePositionRequest) Test(org.junit.Test)

Example 17 with PageDto

use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.

the class PageServiceIntegrationTest method testUpdatePageStatus.

@Test
public void testUpdatePageStatus() {
    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");
    assertEquals("draft", addedPage.getStatus());
    PageStatusRequest pageStatusRequest = new PageStatusRequest();
    pageStatusRequest.setStatus("published");
    PageDto modPage = pageService.updatePageStatus("pagina_13", pageStatusRequest.getStatus());
    assertNotNull(modPage);
    assertEquals("published", modPage.getStatus());
    addedPage = pageService.getPage("pagina_13", "published");
    assertNotNull(addedPage);
    assertEquals("published", addedPage.getStatus());
    pageService.removePage("pagina_13");
}
Also used : PageRequest(org.entando.entando.web.page.model.PageRequest) PageDto(org.entando.entando.aps.system.services.page.model.PageDto) PageStatusRequest(org.entando.entando.web.page.model.PageStatusRequest) Test(org.junit.Test)

Example 18 with PageDto

use of org.entando.entando.aps.system.services.page.model.PageDto in project entando-core by entando.

the class PageControllerTest method createMetadataList.

private List<PageDto> createMetadataList(String json) throws IOException, JsonParseException, JsonMappingException {
    ObjectMapper mapper = new ObjectMapper();
    List<PageDto> result = mapper.readValue(json, new TypeReference<List<PageDto>>() {
    });
    return result;
}
Also used : PageDto(org.entando.entando.aps.system.services.page.model.PageDto) ArrayList(java.util.ArrayList) List(java.util.List) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

PageDto (org.entando.entando.aps.system.services.page.model.PageDto)18 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)9 HashMap (java.util.HashMap)7 RestAccessControl (org.entando.entando.web.common.annotation.RestAccessControl)7 RestResponse (org.entando.entando.web.common.model.RestResponse)7 PageRequest (org.entando.entando.web.page.model.PageRequest)7 ResponseEntity (org.springframework.http.ResponseEntity)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ValidationGenericException (org.entando.entando.web.common.exceptions.ValidationGenericException)6 UserDetails (com.agiletec.aps.system.services.user.UserDetails)3 List (java.util.List)3 PagePositionRequest (org.entando.entando.web.page.model.PagePositionRequest)3 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)2 AbstractControllerTest (org.entando.entando.web.AbstractControllerTest)2 ResultActions (org.springframework.test.web.servlet.ResultActions)2 IManager (com.agiletec.aps.system.common.IManager)1 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 GroupUtilizer (com.agiletec.aps.system.services.group.GroupUtilizer)1 IGroupManager (com.agiletec.aps.system.services.group.IGroupManager)1