org.codehaus.waffle.testing.registrar
Class RegistrarHelper

java.lang.Object
  extended by org.codehaus.waffle.testing.registrar.RegistrarHelper

public class RegistrarHelper
extends java.lang.Object

Registrar helper class. Retrieves controller instances registered in a Registrar and allows the registration of all the components in a given context level.

Author:
Mauro Talevi

Nested Class Summary
static class RegistrarHelper.StubServletContext
          ServletContext stub that returns a PicoComponentRegistry backed by the context itself.
static class RegistrarHelper.StubServletRequest
          HttpServletRequest stub that allows request-scoped components to depend on it
 
Constructor Summary
RegistrarHelper()
           
 
Method Summary
 void componentsFor(java.lang.Class<?> registrarType, ContextLevel level)
          Registers the components for the given registrar and level
 java.lang.Object controllerFor(java.lang.Class<?> registrarType, ContextLevel level, java.lang.String path)
          Returns the registered controller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistrarHelper

public RegistrarHelper()
Method Detail

componentsFor

public void componentsFor(java.lang.Class<?> registrarType,
                          ContextLevel level)
Registers the components for the given registrar and level

Parameters:
registrarType - the Class representing the registrar type
level - the ContextLevel

controllerFor

public java.lang.Object controllerFor(java.lang.Class<?> registrarType,
                                      ContextLevel level,
                                      java.lang.String path)
Returns the registered controller

Parameters:
registrarType - the Class representing the registrar type
level - the ContextLevel
path - the path under which the controller is registered
Returns:
The controller instance or null if not found


Copyright © 2008. All Rights Reserved.