org.apache.tapestry5.ioc.internal
Class IOCInternalTestCase

java.lang.Object
  extended by org.testng.Assert
      extended by org.apache.tapestry5.ioc.test.TestBase
          extended by org.apache.tapestry5.ioc.test.IOCTestCase
              extended by org.apache.tapestry5.ioc.internal.IOCInternalTestCase
All Implemented Interfaces:
ObjectLocator, Registry

public class IOCInternalTestCase
extends IOCTestCase
implements Registry


Constructor Summary
IOCInternalTestCase()
           
 
Method Summary
<T> T
autobuild(Class<T> clazz)
          Autobuilds a class by finding the public constructor with the most parameters.
 void cleanupThread()
          Invoked at the end of a request to discard any thread-specific information accumulated during the current request.
 ClassFactory getClassFactory()
           
<T> T
getObject(Class<T> objectType, AnnotationProvider annotationProvider)
          Obtains an object indirectly, using the MasterObjectProvider service.
<T> T
getService(Class<T> serviceInterface)
          Locates a service given just a service interface.
<T> T
getService(String serviceId, Class<T> serviceInterface)
          Obtains a service via its unique service id.
protected  InternalRegistry mockInternalRegistry()
           
protected  Module mockModule()
           
protected  ObjectCreatorSource mockObjectCreatorSource()
           
protected  ServiceActivityTracker mockServiceActivityTracker()
           
 void performRegistryStartup()
          Invoked to eagerly load services marked with the EagerLoad annotation, and to execute all contributions to the Startup service.
<T> T
proxy(Class<T> interfaceClass, Class<? extends T> implementationClass)
          Creates a proxy.
 void setup_registry()
           
 void shutdown_registry()
           
 void shutdown()
          Shuts down a Registry instance.
protected  void train_findDecoratorsForService(InternalRegistry registry)
           
protected  void train_getDescription(ObjectCreatorSource source, String description)
           
protected
<T> void
train_getService(InternalRegistry registry, String serviceId, Class<T> serviceInterface, T service)
           
 
Methods inherited from class org.apache.tapestry5.ioc.test.IOCTestCase
buildRegistry, findMethod, findMethod, findMethod, join, mockAnnotationProvider, mockClassPropertyAdapter, mockConfiguration, mockContributionDef, mockDecoratorDef, mockLocation, mockLogger, mockMappedConfiguration, mockMasterObjectProvider, mockMessageFormatter, mockMessages, mockModuleDef, mockObjectCreator, mockObjectLocator, mockObjectProvider, mockOrderedConfiguration, mockPerthreadManager, mockPropertyAccess, mockPropertyAdapter, mockResource, mockRunnable, mockServiceBuilderResources, mockServiceBuilderResources, mockServiceDecorator, mockServiceDef, mockServiceResources, mockServiceResources, mockSymbolSource, mockThreadLocale, mockTypeCoercer, newIntermediateType, stub_contains, stub_isDebugEnabled, train_autobuild, train_coerce, train_contains, train_createInterceptor, train_createObject, train_expandSymbols, train_expandSymbols, train_forFile, train_forLocale, train_format, train_get, train_get, train_getAnnotation, train_getLocale, train_getLogger, train_getLogger, train_getMessageFormatter, train_getPath, train_getService, train_getService, train_getServiceId, train_getServiceId, train_getServiceInterface, train_getServiceInterface, train_getTracker, train_isDebugEnabled, train_isTraceEnabled, train_matches, train_provide, train_toURL, train_value
 
Methods inherited from class org.apache.tapestry5.ioc.test.TestBase
assertArraysEqual, assertListsEquals, assertListsEquals, assertMessageContains, create, discardMockControl, expect, get, getMocksControl, newCapture, newMock, replay, set, setAnswer, setThrowable, unreachable, verify
 
Methods inherited from class org.testng.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsNoOrder, assertEqualsNoOrder, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOCInternalTestCase

public IOCInternalTestCase()
Method Detail

cleanupThread

public final void cleanupThread()
Description copied from interface: Registry
Invoked at the end of a request to discard any thread-specific information accumulated during the current request.

