use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentDispenser method testGetRenderedContent_1.
public void testGetRenderedContent_1() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo("ART1", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART1_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
this._contentDispenser.resolveLinks(outputInfo, reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART1.trim()), this.replaceNewLine(outputInfo.getRenderedContent().trim()));
this.setUserOnSession("admin");
outputInfo = this._contentDispenser.getRenderizationInfo("ART1", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART1_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
this._contentDispenser.resolveLinks(outputInfo, reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART1.trim()), this.replaceNewLine(outputInfo.getRenderedContent().trim()));
outputInfo = this._contentDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART104_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
this.setUserOnSession("editorCoach");
outputInfo = this._contentDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART104_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
this.setUserOnSession("pageManagerCoach");
outputInfo = this._contentDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART104_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestNavigatorParser method testGetTargets_1.
public void testGetTargets_1() throws Throwable {
RequestContext reqCtx = this.valueRequestContext("pagina_11", "admin");
String spec = "current.path";
List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
assertEquals(3, targets.size());
NavigatorTarget target0 = targets.get(0);
assertEquals("homepage", target0.getPage().getCode());
NavigatorTarget target1 = targets.get(1);
assertEquals("pagina_1", target1.getPage().getCode());
NavigatorTarget target2 = targets.get(2);
assertEquals("pagina_11", target2.getPage().getCode());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestNavigatorParser method testGetTargets_5.
public void testGetTargets_5() throws Throwable {
RequestContext reqCtx = this.valueRequestContext("pagina_1", "editorCoach");
String spec = "current.subtree(1)+parent.children";
List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
assertEquals(7, targets.size());
NavigatorTarget target0 = targets.get(0);
assertEquals("pagina_1", target0.getPage().getCode());
assertEquals(0, target0.getLevel());
NavigatorTarget target1 = targets.get(1);
assertEquals("pagina_11", target1.getPage().getCode());
assertEquals(1, target1.getLevel());
NavigatorTarget target2 = targets.get(2);
assertEquals("pagina_12", target2.getPage().getCode());
assertEquals(1, target2.getLevel());
NavigatorTarget target3 = targets.get(3);
assertEquals("pagina_1", target3.getPage().getCode());
assertEquals(0, target3.getLevel());
NavigatorTarget target4 = targets.get(4);
assertEquals("pagina_2", target4.getPage().getCode());
assertEquals(0, target4.getLevel());
NavigatorTarget target5 = targets.get(5);
assertEquals("coach_page", target5.getPage().getCode());
assertEquals(0, target5.getLevel());
NavigatorTarget target6 = targets.get(6);
assertEquals("customers_page", target6.getPage().getCode());
assertEquals(0, target6.getLevel());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestNavigatorParser method valueRequestContext.
private RequestContext valueRequestContext(String currentPageCode, String currentUserName) throws Throwable {
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession(currentUserName);
IPage currentPage = this._pageManager.getOnlinePage(currentPageCode);
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, currentPage);
return reqCtx;
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestURLManager method testGetURLString_2.
public void testGetURLString_2() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
PageURL pageURL = _urlManager.createURL(reqCtx);
pageURL.setLangCode("en");
pageURL.setPageCode("pagina_11");
try {
String url = this._urlManager.getURLString(pageURL, reqCtx);
assertEquals("/Entando/en/pagina_11.page", url);
this.changeUrlStyle(SystemConstants.CONFIG_PARAM_URL_STYLE_BREADCRUMBS);
url = this._urlManager.getURLString(pageURL, reqCtx);
assertEquals("/Entando/pages/en/homepage/pagina_1/pagina_11/", url);
} catch (Throwable t) {
throw t;
} finally {
this.changeUrlStyle(SystemConstants.CONFIG_PARAM_URL_STYLE_CLASSIC);
}
}
Aggregations