Search in sources :

Example 36 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class DataObjectMapperCacheWrapperTest method createMockWidget.

private Widget createMockWidget() {
    Widget widget = new Widget();
    WidgetType type = new WidgetType();
    type.setCode("type");
    WidgetTypeParameter param1 = new WidgetTypeParameter();
    param1.setName("dataId");
    WidgetTypeParameter param2 = new WidgetTypeParameter();
    param2.setName("testParam");
    List<WidgetTypeParameter> params = Arrays.asList(param1, param2);
    type.setTypeParameters(params);
    widget.setType(type);
    ApsProperties props = new ApsProperties();
    props.put("dataId", "id1");
    props.put("testParam", "test");
    widget.setConfig(props);
    return widget;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) WidgetTypeParameter(org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 37 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class AbstractTestPageModelAction method createMockPageModel.

protected PageModel createMockPageModel(String code) {
    PageModel model = new PageModel();
    model.setCode(code);
    model.setDescription("Description of model " + code);
    Frame frame0 = new Frame();
    frame0.setPos(0);
    frame0.setDescription("Frame 0");
    frame0.setMainFrame(true);
    Frame frame1 = new Frame();
    frame1.setPos(1);
    frame1.setDescription("Frame 1");
    Widget defWidg1 = new Widget();
    defWidg1.setType(this._widgetTypeManager.getWidgetType("formAction"));
    ApsProperties props1 = new ApsProperties();
    props1.setProperty("actionPath", "/do/login");
    defWidg1.setConfig(props1);
    frame1.setDefaultWidget(defWidg1);
    Frame frame2 = new Frame();
    frame2.setPos(1);
    frame2.setDescription("Frame 2");
    Widget defWidg2 = new Widget();
    defWidg2.setType(this._widgetTypeManager.getWidgetType("login_form"));
    frame2.setDefaultWidget(defWidg2);
    Frame[] configuration = { frame0, frame1, frame2 };
    model.setConfiguration(configuration);
    model.setTemplate("<strong>Freemarker template content</strong>");
    return model;
}
Also used : Frame(com.agiletec.aps.system.services.pagemodel.Frame) Widget(com.agiletec.aps.system.services.page.Widget) PageModel(com.agiletec.aps.system.services.pagemodel.PageModel) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 38 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class TestWidgetTypeAction method testAddNewUserWidgetType.

public void testAddNewUserWidgetType() throws Throwable {
    String widgetTypeCode = "randomWidgetCode_3";
    try {
        this.setUserOnSession("admin");
        this.initAction("/do/Portal/WidgetType", "save");
        this.addParameter("widgetTypeCode", widgetTypeCode);
        this.addParameter("englishTitle", "en");
        this.addParameter("italianTitle", "it");
        this.addParameter("parentWidgetTypeCode", "formAction");
        this.addParameter("strutsAction", WidgetTypeAction.NEW_USER_WIDGET);
        this.addParameter("actionPath", "/myjsp.jsp");
        String result = this.executeAction();
        assertEquals(Action.SUCCESS, result);
        WidgetType addedType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
        assertNotNull(addedType);
        ApsProperties config = addedType.getConfig();
        assertEquals(1, config.size());
        assertEquals("/myjsp.jsp", config.getProperty("actionPath"));
    } catch (Throwable t) {
        throw t;
    } finally {
        this._widgetTypeManager.deleteWidgetType(widgetTypeCode);
    }
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 39 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class TestWidgetTypeAction method testUpdate_3.

public void testUpdate_3() throws Throwable {
    String widgetTypeCode = "test_widgetType_Upd3";
    assertNull(this._widgetTypeManager.getWidgetType(widgetTypeCode));
    try {
        WidgetType type = this.createNewLogicWidgetType(widgetTypeCode);
        this._widgetTypeManager.addWidgetType(type);
        ApsProperties newProperties = new ApsProperties();
        newProperties.put("actionPath", "/do/dologin");
        String result = this.executeUpdate(widgetTypeCode, "Titolo modificato", "Modified title", "admin", newProperties, "**GUI**");
        assertEquals(Action.SUCCESS, result);
        WidgetType extracted = this._widgetTypeManager.getWidgetType(widgetTypeCode);
        assertNotNull(extracted);
        assertEquals("Titolo modificato", extracted.getTitles().get("it"));
        assertEquals("Modified title", extracted.getTitles().get("en"));
        assertEquals("/do/dologin", extracted.getConfig().getProperty("actionPath"));
        newProperties.put("actionPath", "/do/api/dologin");
        result = this.executeUpdate(widgetTypeCode, "Titolo modificato 2", "Modified title 2", "pageManagerCoach", newProperties, "*GUI*");
        assertEquals(Action.SUCCESS, result);
        extracted = this._widgetTypeManager.getWidgetType(widgetTypeCode);
        assertNotNull(extracted);
        assertEquals("Titolo modificato 2", extracted.getTitles().get("it"));
        assertEquals("Modified title 2", extracted.getTitles().get("en"));
        assertEquals("/do/dologin", extracted.getConfig().getProperty("actionPath"));
    } catch (Throwable t) {
        throw t;
    } finally {
        this.cleanDatabase(widgetTypeCode);
    }
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 40 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class TestWidgetTypeAction method createNewLogicWidgetType.

private WidgetType createNewLogicWidgetType(String code) {
    WidgetType type = this.createNewWidgetType(code);
    WidgetType parent = this._widgetTypeManager.getWidgetType("formAction");
    assertNotNull(parent);
    type.setParentType(parent);
    ApsProperties config = new ApsProperties();
    config.put("actionPath", "/do/login");
    type.setConfig(config);
    return type;
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApsProperties(com.agiletec.aps.util.ApsProperties)

Aggregations

ApsProperties (com.agiletec.aps.util.ApsProperties)157 Widget (com.agiletec.aps.system.services.page.Widget)62 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)35 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)28 HashMap (java.util.HashMap)22 IPage (com.agiletec.aps.system.services.page.IPage)18 Lang (com.agiletec.aps.system.services.lang.Lang)14 Test (org.junit.Test)12 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)10 Properties (java.util.Properties)9 RestServerError (org.entando.entando.aps.system.exception.RestServerError)9 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)9 Page (com.agiletec.aps.system.services.page.Page)8 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)8 List (java.util.List)8 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)7 NavigatorExpression (com.agiletec.aps.system.services.page.widget.NavigatorExpression)6 ArrayList (java.util.ArrayList)6 IWidgetTypeManager (org.entando.entando.aps.system.services.widgettype.IWidgetTypeManager)6 ResourceNotFoundException (org.entando.entando.aps.system.exception.ResourceNotFoundException)5