Package org.apache.myfaces.portlet.faces.testsuite.common.util

Examples of org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter


  public void render(RenderRequest request, RenderResponse response)
    throws PortletException, IOException
  {
    response.setContentType("text/html");
    PrintWriter out = 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()));
    }

    out.println(resultWriter.toString());
  }
View Full Code Here


  public void render(RenderRequest request, RenderResponse response ) throws PortletException, IOException {

      response.setContentType("text/html");
      PrintWriter out = 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 2.0 Bridge for JavaServer Faces 1.2"))
        {
          resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
          resultWriter.setDetail("Incorrect Specification Title: " + name + " should be 'Portlet 2.0 Bridge for JavaServer Faces 1.2'");
        }
        else if (version == null || !version.equals("1.0"))
        {
          resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
          resultWriter.setDetail("Incorrect Specification Version: " + version + " should be '2.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.");
    }

    out.println(resultWriter.toString());
  }
View Full Code Here

    response.setContentType("text/html");

    PrintWriter out = 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()));
    }

    out.println(resultWriter.toString());
  }
View Full Code Here

    }
  }
 
  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();
  }
View Full Code Here

  }


  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();
  }
View Full Code Here

    mActionResult = resultWriter.toString();
  }
 
  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();
  }
View Full Code Here

    mActionResult = resultWriter.toString();
  }
 
  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();
  }
View Full Code Here

 
  private void runRenderDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException
  {
    response.setContentType("text/html");
    PrintWriter out = 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());       
    }
   
    out.println(resultWriter.toString());
  }
View Full Code Here

 
  private void runNullRequestRenderTest(RenderRequest request, RenderResponse response) throws PortletException, IOException
  {
    response.setContentType("text/html");
    PrintWriter out = 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());       
    }
   
    out.println(resultWriter.toString());
  }
View Full Code Here

 
  private void runDoubleDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException
  {
    response.setContentType("text/html");
    PrintWriter out = 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());       
    }
   
    out.println(resultWriter.toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.