Search in sources :

Example 6 with DataObjectRenderizationInfo

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

Example 7 with DataObjectRenderizationInfo

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

Example 8 with DataObjectRenderizationInfo

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

Aggregations

DataObjectRenderizationInfo (org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo)8 RequestContext (com.agiletec.aps.system.RequestContext)5 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 Lang (com.agiletec.aps.system.services.lang.Lang)1 Widget (com.agiletec.aps.system.services.page.Widget)1 ApsProperties (com.agiletec.aps.util.ApsProperties)1 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)1 DataObjectModel (org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)1