use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.
the class TestDataObjectModelAction method testDeleteModel.
public void testDeleteModel() throws Throwable {
List<DataObjectModel> eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(0, eventModels.size());
long modelId = 99;
this.addModelForTest(modelId, "EVN");
eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(1, eventModels.size());
DataObjectModel model = (DataObjectModel) eventModels.get(0);
try {
this.setUserOnSession("admin");
this.initAction("/do/dataobject/model", "delete");
this.addParameter("modelId", String.valueOf(modelId));
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
model = this._dataObjectModelManager.getDataObjectModel(modelId);
assertNull(model);
eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(0, eventModels.size());
} catch (Throwable t) {
model = this._dataObjectModelManager.getDataObjectModel(modelId);
if (null != model) {
this._dataObjectModelManager.removeDataObjectModel(model);
}
eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(0, eventModels.size());
throw t;
}
}
use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.
the class TestDataObjectModelAction method testAddNewModel.
public void testAddNewModel() throws Throwable {
List<DataObjectModel> eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(0, eventModels.size());
long modelIdToAdd = 99;
try {
this.setUserOnSession("admin");
this.initAction("/do/dataobject/model", "save");
addParameter("dataType", "EVN");
addParameter("strutsAction", new Integer(ApsAdminSystemConstants.ADD).toString());
addParameter("description", "dataObjectModel description");
addParameter("dataObjectShape", "dataObjectShape field value\r\n");
addParameter("modelId", String.valueOf(modelIdToAdd));
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(1, eventModels.size());
DataObjectModel model = eventModels.get(0);
assertEquals("dataObjectShape field value\r\n", model.getShape());
} catch (Throwable t) {
throw t;
} finally {
DataObjectModel model = this._dataObjectModelManager.getDataObjectModel(modelIdToAdd);
if (null != model) {
this._dataObjectModelManager.removeDataObjectModel(model);
}
eventModels = this._dataObjectModelManager.getModelsForDataObjectType("EVN");
assertEquals(0, eventModels.size());
}
}
use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.
the class TestDataObjectModelFinderAction method tearDown.
@Override
protected void tearDown() throws Exception {
super.tearDown();
DataObjectModel model = this._dataObjectModelManager.getDataObjectModel(MODEL_ID);
if (null != model) {
this._dataObjectModelManager.removeDataObjectModel(model);
}
}
use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.
the class TestDataObjectModelFinderAction method testSearch_2.
public void testSearch_2() throws Throwable {
DataObjectModel dataObjectModel = this.createDataObjectModel(MODEL_ID, "EVN");
this._dataObjectModelManager.addDataObjectModel(dataObjectModel);
String result = this.executeSearch("");
assertEquals(Action.SUCCESS, result);
DataObjectModelFinderAction dataObjectModelFinderAction = (DataObjectModelFinderAction) this.getAction();
List<DataObjectModel> dataObjectModels = dataObjectModelFinderAction.getDataObjectModels();
assertEquals(5, dataObjectModels.size());
result = this.executeSearch("EVN");
assertEquals(Action.SUCCESS, result);
dataObjectModelFinderAction = (DataObjectModelFinderAction) this.getAction();
dataObjectModels = dataObjectModelFinderAction.getDataObjectModels();
assertEquals(1, dataObjectModels.size());
}
Aggregations