Search in sources :

Example 26 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class TestPageAction method testAddForAdminUser.

public void testAddForAdminUser() throws Throwable {
    IPage root = this._pageManager.getDraftRoot();
    String result = this.executeNewPage(root.getCode(), "admin");
    assertEquals(Action.SUCCESS, result);
    PageAction action = (PageAction) this.getAction();
    assertEquals(action.getStrutsAction(), ApsAdminSystemConstants.ADD);
    assertEquals(root.getCode(), action.getParentPageCode());
    assertEquals(root.getGroup(), action.getGroup());
    assertFalse(action.isGroupSelectLock());
    assertTrue(action.isShowable());
    assertTrue(action.isDefaultShowlet());
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage)

Example 27 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class TestPageAction method testSavePage_Clone.

public void testSavePage_Clone() throws Throwable {
    String copiedPageCode = "pagina_2";
    IPage copiedPage = this._pageManager.getDraftPage(copiedPageCode);
    assertNotNull(copiedPage);
    String pageCode = "pagina_test";
    assertNull(this._pageManager.getDraftPage(pageCode));
    try {
        Map<String, String> params = new HashMap<String, String>();
        params.put("strutsAction", String.valueOf(ApsAdminSystemConstants.PASTE));
        params.put("parentPageCode", "pagina_1");
        params.put("copyPageCode", copiedPageCode);
        params.put("langit", "Pagina Test 1");
        params.put("langen", "Test Page 1");
        params.put("model", "aaaa");
        params.put("group", "aaaa");
        params.put("pageCode", pageCode);
        String result = this.executeSave(params, "admin");
        assertEquals(Action.SUCCESS, result);
        IPage addedPage = this._pageManager.getDraftPage(pageCode);
        assertNotNull(addedPage);
        IPage addedPublicPage = this._pageManager.getOnlinePage(pageCode);
        assertNull(addedPublicPage);
        assertEquals("Pagina Test 1", addedPage.getMetadata().getTitles().getProperty("it"));
        assertEquals("Test Page 1", addedPage.getMetadata().getTitles().getProperty("en"));
        PageMetadata addedMetadata = addedPage.getMetadata();
        assertNotNull(addedMetadata);
        PageMetadata expectedMetadata = copiedPage.getMetadata();
        addedMetadata.setTitles(expectedMetadata.getTitles());
        PageTestUtil.comparePageMetadata(expectedMetadata, addedMetadata, null);
    } catch (Throwable t) {
        throw t;
    } finally {
        this._pageManager.deletePage(pageCode);
    }
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage) HashMap(java.util.HashMap)

Example 28 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class TestPageAction method testNewPageByCoachUser.

public void testNewPageByCoachUser() throws Throwable {
    IPage root = this._pageManager.getDraftRoot();
    String result = this.executeNewPage(root.getCode(), "pageManagerCoach");
    assertEquals("pageTree", result);
    IPage coach_page = this._pageManager.getDraftPage("coach_page");
    result = this.executeNewPage(coach_page.getCode(), "pageManagerCoach");
    assertEquals(Action.SUCCESS, result);
    PageAction action = (PageAction) this.getAction();
    assertEquals(action.getStrutsAction(), ApsAdminSystemConstants.ADD);
    assertEquals(coach_page.getCode(), action.getParentPageCode());
    assertEquals(coach_page.getGroup(), action.getGroup());
    assertTrue(action.isGroupSelectLock());
    assertTrue(action.isShowable());
    assertTrue(action.isDefaultShowlet());
    IPage customers_page = this._pageManager.getDraftPage("customers_page");
    result = this.executeNewPage(customers_page.getCode(), "pageManagerCoach");
    assertEquals(Action.SUCCESS, result);
    action = (PageAction) this.getAction();
    assertEquals(action.getStrutsAction(), ApsAdminSystemConstants.ADD);
    assertEquals(customers_page.getCode(), action.getParentPageCode());
    assertEquals(customers_page.getGroup(), action.getGroup());
    assertTrue(action.isGroupSelectLock());
    assertTrue(action.isShowable());
    assertTrue(action.isDefaultShowlet());
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage)

Example 29 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class TestPageAction method testEditForCoachUser.

public void testEditForCoachUser() throws Throwable {
    String selectedPageCode = this._pageManager.getDraftRoot().getCode();
    String result = this.executeActionOnPage(selectedPageCode, "pageManagerCoach", "edit");
    assertEquals("pageTree", result);
    // PAGINA
    IPage customers_page = this._pageManager.getDraftPage("customers_page");
    // NON
    // PREDISPOSTA
    // PER
    // LA
    // PUBBLICAZIONE
    // VOLANTE...
    result = this.executeActionOnPage(customers_page.getCode(), "pageManagerCustomers", "edit");
    assertEquals(Action.SUCCESS, result);
    PageAction action = (PageAction) this.getAction();
    assertEquals(action.getStrutsAction(), ApsAdminSystemConstants.EDIT);
    assertEquals(customers_page.getCode(), action.getPageCode());
    assertEquals(customers_page.getModel().getCode(), action.getModel());
    assertTrue(action.isShowable());
    assertTrue(action.isGroupSelectLock());
    Widget widget = customers_page.getWidgets()[customers_page.getModel().getMainFrame()];
    if (null != widget) {
        assertEquals("content_viewer", widget.getType().getCode());
        assertTrue(null != widget.getConfig() && !widget.getConfig().isEmpty());
    }
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) Widget(com.agiletec.aps.system.services.page.Widget)

Example 30 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class TestPageAction method testCloneForCoachUser.

public void testCloneForCoachUser() throws Throwable {
    IPage copied = this._pageManager.getDraftPage("coach_page");
    String result = this.executeCopyPage(copied, "admin");
    assertEquals(Action.SUCCESS, result);
    PageAction action = (PageAction) this.getAction();
    assertEquals(action.getStrutsAction(), ApsAdminSystemConstants.PASTE);
    assertEquals(copied.getCode(), action.getCopyPageCode());
    assertEquals(copied.getCode(), action.getParentPageCode());
    assertEquals(copied.getModel().getCode(), action.getModel());
    assertEquals(copied.getGroup(), action.getGroup());
    assertEquals(copied.isShowable(), action.isShowable());
    assertNull(action.getTitles().getProperty("it"));
    assertNull(action.getTitles().getProperty("en"));
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage)

Aggregations

IPage (com.agiletec.aps.system.services.page.IPage)209 Widget (com.agiletec.aps.system.services.page.Widget)43 ArrayList (java.util.ArrayList)33 Page (com.agiletec.aps.system.services.page.Page)21 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)20 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)18 ApsProperties (com.agiletec.aps.util.ApsProperties)16 RequestContext (com.agiletec.aps.system.RequestContext)15 List (java.util.List)14 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)14 Lang (com.agiletec.aps.system.services.lang.Lang)12 IPageManager (com.agiletec.aps.system.services.page.IPageManager)12 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)12 HashMap (java.util.HashMap)12 RestServerError (org.entando.entando.aps.system.exception.RestServerError)11 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)10 UserDetails (com.agiletec.aps.system.services.user.UserDetails)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)8 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)8 WidgetConfigurationDto (org.entando.entando.aps.system.services.page.model.WidgetConfigurationDto)8