Search in sources :

Example 1 with TCKSystemEvent

use of com.sun.ts.tests.jsf.common.event.TCKSystemEvent in project faces by jakartaee.

the class TestServlet method applicationPublishEventNPETest1.

// Test for Application.publishEvent throws NullPointerException
public void applicationPublishEventNPETest1(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    Application application = getApplication();
    FacesContext context = getFacesContext();
    if (application == null) {
        out.println(JSFTestUtil.APP_NULL_MSG);
        return;
    }
    UIComponent uic = application.createComponent(UIOutput.COMPONENT_TYPE);
    SystemEvent se = new TCKSystemEvent(uic);
    // Application.publishEvent(null, Class, Object)
    JSFTestUtil.checkForNPE(application, "publishEvent", new Class<?>[] { FacesContext.class, Class.class, Object.class }, new Object[] { null, se.getClass(), "object" }, out);
    // Application.publishEvent(FacesContext, null, Object)
    JSFTestUtil.checkForNPE(application, "publishEvent", new Class<?>[] { FacesContext.class, Class.class, Object.class }, new Object[] { context, null, "object" }, out);
    // Application.publishEvent(FacesContext, Class, null)
    JSFTestUtil.checkForNPE(application, "publishEvent", new Class<?>[] { FacesContext.class, Class.class, Object.class }, new Object[] { context, se.getClass(), null }, out);
}
Also used : TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) SystemEvent(jakarta.faces.event.SystemEvent) FacesContext(jakarta.faces.context.FacesContext) TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) UIComponent(jakarta.faces.component.UIComponent) Application(jakarta.faces.application.Application) PrintWriter(java.io.PrintWriter)

Example 2 with TCKSystemEvent

use of com.sun.ts.tests.jsf.common.event.TCKSystemEvent in project faces by jakartaee.

the class TestServlet method applicationSubscribeToEventNoSrcClassNPETest.

// End applicationSubscribeToEventNoSrcClassTest
// Test for Application.subscribeToEvent
public void applicationSubscribeToEventNoSrcClassNPETest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    Application application = getApplication();
    if (application == null) {
        out.println(JSFTestUtil.APP_NULL_MSG);
        return;
    }
    UIComponent uic = application.createComponent(UIOutput.COMPONENT_TYPE);
    SystemEvent se = new TCKSystemEvent(uic);
    SystemEventListener sel = new TCKSystemEventListener();
    // Application.subscribeToEvent(null, SystemEventListener)
    JSFTestUtil.checkForNPE(application, "subscribeToEvent", new Class<?>[] { Class.class, SystemEventListener.class }, new Object[] { null, sel }, out);
    // Application.subscribeToEvent(Class, null)
    JSFTestUtil.checkForNPE(application, "subscribeToEvent", new Class<?>[] { Class.class, SystemEventListener.class }, new Object[] { se.getClass(), null }, out);
}
Also used : TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) SystemEvent(jakarta.faces.event.SystemEvent) SystemEventListener(jakarta.faces.event.SystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) UIComponent(jakarta.faces.component.UIComponent) Application(jakarta.faces.application.Application) PrintWriter(java.io.PrintWriter)

Example 3 with TCKSystemEvent

use of com.sun.ts.tests.jsf.common.event.TCKSystemEvent in project faces by jakartaee.

the class TestServlet method applicationUnsubscribeFromEventNPETest.

// Test for Application.unsubscribeFromEvent
public void applicationUnsubscribeFromEventNPETest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    Application application = getApplication();
    if (application == null) {
        out.println(JSFTestUtil.APP_NULL_MSG);
        return;
    }
    UIComponent uic = application.createComponent(UIOutput.COMPONENT_TYPE);
    SystemEvent se = new TCKSystemEvent(uic);
    SystemEventListener sel = new TCKSystemEventListener();
    // Application.unsubscribeFromEvent(null, Class, SystemEventListener)
    JSFTestUtil.checkForNPE(application, "unsubscribeFromEvent", new Class<?>[] { Class.class, Class.class, SystemEventListener.class }, new Object[] { null, uic.getClass(), sel }, out);
    // Application.unsubscribeFromEvent(Class, Class, null)
    JSFTestUtil.checkForNPE(application, "unsubscribeFromEvent", new Class<?>[] { Class.class, Class.class, SystemEventListener.class }, new Object[] { se.getClass(), uic.getClass(), null }, out);
    // Application.unsubscribeFromEvent(null, SystemEventListener)
    JSFTestUtil.checkForNPE(application, "unsubscribeFromEvent", new Class<?>[] { Class.class, SystemEventListener.class }, new Object[] { null, sel }, out);
    // Application.unsubscribeFromEvent(Class, null)
    JSFTestUtil.checkForNPE(application, "unsubscribeFromEvent", new Class<?>[] { Class.class, SystemEventListener.class }, new Object[] { se.getClass(), null }, out);
}
Also used : TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) SystemEvent(jakarta.faces.event.SystemEvent) SystemEventListener(jakarta.faces.event.SystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) UIComponent(jakarta.faces.component.UIComponent) Application(jakarta.faces.application.Application) PrintWriter(java.io.PrintWriter)

