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);
}
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);
}
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);
}
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();
}
}
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();
}
}
Aggregations