Search in sources :

Example 1 with BridgeTCKResultWriter

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

the class InitMethodTestPortlet method render.

public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
    if ((String) getPortletContext().getAttribute(TEST_PASS_PREFIX + getPortletName()) != null) {
        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 2 with BridgeTCKResultWriter

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

the class GetBridgeClassNameMethodTestPortlet method render.

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

Example 3 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runActionDestroyTest.

private void runActionDestroyTest(ActionRequest request, ActionResponse response) throws PortletException, IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_ACTION_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(action) 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(action) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(action) 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 4 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runNullRequestActionTest.

private void runNullRequestActionTest(ActionRequest request, ActionResponse response) throws PortletException, IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(NULLREQUEST_ACTION_TEST);
    // Run test
    try {
        Bridge bridge = getFacesBridge(request, response);
        bridge.doFacesRequest((ActionRequest) null, (ActionResponse) null);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(action) 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(action) when passed a null request/response.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(action) when passed a null request/response. Instead it threw: " + e.toString());
    }
    mActionResult = 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)

Example 5 with BridgeTCKResultWriter

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

the class BridgeDestroyTestPortlet method runDoubleDestroyTest.

private void runDoubleDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_DOUBLE_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.destroy();
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Calling destroy on a destroyed bridge correctly completed without exception.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Calling destroy on a destroyed bridge incorrectly threw an exception: " + 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