use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestCacheInfoManager method testGetRenderedContent_3.
public void testGetRenderedContent_3() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
String contentId = null;
String langCode = "en";
long modelId = -1;
try {
modelId = this.createMockContentModel();
contentId = this.createMockContent();
String renderInfoCacheKey = BaseContentDispenser.getRenderizationInfoCacheKey(contentId, modelId, langCode, reqCtx);
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, langCode, reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
// -----------
ContentModel contentModel = this._contentModelManager.getContentModel(modelId);
contentModel.setDescription("Modified model description");
this._contentModelManager.updateContentModel(contentModel);
super.waitNotifyingThread();
assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
// -----------
outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, langCode, reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
} catch (Throwable t) {
throw t;
} finally {
this.deleteMockContentObject(contentId, modelId);
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestCacheInfoManager method testGetRenderedContent_2.
public void testGetRenderedContent_2() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
String contentId = null;
String langCode = "en";
long modelId = -1;
try {
modelId = this.createMockContentModel();
contentId = this.createMockContent();
String renderInfoCacheKey = BaseContentDispenser.getRenderizationInfoCacheKey(contentId, modelId, langCode, reqCtx);
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, langCode, reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
// -----------
Content content = this._contentManager.loadContent(contentId, true);
content.setDescription("Modified content description");
this._contentManager.insertOnLineContent(content);
super.waitNotifyingThread();
assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
// -----------
outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, langCode, reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
} catch (Throwable t) {
throw t;
} finally {
this.deleteMockContentObject(contentId, modelId);
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestDataObjectDispenser method testGetRenderedContent_2.
public void testGetRenderedContent_2() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession("admin");
DataObjectRenderizationInfo outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART120", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART120_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART120", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART120_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART121", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART121_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART121", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART121_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART122", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART122_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestDataObjectDispenser method testGetRenderedContent_3.
public void testGetRenderedContent_3() throws Throwable {
DataObject dataobject = this._dataObjectManager.loadDataObject("ART120", true);
dataobject.setId(null);
try {
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession("admin");
this._dataObjectManager.insertDataObject(dataobject);
DataObjectRenderizationInfo outputInfo = this._dataObjectDispenser.getRenderizationInfo(dataobject.getId(), 2, "it", reqCtx);
assertNotNull(outputInfo);
// assertNotNull(this._cacheInfoManager.getFromCache(JacmsSystemConstants.CONTENT_CACHE_PREFIX+dataobject.getId()));
// assertNotNull(this._cacheInfoManager.getFromCache(JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX+dataobject.getId()));
this._dataObjectManager.insertDataObject(dataobject);
this.waitNotifyingThread();
// assertNull(this._cacheInfoManager.getFromCache(JacmsSystemConstants.CONTENT_CACHE_PREFIX+dataobject.getId()));
// assertNull(this._cacheInfoManager.getFromCache(JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX+dataobject.getId()));
} catch (Throwable t) {
throw t;
} finally {
if (null != dataobject.getId()) {
this._dataObjectManager.deleteDataObject(dataobject);
}
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestAuthenticator method testService_1.
public void testService_1() throws ApsSystemException {
RequestContext reqCtx = this.getRequestContext();
int status = _authenticator.service(reqCtx, ControllerManager.CONTINUE);
assertEquals(status, ControllerManager.CONTINUE);
UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
assertEquals(SystemConstants.GUEST_USER_NAME, currentUser.getUsername());
}
Aggregations