use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestContentGroupAction method deleteContents.
private void deleteContents(String[] contentIds) throws Throwable {
for (int i = 0; i < contentIds.length; i++) {
Content content = this.getContentManager().loadContent(contentIds[i], false);
if (null != content) {
this.getContentManager().removeOnLineContent(content);
this.getContentManager().deleteContent(content);
}
}
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestContentGroupAction method testInsertOnLineContents_1.
public void testInsertOnLineContents_1() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTI FREE
String[] masterContentIds = { "ART111", "EVN20" };
String[] newContentIds = null;
try {
newContentIds = this.addDraftContentsForTest(masterContentIds, false);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertFalse(content.isOnLine());
}
this.initAction("/do/jacms/Content", "approveContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertTrue(content.isOnLine());
}
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(1, messages.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestIntroNewContentAction method testCreateNewVoid.
public void testCreateNewVoid() throws Throwable {
String contentTypeCode = "ART";
Content prototype = this.getContentManager().createContentType(contentTypeCode);
String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(prototype, ApsAdminSystemConstants.ADD);
this.initAction("/do/jacms/Content", "createNewVoid");
this.setUserOnSession("admin");
this.addParameter("contentTypeCode", contentTypeCode);
String result = this.executeAction();
assertEquals(Action.INPUT, result);
Map<String, List<String>> fieldErrors = this.getAction().getFieldErrors();
assertEquals(2, fieldErrors.size());
assertEquals(1, fieldErrors.get("contentDescription").size());
assertEquals(1, fieldErrors.get("contentMainGroup").size());
Content content = super.getContentOnEdit(contentOnSessionMarker);
assertNull(content);
this.initAction("/do/jacms/Content", "createNewVoid");
this.setUserOnSession("admin");
this.addParameter("contentTypeCode", contentTypeCode);
this.addParameter("contentDescription", "Descrizione di prova");
this.addParameter("contentMainGroup", Group.FREE_GROUP_NAME);
result = this.executeAction();
assertEquals(Action.SUCCESS, result);
content = super.getContentOnEdit(contentOnSessionMarker);
assertNotNull(content);
assertEquals(contentTypeCode, content.getTypeCode());
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestLinkAttributeAction method testChooseLinkType.
public void testChooseLinkType() throws Throwable {
String contentId = "ART1";
String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
this.executeEdit(contentId, "admin");
// iniziazione parametri sessione
HttpSession session = this.getRequest().getSession();
session.setAttribute(ILinkAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, "VediAnche");
session.setAttribute(ILinkAttributeActionHelper.LINK_LANG_CODE_SESSION_PARAM, "it");
this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
this.addParameter("linkType", "1");
String result = this.executeAction();
assertEquals("configUrlLink", result);
this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
this.addParameter("linkType", "2");
result = this.executeAction();
assertEquals("configPageLink", result);
this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
this.addParameter("linkType", "3");
result = this.executeAction();
assertEquals("configContentLink", result);
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
assertNotNull(currentContent);
assertEquals("ART1", currentContent.getId());
assertEquals("Articolo", currentContent.getDescription());
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestLinkAttributeAction method testFailureChooseLinkType_1.
public void testFailureChooseLinkType_1() throws Throwable {
String contentId = "ART1";
String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
this.executeEdit(contentId, "admin");
// iniziazione parametri sessione
HttpSession session = this.getRequest().getSession();
session.setAttribute(ILinkAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, "VediAnche");
session.setAttribute(ILinkAttributeActionHelper.LINK_LANG_CODE_SESSION_PARAM, "it");
this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
String result = this.executeAction();
assertEquals(Action.INPUT, result);
Map<String, List<String>> fieldErrors = this.getAction().getFieldErrors();
assertEquals(1, fieldErrors.size());
List<String> typeFieldErrors = fieldErrors.get("linkType");
assertEquals(1, typeFieldErrors.size());
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
assertNotNull(currentContent);
assertEquals("ART1", currentContent.getId());
assertEquals("Articolo", currentContent.getDescription());
}
Aggregations