use of com.enonic.xp.portal.filter.FilterScript in project xp by enonic.
the class MappingFilterHandlerWorker method execute.
@Override
public PortalResponse execute() throws Exception {
final Trace trace = Tracer.current();
if (trace != null) {
trace.put("contentPath", this.request.getContentPath().toString());
trace.put("type", "filter");
}
final FilterScript filterScript = getScript();
return filterScript.execute(this.request, this.response, this.webHandlerChain);
}
use of com.enonic.xp.portal.filter.FilterScript in project xp by enonic.
the class FilterScriptImplTest method execute.
protected final void execute(final String script, final WebHandlerChain webHandlerChain) {
final FilterScript controllerScript = this.factory.fromScript(ResourceKey.from(script));
this.portalResponse = controllerScript.execute(this.portalRequest, this.portalResponse, webHandlerChain);
}
use of com.enonic.xp.portal.filter.FilterScript 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);
}
Aggregations