Search in sources :

Example 51 with RequestContext

use of com.agiletec.aps.system.RequestContext in project entando-core by entando.

the class TestNavigatorParser method testGetTargets_2.

public void testGetTargets_2() throws Throwable {
    RequestContext reqCtx = this.valueRequestContext("contentview", "admin");
    String spec = "current.path";
    List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
    assertEquals(2, targets.size());
    NavigatorTarget target0 = targets.get(0);
    assertEquals("homepage", target0.getPage().getCode());
    NavigatorTarget target1 = targets.get(1);
    assertEquals("contentview", target1.getPage().getCode());
}
Also used : NavigatorTarget(com.agiletec.aps.system.services.page.widget.NavigatorTarget) RequestContext(com.agiletec.aps.system.RequestContext)

Example 52 with RequestContext

use of com.agiletec.aps.system.RequestContext in project entando-core by entando.

the class TestNavigatorParser method testGetTargets_3.

public void testGetTargets_3() throws Throwable {
    RequestContext reqCtx = this.valueRequestContext("pagina_11", SystemConstants.GUEST_USER_NAME);
    String spec = "abs(0).subtree(2)";
    List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
    assertEquals(5, targets.size());
    NavigatorTarget target0 = targets.get(0);
    assertEquals("homepage", target0.getPage().getCode());
    assertEquals(0, target0.getLevel());
    NavigatorTarget target1 = targets.get(1);
    assertEquals("pagina_1", target1.getPage().getCode());
    assertEquals(1, target1.getLevel());
    NavigatorTarget target2 = targets.get(2);
    assertEquals("pagina_11", target2.getPage().getCode());
    assertEquals(2, target2.getLevel());
    NavigatorTarget target3 = targets.get(3);
    assertEquals("pagina_12", target3.getPage().getCode());
    assertEquals(2, target3.getLevel());
    NavigatorTarget target4 = targets.get(4);
    assertEquals("pagina_2", target4.getPage().getCode());
    assertEquals(1, target4.getLevel());
}
Also used : NavigatorTarget(com.agiletec.aps.system.services.page.widget.NavigatorTarget) RequestContext(com.agiletec.aps.system.RequestContext)

Example 53 with RequestContext

use of com.agiletec.aps.system.RequestContext in project entando-core by entando.

the class TestURLManager method testGetURLString_1.

public void testGetURLString_1() throws Throwable {
    RequestContext reqCtx = this.getRequestContext();
    PageURL pageURL = _urlManager.createURL(reqCtx);
    pageURL.setLangCode("it");
    pageURL.setPageCode("homepage");
    try {
        String url = this._urlManager.getURLString(pageURL, reqCtx);
        assertEquals("/Entando/it/homepage.page", url);
        this.changeUrlStyle(SystemConstants.CONFIG_PARAM_URL_STYLE_BREADCRUMBS);
        url = this._urlManager.getURLString(pageURL, reqCtx);
        assertEquals("/Entando/pages/it/homepage/", url);
    } catch (Throwable t) {
        throw t;
    } finally {
        this.changeUrlStyle(SystemConstants.CONFIG_PARAM_URL_STYLE_CLASSIC);
    }
}
Also used : RequestContext(com.agiletec.aps.system.RequestContext)

Example 54 with RequestContext

use of com.agiletec.aps.system.RequestContext in project entando-core by entando.

the class TestContentListHelper method testGetFilters_OneDefinition.

