Search in sources :

Example 11 with BridgeTCKResultWriter

use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.

the class IsPreserveActionParametersMethodTestPortlet method render.

public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    boolean pass = getPortletContext().getAttribute(TEST_FAIL_PREFIX + getPortletName()) == null;
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
    if (pass) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail((String) getPortletContext().getAttribute(TEST_PASS_PREFIX + getPortletName()));
    } else {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail((String) getPortletContext().getAttribute(TEST_FAIL_PREFIX + getPortletName()));
    }
    responsePrintWriter.println(resultWriter.toString());
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) PrintWriter(java.io.PrintWriter)

Example 12 with BridgeTCKResultWriter

use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.

the class ManualBridgeInvokePortlet method outputTestResult.

protected void outputTestResult(PortletRequest portletRequest, MimeResponse mimeResponse, Boolean pass, String detail) throws IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
    if (pass.booleanValue()) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail(detail);
    } else {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail(detail);
    }
    if ((mimeResponse instanceof RenderResponse) || (mimeResponse instanceof ResourceResponse)) {
        mimeResponse.setContentType("text/html");
        PrintWriter out = mimeResponse.getWriter();
        out.println(resultWriter.toString());
    } else {
        portletRequest.setAttribute(BridgeTCKResultWriter.class.getName(), resultWriter);
    }
}
Also used : ResourceResponse(javax.portlet.ResourceResponse) BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) RenderResponse(javax.portlet.RenderResponse) PrintWriter(java.io.PrintWriter)

Example 13 with BridgeTCKResultWriter

use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.

the class NonFacesViewTestPortlet method outputTestResult.

private String outputTestResult(boolean pass, String msg) throws IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
    if (pass) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail(msg);
    } else {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail(msg);
    }
    return resultWriter.toString();
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter)

Example 14 with BridgeTCKResultWriter

use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.

the class TestBean method setTestResult.

public void setTestResult(boolean passed, String detail) {
    mResultWriter = new BridgeTCKResultWriter(mTestName);
    mResultWriter.setStatus(passed);
    mResultWriter.addDetail(detail);
    mStatus = passed;
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter)

Example 15 with BridgeTCKResultWriter

use of com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter in project liferay-faces-bridge-impl by liferay.

the class RenderViewDispatchCompatPortlet method outputResultWriter.

private void outputResultWriter(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException {
    BridgeTCKResultWriter bridgeTCKResultWriter = (BridgeTCKResultWriter) renderRequest.getAttribute(BridgeTCKResultWriter.class.getName());
    if (bridgeTCKResultWriter != null) {
        PrintWriter printWriter = renderResponse.getWriter();
        printWriter.write(bridgeTCKResultWriter.toString());
    }
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) PrintWriter(java.io.PrintWriter)

Aggregations

BridgeTCKResultWriter (com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter)23 PrintWriter (java.io.PrintWriter)16 IOException (java.io.IOException)7 PortletException (javax.portlet.PortletException)7 Bridge (javax.portlet.faces.Bridge)7 BridgeUninitializedException (javax.portlet.faces.BridgeUninitializedException)7 RenderResponse (javax.portlet.RenderResponse)2 FacesContextFactory (javax.faces.context.FacesContextFactory)1 ResourceResponse (javax.portlet.ResourceResponse)1