Search in sources :

Example 11 with ImageUrlParams

use of com.enonic.xp.portal.url.ImageUrlParams in project xp by enonic.

the class PortalUrlServiceImpl_imageUrlTest method createUrl_withId_notFound.

@Test
public void createUrl_withId_notFound() {
    createContentNotFound();
    final ImageUrlParams params = new ImageUrlParams().id("123456").portalRequest(this.portalRequest).scale("max(300)").validate();
    final String url = this.service.imageUrl(params);
    assertEquals("/site/default/draft/context/path/_/error/500?message=Image+with+%5B123456%5D+id+not+found", url);
}
Also used : ImageUrlParams(com.enonic.xp.portal.url.ImageUrlParams) Test(org.junit.jupiter.api.Test)

Example 12 with ImageUrlParams

use of com.enonic.xp.portal.url.ImageUrlParams in project xp by enonic.

the class PortalUrlServiceImpl_imageUrlTest method createUrl_withPath.

@Test
public void createUrl_withPath() {
    createContent();
    final ImageUrlParams params = new ImageUrlParams().path("/a/b/mycontent").portalRequest(this.portalRequest).scale("max(300)").validate();
    final String url = this.service.imageUrl(params);
    assertEquals("/site/default/draft/context/path/_/image/123456:8cf45815bba82c9711c673c9bb7304039a790026/max-300/mycontent", url);
}
Also used : ImageUrlParams(com.enonic.xp.portal.url.ImageUrlParams) Test(org.junit.jupiter.api.Test)

Aggregations

ImageUrlParams (com.enonic.xp.portal.url.ImageUrlParams)12 Test (org.junit.jupiter.api.Test)10 PortalRequest (com.enonic.xp.portal.PortalRequest)2 ApplicationKey (com.enonic.xp.app.ApplicationKey)1 ApplicationKeys (com.enonic.xp.app.ApplicationKeys)1 Attachment (com.enonic.xp.attachment.Attachment)1 ContentId (com.enonic.xp.content.ContentId)1 ContentService (com.enonic.xp.content.ContentService)1 Media (com.enonic.xp.content.Media)1 AttachmentUrlParams (com.enonic.xp.portal.url.AttachmentUrlParams)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