Search in sources :

Example 16 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runRenderDestroyTest.

private void runRenderDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_RENDER_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.doFacesRequest(request, response);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge. Instead the request completed without an exception.");
    } catch (BridgeUninitializedException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge. Instead it threw: " + e.toString());
    }
    responsePrintWriter.println(resultWriter.toString());
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException) PrintWriter(java.io.PrintWriter)

Example 17 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runEventDestroyTest.

private void runEventDestroyTest(EventRequest request, EventResponse response) throws PortletException, IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_EVENT_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.doFacesRequest(request, response);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(event) when passed a destroyed bridge. Instead the request completed without an exception.");
    } catch (BridgeUninitializedException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(event) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(event) when passed a destroyed bridge. Instead it threw: " + e.toString());
    }
    mActionResult = resultWriter.toString();
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException)

Example 18 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runResourceDestroyTest.

private void runResourceDestroyTest(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_RESOURCE_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.doFacesRequest(request, response);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(resource) when passed a destroyed bridge. Instead the request completed without an exception.");
    } catch (BridgeUninitializedException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(resource) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(resource) when passed a destroyed bridge. Instead it threw: " + e.toString());
    }
    mActionResult = resultWriter.toString();
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException)

Example 19 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method encodeDestroyTestAlreadyRun.

private void encodeDestroyTestAlreadyRun(String testName) {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(testName);
    resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
    resultWriter.setDetail("Test result has already been rendered. This can can only be rendered once prior to portlet or app reload.  To rerun this test reload.  The result that has previously been rendered is: " + mActionResult);
    mActionResult = resultWriter.toString();
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter)

Example 20 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runNullRequestRenderTest.

private void runNullRequestRenderTest(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(NULLREQUEST_RENDER_TEST);
    // Run test
    try {
        Bridge bridge = getFacesBridge(request, response);
        bridge.doFacesRequest((RenderRequest) null, (RenderResponse) null);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(render) when passed a null request/response. Instead the request completed without an exception.");
    } catch (NullPointerException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw NullPointerException from doFacesRequest(render) when passed a null request/response.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(render) when passed a null request/response. Instead it threw: " + e.toString());
    }
    responsePrintWriter.println(resultWriter.toString());
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException) 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