public void testGetFilters_OneDefinition() {
    RequestContext reqCtx = this.getRequestContext();
    String contentType = "ART";
    String showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=ASC)";
    EntitySearchFilter[] filters = this._helper.getFilters(contentType, showletParam, reqCtx);
    assertNotNull(filters);
    assertEquals(1, filters.length);
    EntitySearchFilter entitySearchFilter = filters[0];
    assertNotNull(entitySearchFilter);
    assertEquals("Titolo", entitySearchFilter.getKey());
    assertEquals("START", entitySearchFilter.getStart());
    assertEquals("END", entitySearchFilter.getEnd());
    assertEquals("ASC", entitySearchFilter.getOrder().toString());
    contentType = "ART";
    showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=DESC)";
    filters = this._helper.getFilters(contentType, showletParam, reqCtx);
    assertNotNull(filters);
    assertEquals(1, filters.length);
    entitySearchFilter = filters[0];
    assertNotNull(entitySearchFilter);
    assertEquals("Titolo", entitySearchFilter.getKey());
    assertEquals("START", entitySearchFilter.getStart());
    assertEquals("END", entitySearchFilter.getEnd());
    assertEquals("DESC", entitySearchFilter.getOrder().toString());
    contentType = "ART";
    showletParam = "(key=descr;value=VALUE;attributeFilter=FALSE;order=ASC)";
    filters = this._helper.getFilters(contentType, showletParam, reqCtx);
    assertNotNull(filters);
    assertEquals(1, filters.length);
    entitySearchFilter = filters[0];
    assertNotNull(entitySearchFilter);
    assertEquals("descr", entitySearchFilter.getKey());
    assertEquals(null, entitySearchFilter.getStart());
    assertEquals(null, entitySearchFilter.getEnd());
    assertEquals("ASC", entitySearchFilter.getOrder().toString());
}
Also used : RequestContext(com.agiletec.aps.system.RequestContext) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Example 55 with RequestContext

use of com.agiletec.aps.system.RequestContext in project entando-core by entando.

the class TestContentListHelper method testGetFilters_TwoDefinition.

public void testGetFilters_TwoDefinition() {
    RequestContext reqCtx = this.getRequestContext();
    String contentType = "ART";
    String showletParam = "(key=Titolo;attributeFilter=TRUE;start=START;end=END;like=FALSE;order=ASC)+(key=descr;value=VALUE;attributeFilter=FALSE;order=ASC)";
    EntitySearchFilter[] filters = this._helper.getFilters(contentType, showletParam, reqCtx);
    assertNotNull(filters);
    assertEquals(2, filters.length);
    EntitySearchFilter entitySearchFilter = filters[0];
    assertNotNull(entitySearchFilter);
    assertEquals("Titolo", entitySearchFilter.getKey());
    assertEquals("START", entitySearchFilter.getStart());
    assertEquals("END", entitySearchFilter.getEnd());
    assertEquals("ASC", entitySearchFilter.getOrder().toString());
    assertEquals(null, entitySearchFilter.getValue());
    assertTrue(entitySearchFilter.isAttributeFilter());
    entitySearchFilter = filters[1];
    assertNotNull(entitySearchFilter);
    assertEquals("descr", entitySearchFilter.getKey());
    assertEquals(null, entitySearchFilter.getStart());
    assertEquals(null, entitySearchFilter.getEnd());
    assertEquals("ASC", entitySearchFilter.getOrder().toString());
    assertFalse(entitySearchFilter.isAttributeFilter());
    Object obj = entitySearchFilter.getValue();
    assertNotNull(obj);
    assertEquals(String.class, obj.getClass());
    assertEquals("VALUE", (String) obj);
}
Also used : RequestContext(com.agiletec.aps.system.RequestContext) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Aggregations

RequestContext (com.agiletec.aps.system.RequestContext)89 ServletRequest (javax.servlet.ServletRequest)25 JspException (javax.servlet.jsp.JspException)22 IPage (com.agiletec.aps.system.services.page.IPage)15 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)12 Lang (com.agiletec.aps.system.services.lang.Lang)10 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)9 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 Widget (com.agiletec.aps.system.services.page.Widget)5 NavigatorTarget (com.agiletec.aps.system.services.page.widget.NavigatorTarget)5 IURLManager (com.agiletec.aps.system.services.url.IURLManager)5 ContentRenderizationInfo (com.agiletec.plugins.jacms.aps.system.services.dispenser.ContentRenderizationInfo)5 DataObjectRenderizationInfo (org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo)5 ILangManager (com.agiletec.aps.system.services.lang.ILangManager)4 UserDetails (com.agiletec.aps.system.services.user.UserDetails)4 ControllerManager (com.agiletec.aps.system.services.controller.ControllerManager)3 HeadInfoContainer (com.agiletec.aps.tags.util.HeadInfoContainer)3 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)3 IContentListWidgetHelper (com.agiletec.plugins.jacms.aps.system.services.content.widget.IContentListWidgetHelper)3 IContentViewerHelper (com.agiletec.plugins.jacms.aps.system.services.content.widget.IContentViewerHelper)3