use of com.enonic.xp.portal.PortalRequest in project xp by enonic.
the class UnknownEndpointHandlerTest method setUp.
@BeforeEach
public void setUp() {
this.handler = new UnknownEndpointHandler();
this.request = new PortalRequest();
}
use of com.enonic.xp.portal.PortalRequest in project xp by enonic.
the class IdProviderControllerServiceImplTest method executeMissingIdProvider.
@Test
public void executeMissingIdProvider() throws IOException {
final IdProviderControllerExecutionParams executionParams = IdProviderControllerExecutionParams.create().portalRequest(new PortalRequest()).idProviderKey(IdProviderKey.from("missingidprovider")).functionName("missingfunction").build();
final PortalResponse portalResponse = idProviderControllerService.execute(executionParams);
assertNull(portalResponse);
}
use of com.enonic.xp.portal.PortalRequest in project xp by enonic.
the class IdProviderControllerServiceImplTest method executeMissingFunction.
@Test
public void executeMissingFunction() throws IOException {
final IdProviderControllerExecutionParams executionParams = IdProviderControllerExecutionParams.create().portalRequest(new PortalRequest()).idProviderKey(IdProviderKey.from("myemptyidprovider")).functionName("missingfunction").build();
final PortalResponse portalResponse = idProviderControllerService.execute(executionParams);
assertNull(portalResponse);
}
use of com.enonic.xp.portal.PortalRequest in project xp by enonic.
the class PortalRequestMapperTest method setup.
@BeforeEach
public void setup() {
this.portalRequest = new PortalRequest();
this.portalRequest.setMethod(HttpMethod.GET);
this.portalRequest.setScheme("http");
this.portalRequest.setHost("localhost");
this.portalRequest.setPort(80);
this.portalRequest.setRemoteAddress("10.0.0.1");
this.portalRequest.setPath("/site/live/master/a/b");
this.portalRequest.setRawPath("/site/live/master/a/b");
this.portalRequest.setContextPath("/site/live/master/a");
this.portalRequest.setUrl("http://localhost/site/live/master/a/b?param1=value1");
this.portalRequest.setValidTicket(Boolean.TRUE);
this.portalRequest.getParams().put("param1", "value1");
this.portalRequest.getParams().put("param2", "value2");
this.portalRequest.getParams().put("param3", "value3-A");
this.portalRequest.getParams().put("param3", "value3-B");
this.portalRequest.getHeaders().put("header1", "value1");
this.portalRequest.getHeaders().put("header2", "value2");
this.portalRequest.getHeaders().put("header3", "value3");
this.portalRequest.setApplicationKey(ApplicationKey.from("myapplication"));
this.portalRequest.setContent(ContentFixtures.newContent());
this.portalRequest.setSite(ContentFixtures.newSite());
this.portalRequest.setPageDescriptor(ContentFixtures.newPageDescriptor());
}
use of com.enonic.xp.portal.PortalRequest in project xp by enonic.
the class PostProcessorImplTest method testPostProcessingInjections.
private void testPostProcessingInjections(final HttpMethod httpMethod) throws Exception {
final String html = readResource("postProcessSource2.html");
final PostProcessorImpl postProcessor = new PostProcessorImpl();
postProcessor.addInjection(new TestPostProcessInjection());
final PortalResponse.Builder portalResponseBuilder = PortalResponse.create().contentType(MediaType.HTML_UTF_8).body(html);
final PortalRequest portalRequest = new PortalRequest();
portalRequest.setMethod(httpMethod);
final PortalResponse portalResponse = postProcessor.processResponse(portalRequest, portalResponseBuilder.build());
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("postProcessResult2.html");
assertEqualsTrimmed(expectedResult, outputHtml);
}
Aggregations