use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestLinkAttributeAction method testFailureChooseLinkType_2.
public void testFailureChooseLinkType_2() 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", "0");
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());
this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
this.addParameter("linkType", "4");
result = this.executeAction();
assertEquals(Action.INPUT, result);
fieldErrors = this.getAction().getFieldErrors();
assertEquals(1, fieldErrors.size());
typeFieldErrors = fieldErrors.get("linkType");
assertEquals(1, typeFieldErrors.size());
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 testRemoveLink.
public void testRemoveLink() throws Throwable {
String contentId = "ART102";
String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
this.executeEdit(contentId, "admin");
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
assertNotNull(currentContent);
LinkAttribute linkAttribute = (LinkAttribute) currentContent.getAttribute("VediAnche");
assertNotNull(linkAttribute);
SymbolicLink symbolicLink = linkAttribute.getSymbolicLink();
assertNotNull(symbolicLink);
assertEquals("ART111", symbolicLink.getContentDest());
this.initContentAction("/do/jacms/Content", "removeLink", contentOnSessionMarker);
this.addParameter("attributeName", "VediAnche");
this.addParameter("langCode", "it");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
currentContent = this.getContentOnEdit(contentOnSessionMarker);
assertNotNull(currentContent);
linkAttribute = (LinkAttribute) currentContent.getAttribute("VediAnche");
assertNotNull(linkAttribute);
symbolicLink = linkAttribute.getSymbolicLink();
assertNull(symbolicLink);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestListAttributeAction method initEditContent.
private String initEditContent() throws Throwable {
String contentId = "ART1";
Content content = this.getContentManager().loadContent(contentId, false);
this.executeEdit(contentId, "admin");
String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(content, ApsAdminSystemConstants.EDIT);
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
MonoListAttribute monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
List<AttributeInterface> attributes = monoListAttribute.getAttributes();
String[] expected = { "Pippo", "Paperino", "Pluto" };
this.verifyText(attributes, expected);
return contentOnSessionMarker;
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestListAttributeAction method testRemoveListElement.
public void testRemoveListElement() throws Throwable {
String contentOnSessionMarker = this.initEditContent();
this.initContentAction("/do/jacms/Content", "removeListElement", contentOnSessionMarker);
this.addParameter("attributeName", "Autori");
this.addParameter("elementIndex", "1");
this.addParameter("listLangCode", "it");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
MonoListAttribute monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
List<AttributeInterface> attributes = monoListAttribute.getAttributes();
String[] expected = { "Pippo", "Pluto" };
this.verifyText(attributes, expected);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestListAttributeAction method testMoveListElement.
public void testMoveListElement() throws Throwable {
String contentOnSessionMarker = this.initEditContent();
this.initContentAction("/do/jacms/Content", "moveListElement", contentOnSessionMarker);
this.addParameter("attributeName", "Autori");
this.addParameter("elementIndex", "1");
this.addParameter("listLangCode", "it");
this.addParameter("movement", IListAttributeAction.MOVEMENT_UP_CODE);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
MonoListAttribute monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
List<AttributeInterface> attributes = monoListAttribute.getAttributes();
String[] expected = { "Paperino", "Pippo", "Pluto" };
this.verifyText(attributes, expected);
this.initContentAction("/do/jacms/Content", "moveListElement", contentOnSessionMarker);
this.addParameter("attributeName", "Autori");
this.addParameter("elementIndex", "1");
this.addParameter("listLangCode", "it");
this.addParameter("movement", IListAttributeAction.MOVEMENT_DOWN_CODE);
result = this.executeAction();
assertEquals(Action.SUCCESS, result);
currentContent = this.getContentOnEdit(contentOnSessionMarker);
monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
attributes = monoListAttribute.getAttributes();
String[] expected2 = { "Paperino", "Pluto", "Pippo" };
this.verifyText(attributes, expected2);
}
Aggregations