Search in sources :

Example 26 with RequestContext

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);
    }
}
Also used : ContentRenderizationInfo(com.agiletec.plugins.jacms.aps.system.services.dispenser.ContentRenderizationInfo) ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel) RequestContext(com.agiletec.aps.system.RequestContext)

Example 27 with RequestContext

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);
    }
}
Also used : ContentRenderizationInfo(com.agiletec.plugins.jacms.aps.system.services.dispenser.ContentRenderizationInfo) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) RequestContext(com.agiletec.aps.system.RequestContext)

Example 28 with RequestContext

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()));
}
Also used : DataObjectRenderizationInfo(org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo) RequestContext(com.agiletec.aps.system.RequestContext)

Example 29 with RequestContext

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);
        }
    }
}
Also used : DataObjectRenderizationInfo(org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo) DataObject(org.entando.entando.aps.system.services.dataobject.model.DataObject) RequestContext(com.agiletec.aps.system.RequestContext)

Example 30 with RequestContext

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());
}
Also used : UserDetails(com.agiletec.aps.system.services.user.UserDetails) RequestContext(com.agiletec.aps.system.RequestContext)

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