Search in sources :

Example 1 with MockBeanManager

use of com.sun.faces.mock.MockBeanManager in project mojarra by eclipse-ee4j.

the class ELUtilsTest method setUp.

@Before
public void setUp() {
    MockServletContext mockServletContext = new MockServletContext() {

        @Override
        public URL getResource(String path) {
            return null;
        }
    };
    mockServletContext.addInitParameter("appParamName", "appParamValue");
    mockServletContext.setAttribute("appScopeName", "appScopeValue");
    ExternalContextImpl externalContext = new ExternalContextImpl(mockServletContext, new MockHttpServletRequest(), new MockHttpServletResponse());
    FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY, "com.sun.faces.mock.MockRenderKitFactory");
    new FacesContextImpl(externalContext, new LifecycleImpl());
    new ApplicationImpl();
    applicationAssociate = (ApplicationAssociate) externalContext.getApplicationMap().get(RIConstants.FACES_PREFIX + "ApplicationAssociate");
    FacesContext.getCurrentInstance().getAttributes().put(RIConstants.CDI_BEAN_MANAGER, new MockBeanManager());
}
Also used : FacesContextImpl(com.sun.faces.context.FacesContextImpl) MockHttpServletRequest(com.sun.faces.mock.MockHttpServletRequest) ApplicationImpl(com.sun.faces.application.ApplicationImpl) MockBeanManager(com.sun.faces.mock.MockBeanManager) ExternalContextImpl(com.sun.faces.context.ExternalContextImpl) LifecycleImpl(com.sun.faces.lifecycle.LifecycleImpl) MockServletContext(com.sun.faces.mock.MockServletContext) MockHttpServletResponse(com.sun.faces.mock.MockHttpServletResponse) Before(org.junit.Before)

Aggregations

ApplicationImpl (com.sun.faces.application.ApplicationImpl)1 ExternalContextImpl (com.sun.faces.context.ExternalContextImpl)1 FacesContextImpl (com.sun.faces.context.FacesContextImpl)1 LifecycleImpl (com.sun.faces.lifecycle.LifecycleImpl)1 MockBeanManager (com.sun.faces.mock.MockBeanManager)1 MockHttpServletRequest (com.sun.faces.mock.MockHttpServletRequest)1 MockHttpServletResponse (com.sun.faces.mock.MockHttpServletResponse)1 MockServletContext (com.sun.faces.mock.MockServletContext)1 Before (org.junit.Before)1