Search in sources :

Example 66 with Content

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());
}
Also used : HttpSession(javax.servlet.http.HttpSession) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) List(java.util.List)

Example 67 with Content

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);
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 68 with Content

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;
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 69 with Content

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);
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 70 with Content

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);
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)227 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)55 AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)35 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)29 ArrayList (java.util.ArrayList)26 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)17 ActionSupport (com.opensymphony.xwork2.ActionSupport)14 List (java.util.List)14 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)13 HttpSession (javax.servlet.http.HttpSession)13 UserDetails (com.agiletec.aps.system.services.user.UserDetails)12 IPage (com.agiletec.aps.system.services.page.IPage)10 Date (java.util.Date)8 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)7 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)7 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)7 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)7 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)7 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)6 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)6