use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class BaseTestCase method setUp.
@Override
protected void setUp() throws Exception {
try {
super.setUp();
ServletContext srvCtx = new MockServletContext("", new FileSystemResourceLoader());
ApplicationContext applicationContext = this.getConfigUtils().createApplicationContext(srvCtx);
this.setApplicationContext(applicationContext);
RequestContext reqCtx = this.createRequestContext(applicationContext, srvCtx);
this.setRequestContext(reqCtx);
this.setUserOnSession("guest");
} catch (Exception e) {
throw e;
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class SystemInfoWrapper method getActionPathUrl.
public String getActionPathUrl(String actionPath) {
String url = null;
RequestContext reqCtx = this.getReqCtx();
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, reqCtx.getRequest());
try {
PageURL pageUrl = urlManager.createURL(reqCtx);
IPage currPage = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
pageUrl.setPage(currPage);
pageUrl.addParam(InternalServletTag.REQUEST_PARAM_ACTIONPATH, actionPath);
pageUrl.addParam(InternalServletTag.REQUEST_PARAM_FRAMEDEST, currentFrame.toString());
url = pageUrl.getURL();
} catch (Throwable t) {
_logger.error("Error getting path for action path: {}", actionPath, t);
return null;
}
return url;
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentListHelper method valueRequestContext.
private RequestContext valueRequestContext(String pageCode, int frame) throws Throwable {
RequestContext reqCtx = this.getRequestContext();
try {
Widget widgetToAdd = this.getShowletForTest("content_viewer_list", null);
this.setPageWidgets(pageCode, frame, widgetToAdd);
IPage page = this._pageManager.getOnlinePage(pageCode);
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, page);
Widget widget = page.getWidgets()[frame];
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, widget);
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME, new Integer(frame));
} catch (Throwable t) {
this.setPageWidgets(pageCode, frame, null);
throw t;
}
return reqCtx;
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentListHelper method testGetContents_1.
public void testGetContents_1() throws Throwable {
String pageCode = "pagina_1";
int frame = 1;
try {
this.setUserOnSession("guest");
RequestContext reqCtx = this.valueRequestContext(pageCode, frame);
MockContentListTagBean bean = new MockContentListTagBean();
bean.setContentType("EVN");
EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true);
filter.setOrder(EntitySearchFilter.DESC_ORDER);
bean.addFilter(filter);
List<String> contents = this._helper.getContentsId(bean, reqCtx);
String[] expected = { "EVN194", "EVN193", "EVN24", "EVN23", "EVN25", "EVN20", "EVN21", "EVN192", "EVN191" };
assertEquals(expected.length, contents.size());
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], contents.get(i));
}
} catch (Throwable t) {
throw t;
} finally {
this.setPageWidgets(pageCode, frame, null);
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentDispenser method testGetRenderedContent_3.
public void testGetRenderedContent_3() throws Throwable {
Content content = this._contentManager.loadContent("ART120", true);
content.setId(null);
try {
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession("admin");
this._contentManager.insertOnLineContent(content);
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo(content.getId(), 2, "it", reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX + content.getId()));
this._contentManager.insertOnLineContent(content);
this.waitNotifyingThread();
assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX + content.getId()));
} catch (Throwable t) {
throw t;
} finally {
if (null != content.getId()) {
this._contentManager.deleteContent(content);
}
}
}
Aggregations