1 Reply Latest reply on Jun 13, 2007 8:50 AM by julien1

    JSFUnit and Portlets

    mwringe

      I am still confused as to how jsf portlet applications should be tested using jsfunit. JSFUnit expects to be able to browse to a URL to access the jsf page. This is something that can't be done currently in portal.

      Trivial JSF portlets can be easily altered so that it can be accessed just as a normal jsf application, but it gets more difficult with more complex portlets that rely on portal specifics.

      I know it was mentioned that I could setup the jsf application and use the micro-container to bootstrap portal services. I am a little lost in this. Would this require running new services or tieing into an already running portals services?

        • 1. Re: JSFUnit and Portlets

          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.