use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestSearchEngineManager method createDataObject_3.
private DataObject createDataObject_3() {
DataObject content = new DataObject();
content.setId("103");
content.setMainGroup(Group.FREE_GROUP_NAME);
content.setTypeCode("ART");
TextAttribute text = new TextAttribute();
text.setName("Articolo");
text.setType("Text");
text.setIndexingType(IndexableAttributeInterface.INDEXING_TYPE_TEXT);
text.setText("La vita รจ una cosa meravigliosa", "it");
text.setText("Life is a wonderful thing", "en");
content.addAttribute(text);
Category category = this._categoryManager.getCategory("general_cat1");
content.addCategory(category);
return content;
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManagerTest method testCrateWithDefaultModel.
@Test
public void testCrateWithDefaultModel() throws ApsSystemException {
String typeCode = "ART";
// @formatter:off
when(entityTypeFactory.extractEntityType("ART", DataObject.class, dataObjectManager.getConfigItemName(), this.entityTypeDom, dataObjectManager.getName(), this.entityDom)).thenReturn(this.createFakeEntity(typeCode, "1", null));
// @formatter:on
DataObject dataObject = dataObjectManager.createDataObject(typeCode);
assertThat(dataObject, is(not(nullValue())));
String defaultModel = dataObject.getDefaultModel();
assertThat(defaultModel, is("1"));
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManagerTest method testSave.
@Test
public void testSave() throws ApsSystemException {
String typeCode = "ART";
// @formatter:off
when(beanFactory.getBean(SystemConstants.KEY_GENERATOR_MANAGER)).thenReturn(new FakeKeyGeneratorManager());
when(entityTypeFactory.extractEntityType("ART", DataObject.class, dataObjectManager.getConfigItemName(), this.entityTypeDom, dataObjectManager.getName(), this.entityDom)).thenReturn(this.createFakeEntity(typeCode, "1", "dataObjectview"));
// @formatter:on
DataObject dataObject = dataObjectManager.createDataObject(typeCode);
dataObjectManager.saveDataObject(dataObject);
assertThat(dataObject.getId(), is("ART1"));
Mockito.verify(dataObjectDao, Mockito.times(1)).addEntity(dataObject);
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManagerTest method testCreateDataObject.
@Test
public void testCreateDataObject() throws ApsSystemException {
String typeCode = "ART";
// @formatter:off
when(entityTypeFactory.extractEntityType("ART", DataObject.class, dataObjectManager.getConfigItemName(), this.entityTypeDom, dataObjectManager.getName(), this.entityDom)).thenReturn(this.createFakeEntity(typeCode, null, null));
// @formatter:on
DataObject dataObjectType = dataObjectManager.createDataObject(typeCode);
assertThat(dataObjectType, is(not(nullValue())));
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManagerTest method createFakeEntity.
private IApsEntity createFakeEntity(String typeCode, String defaultModel, String viewPage) {
DataObject dataObject = new DataObject();
dataObject.setTypeCode(typeCode);
dataObject.setDefaultModel(defaultModel);
dataObject.setViewPage(viewPage);
return dataObject;
}
Aggregations