use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentListHelper method testGetContents_2.
public void testGetContents_2() throws Throwable {
String pageCode = "pagina_1";
int frame = 1;
try {
this.setUserOnSession("admin");
RequestContext reqCtx = this.valueRequestContext(pageCode, frame);
MockContentListTagBean bean = new MockContentListTagBean();
bean.setContentType("EVN");
bean.addCategory("evento");
EntitySearchFilter filter = new EntitySearchFilter("DataInizio", true);
filter.setOrder(EntitySearchFilter.DESC_ORDER);
bean.addFilter(filter);
List<String> contents = this._helper.getContentsId(bean, reqCtx);
String[] expected = { "EVN193", "EVN192" };
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_2.
public void testGetRenderedContent_2() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession("admin");
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo("ART120", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART120_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
this._contentDispenser.resolveLinks(outputInfo, reqCtx);
assertEquals(this.replaceNewLine(_attendedItART120.trim()), this.replaceNewLine(outputInfo.getRenderedContent().trim()));
outputInfo = this._contentDispenser.getRenderizationInfo("ART120", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART120_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
this._contentDispenser.resolveLinks(outputInfo, reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART120.trim()), this.replaceNewLine(outputInfo.getRenderedContent().trim()));
outputInfo = this._contentDispenser.getRenderizationInfo("ART121", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART121_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
outputInfo = this._contentDispenser.getRenderizationInfo("ART121", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART121_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
outputInfo = this._contentDispenser.getRenderizationInfo("ART122", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART122_cached.trim()), this.replaceNewLine(outputInfo.getCachedRenderedContent().trim()));
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentDispenser method testGetUnauthorizedContent.
public void testGetUnauthorizedContent() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals("Current user 'guest' can't view this content", outputInfo.getCachedRenderedContent().trim());
this.setUserOnSession("editorCustomers");
outputInfo = this._contentDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals("Current user 'editorCustomers' can't view this content", outputInfo.getCachedRenderedContent().trim());
this.setUserOnSession("supervisorCustomers");
outputInfo = this._contentDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals("Current user 'supervisorCustomers' can't view this content", outputInfo.getCachedRenderedContent().trim());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentDispenser method testGetRenderedContent_4.
public void testGetRenderedContent_4() throws Throwable {
String contentId = "ART120";
String contentShapeModel = "title (Text): testo=$content.Titolo.getText()";
int modelId = 1972;
try {
this.addNewContentModel(modelId, contentShapeModel, "ART");
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession("admin");
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, "en", reqCtx);
assertEquals("title (Text): testo=Title of Administrator's Content", outputInfo.getCachedRenderedContent());
ContentModel model = this._contentModelManager.getContentModel(modelId);
String newContentShapeModel = "title: testo=$content.Titolo.getText()";
model.setContentShape(newContentShapeModel);
this._contentModelManager.updateContentModel(model);
this.waitNotifyingThread();
outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, "en", reqCtx);
assertEquals("title: testo=Title of Administrator's Content", outputInfo.getCachedRenderedContent());
} catch (Throwable t) {
throw t;
} finally {
ContentModel model = this._contentModelManager.getContentModel(modelId);
if (null != model) {
this._contentModelManager.removeContentModel(model);
}
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestContentDispenser method testGetRenderedContentWithWrongModel.
public void testGetRenderedContentWithWrongModel() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
String output = _contentDispenser.getRenderedContent("ART1", 67, "en", reqCtx);
assertEquals("Content model 67 undefined", output.trim());
}
Aggregations