use of com.agiletec.plugins.jacms.apsadmin.content.attribute.action.resource.ExtendedResourceFinderAction in project entando-core by entando.
the class TestExtendedResourceFinderAction method testJoinImageResource.
public void testJoinImageResource() throws Throwable {
this.executeEdit("ART102", "admin");
String contentOnSessionMarker = super.extractSessionMarker("ART102", ApsAdminSystemConstants.EDIT);
ContentAction action = (ContentAction) this.getAction();
ImageAttribute imageAttribute = (ImageAttribute) action.getContent().getAttribute("Foto");
assertNull(imageAttribute.getResource("it"));
assertNull(imageAttribute.getResource("en"));
// iniziazione parametri sessione
HttpSession session = this.getRequest().getSession();
session.setAttribute(ResourceAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, "Foto");
session.setAttribute(ResourceAttributeActionHelper.RESOURCE_TYPE_CODE_SESSION_PARAM, "Image");
session.setAttribute(ResourceAttributeActionHelper.RESOURCE_LANG_CODE_SESSION_PARAM, "it");
this.initContentAction("/do/jacms/Content/Resource", "joinResource", contentOnSessionMarker);
// per replicare il chain in occasione dei chooseResource da edit Contenuto.
this.addParameter("resourceTypeCode", "Image");
this.addParameter("resourceId", "44");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
ExtendedResourceFinderAction attributeAction = (ExtendedResourceFinderAction) this.getAction();
imageAttribute = (ImageAttribute) attributeAction.getContent().getAttribute("Foto");
assertNotNull(imageAttribute.getResource("it"));
assertEquals("44", imageAttribute.getResource("it").getId());
assertNull(imageAttribute.getResource("en"));
}
Aggregations