ThreadSafe Pattern Test

Pattern Test that verifies that ThreadSafe Avalon component can only set instance variables in their compose initialize(), dispose() or configure() methods. This is to prevent setting state in a ThreadSafe component.

Example of test violation:

public class MyComponent implements Component, Composable, Initializable, 
    Disposable, ThreadSafe
{
    private ComponentManager componentManager;
    private String instanceVariable;
    
    // Allowed
    private Hashtable hash = new Hashtable();

    public void compose(ComponentManager componentManager)
    {
        // Allowed
        this.componentManager = componentManager;
    }        

    public void initialize()
    {
        // Allowed
        this.instanceVariable = "is allowed";
    }        

    public void dispose()
    {
        // Allowed
        this.instanceVariable = "is allowed";
    }        

    public void someMethod()
    {
        // NOT allowed
        this.instanceVariable = "not allowed";
    }