Search in sources :

Example 1 with FilterScriptFactory

use of com.enonic.xp.portal.filter.FilterScriptFactory in project xp by enonic.

the class MappingHandlerTest method setup.

@BeforeEach
public final void setup() throws Exception {
    this.request = new PortalRequest();
    final ControllerScriptFactory controllerScriptFactory = mock(ControllerScriptFactory.class);
    ControllerScript controllerScript = mock(ControllerScript.class);
    when(controllerScriptFactory.fromDir(Mockito.any())).thenReturn(controllerScript);
    final PortalResponse portalResponse = PortalResponse.create().build();
    when(controllerScript.execute(Mockito.any())).thenReturn(portalResponse);
    FilterScriptFactory filterScriptFactory = mock(FilterScriptFactory.class);
    FilterScript filterScript = mock(FilterScript.class);
    when(filterScriptFactory.fromScript(Mockito.any())).thenReturn(filterScript);
    when(filterScript.execute(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(portalResponse);
    this.resourceService = mock(ResourceService.class);
    final Resource resourceNotFound = mock(Resource.class);
    when(resourceNotFound.exists()).thenReturn(false);
    final Resource resource = mock(Resource.class);
    when(resource.exists()).thenReturn(true);
    when(this.resourceService.getResource(ResourceKey.from("demo:/services/test"))).thenReturn(resource);
    this.contentService = mock(ContentService.class);
    this.rendererDelegate = mock(RendererDelegate.class);
    this.siteService = mock(SiteService.class);
    this.handler = new MappingHandler(resourceService, controllerScriptFactory, filterScriptFactory, rendererDelegate, new ControllerMappingsResolver(siteService), new ContentResolver(contentService));
    this.request.setMethod(HttpMethod.GET);
}
Also used : FilterScriptFactory(com.enonic.xp.portal.filter.FilterScriptFactory) ControllerScript(com.enonic.xp.portal.controller.ControllerScript) FilterScript(com.enonic.xp.portal.filter.FilterScript) ResourceService(com.enonic.xp.resource.ResourceService) Resource(com.enonic.xp.resource.Resource) ContentService(com.enonic.xp.content.ContentService) ControllerScriptFactory(com.enonic.xp.portal.controller.ControllerScriptFactory) PortalRequest(com.enonic.xp.portal.PortalRequest) ContentResolver(com.enonic.xp.portal.impl.ContentResolver) PortalResponse(com.enonic.xp.portal.PortalResponse) SiteService(com.enonic.xp.site.SiteService) RendererDelegate(com.enonic.xp.portal.impl.rendering.RendererDelegate) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ContentService (com.enonic.xp.content.ContentService)1 PortalRequest (com.enonic.xp.portal.PortalRequest)1 PortalResponse (com.enonic.xp.portal.PortalResponse)1 ControllerScript (com.enonic.xp.portal.controller.ControllerScript)1 ControllerScriptFactory (com.enonic.xp.portal.controller.ControllerScriptFactory)1 FilterScript (com.enonic.xp.portal.filter.FilterScript)1 FilterScriptFactory (com.enonic.xp.portal.filter.FilterScriptFactory)1 ContentResolver (com.enonic.xp.portal.impl.ContentResolver)1 RendererDelegate (com.enonic.xp.portal.impl.rendering.RendererDelegate)1 Resource (com.enonic.xp.resource.Resource)1 ResourceService (com.enonic.xp.resource.ResourceService)1 SiteService (com.enonic.xp.site.SiteService)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1