org.picocontainer.tck
Class AbstractComponentAdapterTest

java.lang.Object
  extended by org.picocontainer.tck.AbstractComponentAdapterTest
Direct Known Subclasses:
ConstructorInjectorTestCase, InstanceAdapterTestCase, SetterInjectorTestCase

public abstract class AbstractComponentAdapterTest
extends Object

Test suite for a ComponentAdapter implementation.

Author:
Jörg Schaible

Nested Class Summary
static class AbstractComponentAdapterTest.CollectingBehavior
           
static class AbstractComponentAdapterTest.CycleDetectorBehavior
           
static class AbstractComponentAdapterTest.NotInstantiatableBehavior
           
static class AbstractComponentAdapterTest.RecordingLifecycleStrategy
           
 
Field Summary
static int INSTANTIATING
           
static int RESOLVING
           
static int SERIALIZABLE
           
static int VERIFYING
           
 
Constructor Summary
AbstractComponentAdapterTest()
           
 
Method Summary
protected  ComponentFactory createDefaultComponentFactory()
           
protected  int getComponentAdapterNature()
           
protected abstract  Class getComponentAdapterType()
           
protected  ComponentAdapter prepDEF_isAbleToTakeParameters(MutablePicoContainer picoContainer)
          Prepare the test isAbleToTakeParameters.
protected abstract  ComponentAdapter prepDEF_verifyDoesNotInstantiate(MutablePicoContainer picoContainer)
          Prepare the test verifyDoesNotInstantiate.
protected abstract  ComponentAdapter prepDEF_verifyWithoutDependencyWorks(MutablePicoContainer picoContainer)
          Prepare the test verifyWithoutDependencyWorks.
protected abstract  ComponentAdapter prepDEF_visitable()
          Prepare the test visitable.
protected  ComponentAdapter prepINS_createsNewInstances(MutablePicoContainer picoContainer)
          Prepare the test createsNewInstances.
protected  ComponentAdapter prepINS_errorIsRethrown(MutablePicoContainer picoContainer)
          Prepare the test errorIsRethrown.
protected  ComponentAdapter prepINS_normalExceptionIsRethrownInsidePicoInitializationException(MutablePicoContainer picoContainer)
          Prepare the test normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException.
protected  ComponentAdapter prepINS_runtimeExceptionIsRethrown(MutablePicoContainer picoContainer)
          Prepare the test runtimeExceptionIsRethrown.
protected  ComponentAdapter prepRES_dependenciesAreResolved(MutablePicoContainer picoContainer)
          Prepare the test dependenciesAreResolved.
protected  ComponentAdapter prepRES_failingInstantiationWithCyclicDependencyException(MutablePicoContainer picoContainer)
          Prepare the test failingInstantiationWithCyclicDependencyException.
protected  ComponentAdapter prepRES_failingVerificationWithCyclicDependencyException(MutablePicoContainer picoContainer)
          Prepare the test failingVerificationWithCyclicDependencyException.
protected  ComponentAdapter prepSER_isSerializable(MutablePicoContainer picoContainer)
          Prepare the test isSerializable.
protected  ComponentAdapter prepSER_isXStreamSerializable(MutablePicoContainer picoContainer)
          Prepare the test isXStreamSerializable.
protected  ComponentAdapter prepVER_verificationFails(MutablePicoContainer picoContainer)
          Prepare the test verificationFailsWithUnsatisfiedDependency.
 void testDEF_isAbleToTakeParameters()
           
 void testDEF_verifyDoesNotInstantiate()
           
 void testDEF_verifyWithoutDependencyWorks()
           
 void testDEF_visitable()
           
 void testINS_createsNewInstances()
           
 void testINS_errorIsRethrown()
           
 void testINS_normalExceptionIsRethrownInsidePicoInitializationException()
           
 void testINS_runtimeExceptionIsRethrown()
           
 void testRES_dependenciesAreResolved()
           
 void testRES_failingInstantiationWithCyclicDependencyException()
           
 void testRES_failingVerificationWithCyclicDependencyException()
           
 void testSER_isSerializable()
           
 void testSER_isXStreamSerializable()
           
 void testSER_isXStreamSerializableWithPureReflection()
           
 void testVER_verificationFails()
           
