use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestDataObjectListHelper 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);
MockDataObjectListTagBean bean = new MockDataObjectListTagBean();
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 TestDataObjectDispenser method testGetUnauthorizedContent.
public void testGetUnauthorizedContent() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
DataObjectRenderizationInfo outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals("Current user 'guest' can't view this DataObject", outputInfo.getRenderedDataobject().trim());
this.setUserOnSession("editorCustomers");
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals("Current user 'editorCustomers' can't view this DataObject", outputInfo.getRenderedDataobject().trim());
this.setUserOnSession("supervisorCustomers");
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals("Current user 'supervisorCustomers' can't view this DataObject", outputInfo.getRenderedDataobject().trim());
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestDataObjectDispenser method testGetRenderedContent_1.
public void testGetRenderedContent_1() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
DataObjectRenderizationInfo outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART1", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART1_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
this.setUserOnSession("admin");
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART1", 2, "en", reqCtx);
assertEquals(this.replaceNewLine(_attendedEnART1_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART104_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
this.setUserOnSession("editorCoach");
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART104_cached.trim()), this.replaceNewLine(outputInfo.getRenderedDataobject().trim()));
this.setUserOnSession("pageManagerCoach");
outputInfo = this._dataObjectDispenser.getRenderizationInfo("ART104", 2, "it", reqCtx);
assertEquals(this.replaceNewLine(_attendedItART104_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_4.
public void testGetRenderedContent_4() throws Throwable {
String dataobjectId = "ART120";
String dataobjectShapeModel = "title (Text): testo=$data.Titolo.getText()";
int modelId = 1972;
try {
this.addNewDataObjectModel(modelId, dataobjectShapeModel, "ART");
RequestContext reqCtx = this.getRequestContext();
this.setUserOnSession("admin");
DataObjectRenderizationInfo outputInfo = this._dataObjectDispenser.getRenderizationInfo(dataobjectId, modelId, "en", reqCtx);
assertEquals("title (Text): testo=Title of Administrator's Content", outputInfo.getRenderedDataobject());
DataObjectModel model = this._dataObjectModelManager.getDataObjectModel(modelId);
String newContentShapeModel = "title: testo=$data.Titolo.getText()";
model.setShape(newContentShapeModel);
this._dataObjectModelManager.updateDataObjectModel(model);
this.waitNotifyingThread();
outputInfo = this._dataObjectDispenser.getRenderizationInfo(dataobjectId, modelId, "en", reqCtx);
assertEquals("title: testo=Title of Administrator's Content", outputInfo.getRenderedDataobject());
} catch (Throwable t) {
throw t;
} finally {
DataObjectModel model = this._dataObjectModelManager.getDataObjectModel(modelId);
if (null != model) {
this._dataObjectModelManager.removeDataObjectModel(model);
}
}
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class TestNavigatorParser method testGetTargets_4.
public void testGetTargets_4() throws Throwable {
RequestContext reqCtx = this.valueRequestContext("pagina_11", "editorCustomers");
String spec = "code(homepage).children";
List<NavigatorTarget> targets = this._navigatorParser.parseSpec(spec, reqCtx);
assertEquals(3, targets.size());
NavigatorTarget target0 = targets.get(0);
assertEquals("pagina_1", target0.getPage().getCode());
assertEquals(0, target0.getLevel());
NavigatorTarget target1 = targets.get(1);
assertEquals("pagina_2", target1.getPage().getCode());
assertEquals(0, target1.getLevel());
NavigatorTarget target2 = targets.get(2);
assertEquals("customers_page", target2.getPage().getCode());
assertEquals(0, target2.getLevel());
}
Aggregations