Search in sources :

Example 1 with ApplicationImplEventManager

use of org.apache.myfaces.application.ApplicationImplEventManager in project myfaces by apache.

the class GlobalPostAddToViewEventTestCase method testPostAddToViewSourceSuperClass.

@Test
public void testPostAddToViewSourceSuperClass() throws Exception {
    ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
    eventManager.subscribeToEvent(PostAddToViewEvent.class, UIOutput.class, new HeadResourceListener());
    eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
    Assert.assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
Also used : HtmlHead(jakarta.faces.component.html.HtmlHead) ApplicationImplEventManager(org.apache.myfaces.application.ApplicationImplEventManager) Test(org.junit.Test)

Example 2 with ApplicationImplEventManager

use of org.apache.myfaces.application.ApplicationImplEventManager in project myfaces by apache.

the class GlobalPostAddToViewEventTestCase method testPostAddToViewSourceNull.

@Test
public void testPostAddToViewSourceNull() throws Exception {
    ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
    eventManager.subscribeToEvent(PostAddToViewEvent.class, new HeadResourceListener());
    eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
    Assert.assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
Also used : HtmlHead(jakarta.faces.component.html.HtmlHead) ApplicationImplEventManager(org.apache.myfaces.application.ApplicationImplEventManager) Test(org.junit.Test)

Example 3 with ApplicationImplEventManager

use of org.apache.myfaces.application.ApplicationImplEventManager in project myfaces by apache.

the class GlobalPostAddToViewEventTestCase method testPostAddToViewSourceUnmatching.

@Test
public void testPostAddToViewSourceUnmatching() throws Exception {
    ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
    eventManager.subscribeToEvent(PostAddToViewEvent.class, HtmlInputText.class, new HeadResourceListener());
    eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
    Assert.assertFalse(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
Also used : HtmlHead(jakarta.faces.component.html.HtmlHead) ApplicationImplEventManager(org.apache.myfaces.application.ApplicationImplEventManager) Test(org.junit.Test)

Example 4 with ApplicationImplEventManager

use of org.apache.myfaces.application.ApplicationImplEventManager in project myfaces by apache.

the class GlobalPostAddToViewEventTestCase method testPostAddToViewSourceDirect.

@Test
public void testPostAddToViewSourceDirect() throws Exception {
    ApplicationImplEventManager eventManager = new ApplicationImplEventManager();
    eventManager.subscribeToEvent(PostAddToViewEvent.class, HtmlHead.class, new HeadResourceListener());
    eventManager.publishEvent(facesContext, PostAddToViewEvent.class, HtmlHead.class, new HtmlHead());
    Assert.assertTrue(facesContext.getAttributes().containsKey("SystemEventListenerInvokedForHead"));
}
Also used : HtmlHead(jakarta.faces.component.html.HtmlHead) ApplicationImplEventManager(org.apache.myfaces.application.ApplicationImplEventManager) Test(org.junit.Test)

Aggregations

HtmlHead (jakarta.faces.component.html.HtmlHead)4 ApplicationImplEventManager (org.apache.myfaces.application.ApplicationImplEventManager)4 Test (org.junit.Test)4