use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class ContentManagerTest method testGetXML.
@Test
public void testGetXML() throws Throwable {
String typeCode = "ART";
// @formatter:off
when(entityTypeFactory.extractEntityType(typeCode, Content.class, contentManager.getConfigItemName(), this.entityTypeDom, contentManager.getName(), this.entityDom)).thenReturn(this.createFakeEntity(typeCode, "contentview", "1"));
// @formatter:on
Content content = contentManager.createContentType(typeCode);
ContentDOM contentDOM = new ContentDOM();
contentDOM.setRootElementName("content");
content.setEntityDOM(contentDOM);
content.setId("ART1");
content.setTypeCode("Articolo");
content.setTypeDescription("Articolo");
content.setDescription("descrizione");
content.setStatus(Content.STATUS_DRAFT);
content.setMainGroup("free");
Category cat13 = new Category();
cat13.setCode("13");
content.addCategory(cat13);
Category cat19 = new Category();
cat19.setCode("19");
content.addCategory(cat19);
String xml = content.getXML();
assertNotNull(xml);
assertTrue(xml.indexOf("<content id=\"ART1\" typecode=\"Articolo\" typedescr=\"Articolo\">") != -1);
assertTrue(xml.indexOf("<descr>descrizione</descr>") != -1);
assertTrue(xml.indexOf("<status>" + Content.STATUS_DRAFT + "</status>") != -1);
assertTrue(xml.indexOf("<category id=\"13\" />") != -1);
assertTrue(xml.indexOf("<category id=\"19\" />") != -1);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class ContentManagerTest method testCreateContent.
@Test
public void testCreateContent() throws ApsSystemException {
String typeCode = "ART";
// @formatter:off
when(entityTypeFactory.extractEntityType(typeCode, Content.class, contentManager.getConfigItemName(), this.entityTypeDom, contentManager.getName(), this.entityDom)).thenReturn(this.createFakeEntity(typeCode, "contentview", "1"));
// @formatter:on
Content content = this.contentManager.createContentType(typeCode);
assertThat(content, is(not(nullValue())));
assertThat(content.getViewPage(), is("contentview"));
assertThat(content.getDefaultModel(), is("1"));
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestContentManager method testGetXML.
public void testGetXML() throws Throwable {
Content content = this._contentManager.createContentType("ART");
content.setId("ART1");
content.setTypeCode("Articolo");
content.setTypeDescription("Articolo");
content.setDescription("descrizione");
content.setStatus(Content.STATUS_DRAFT);
content.setMainGroup("free");
Category cat13 = new Category();
cat13.setCode("13");
content.addCategory(cat13);
Category cat19 = new Category();
cat19.setCode("19");
content.addCategory(cat19);
String xml = content.getXML();
assertNotNull(xml);
assertTrue(xml.indexOf("<content id=\"ART1\" typecode=\"Articolo\" typedescr=\"Articolo\">") != -1);
assertTrue(xml.indexOf("<descr>descrizione</descr>") != -1);
assertTrue(xml.indexOf("<status>" + Content.STATUS_DRAFT + "</status>") != -1);
assertTrue(xml.indexOf("<category id=\"13\" />") != -1);
assertTrue(xml.indexOf("<category id=\"19\" />") != -1);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestContentManager method testLoadOrderedPublicEvents_4.
public void testLoadOrderedPublicEvents_4() throws Throwable {
Content masterContent = this._contentManager.loadContent("EVN193", true);
masterContent.setId(null);
DateAttribute dateAttribute = (DateAttribute) masterContent.getAttribute("DataInizio");
dateAttribute.setDate(DateConverter.parseDate("17/06/2019", "dd/MM/yyyy"));
try {
this._contentManager.saveContent(masterContent);
this._contentManager.insertOnLineContent(masterContent);
this.waitNotifyingThread();
EntitySearchFilter filterForDate = new EntitySearchFilter("DataInizio", true);
filterForDate.setOrder(EntitySearchFilter.DESC_ORDER);
EntitySearchFilter[] filters = { filterForDate };
List<String> contents = _contentManager.loadPublicContentsId("EVN", null, filters, null);
String[] expectedFreeOrderedContentsId = { "EVN194", masterContent.getId(), "EVN193", "EVN24", "EVN23", "EVN25", "EVN20", "EVN21", "EVN192", "EVN191" };
assertEquals(expectedFreeOrderedContentsId.length, contents.size());
for (int i = 0; i < expectedFreeOrderedContentsId.length; i++) {
assertEquals(expectedFreeOrderedContentsId[i], contents.get(i));
}
} catch (Throwable t) {
throw t;
} finally {
if (null != masterContent.getId() && !"EVN193".equals(masterContent.getId())) {
this._contentManager.removeOnLineContent(masterContent);
this._contentManager.deleteContent(masterContent);
}
}
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestContentManager method deleteContents.
private void deleteContents(String[] contentIds) throws Throwable {
for (int i = 0; i < contentIds.length; i++) {
Content content = this._contentManager.loadContent(contentIds[i], false);
if (null != content) {
this._contentManager.removeOnLineContent(content);
this._contentManager.deleteContent(content);
}
}
}
Aggregations