Search in sources :

Example 6 with ImageUrlParams

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

the class PortalUrlServiceImpl_imageUrlTest method createUrl_withNonMediaContent.

@Test
public void createUrl_withNonMediaContent() {
    this.portalRequest.setContent(createContent("non-media", false));
    final ImageUrlParams params = new ImageUrlParams().format("png").portalRequest(this.portalRequest).scale("max(300)").validate();
    assertEquals("/site/default/draft/a/b/mycontent/_/error/500?message=Image+with+%5B123456%5D+id+not+found", this.service.imageUrl(params));
}
Also used : ImageUrlParams(com.enonic.xp.portal.url.ImageUrlParams) Test(org.junit.jupiter.api.Test)

Example 7 with ImageUrlParams

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

the class PortalUrlServiceImpl_imageUrlTest method createUrl_withoutContentPath.

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

Example 8 with ImageUrlParams

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

the class PortalUrlServiceImpl_imageUrlTest method createUrl_withFormat.

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

Example 9 with ImageUrlParams

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

the class PortalUrlServiceImpl_imageUrlTest method createUrl_withId.

@Test
public void createUrl_withId() {
    createContent();
    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/_/image/123456:8cf45815bba82c9711c673c9bb7304039a790026/max-300/mycontent", url);
}
Also used : ImageUrlParams(com.enonic.xp.portal.url.ImageUrlParams) Test(org.junit.jupiter.api.Test)

Example 10 with ImageUrlParams

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

the class PortalUrlServiceImpl_imageUrlTest method createUrl.

@Test
public void createUrl() {
    this.portalRequest.setContent(createContent());
    final ImageUrlParams params = new ImageUrlParams().portalRequest(this.portalRequest).scale("max(300)").validate();
    final String url = this.service.imageUrl(params);
    assertEquals("/site/default/draft/a/b/mycontent/_/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