use of org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo 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 org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo 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 org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo 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);
}
}
}
Aggregations