Example 4 with TCKSystemEvent

use of com.sun.ts.tests.jsf.common.event.TCKSystemEvent in project faces by jakartaee.

the class TestServlet method applicationSubscribeToEventNoSrcClassTest.

// End applicationSubscribeToEventNullTest
// Test for Application.subscribeToEvent
public void applicationSubscribeToEventNoSrcClassTest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    Application application = getApplication();
    if (application == null) {
        out.println(JSFTestUtil.APP_NULL_MSG);
        return;
    }
    UIComponent uic = application.createComponent(UIOutput.COMPONENT_TYPE);
    SystemEvent se = new TCKSystemEvent(uic);
    SystemEventListener sel = new TCKSystemEventListener();
    try {
        application.subscribeToEvent(se.getClass(), sel);
        out.println(JSFTestUtil.PASS);
    } catch (Exception e) {
        out.println(JSFTestUtil.FAIL + JSFTestUtil.NL);
        e.printStackTrace();
    }
}
Also used : TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) SystemEvent(jakarta.faces.event.SystemEvent) SystemEventListener(jakarta.faces.event.SystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) UIComponent(jakarta.faces.component.UIComponent) Application(jakarta.faces.application.Application) ServletException(jakarta.servlet.ServletException) ELException(jakarta.el.ELException) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Example 5 with TCKSystemEvent

use of com.sun.ts.tests.jsf.common.event.TCKSystemEvent in project faces by jakartaee.

the class TestServlet method applicationUnsubscribeFromEventSLTest.

// Test for Application.unsubscribeFromEvent(systemEventClass, listener)
public void applicationUnsubscribeFromEventSLTest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    Application application = getApplication();
    if (application == null) {
        out.println(JSFTestUtil.APP_NULL_MSG);
        return;
    }
    UIComponent uic = application.createComponent(UIOutput.COMPONENT_TYPE);
    SystemEvent se = new TCKSystemEvent(uic);
    SystemEventListener sel = new TCKSystemEventListener();
    try {
        application.unsubscribeFromEvent(se.getClass(), sel);
        out.println(JSFTestUtil.PASS);
    } catch (Exception e) {
        out.println(JSFTestUtil.FAIL + JSFTestUtil.NL);
        e.printStackTrace();
    }
}
Also used : TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) SystemEvent(jakarta.faces.event.SystemEvent) SystemEventListener(jakarta.faces.event.SystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEventListener(com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener) TCKSystemEvent(com.sun.ts.tests.jsf.common.event.TCKSystemEvent) UIComponent(jakarta.faces.component.UIComponent) Application(jakarta.faces.application.Application) ServletException(jakarta.servlet.ServletException) ELException(jakarta.el.ELException) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Aggregations

TCKSystemEvent (com.sun.ts.tests.jsf.common.event.TCKSystemEvent)20 PrintWriter (java.io.PrintWriter)20 UIComponent (jakarta.faces.component.UIComponent)18 SystemEvent (jakarta.faces.event.SystemEvent)18 ELException (jakarta.el.ELException)15 ServletException (jakarta.servlet.ServletException)15 IOException (java.io.IOException)15 TCKSystemEventListener (com.sun.ts.tests.jsf.common.listener.TCKSystemEventListener)13 SystemEventListener (jakarta.faces.event.SystemEventListener)13 Application (jakarta.faces.application.Application)11 FacesException (jakarta.faces.FacesException)7 ApplicationWrapper (jakarta.faces.application.ApplicationWrapper)7 UICommand (jakarta.faces.component.UICommand)2 FacesContext (jakarta.faces.context.FacesContext)1