protected  PicoContainer wrapComponentInstances(Class decoratingComponentAdapterClass, PicoContainer picoContainer, Object[] wrapperDependencies)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIALIZABLE

public static final int SERIALIZABLE
See Also:
Constant Field Values

VERIFYING

public static final int VERIFYING
See Also:
Constant Field Values

INSTANTIATING

public static final int INSTANTIATING
See Also:
Constant Field Values

RESOLVING

public static final int RESOLVING
See Also:
Constant Field Values
Constructor Detail

AbstractComponentAdapterTest

public AbstractComponentAdapterTest()
Method Detail

getComponentAdapterType

protected abstract Class getComponentAdapterType()

getComponentAdapterNature

protected int getComponentAdapterNature()

createDefaultComponentFactory

protected ComponentFactory createDefaultComponentFactory()

prepDEF_verifyWithoutDependencyWorks

protected abstract ComponentAdapter prepDEF_verifyWithoutDependencyWorks(MutablePicoContainer picoContainer)
Prepare the test verifyWithoutDependencyWorks.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test for a component without dependencies. Registration in the pico is not necessary.

testDEF_verifyWithoutDependencyWorks

public final void testDEF_verifyWithoutDependencyWorks()

prepDEF_verifyDoesNotInstantiate

protected abstract ComponentAdapter prepDEF_verifyDoesNotInstantiate(MutablePicoContainer picoContainer)
Prepare the test verifyDoesNotInstantiate.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test for a component that may throw on instantiation. Registration in the pico is not necessary.

testDEF_verifyDoesNotInstantiate

public final void testDEF_verifyDoesNotInstantiate()

prepDEF_visitable

protected abstract ComponentAdapter prepDEF_visitable()
Prepare the test visitable.

Returns:
a ComponentAdapter of the type to test. If the ComponentAdapter supports Parameter, you have to select a component, that have some.

testDEF_visitable

public final void testDEF_visitable()

prepDEF_isAbleToTakeParameters

protected ComponentAdapter prepDEF_isAbleToTakeParameters(MutablePicoContainer picoContainer)
Prepare the test isAbleToTakeParameters. Overload this function, if the ComponentAdapter to test supports Parameter.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Select a component, that has some parameters. Registration in the pico is not necessary.

testDEF_isAbleToTakeParameters

public final void testDEF_isAbleToTakeParameters()

prepSER_isSerializable

protected ComponentAdapter prepSER_isSerializable(MutablePicoContainer picoContainer)
Prepare the test isSerializable. Overload this function, if the ComponentAdapter supports serialization.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Registration in the pico is not necessary.

testSER_isSerializable

public final void testSER_isSerializable()
                                  throws IOException,
                                         ClassNotFoundException
Throws:
IOException
ClassNotFoundException

prepSER_isXStreamSerializable

protected ComponentAdapter prepSER_isXStreamSerializable(MutablePicoContainer picoContainer)
Prepare the test isXStreamSerializable. Overload this function, if the ComponentAdapter supports serialization.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Registration in the pico is not necessary.

testSER_isXStreamSerializableWithPureReflection

public final void testSER_isXStreamSerializableWithPureReflection()

testSER_isXStreamSerializable

public final void testSER_isXStreamSerializable()

prepVER_verificationFails

protected ComponentAdapter prepVER_verificationFails(MutablePicoContainer picoContainer)
Prepare the test verificationFailsWithUnsatisfiedDependency. Overload this function, if the ComponentAdapter's verification can fail e.g. due to an unresolved dependency.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test, that fails for the verification, e.g. because of a compoennt with missing dependencies. Registration in the pico is not necessary.

