This content has been marked as final.
Show 1 reply
-
1. Re: JSFUnit and Portlets
julien1 Jun 13, 2007 8:50 AM (in response to mwringe)JBoss Portal management apps get their services from the servlet context attributes. They are injected in the application via JSF wiring capabilities.
<managed-bean> <managed-bean-name>portalobjectmgr</managed-bean-name> <managed-bean-class>org.jboss.portal.core.admin.ui.PortalObjectManagerBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>roleModule</property-name> <value>#{applicationScope.RoleModule}</value> </managed-property> <managed-property> <property-name>portalObjectContainer</property-name> <value>#{applicationScope.PortalObjectContainer}</value> </managed-property> <managed-property> <property-name>instanceContainer</property-name> <value>#{applicationScope.InstanceContainer}</value> </managed-property> <managed-property> <property-name>layoutService</property-name> <value>#{applicationScope.LayoutService}</value> </managed-property> <managed-property> <property-name>themeService</property-name> <value>#{applicationScope.ThemeService}</value> </managed-property> <managed-property> <property-name>domainConfigurator</property-name> <value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value> </managed-property> </managed-bean>
In that example we can see the the portalobjectmgr bean requires the injection of several services. Those services are injected by the portal at runtime.
So testing our apps requires those services to be present as well. Most of those services are POJOs which can be wired using microcontainer.
The microcontainer would be bootstrapped as a servlet context listener and it is possible to make the servlet context attributes being seen as a bean of the MC, providing thus injection capabilities in the servlet context attributes.