use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink in project entando-core by entando.
the class TestPageLinkAction method testJoinPageLink_1.
public void testJoinPageLink_1() throws Throwable {
String contentOnSessionMarker = this.initJoinLinkTest("admin", "ART1", "VediAnche", "it");
this.initContentAction("/do/jacms/Content/Link", "joinPageLink", contentOnSessionMarker);
this.addParameter("linkType", String.valueOf(SymbolicLink.PAGE_TYPE));
this.addParameter("selectedNode", "pagina_11");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
Content content = this.getContentOnEdit(contentOnSessionMarker);
LinkAttribute attribute = (LinkAttribute) content.getAttribute("VediAnche");
SymbolicLink symbolicLink = attribute.getSymbolicLink();
assertNotNull(symbolicLink);
assertEquals("pagina_11", symbolicLink.getPageDest());
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink in project entando-core by entando.
the class TestValidateContent method testValidate_2.
public void testValidate_2() throws Throwable {
try {
Content content = this._contentManager.loadContent("EVN191", true);
content.setId(null);
// Valorizzo il gruppo proprietario
content.setMainGroup(Group.FREE_GROUP_NAME);
content.getGroups().add("customers");
MonoListAttribute linksCorrelati = (MonoListAttribute) content.getAttribute("LinkCorrelati");
LinkAttribute linkAttribute = (LinkAttribute) linksCorrelati.addAttribute();
List<FieldError> errors = content.validate(this._groupManager);
assertNotNull(errors);
assertEquals(1, errors.size());
FieldError error = errors.get(0);
// Verifica obbligatorietà attributo "Titolo"
assertEquals("Monolist:Link:LinkCorrelati_0", error.getFieldCode());
assertEquals(FieldError.INVALID, error.getErrorCode());
// AGGIUNGO LINK SU PAGINA COACH
linkAttribute.setText("Descrizione link", "it");
SymbolicLink symbolicLink = new SymbolicLink();
// Contenuto di coach
symbolicLink.setDestinationToContent("EVN103");
linkAttribute.setSymbolicLink(symbolicLink);
errors = content.validate(this._groupManager);
assertNotNull(errors);
assertEquals(1, errors.size());
error = errors.get(0);
assertEquals("Monolist:Link:LinkCorrelati_0", error.getFieldCode());
assertEquals(ICmsAttributeErrorCodes.INVALID_CONTENT_GROUPS, error.getErrorCode());
} catch (Throwable t) {
throw t;
}
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink in project entando-core by entando.
the class TestLinkResolverManager method testResolveResourceLink.
public void testResolveResourceLink() throws Throwable {
SymbolicLink link = new SymbolicLink();
link.setDestinationToResource("44");
String text = "The link is: '" + link.getSymbolicDestination() + "'; end";
String expected = "The link is: '/Entando/resources/cms/images/lvback_d0.jpg'; end";
String resolvedText = _resolver.resolveLinks(text, null, _reqCtx);
assertEquals(expected, resolvedText);
link = new SymbolicLink();
link.setDestinationToResource("82");
text = "The second resource link is: '" + link.getSymbolicDestination() + "'; end";
expected = "The second resource link is: '/Entando/protected/82/0/def/ref/ART122/'; end";
resolvedText = _resolver.resolveLinks(text, "ART122", _reqCtx);
assertEquals(expected, resolvedText);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink in project entando-core by entando.
the class TestLinkResolverManager method testResolveWithNoise.
public void testResolveWithNoise() {
SymbolicLink link = new SymbolicLink();
link.setDestinationToContentOnPage("ART1", "homepage");
String text = "Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_PREFIX + " - Qui c'è un link: ''" + link.getSymbolicDestination() + "'; " + "altro Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_POSTFIX + " fine";
String expected = "Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_PREFIX + " - Qui c'è un link: ''/Entando/it/homepage.page?contentId=ART1'; " + "altro Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_POSTFIX + " fine";
String resolvedText = _resolver.resolveLinks(text, null, _reqCtx);
assertEquals(expected, resolvedText);
text = text + text;
expected = expected + expected;
resolvedText = _resolver.resolveLinks(text, null, _reqCtx);
assertEquals(expected, resolvedText);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink in project entando-core by entando.
the class TestContentAction method testValidate_2.
public void testValidate_2() throws Throwable {
String insertedDescr = "XXX Prova Validazione XXX";
try {
Content contentForTest = this.getContentManager().loadContent("EVN191", true);
String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(contentForTest, ApsAdminSystemConstants.EDIT);
contentForTest.setId(null);
contentForTest.setDescription(insertedDescr);
// Valorizzo il gruppo proprietario
contentForTest.setMainGroup("coach");
contentForTest.getGroups().add("customers");
// AGGIUNGO LINK SU PAGINA COACH
MonoListAttribute linksCorrelati = (MonoListAttribute) contentForTest.getAttribute("LinkCorrelati");
LinkAttribute linkAttribute = (LinkAttribute) linksCorrelati.addAttribute();
linkAttribute.setText("Descrizione link", "it");
SymbolicLink symbolicLink = new SymbolicLink();
// Contenuto di coach
symbolicLink.setDestinationToContent("EVN103");
linkAttribute.setSymbolicLink(symbolicLink);
this.getRequest().getSession().setAttribute(ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + contentOnSessionMarker, contentForTest);
this.initContentAction("/do/jacms/Content", "save", contentOnSessionMarker);
this.setUserOnSession("admin");
String result = this.executeAction();
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
assertEquals(1, action.getFieldErrors().size());
assertEquals(1, action.getFieldErrors().get("Monolist:Link:LinkCorrelati_0").size());
} catch (Throwable t) {
throw t;
} finally {
this.removeTestContent(insertedDescr);
}
}
Aggregations