tldPaths = new String[1];
tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/component/tobago.tld";
super.setUp();
ServletContext servletContext = new MockServletContext();
HttpServletRequest request = new MockHttpServletRequest();
HttpServletResponse response = new MockHttpServletResponse();
pageContext = new MockPageContext(request);
ExternalContext externalContext =
new MockExternalContext(servletContext, request, response);
Lifecycle lifecycle = null;
facesContext = new MockFacesContext(externalContext, lifecycle);
// Set up Faces API Objects
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
"org.apache.myfaces.tobago.mock.faces.MockApplicationFactory");
FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
"org.apache.myfaces.tobago.mock.faces.MockRenderKitFactory");
ApplicationFactory applicationFactory = (ApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
application = applicationFactory.getApplication();
application.addComponent("javax.faces.ViewRoot", "org.apache.myfaces.tobago.component.UIViewRoot");
application.addComponent("javax.faces.Command", "javax.faces.component.UICommand");
application.addComponent("org.apache.myfaces.tobago.Command", "org.apache.myfaces.tobago.component.UICommand");
application
.addComponent("org.apache.myfaces.tobago.LinkCommand", "org.apache.myfaces.tobago.component.UILinkCommand");
application
.addComponent("org.apache.myfaces.tobago.ButtonCommand", "org.apache.myfaces.tobago.component.UIButtonCommand");
facesContext.setApplication(application);
UIViewRoot root = facesContext
.getApplication().getViewHandler().createView(facesContext, "testViewId");
root.setViewId("/viewId");
facesContext.setViewRoot(root);
RenderKitFactory renderKitFactory = (RenderKitFactory)
FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
RenderKit renderKit = new MockRenderKit();
try {
renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT, renderKit);
} catch (IllegalArgumentException e) {
// ignore
}
request.setAttribute("peter", new DummyBean(true, 20, "Peter"));
request.setAttribute("marry", new DummyBean(false, 17, "Marry"));
}