Search in sources :

Example 21 with BridgeTCKResultWriter

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

the class BridgeVersionTestPortlet method render.

public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(TEST_NAME);
    // Get the version info from the Bridge class
    try {
        Class c = Class.forName("javax.portlet.faces.Bridge");
        String name = c.getPackage().getSpecificationTitle();
        String version = c.getPackage().getSpecificationVersion();
        if ((name == null) || !name.equals("Portlet 3.0 Bridge for JavaServer Faces 2.3")) {
            resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
            resultWriter.setDetail("Incorrect Specification Title: " + name + " should be 'Portlet 3.0 Bridge for JavaServer Faces 2.3'");
        } else if ((version == null) || !version.equals("6.0.0")) {
            resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
            resultWriter.setDetail("Incorrect Specification Version: " + version + " should be '6.0.0'");
        } else {
            resultWriter.setStatus(BridgeTCKResultWriter.PASS);
            resultWriter.setDetail("Correct Specification Title: " + name + " and correct specification version: " + version);
        }
    } catch (ClassNotFoundException e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("javax.portlet.faces.Bridge class not found.");
    }
    responsePrintWriter.println(resultWriter.toString());
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) PrintWriter(java.io.PrintWriter)

Example 22 with BridgeTCKResultWriter

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

the class GetBridgeEventHandlerTestPortlet method render.

@Override
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    executeTest(getBridgeEventHandler());
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
    if (getPortletContext().getAttribute(TEST_FAIL_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 23 with BridgeTCKResultWriter

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

the class GetBridgePublicRenderParameterHandlerTestPortlet method render.

@Override
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    executeText(getBridgePublicRenderParameterHandler());
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(getTestName());
    if (getPortletContext().getAttribute(TEST_FAIL_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)

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