use of com.enonic.xp.portal.url.AttachmentUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_attachmentUrlTest method createUrl_withName.
@Test
public void createUrl_withName() {
this.portalRequest.setContent(createContent());
final AttachmentUrlParams params = new AttachmentUrlParams().portalRequest(this.portalRequest).name("a1.jpg");
final String url = this.service.attachmentUrl(params);
assertEquals("/site/default/draft/a/b/mycontent/_/attachment/inline/123456:binaryHash1/a1.jpg", url);
}
use of com.enonic.xp.portal.url.AttachmentUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_attachmentUrlTest method createUrl_withDownload.
@Test
public void createUrl_withDownload() {
this.portalRequest.setContent(createContent());
final AttachmentUrlParams params = new AttachmentUrlParams().portalRequest(this.portalRequest).download(true);
final String url = this.service.attachmentUrl(params);
assertEquals("/site/default/draft/a/b/mycontent/_/attachment/download/123456:binaryHash2/a2.jpg", url);
}
use of com.enonic.xp.portal.url.AttachmentUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_attachmentUrlTest method createUrl_withoutNameAndLabel.
@Test
public void createUrl_withoutNameAndLabel() {
this.portalRequest.setContent(createContent());
final AttachmentUrlParams params = new AttachmentUrlParams().portalRequest(this.portalRequest).param("a", 3);
final String url = this.service.attachmentUrl(params);
assertEquals("/site/default/draft/a/b/mycontent/_/attachment/inline/123456:binaryHash2/a2.jpg?a=3", url);
}
Aggregations