Search in sources :

Example 1 with TCKDecoratedContextFactory

use of com.sun.ts.tests.jsf.common.factories.TCKDecoratedContextFactory in project faces by jakartaee.

the class TestServlet method getFactoryDecoratedTest.

public void getFactoryDecoratedTest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter pw = response.getWriter();
    String expectFactNames = "com.sun.ts.tests.jsf.common.factories." + "TCKContextFactoryFour and com.sun.ts.tests.jsf.common." + "factories.TCKContextFactoryThree";
    try {
        FacesContextFactory fcf = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
        TCKDecoratedContextFactory tckFactory = (TCKDecoratedContextFactory) fcf.getWrapped();
        String factNameFour = tckFactory.getClass().getCanonicalName();
        String factNameThree = tckFactory.getParent();
        if (factNameThree.contains("TCKContextFactoryThree") && factNameFour.contains("TCKContextFactoryFour")) {
            pw.println("Test PASSED");
        } else {
            pw.println("FacesContext Were not Decorated in correct order.");
            pw.println("Found: " + factNameThree + " And " + factNameFour);
            pw.println("Expected: " + expectFactNames);
            pw.println("Test FAILED.");
        }
    } catch (Exception e) {
        pw.println("Test FAILED.");
        pw.println(e.toString());
    }
}
Also used : TCKDecoratedContextFactory(com.sun.ts.tests.jsf.common.factories.TCKDecoratedContextFactory) FacesContextFactory(jakarta.faces.context.FacesContextFactory) IOException(java.io.IOException) ServletException(jakarta.servlet.ServletException) PrintWriter(java.io.PrintWriter)

Aggregations

TCKDecoratedContextFactory (com.sun.ts.tests.jsf.common.factories.TCKDecoratedContextFactory)1 FacesContextFactory (jakarta.faces.context.FacesContextFactory)1 ServletException (jakarta.servlet.ServletException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1