Search in sources :

Example 6 with AttachmentUrlParams

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);
}
Also used : AttachmentUrlParams(com.enonic.xp.portal.url.AttachmentUrlParams) Test(org.junit.jupiter.api.Test)

Example 7 with AttachmentUrlParams

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);
}
Also used : AttachmentUrlParams(com.enonic.xp.portal.url.AttachmentUrlParams) Test(org.junit.jupiter.api.Test)

Example 8 with AttachmentUrlParams

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);
}
Also used : AttachmentUrlParams(com.enonic.xp.portal.url.AttachmentUrlParams) Test(org.junit.jupiter.api.Test)

Aggregations

AttachmentUrlParams (com.enonic.xp.portal.url.AttachmentUrlParams)8 Test (org.junit.jupiter.api.Test)7 ApplicationKey (com.enonic.xp.app.ApplicationKey)1 ApplicationKeys (com.enonic.xp.app.ApplicationKeys)1 PortalRequest (com.enonic.xp.portal.PortalRequest)1 ImageUrlParams (com.enonic.xp.portal.url.ImageUrlParams)1 PageUrlParams (com.enonic.xp.portal.url.PageUrlParams)1 PortalUrlService (com.enonic.xp.portal.url.PortalUrlService)1 Site (com.enonic.xp.site.Site)1 ImageStyle (com.enonic.xp.style.ImageStyle)1 StyleDescriptorService (com.enonic.xp.style.StyleDescriptorService)1 StyleDescriptors (com.enonic.xp.style.StyleDescriptors)1 Splitter (com.google.common.base.Splitter)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1