Specified by:
cleanupThread in interface Registry
See Also:
PerthreadManager, ThreadCleanupListener

getClassFactory

public final ClassFactory getClassFactory()

getObject

public final <T> T getObject(Class<T> objectType,
                             AnnotationProvider annotationProvider)
Description copied from interface: ObjectLocator
Obtains an object indirectly, using the MasterObjectProvider service.

Specified by:
getObject in interface ObjectLocator
Parameters:
objectType - the type of object to be returned
annotationProvider - provides access to annotations on the field or parameter for which a value is to be obtained, which may be utilized in selecting an appropriate object, use null when annotations are not available (in which case, selection will be based only on the object type)
Returns:
the requested object
See Also:
ObjectProvider

getService

public final <T> T getService(Class<T> serviceInterface)
Description copied from interface: ObjectLocator
Locates a service given just a service interface. A single service must implement the service interface (which can be hard to guarantee). The search takes into account inheritance of the service interface (not the service implementation), which may result in a failure due to extra matches.

Specified by:
getService in interface ObjectLocator
Parameters:
serviceInterface - the interface the service implements
Returns:
the service's proxy

getService

public final <T> T getService(String serviceId,
                              Class<T> serviceInterface)
Description copied from interface: ObjectLocator
Obtains a service via its unique service id. Returns the service's proxy. The service proxy implements the same interface as the actual service, and is used to instantiate the actual service only as needed (this is transparent to the application).

Specified by:
getService in interface ObjectLocator
Parameters:
serviceId - unique Service id used to locate the service object (may contain symbols, which will be expanded), case is ignored
serviceInterface - the interface implemented by the service (or an interface extended by the service interface)
Returns:
the service instance

autobuild

public final <T> T autobuild(Class<T> clazz)
Description copied from interface: ObjectLocator
Autobuilds a class by finding the public constructor with the most parameters. Services and resources will be injected into the parameters of the constructor.

Specified by:
autobuild in interface ObjectLocator
Parameters:
clazz - the type of object to instantiate
Returns:
the instantiated instance
See Also:
MasterObjectProvider

performRegistryStartup

public final void performRegistryStartup()
Description copied from interface: Registry
Invoked to eagerly load services marked with the EagerLoad annotation, and to execute all contributions to the Startup service.

Specified by:
performRegistryStartup in interface Registry

proxy

public <T> T proxy(Class<T> interfaceClass,
                   Class<? extends T> implementationClass)
Description copied from interface: ObjectLocator
Creates a proxy. The proxy will defer invocation of ObjectLocator.autobuild(Class) until just-in-time (that is, first method invocation). In a limited number of cases, it is necessary to use such a proxy to prevent service construction cycles, particularly when contributing (directly or indirectly) to the MasterObjectProvider (which is itself at the heart of autobuilding).

Specified by:
proxy in interface ObjectLocator
Parameters:
interfaceClass - the interface implemented by the proxy
implementationClass - a concrete class that implements the interface
Returns:
a proxy

setup_registry

public final void setup_registry()

shutdown

public final void shutdown()
Description copied from interface: Registry
Shuts down a Registry instance. Notifies all listeners that the registry has shutdown. Further method invocations on the Registry are no longer allowed, and the Registry instance should be discarded.

Specified by:
shutdown in interface Registry
See Also:
RegistryShutdownHub, RegistryShutdownListener

shutdown_registry

public final void shutdown_registry()

mockInternalRegistry

protected final InternalRegistry mockInternalRegistry()

mockModule

protected final Module mockModule()

mockObjectCreatorSource

protected final ObjectCreatorSource mockObjectCreatorSource()

train_findDecoratorsForService

protected final void train_findDecoratorsForService(InternalRegistry registry)

train_getDescription

protected final void train_getDescription(ObjectCreatorSource source,
                                          String description)

train_getService

protected final <T> void train_getService(InternalRegistry registry,
                                          String serviceId,
                                          Class<T> serviceInterface,
                                          T service)

mockServiceActivityTracker

protected ServiceActivityTracker mockServiceActivityTracker()


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.