use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class PostProcessorImplTest method testPostProcessingInstructions.
private void testPostProcessingInstructions(final HttpMethod httpMethod) throws Exception {
final String html = readResource("postProcessSource1.html");
final PostProcessorImpl postProcessor = new PostProcessorImpl();
postProcessor.addInstruction(new TestPostProcessInstruction());
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("postProcessResult1.html");
assertEqualsTrimmed(expectedResult, outputHtml);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class MacroInstructionTest method testNoMacroInstruction.
@Test
public void testNoMacroInstruction() throws Exception {
PortalResponse response = macroInstruction.evaluate(portalRequest, "MY_INSTRUCTION _name=\"mymacro\" param1=\"value1\" _body=\"body\"");
assertNull(response);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class MacroInstructionTest method testInvalidMacroInstruction.
@Test
public void testInvalidMacroInstruction() throws Exception {
PortalResponse response = macroInstruction.evaluate(portalRequest, "MACRO _name=\"mymacro\" param.with.dot=\"value1\" _body=\"body\"");
assertNull(response);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method nonSingleRootTagHtml.
@Test
public void nonSingleRootTagHtml() throws Exception {
final String html = readResource("part6Source.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
assertEquals(html, outputHtml);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method injectWithMultipleComments.
@Test
public void injectWithMultipleComments() throws Exception {
final String html = readResource("part9Source.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("part9Rendered.html");
assertEquals(expectedResult, outputHtml);
}
Aggregations