testVER_verificationFails

public final void testVER_verificationFails()

prepINS_createsNewInstances

protected ComponentAdapter prepINS_createsNewInstances(MutablePicoContainer picoContainer)
Prepare the test createsNewInstances. Overload this function, if the ComponentAdapter is instantiating. It should create a new instance with every call.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Registration in the pico is not necessary.

testINS_createsNewInstances

public final void testINS_createsNewInstances()

prepINS_errorIsRethrown

protected ComponentAdapter prepINS_errorIsRethrown(MutablePicoContainer picoContainer)
Prepare the test errorIsRethrown. Overload this function, if the ComponentAdapter is instantiating.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test with a component that fails with an Error at instantiation. Registration in the pico is not necessary.

testINS_errorIsRethrown

public final void testINS_errorIsRethrown()

prepINS_runtimeExceptionIsRethrown

protected ComponentAdapter prepINS_runtimeExceptionIsRethrown(MutablePicoContainer picoContainer)
Prepare the test runtimeExceptionIsRethrown. Overload this function, if the ComponentAdapter is instantiating.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test with a component that fails with a RuntimeException at instantiation. Registration in the pico is not necessary.

testINS_runtimeExceptionIsRethrown

public final void testINS_runtimeExceptionIsRethrown()

prepINS_normalExceptionIsRethrownInsidePicoInitializationException

protected ComponentAdapter prepINS_normalExceptionIsRethrownInsidePicoInitializationException(MutablePicoContainer picoContainer)
Prepare the test normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException. Overload this function, if the ComponentAdapter is instantiating.

Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test with a component that fails with a PicoCompositionException at instantiation. Registration in the pico is not necessary.

testINS_normalExceptionIsRethrownInsidePicoInitializationException

public final void testINS_normalExceptionIsRethrownInsidePicoInitializationException()

prepRES_dependenciesAreResolved

protected ComponentAdapter prepRES_dependenciesAreResolved(MutablePicoContainer picoContainer)
Prepare the test dependenciesAreResolved. Overload this function, if the ComponentAdapter is resolves dependencies.

Parameters:
picoContainer - container, used to register dependencies.
Returns:
a ComponentAdapter of the type to test with a component that has dependencies. Registration in the pico is not necessary.

testRES_dependenciesAreResolved

public final void testRES_dependenciesAreResolved()

prepRES_failingVerificationWithCyclicDependencyException

protected ComponentAdapter prepRES_failingVerificationWithCyclicDependencyException(MutablePicoContainer picoContainer)
Prepare the test failingVerificationWithCyclicDependencyException. Overload this function, if the ComponentAdapter is resolves dependencies.

Parameters:
picoContainer - container, used to register dependencies.
Returns:
a ComponentAdapter of the type to test with a component that has cyclic dependencies. You have to register the component itself in the pico.

testRES_failingVerificationWithCyclicDependencyException

public final void testRES_failingVerificationWithCyclicDependencyException()

prepRES_failingInstantiationWithCyclicDependencyException

protected ComponentAdapter prepRES_failingInstantiationWithCyclicDependencyException(MutablePicoContainer picoContainer)
Prepare the test failingInstantiationWithCyclicDependencyException. Overload this function, if the ComponentAdapter is resolves dependencies.

Parameters:
picoContainer - container, used to register dependencies.
Returns:
a ComponentAdapter of the type to test with a component that has cyclic dependencies. You have to register the component itself in the pico.

testRES_failingInstantiationWithCyclicDependencyException

public final void testRES_failingInstantiationWithCyclicDependencyException()

wrapComponentInstances

protected final PicoContainer wrapComponentInstances(Class decoratingComponentAdapterClass,
                                                     PicoContainer picoContainer,
                                                     Object[] wrapperDependencies)


Copyright © 2003-2010 Codehaus. All Rights Reserved.