incubator-composer-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject svn commit: r618170 [2/2] - in /incubator/composer/trunk/composer-core: ./ src/main/java/org/apache/composer/core/adapters/ src/main/java/org/apache/composer/core/behaviors/ src/test/java/org/apache/composer/core/adapters/ src/test/java/org/apache/comp...
Date Mon, 04 Feb 2008 05:34:03 GMT
Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/StaticFactoryAdapterTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/StaticFactoryAdapterTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/StaticFactoryAdapterTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/StaticFactoryAdapterTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.composer.core.adapters;
+
+import org.apache.composer.core.ComponentAdapter;
+import org.apache.composer.core.containers.DefaultContainer;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+
+/**
+ * @author Jörg Schaible
+ */
+public class StaticFactoryAdapterTestCase {
+
+    @Test public void testStaticFactoryInAction() {
+        ComponentAdapter componentAdapter = new StaticFactoryAdapter(Registry.class, new StaticFactory() {
+            public Object get() {
+                try {
+                    return LocateRegistry.getRegistry();
+                } catch (RemoteException e) {
+                    return null;
+                }
+            }
+        });
+
+        DefaultContainer pico = new DefaultContainer();
+        pico.addAdapter(componentAdapter).getComponentAdapter(componentAdapter.getComponentKey()).verify(pico);
+        Registry registry = pico.getComponent(Registry.class);
+        assertNotNull(registry);
+    }
+}

Propchange: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/StaticFactoryAdapterTestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalComponentAdapterTest.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalComponentAdapterTest.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalComponentAdapterTest.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalComponentAdapterTest.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,245 @@
+/*****************************************************************************
+ * Copyright (c) PicoContainer Organization. All rights reserved.            *
+ * ------------------------------------------------------------------------- *
+ * The software in this package is published under the terms of the BSD      *
+ * style license a copy of which has been included with this distribution in *
+ * the LICENSE.txt file.                                                     *
+ *                                                                           *
+ * Original code by Joerg Schaible                                           *
+ *****************************************************************************/
+package org.picocontainer.gems.adapters;
+
+
+import org.apache.composer.core.ComponentAdapter;
+import org.apache.composer.core.CompositionException;
+import org.apache.composer.core.MutableContainer;
+import org.apache.composer.core.Parameter;
+import org.apache.composer.core.adapters.ThreadLocalized;
+import org.apache.composer.core.containers.DefaultContainer;
+import org.apache.composer.core.injectors.ConstructorInjector;
+import org.apache.composer.core.lifecycle.NullLifecycleStrategy;
+import org.apache.composer.core.monitors.NullComponentMonitor;
+import org.apache.composer.core.parameters.ConstantParameter;
+import org.apache.composer.core.tck.AbstractComponentAdapterTest;
+import org.apache.composer.core.testmodel.SimpleTouchable;
+import org.apache.composer.core.testmodel.Touchable;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * Unit test for ThreadLocalized.
+ *
+ * @author Jörg Schaible
+ */
+public class ThreadLocalComponentAdapterTest extends AbstractComponentAdapterTest {
+
+    @Override
+    protected Class getComponentAdapterType() {
+        return ThreadLocalized.class;
+    }
+
+    @Override
+    protected int getComponentAdapterNature() {
+        return super.getComponentAdapterNature() & ~(RESOLVING | VERIFYING | INSTANTIATING);
+    }
+
+    private ComponentAdapter createComponentAdapterWithSimpleTouchable() {
+        return new ThreadLocalized(new ConstructorInjector(
+            Touchable.class, SimpleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+    }
+
+    @Override
+    protected ComponentAdapter prepDEF_verifyWithoutDependencyWorks(MutableContainer picoContainer) {
+        return createComponentAdapterWithSimpleTouchable();
+    }
+
+    @Override
+    protected ComponentAdapter prepDEF_verifyDoesNotInstantiate(MutableContainer picoContainer) {
+        return createComponentAdapterWithSimpleTouchable();
+    }
+
+    @Override
+    protected ComponentAdapter prepDEF_visitable() {
+        return createComponentAdapterWithSimpleTouchable();
+    }
+
+    @Override
+    protected ComponentAdapter prepDEF_isAbleToTakeParameters(MutableContainer picoContainer) {
+        return new ThreadLocalized(new ConstructorInjector(
+            List.class, ArrayList.class, new Parameter[] {new ConstantParameter(10)}, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+    }
+
+    @Override
+    protected ComponentAdapter prepSER_isSerializable(MutableContainer picoContainer) {
+        return createComponentAdapterWithSimpleTouchable();
+    }
+
+    @Override
+    protected ComponentAdapter prepSER_isXStreamSerializable(MutableContainer picoContainer) {
+        return createComponentAdapterWithSimpleTouchable();
+    }
+
+    /** Helper class testing ThreadLocal cache. */
+    public static class Runner implements Runnable {
+
+        private final Touchable m_touchable;
+        private final List<Touchable> m_list;
+        private final Set<Touchable> m_set;
+
+        /**
+         * Constructs a Runner.
+         *
+         * @param touchable The instance
+         * @param list      The list to which all instances are added
+         * @param set       The set to which all instances are added
+         */
+        public Runner(final Touchable touchable, final List<Touchable> list, final Set<Touchable> set) {
+            m_touchable = touchable;
+            m_list = list;
+            m_set = set;
+        }
+
+        /** @see java.lang.Runnable#run() */
+        public void run() {
+            final Thread thread = Thread.currentThread();
+            while (!Thread.interrupted()) {
+                m_set.add(m_touchable);
+                m_list.add(m_touchable);
+                try {
+                    synchronized (thread) {
+                        thread.wait();
+                    }
+                } catch (InterruptedException e) {
+                    //propagate interrupt
+                    thread.interrupt();
+                }
+            }
+        }
+    }
+
+    /**
+     * Test usage from multiple threads.
+     *
+     * @throws InterruptedException if interrupted
+     */
+    public final void testInstancesUsedFromMultipleThreads() throws InterruptedException {
+        final Set<Touchable> set = Collections.synchronizedSet(new HashSet<Touchable>());
+        final List<Touchable> list = Collections.synchronizedList(new ArrayList<Touchable>());
+        final ComponentAdapter componentAdapter = new ThreadLocalized(new ConstructorInjector(
+            Touchable.class, SimpleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+        final Touchable touchable = (Touchable)componentAdapter.getComponentInstance(null);
+
+        final Thread[] threads = {
+            new Thread(new Runner(touchable, list, set), "junit-1"),
+            new Thread(new Runner(touchable, list, set), "junit-2"),
+            new Thread(new Runner(touchable, list, set), "junit-3"), };
+        for (int i = threads.length; i-- > 0;) {
+            threads[i].start();
+        }
+        Thread.sleep(300);
+        for (int i = threads.length; i-- > 0;) {
+            synchronized (threads[i]) {
+                threads[i].notifyAll();
+            }
+        }
+        Thread.sleep(300);
+        for (int i = threads.length; i-- > 0;) {
+            threads[i].interrupt();
+        }
+        Thread.sleep(300);
+        assertEquals(6, list.size());
+        assertEquals(3, set.size());
+    }
+
+    public void testThreadLocalInstancesEqual() throws Exception {
+        final ComponentAdapter componentAdapter = new ThreadLocalized(new ConstructorInjector(
+            Touchable.class, SimpleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+        final Touchable touchable = (Touchable)componentAdapter.getComponentInstance(null);
+        assertEquals(touchable, touchable);
+    }
+
+    @SuppressWarnings({ "unchecked" })
+    public final void testInstancesAreNotSharedBetweenContainers() {
+        final DefaultContainer picoA = new DefaultContainer();
+        final DefaultContainer picoB = new DefaultContainer();
+        picoA.addAdapter(new ThreadLocalized(new ConstructorInjector(List.class, ArrayList.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false)));
+        picoB.addAdapter(new ThreadLocalized(new ConstructorInjector(List.class, ArrayList.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false)));
+        final List<String> hello1 = (List<String>)picoA.getComponent(List.class);
+        final List hello2 = picoA.getComponent(List.class);
+        hello1.add("foo");
+        assertEquals(hello1, hello2);
+        final List hello3 = picoB.getComponent(List.class);
+        assertEquals(0, hello3.size());
+    }
+
+    /** Test fail-fast for components without interface. */
+    public void testComponentMustImplementInterface() {
+        try {
+            new ThreadLocalized(new ConstructorInjector(Object.class, Object.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+            fail("PicoCompositionException expected");
+        } catch (final CompositionException e) {
+            assertTrue(e.getMessage().endsWith("It does not implement any interfaces."));
+        }
+    }
+
+    public static interface TargetInvocationExceptionTester {
+        public void throwsCheckedException() throws ClassNotFoundException;
+
+        public void throwsRuntimeException();
+
+        public void throwsError();
+    }
+
+    public static class ThrowingComponent implements TargetInvocationExceptionTester {
+        public void throwsCheckedException() throws ClassNotFoundException {
+            throw new ClassNotFoundException("junit");
+        }
+
+        public void throwsRuntimeException() {
+            throw new RuntimeException("junit");
+        }
+
+        public void throwsError() {
+            throw new Error("junit");
+        }
+    }
+
+    public void testExceptionHandling() {
+        final ComponentAdapter componentAdapter = new ThreadLocalized(new ConstructorInjector(
+            TargetInvocationExceptionTester.class, ThrowingComponent.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+        final TargetInvocationExceptionTester tester =
+            (TargetInvocationExceptionTester)componentAdapter.getComponentInstance(null);
+        try {
+            tester.throwsCheckedException();
+            fail("ClassNotFoundException expected");
+        } catch (final ClassNotFoundException e) {
+            assertEquals("junit", e.getMessage());
+        }
+        try {
+            tester.throwsRuntimeException();
+            fail("RuntimeException expected");
+        } catch (final RuntimeException e) {
+            assertEquals("junit", e.getMessage());
+        }
+        try {
+            tester.throwsError();
+            fail("Error expected");
+        } catch (final Error e) {
+            assertEquals("junit", e.getMessage());
+        }
+    }
+
+    /** Test ComponentAdapter using simple keys. */
+    public final void testSimpleKeys() {
+        final ComponentAdapter componentAdapter = new ThreadLocalized(new ConstructorInjector(
+            "List", ArrayList.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+        final List hello = (List)componentAdapter.getComponentInstance(null);
+        assertNotNull(hello);
+    }
+}

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalReferenceTest.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalReferenceTest.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalReferenceTest.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalReferenceTest.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) PicoContainer Organization. All rights reserved.            *
+ * ------------------------------------------------------------------------- *
+ * The software in this package is published under the terms of the BSD      *
+ * style license a copy of which has been included with this distribution in *
+ * the LICENSE.txt file.                                                     *
+ *                                                                           *
+ * Original code by Joerg Schaible                                           *
+ *****************************************************************************/
+package org.picocontainer.gems.adapters;
+
+import org.apache.composer.core.ObjectReference;
+import org.apache.composer.core.references.ThreadLocalReference;
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * Unit test for ThreadLocalReference
+ * 
+ * @author J&ouml;rg Schaible
+ */
+public final class ThreadLocalReferenceTest {
+
+    private List m_exceptionList;
+
+    @Before
+    public void setUp() throws Exception {
+        m_exceptionList = Collections.synchronizedList(new ArrayList());
+    }
+
+    final class RunIt implements Runnable {
+
+        private final ObjectReference m_reference;
+
+        /**
+         * Construct an instance.
+         * 
+         * @param reference
+         */
+        public RunIt(ObjectReference reference) {
+            super();
+            m_reference = reference;
+        }
+
+        /**
+         * @see java.lang.Runnable#run()
+         */
+        public void run() {
+            try {
+                final Thread thread = Thread.currentThread();
+                m_reference.set(thread.getName());
+                synchronized (thread) {
+                    thread.wait();
+                }
+                assertEquals(thread.getName(), m_reference.get());
+            } catch (InterruptedException e) {
+                m_exceptionList.add(e);
+            }
+        }
+    }
+
+    /**
+     * Test working ThreadLocalReference
+     * 
+     * @throws InterruptedException
+     */
+    @Test public void testThreadLocalReference() throws InterruptedException {
+        final ThreadLocalReference reference = new ThreadLocalReference();
+        final Thread[] threads = new Thread[]{
+                new Thread(new RunIt(reference), "junit-TLR-1"), new Thread(new RunIt(reference), "junit-TLR-2"),
+                new Thread(new RunIt(reference), "junit-TLR-3")};
+        reference.set("Hello");
+        for (Thread thread1 : threads) {
+            thread1.start();
+        }
+        Thread.sleep(50);
+        assertEquals("Hello", reference.get());
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.notify();
+            }
+        }
+        Thread.sleep(50);
+        assertEquals("Unexpected Exceptions: " + m_exceptionList, 0, m_exceptionList.size());
+    }
+}

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalizingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalizingTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalizingTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/adapters/ThreadLocalizingTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,139 @@
+/*****************************************************************************
+ * Copyright (c) PicoContainer Organization. All rights reserved.            *
+ * ------------------------------------------------------------------------- *
+ * The software in this package is published under the terms of the BSD      *
+ * style license a copy of which has been included with this distribution in *
+ * the LICENSE.txt file.                                                     *
+ *                                                                           *
+ * Original code by Joerg Schaible                                           *
+ *****************************************************************************/
+
+package org.apache.composer.core.adapters;
+
+import org.apache.composer.core.ComponentAdapter;
+import org.apache.composer.core.ComponentFactory;
+import org.apache.composer.core.injectors.ConstructorInjection;
+import org.apache.composer.core.lifecycle.NullLifecycleStrategy;
+import org.apache.composer.core.monitors.NullComponentMonitor;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+
+/**
+ * Test ThreadLocalizing.
+ * 
+ * @author J&ouml;rg Schaible
+ */
+public class ThreadLocalizingTestCase {
+
+    /**
+     * Test creation of a CA ensuring ThreadLocal-behaviour.
+     * 
+     * @throws InterruptedException
+     */
+    @Test public void testCreateComponentAdapterEnsuringThreadLocal() throws InterruptedException {
+        final ComponentFactory componentFactory = new ThreadLocalizing().wrap(new ConstructorInjection());
+        final ComponentAdapter componentAdapter = componentFactory.createComponentAdapter(
+                new NullComponentMonitor(), new NullLifecycleStrategy(), new Properties(), List.class, ArrayList.class);
+        final List list = (List)componentAdapter.getComponentInstance(null);
+        list.add(this);
+        final List list2 = new ArrayList();
+        final Thread thread = new Thread(new Runnable() {
+            /**
+             * @see java.lang.Runnable#run()
+             */
+            public void run() {
+                list2.addAll(list);
+                list2.add(Thread.currentThread());
+            }
+        }, "junit");
+        thread.start();
+        thread.join();
+        assertEquals(1, list2.size());
+        assertSame(thread, list2.get(0));
+    }
+
+    /**
+     * Test creation of a CA failing ThreadLocal-behaviour.
+     * 
+     * @throws InterruptedException
+     */
+    @Test public void testCreateComponentAdapterFailingThreadLocal() throws InterruptedException {
+        final ComponentFactory componentFactory = new ThreadLocalizing(ThreadLocalizing.THREAD_ENSURES_LOCALITY).wrap(new ConstructorInjection());
+        final ComponentAdapter componentAdapter = componentFactory.createComponentAdapter(
+                new NullComponentMonitor(), new NullLifecycleStrategy(), new Properties(), List.class, ArrayList.class);
+        final List list = (List)componentAdapter.getComponentInstance(null);
+        list.add(this);
+        final List list2 = new ArrayList();
+        final Thread thread = new Thread(new Runnable() {
+            /**
+             * @see java.lang.Runnable#run()
+             */
+            public void run() {
+                list2.addAll(list);
+                list2.add(Thread.currentThread());
+            }
+        }, "junit");
+        thread.start();
+        thread.join();
+        assertEquals(2, list2.size());
+        assertSame(this, list2.get(0));
+        assertSame(thread, list2.get(1));
+    }
+
+    /**
+     * Test creation of a CA with ThreadLocal-behaviour works if the thread ensures creation.
+     * 
+     * @throws InterruptedException
+     */
+    @Test public void testCreateComponentAdapterWorksForDifferentThreads() throws InterruptedException {
+        final ComponentFactory componentFactory = new ThreadLocalizing(ThreadLocalizing.THREAD_ENSURES_LOCALITY).wrap(new ConstructorInjection());
+        final ComponentAdapter componentAdapter = componentFactory.createComponentAdapter(
+                new NullComponentMonitor(), new NullLifecycleStrategy(), new Properties(), List.class, ArrayList.class);
+        final List list = (List)componentAdapter.getComponentInstance(null);
+        list.add(this);
+        final List list2 = new ArrayList();
+        final Thread thread = new Thread(new Runnable() {
+            /**
+             * @see java.lang.Runnable#run()
+             */
+            public void run() {
+                final List newList = (List)componentAdapter.getComponentInstance(null);
+                list2.addAll(newList);
+                final Thread junitThread = Thread.currentThread();
+                list2.add(junitThread);
+                if (newList.size() == 0) {
+                    synchronized (junitThread) {
+                        junitThread.notify();
+                        try {
+                            junitThread.wait();
+                        } catch (InterruptedException e) {
+                            // Ignore
+                        }
+                    }
+                    newList.add(list2);
+                    run();
+                }
+            }
+        }, "junit");
+        synchronized (thread) {
+            thread.start();
+            thread.wait();
+        }
+        assertEquals(1, list2.size());
+        assertSame(thread, list2.get(0));
+        synchronized (thread) {
+            thread.notify();
+        }
+        thread.join();
+        assertEquals(3, list2.size());
+        assertSame(thread, list2.get(0));
+        assertSame(list2, list2.get(1));
+        assertSame(thread, list2.get(2));
+    }
+}

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AsmImplementationHidingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AsmImplementationHidingTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AsmImplementationHidingTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AsmImplementationHidingTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * Copyright (c) PicoContainer Organization. All rights reserved.            *
+ * ------------------------------------------------------------------------- *
+ * The software in this package is published under the terms of the BSD      *
+ * style license a copy of which has been included with this distribution in *
+ * the LICENSE.txt file.                                                     *
+ *                                                                           *
+ *****************************************************************************/
+
+package org.apache.composer.core.behaviors;
+
+import org.apache.composer.core.Characteristics;
+import org.apache.composer.core.ComponentAdapter;
+import org.apache.composer.core.ComponentFactory;
+import org.apache.composer.core.adapters.Elephant;
+import org.apache.composer.core.adapters.ElephantImpl;
+import org.apache.composer.core.adapters.ElephantProxy;
+import org.apache.composer.core.adapters.InstanceAdapter;
+import org.apache.composer.core.containers.DefaultContainer;
+import org.apache.composer.core.injectors.AdaptingInjection;
+import org.apache.composer.core.injectors.ConstructorInjection;
+import org.apache.composer.core.injectors.ConstructorInjector;
+import org.apache.composer.core.lifecycle.NullLifecycleStrategy;
+import org.apache.composer.core.monitors.NullComponentMonitor;
+import org.apache.composer.core.tck.AbstractComponentFactoryTest;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+
+
+public final class AsmImplementationHidingTestCase extends AbstractComponentFactoryTest {
+
+    private final ComponentFactory implementationHidingComponentFactory = new AsmImplementationHiding().wrap(new AdaptingInjection());
+
+    public void testAddComponentUsesImplementationHidingBehavior() {
+        DefaultContainer pico =
+            new DefaultContainer(new AsmImplementationHiding().wrap(new ConstructorInjection()));
+        pico.addComponent("foo", String.class);
+        ComponentAdapter foo = pico.getComponentAdapter("foo");
+        assertEquals(HiddenImplementation.class, foo.getClass());
+        assertEquals(ConstructorInjector.class, ((AbstractBehavior) foo).getDelegate().getClass());
+    }
+
+    public void testAddComponentUsesImplementationHidingBehaviorWithRedundantHideImplProperty() {
+        DefaultContainer pico =
+            new DefaultContainer(new AsmImplementationHiding().wrap(new ConstructorInjection()));
+        pico.change(Characteristics.HIDE_IMPL).addComponent("foo", String.class);
+        ComponentAdapter foo = pico.getComponentAdapter("foo");
+        assertEquals(HiddenImplementation.class, foo.getClass());
+        assertEquals(ConstructorInjector.class, ((AbstractBehavior) foo).getDelegate().getClass());
+    }
+
+    public void testAddComponentNoesNotUseImplementationHidingBehaviorWhenNoCachePropertyIsSpecified() {
+        DefaultContainer pico =
+            new DefaultContainer(new AsmImplementationHiding().wrap(new ConstructorInjection()));
+        pico.change(Characteristics.NO_HIDE_IMPL).addComponent("foo", String.class);
+        ComponentAdapter foo = pico.getComponentAdapter("foo");
+        assertEquals(ConstructorInjector.class, foo.getClass());
+    }
+
+    public void testAddAdapterUsesImplementationHidingBehavior() {
+        DefaultContainer pico =
+            new DefaultContainer(new AsmImplementationHiding().wrap(new ConstructorInjection()));
+        pico.addAdapter(new InstanceAdapter("foo", "bar", new NullLifecycleStrategy(), new NullComponentMonitor()));
+        ComponentAdapter foo = pico.getComponentAdapter("foo");
+        assertEquals(HiddenImplementation.class, foo.getClass());
+        assertEquals(InstanceAdapter.class, ((AbstractBehavior) foo).getDelegate().getClass());
+
+    }
+
+    public void testAddAdapterUsesImplementationHidingBehaviorWithRedundantHideImplProperty() {
+        DefaultContainer pico =
+            new DefaultContainer(new AsmImplementationHiding().wrap(new ConstructorInjection()));
+        pico.change(Characteristics.HIDE_IMPL).addAdapter(new InstanceAdapter("foo", "bar", new NullLifecycleStrategy(), new NullComponentMonitor()));
+        ComponentAdapter foo = pico.getComponentAdapter("foo");
+        assertEquals(HiddenImplementation.class, foo.getClass());
+        assertEquals(InstanceAdapter.class, ((AbstractBehavior) foo).getDelegate().getClass());
+    }
+
+    public void testAddAdapterNoesNotUseImplementationHidingBehaviorWhenNoCachePropertyIsSpecified() {
+        DefaultContainer pico =
+            new DefaultContainer(new AsmImplementationHiding().wrap(new ConstructorInjection()));
+        pico.change(Characteristics.NO_HIDE_IMPL).addAdapter(new InstanceAdapter("foo", "bar", new NullLifecycleStrategy(), new NullComponentMonitor()));
+        ComponentAdapter foo = pico.getComponentAdapter("foo");
+        assertEquals(InstanceAdapter.class, foo.getClass());
+    }
+
+    protected ComponentFactory createComponentFactory() {
+        return implementationHidingComponentFactory;
+    }
+
+    public void testElephantWithoutAsmProxy() throws IOException {
+        assertions(new ElephantProxy(new ElephantImpl()));
+    }
+
+    public void testElephantWithAsmProxy() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, IOException {
+        DefaultContainer pico = new DefaultContainer();
+        pico.addAdapter(new HiddenImplementation(new ConstructorInjector("l", ArrayList.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false)));
+        Elephant elephant = pico.addComponent(Elephant.class, ElephantImpl.class).getComponent(Elephant.class);
+
+        assertions(elephant);
+
+    }
+
+    private void assertions(Elephant foo) throws IOException {
+        assertEquals("onetwo", foo.objects("one", "two"));
+        assertEquals("onetwo", foo.objectsArray(new String[]{"one"}, new String[]{"two"})[0]);
+        assertEquals(3, foo.iint(1, 2));
+        assertEquals(3, foo.llong(1, 2));
+        assertEquals(6, foo.bbyte((byte) 1, (byte) 2, (byte) 3));
+        assertEquals((float) 10, foo.ffloat(1, 2, 3, 4));
+        assertEquals((double) 3, foo.ddouble(1, 2));
+        assertEquals('c', foo.cchar('a', 'b'));
+        assertEquals(3, foo.sshort((short) 1, (short) 2));
+        assertEquals(true, foo.bboolean(true, true));
+        assertEquals(true, foo.bbooleanArray(new boolean[]{true}, new boolean[]{true})[0]);
+    }
+
+}
\ No newline at end of file

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatedTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatedTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatedTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatedTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.composer.core.behaviors;
+
+import com.thoughtworks.proxy.factory.CglibProxyFactory;
+import org.apache.composer.core.ComponentAdapter;
+import org.apache.composer.core.CompositionException;
+import org.apache.composer.core.MutableContainer;
+import org.apache.composer.core.adapters.InstanceAdapter;
+import org.apache.composer.core.containers.DefaultContainer;
+import org.apache.composer.core.injectors.ConstructorInjector;
+import org.apache.composer.core.lifecycle.NullLifecycleStrategy;
+import org.apache.composer.core.monitors.NullComponentMonitor;
+import org.apache.composer.core.tck.AbstractComponentAdapterTest;
+import org.apache.composer.core.testmodel.CompatibleTouchable;
+import org.apache.composer.core.testmodel.SimpleTouchable;
+import org.apache.composer.core.testmodel.Touchable;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+
+/**
+ * @author J&ouml;rg Schaible
+ */
+public class AssimilatedTestCase extends AbstractComponentAdapterTest {
+
+    /**
+     * Test if an instance can be assimilated.
+     */
+    @Test public void testInstanceIsBorged() {
+        final MutableContainer mpc = new DefaultContainer();
+        final ComponentAdapter<CompatibleTouchable> componentAdapter = new Cached<CompatibleTouchable>(new ConstructorInjector(
+                CompatibleTouchable.class, CompatibleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+        mpc.addAdapter(new Assimilated(Touchable.class, componentAdapter));
+        final CompatibleTouchable compatibleTouchable = componentAdapter.getComponentInstance(mpc);
+        final Touchable touchable = mpc.getComponent(Touchable.class);
+        assertFalse(compatibleTouchable.wasTouched());
+        touchable.touch();
+        assertTrue(compatibleTouchable.wasTouched());
+        assertTrue(Proxy.isProxyClass(touchable.getClass()));
+    }
+
+    /**
+     * Test if the component key is preserved if it is not a class type.
+     */
+    @Test public void testComponentKeyIsPreserved() {
+        final DefaultContainer mpc = new DefaultContainer();
+        final ComponentAdapter<CompatibleTouchable> componentAdapter = new Cached<CompatibleTouchable>(new ConstructorInjector(
+                "Touchy", CompatibleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+        mpc.addAdapter(new Assimilated(Touchable.class, componentAdapter));
+        final CompatibleTouchable compatibleTouchable = componentAdapter.getComponentInstance(mpc);
+        final Touchable touchable = (Touchable)mpc.getComponent("Touchy");
+        assertFalse(compatibleTouchable.wasTouched());
+        touchable.touch();
+        assertTrue(compatibleTouchable.wasTouched());
+        assertTrue(Proxy.isProxyClass(touchable.getClass()));
+    }
+
+    /**
+     * Test if proxy generation is omitted, if types are compatible.
+     */
+    @Test public void testAvoidUnnecessaryProxy() {
+        final DefaultContainer mpc = new DefaultContainer();
+        mpc.addAdapter(new Assimilated(AbstractComponentAdapterTest.class, new InstanceAdapter<AssimilatedTestCase>(AbstractComponentAdapterTest.class, this, new NullLifecycleStrategy(),
+                                                                        new NullComponentMonitor())));
+        final AbstractComponentAdapterTest self = mpc.getComponent(AbstractComponentAdapterTest.class);
+        assertFalse(Proxy.isProxyClass(self.getClass()));
+        assertSame(this, self);
+    }
+
+    /**
+     * Test if proxy generation is omitted, if types are compatible and that the component key is not changed.
+     */
+    @Test public void testAvoidedProxyDoesNotChangeComponentKey() {
+        final DefaultContainer mpc = new DefaultContainer();
+        mpc.addAdapter(new Assimilated(AbstractComponentAdapterTest.class, new InstanceAdapter<AssimilatedTestCase>(getClass(), this, new NullLifecycleStrategy(),
+                                                                        new NullComponentMonitor())));
+        final AbstractComponentAdapterTest self = mpc.getComponent(getClass());
+        assertNotNull(self);
+        assertSame(this, self);
+    }
+
+    /**
+     * Test fail-fast for components without interface.
+     */
+    @Test public void testComponentMustImplementInterface() {
+        try {
+            new Assimilated(SimpleTouchable.class, new InstanceAdapter<AssimilatedTestCase>(AbstractComponentAdapterTest.class, this, new NullLifecycleStrategy(),
+                                                                        new NullComponentMonitor()));
+            fail("PicoCompositionException expected");
+        } catch (final CompositionException e) {
+            assertTrue(e.getMessage().endsWith(SimpleTouchable.class.getName()));
+        }
+    }
+
+    /**
+     * Test fail-fast for components without matching methods.
+     * @throws NoSuchMethodException 
+     */
+    @Test public void testComponentMustHaveMathichMethods() throws NoSuchMethodException {
+        final Method touch = Touchable.class.getMethod("touch", (Class[])null);
+        try {
+            new Assimilated(Touchable.class, new InstanceAdapter<AssimilatedTestCase>(AbstractComponentAdapterTest.class, this, new NullLifecycleStrategy(),
+                                                                        new NullComponentMonitor()));
+            fail("PicoCompositionException expected");
+        } catch (final CompositionException e) {
+            assertTrue(e.getMessage().endsWith(touch.toString()));
+        }
+    }
+
+    // -------- TCK -----------
+
+    protected Class getComponentAdapterType() {
+        return Assimilated.class;
+    }
+
+    protected int getComponentAdapterNature() {
+        return super.getComponentAdapterNature() & ~(RESOLVING | VERIFYING | INSTANTIATING);
+    }
+
+    private ComponentAdapter createComponentAdapterWithTouchable() {
+        return new Assimilated(Touchable.class, new ConstructorInjector(
+                CompatibleTouchable.class, CompatibleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false));
+    }
+
+    protected ComponentAdapter prepDEF_verifyWithoutDependencyWorks(MutableContainer picoContainer) {
+        return createComponentAdapterWithTouchable();
+    }
+
+    protected ComponentAdapter prepDEF_verifyDoesNotInstantiate(MutableContainer picoContainer) {
+        return createComponentAdapterWithTouchable();
+    }
+
+    protected ComponentAdapter prepDEF_visitable() {
+        return createComponentAdapterWithTouchable();
+    }
+
+    protected ComponentAdapter prepSER_isSerializable(MutableContainer picoContainer) {
+        return new Assimilated(Touchable.class, new InstanceAdapter<CompatibleTouchable>(
+                CompatibleTouchable.class, new CompatibleTouchable(), new NullLifecycleStrategy(),
+                                                                        new NullComponentMonitor()), new CglibProxyFactory());
+    }
+
+    protected ComponentAdapter prepSER_isXStreamSerializable(MutableContainer picoContainer) {
+        return createComponentAdapterWithTouchable();
+    }
+}

Propchange: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatedTestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatingTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatingTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/AssimilatingTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (C) NanoContainer Organization. All rights reserved.            *
+ * ------------------------------------------------------------------------- *
+ * The software in this package is published under the terms of the BSD      *
+ * style license a copy of which has been included with this distribution in *
+ * the LICENSE.txt file.                                                     *
+ *                                                                           *
+ * Original code by Joerg Schaibe                                            *
+ *****************************************************************************/
+
+package org.apache.composer.core.behaviors;
+
+import org.apache.composer.core.ComponentFactory;
+import org.apache.composer.core.CompositionException;
+import org.apache.composer.core.containers.DefaultContainer;
+import org.apache.composer.core.injectors.ConstructorInjection;
+import org.apache.composer.core.tck.AbstractComponentFactoryTest;
+import org.apache.composer.core.testmodel.AlternativeTouchable;
+import org.apache.composer.core.testmodel.CompatibleTouchable;
+import org.apache.composer.core.testmodel.SimpleTouchable;
+import org.apache.composer.core.testmodel.Touchable;
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+/**
+ * @author J&ouml;rg Schaible
+ */
+public class AssimilatingTestCase extends AbstractComponentFactoryTest {
+
+    /**
+     * @see org.picocontainer.tck.AbstractComponentFactoryTestCase#createComponentFactory()
+     */
+    protected ComponentFactory createComponentFactory() {
+        return new Assimilating(Touchable.class).wrap(new ConstructorInjection());
+    }
+
+    /**
+     * Test automatic assimilation of registered components.
+     */
+    public void testAutomaticAssimilation() {
+        container = new DefaultContainer(createComponentFactory());
+        container.addComponent(SimpleTouchable.class);
+        container.addComponent(AlternativeTouchable.class);
+        container.addComponent(CompatibleTouchable.class);
+        final List list = container.getComponents(Touchable.class);
+        assertEquals(3, list.size());
+    }
+
+    /**
+     * Test automatic assimilation of registered components.
+     */
+    public void testOnlyOneTouchableComponentKeyPossible() {
+        container = new DefaultContainer(createComponentFactory());
+        container.addComponent(Touchable.class, SimpleTouchable.class);
+        try {
+            container.addComponent(CompatibleTouchable.class);
+            fail("DuplicateComponentKeyRegistrationException expected");
+        } catch (final CompositionException e) {
+            assertTrue(e.getMessage().startsWith("Duplicate"));
+            // fine
+        }
+    }
+
+    /**
+     * Test automatic assimilation of registered components.
+     */
+    public void testMultipleAssimilatedComponentsWithUserDefinedKeys() {
+        container = new DefaultContainer(createComponentFactory());
+        container.addComponent(Touchable.class, SimpleTouchable.class);
+        container.addComponent("1", CompatibleTouchable.class);
+        container.addComponent("2", CompatibleTouchable.class);
+        container.addComponent("3", CompatibleTouchable.class);
+        final List list = container.getComponents(Touchable.class);
+        assertEquals(4, list.size());
+    }
+}

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/HotSwappingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/HotSwappingTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/HotSwappingTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/HotSwappingTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * Copyright (c) PicoContainer Organization. All rights reserved.            *
+ * ------------------------------------------------------------------------- *
+ * The software in this package is published under the terms of the BSD      *
+ * style license a copy of which has been included with this distribution in *
+ * the LICENSE.txt file.                                                     *
+ *                                                                           *
+ *****************************************************************************/
+
+package org.apache.composer.core.behaviors;
+
+import org.apache.composer.core.ComponentFactory;
+import org.apache.composer.core.containers.DefaultContainer;
+import org.apache.composer.core.injectors.AdaptingInjection;
+import org.apache.composer.core.injectors.ConstructorInjection;
+import org.apache.composer.core.injectors.ConstructorInjector;
+import org.apache.composer.core.lifecycle.NullLifecycleStrategy;
+import org.apache.composer.core.monitors.NullComponentMonitor;
+import org.apache.composer.core.tck.AbstractComponentFactoryTest;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public final class HotSwappingTestCase extends AbstractComponentFactoryTest {
+    private final ComponentFactory implementationHidingComponentFactory = new HotSwapping().wrap(new AdaptingInjection());
+
+    // START SNIPPET: man
+    public static interface Man {
+        Woman getWoman();
+
+        void kiss();
+
+        boolean wasKissed();
+    }
+
+    // END SNIPPET: man
+
+    // START SNIPPET: woman
+    public static interface Woman {
+        Man getMan();
+    }
+
+    // END SNIPPET: woman
+
+    public static class Wife implements Woman {
+        public final Man partner;
+
+        public Wife(Man partner) {
+            this.partner = partner;
+        }
+
+        public Man getMan() {
+            return partner;
+        }
+    }
+
+
+    public void testHotSwappingNaturaelyCaches() {
+        DefaultContainer pico = new DefaultContainer(new HotSwapping().wrap(new ConstructorInjection()));
+        pico.addComponent(Map.class, HashMap.class);
+        Map firstMap = pico.getComponent(Map.class);
+        Map secondMap = pico.getComponent(Map.class);
+        assertSame(firstMap, secondMap);
+    }
+
+    public void testHotSwappingNaturaelyCaches2() {
+        DefaultContainer pico = new DefaultContainer(new HotSwapping());
+        pico.addComponent(Map.class, HashMap.class);
+        Map firstMap = pico.getComponent(Map.class);
+        firstMap.put("foo", "bar");
+        HotSwappable hsca = (HotSwappable) pico.getComponentAdapter(Map.class);
+        hsca.getSwappable().swap(new HashMap());
+        Map secondMap = pico.getComponent(Map.class);
+        secondMap.put("apple", "orange");
+        assertSame(firstMap, secondMap);
+        assertNull(firstMap.get("foo"));
+        assertNotNull(firstMap.get("apple"));
+
+    }
+
+    public void testSwappingViaSwappableInterface() {
+        DefaultContainer pico = new DefaultContainer();
+        ConstructorInjector constructorInjector = new ConstructorInjector("l", ArrayList.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false);
+        HotSwappable hsca = (HotSwappable) pico.addAdapter(new HotSwappable(constructorInjector)).getComponentAdapter(constructorInjector.getComponentKey());
+        List l = (List)pico.getComponent("l");
+        l.add("Hello");
+        final ArrayList newList = new ArrayList();
+
+        ArrayList oldSubject = (ArrayList) hsca.swapRealInstance(newList);
+        assertEquals("Hello", oldSubject.get(0));
+        assertTrue(l.isEmpty());
+        l.add("World");
+        assertEquals("World", l.get(0));
+    }
+
+
+    protected ComponentFactory createComponentFactory() {
+        return implementationHidingComponentFactory;
+    }
+
+}

Added: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PooledTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PooledTestCase.java?rev=618170&view=auto
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PooledTestCase.java (added)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PooledTestCase.java Sun Feb  3 21:33:53 2008
@@ -0,0 +1,373 @@
+/*
+ * Copyright (C) 2005 J&ouml;rg Schaible
+ * Created on 29.08.2005 by J&ouml;rg Schaible
+ */
+package org.apache.composer.core.behaviors;
+
+import com.thoughtworks.proxy.ProxyFactory;
+import com.thoughtworks.proxy.factory.CglibProxyFactory;
+import com.thoughtworks.proxy.toys.pool.Poolable;
+import org.apache.composer.core.Behavior;
+import org.apache.composer.core.ComponentAdapter;
+import org.apache.composer.core.MutableContainer;
+import org.apache.composer.core.NameBinding;
+import org.apache.composer.core.containers.DefaultContainer;
+import org.apache.composer.core.injectors.ConstructorInjector;
+import org.apache.composer.core.lifecycle.NullLifecycleStrategy;
+import org.apache.composer.core.monitors.NullComponentMonitor;
+import org.apache.composer.core.tck.AbstractComponentAdapterTest;
+import org.apache.composer.core.testmodel.RecordingLifecycle;
+import org.apache.composer.core.testmodel.SimpleTouchable;
+import org.apache.composer.core.testmodel.Touchable;
+import static org.junit.Assert.*;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+
+/**
+ * @author J&ouml;rg Schaible
+ */
+public final class PooledTestCase extends AbstractComponentAdapterTest {
+
+    public static interface Identifiable {
+        int getId();
+    }
+
+    public static final class InstanceCounter implements Identifiable, Serializable {
+        private static int counter = 0;
+        private final int id;
+
+        public InstanceCounter() {
+            id = counter++;
+        }
+
+        public int getId() {
+            return id;
+        }
+
+        public boolean equals(Object arg) {
+            return arg instanceof Identifiable && id == ((Identifiable)arg).getId();
+        }
+    }
+
+    protected void setUp() throws Exception {
+        InstanceCounter.counter = 0;
+    }
+
+    public void testNewIsInstantiatedOnEachRequest() {
+        ComponentAdapter componentAdapter = new Pooled(new ConstructorInjector(
+                Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext());
+
+        Object borrowed0 = componentAdapter.getComponentInstance(null);
+        Object borrowed1 = componentAdapter.getComponentInstance(null);
+
+        assertNotSame(borrowed0, borrowed1);
+    }
+
+    public void testInstancesCanBeRecycled() {
+        ComponentAdapter componentAdapter = new Pooled(new ConstructorInjector(
+                Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext());
+
+        Object borrowed0 = componentAdapter.getComponentInstance(null);
+        Object borrowed1 = componentAdapter.getComponentInstance(null);
+        Object borrowed2 = componentAdapter.getComponentInstance(null);
+
+        assertNotSame(borrowed0, borrowed1);
+        assertNotSame(borrowed1, borrowed2);
+
+        //noinspection UnusedAssignment
+        borrowed1 = null;
+        System.gc();
+
+        Identifiable borrowed = (Identifiable)componentAdapter.getComponentInstance(null);
+        assertEquals(1, borrowed.getId());
+
+        ((Poolable)borrowed).returnInstanceToPool();
+
+        Object borrowedReloaded = componentAdapter.getComponentInstance(null);
+        assertEquals(borrowed, borrowedReloaded);
+    }
+
+    public void testBlocksWhenExhausted() throws InterruptedException {
+        final ComponentAdapter componentAdapter = new Pooled(new ConstructorInjector(
+                Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext() {
+            public int getMaxSize() {
+                return 2;
+            }
+
+            public int getMaxWaitInMilliseconds() {
+                return 3000;
+            }
+        });
+
+        final Identifiable[] borrowed = new Identifiable[3];
+        final Throwable[] threadException = new Throwable[2];
+
+        final StringBuffer order = new StringBuffer();
+        final Thread returner = new Thread() {
+            public void run() {
+                try {
+                    synchronized (this) {
+                        notifyAll();
+                        wait(200); // ensure, that main thread is blocked
+                    }
+                    order.append("returner ");
+                    ((Poolable)borrowed[0]).returnInstanceToPool();
+                } catch (Throwable t) {
+                    t.printStackTrace();
+                    synchronized (componentAdapter) {
+                        componentAdapter.notify();
+                    }
+                    threadException[1] = t;
+                }
+            }
+        };
+
+        borrowed[0] = (Identifiable)componentAdapter.getComponentInstance(null);
+        borrowed[1] = (Identifiable)componentAdapter.getComponentInstance(null);
+        synchronized (returner) {
+            returner.start();
+            returner.wait();
+        }
+
+        // should block
+        order.append("main ");
+        borrowed[2] = (Identifiable)componentAdapter.getComponentInstance(null);
+        order.append("main");
+
+        returner.join();
+
+        assertNull(threadException[0]);
+        assertNull(threadException[1]);
+
+        assertEquals("main returner main", order.toString());
+
+        assertEquals(borrowed[0].getId(), borrowed[2].getId());
+        assertFalse(borrowed[1].getId() == borrowed[2].getId());
+    }
+
+    public void testTimeoutWhenExhausted() {
+        final ComponentAdapter componentAdapter = new Pooled(new ConstructorInjector(
+                Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext() {
+            public int getMaxSize() {
+                return 2;
+            }
+
+            public int getMaxWaitInMilliseconds() {
+                return 250;
+            }
+        });
+
+        Identifiable borrowed0 = (Identifiable)componentAdapter.getComponentInstance(null);
+        Identifiable borrowed1 = (Identifiable)componentAdapter.getComponentInstance(null);
+        assertNotNull(borrowed0);
+        assertFalse(borrowed0.getId() == borrowed1.getId());
+        long time = System.currentTimeMillis();
+        try {
+            componentAdapter.getComponentInstance(null);
+            fail("Thrown " + Pooled.PoolException.class.getName() + " expected");
+        } catch (final Pooled.PoolException e) {
+            assertTrue(e.getMessage().indexOf("Time out") >= 0);
+            assertTrue(System.currentTimeMillis() - time >= 250);
+        }
+    }
+
+    public void testGrowsAlways() {
+        Pooled behavior = new Pooled(
+                new ConstructorInjector("foo", Object.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false),
+                new Pooled.DefaultContext() {
+
+                    public ProxyFactory getProxyFactory() {
+                        return new CglibProxyFactory();
+                    }
+                });
+
+        final Set<Object> set = new HashSet<Object>();
+        try {
+            final int max = 5;
+            int i;
+            for (i = 0; i < max; ++i) {
+                assertEquals(i, behavior.size());
+                final Object object = behavior.getComponentInstance(null);
+                set.add(object);
+            }
+            assertEquals(i, behavior.size());
+            assertEquals(i, set.size());
+
+            for (Object aSet : set) {
+                Poolable object = (Poolable)aSet;
+                object.returnInstanceToPool();
+                assertEquals(max, behavior.size());
+            }
+
+            for (i = 0; i < max; ++i) {
+                assertEquals(max, behavior.size());
+                final Object object = behavior.getComponentInstance(null);
+                assertNotNull(object);
+                set.add(object);
+            }
+
+            assertEquals(max, set.size());
+
+        } catch (Pooled.PoolException e) {
+            fail("This pool should not get exhausted.");
+        }
+    }
+
+    public void testFailsWhenExhausted() {
+        final Pooled behavior = new Pooled(
+                new ConstructorInjector(Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false),
+                new Pooled.DefaultContext() {
+                    public int getMaxSize() {
+                        return 2;
+                    }
+                });
+
+        assertEquals(0, behavior.size());
+        Identifiable borrowed0 = (Identifiable)behavior.getComponentInstance(null);
+        assertEquals(1, behavior.size());
+        Identifiable borrowed1 = (Identifiable)behavior.getComponentInstance(null);
+        assertEquals(2, behavior.size());
+        try {
+            behavior.getComponentInstance(null);
+            fail("Expected ExhaustedException, pool shouldn't be able to grow further.");
+        } catch (Pooled.PoolException e) {
+            assertTrue(e.getMessage().indexOf("exhausted") >= 0);
+        }
+
+        assertFalse(borrowed0.getId() == borrowed1.getId());
+    }
+
+    public void testInternalGCCall() {
+        ComponentAdapter componentAdapter = new Pooled(new ConstructorInjector(
+                Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext() {
+            public int getMaxSize() {
+                return 1;
+            }
+
+            public boolean autostartGC() {
+                return true;
+            }
+        });
+
+        for (int i = 0; i < 5; i++) {
+            final Identifiable borrowed = (Identifiable)componentAdapter.getComponentInstance(null);
+            assertNotNull(borrowed);
+            assertEquals(0, borrowed.getId());
+        }
+    }
+
+    /**
+     * Prepare the test <em>lifecycleManagerSupport</em>. Prepare the delivered PicoContainer with an adapter, that
+     * has a lifecycle and use a StringBuffer registered in the container to record the lifecycle method invocations.
+     * The recorded String in the buffer must result in <strong>&qout;&lt;OneOne&gt;!One&qout;</strong>. The addAdapter
+     * top test should be registered in the container and delivered as return value.
+     * @param picoContainer the container
+     * @return the adapter to test
+     */
+    private ComponentAdapter prepDEF_lifecycleManagerSupport(MutableContainer picoContainer) {
+        picoContainer.addComponent(RecordingLifecycle.One.class);
+        Pooled poolingBehavior = new Pooled(new ConstructorInjector(
+                RecordingLifecycle.Recorder.class, RecordingLifecycle.Two.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext());
+        return picoContainer.addAdapter(poolingBehavior).getComponentAdapter(RecordingLifecycle.One.class, (NameBinding) null);
+    }
+
+    public void testDEF_lifecycleManagerSupport() {
+        if ((getComponentAdapterNature() & RESOLVING) > 0) {
+            final Class type = getComponentAdapterType();
+            if (Behavior.class.isAssignableFrom(type)) {
+                final StringBuffer buffer = new StringBuffer();
+                final MutableContainer picoContainer = new DefaultContainer(
+                        createDefaultComponentFactory());
+                picoContainer.addComponent(buffer);
+                final ComponentAdapter componentAdapter = prepDEF_lifecycleManagerSupport(picoContainer);
+                assertSame(getComponentAdapterType(), componentAdapter.getClass());
+                assertEquals(0, buffer.length());
+                picoContainer.start();
+                picoContainer.stop();
+                picoContainer.dispose();
+                // @todo Move test to AbstractAbstractCATC
+                assertEquals("<OneOne>!One", buffer.toString());
+            }
+        }
+    }
+
+    /**
+     * Prepare the test <em>lifecycleManagerHonorsInstantiationSequence</em>. Prepare the delivered PicoContainer
+     * with addAdapter(s), that have dependend components, have a lifecycle and use a StringBuffer registered in the
+     * container to record the lifecycle method invocations. The recorded String in the buffer must result in
+     * <strong>&qout;&lt;One&lt;TwoTwo&gt;One&gt;!Two!One&qout;</strong>. The adapter top test should be registered in
+     * the container and delivered as return value.
+     * @param picoContainer the container
+     * @return the adapter to test
+     */
+    private ComponentAdapter prepRES_lifecycleManagerHonorsInstantiationSequence(MutableContainer picoContainer) {
+        picoContainer.addComponent(RecordingLifecycle.One.class);
+        Pooled poolingBehavior = new Pooled(new ConstructorInjector(
+                RecordingLifecycle.Recorder.class, RecordingLifecycle.Two.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext());
+        return picoContainer.addAdapter(poolingBehavior).getComponentAdapter(RecordingLifecycle.Two.class, (NameBinding) null);
+    }
+
+    public void testRES_lifecycleManagerHonorsInstantiationSequence() {
+        if ((getComponentAdapterNature() & RESOLVING) > 0) {
+            final Class type = getComponentAdapterType();
+            if (Behavior.class.isAssignableFrom(type)) {
+                final StringBuffer buffer = new StringBuffer();
+                final MutableContainer picoContainer = new DefaultContainer(
+                        createDefaultComponentFactory());
+                picoContainer.addComponent(buffer);
+                final ComponentAdapter componentAdapter = prepRES_lifecycleManagerHonorsInstantiationSequence(picoContainer);
+                assertSame(getComponentAdapterType(), componentAdapter.getClass());
+                assertEquals(0, buffer.length());
+                picoContainer.start();
+                picoContainer.stop();
+                picoContainer.dispose();
+                // @todo Move test to AbstractAbstractCATC
+                assertEquals("<One<TwoTwo>One>!Two!One", buffer.toString());
+            }
+        }
+    }
+
+    // -------- TCK -----------
+
+    protected Class getComponentAdapterType() {
+        return Pooled.class;
+    }
+
+    protected int getComponentAdapterNature() {
+        return super.getComponentAdapterNature() & ~(INSTANTIATING | RESOLVING | VERIFYING);
+    }
+
+    private ComponentAdapter createPoolOfTouchables() {
+        return new Pooled(new ConstructorInjector(
+                Touchable.class, SimpleTouchable.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext());
+    }
+
+    protected ComponentAdapter prepDEF_verifyWithoutDependencyWorks(MutableContainer picoContainer) {
+        return createPoolOfTouchables();
+    }
+
+    protected ComponentAdapter prepDEF_verifyDoesNotInstantiate(MutableContainer picoContainer) {
+        return createPoolOfTouchables();
+    }
+
+    protected ComponentAdapter prepDEF_visitable() {
+        return createPoolOfTouchables();
+    }
+
+    private ComponentAdapter createSerializable() {
+        return new Pooled(new ConstructorInjector(
+                Identifiable.class, InstanceCounter.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false), new Pooled.DefaultContext());
+    }
+
+    protected ComponentAdapter prepSER_isSerializable(MutableContainer picoContainer) {
+        return createSerializable();
+    }
+
+    protected ComponentAdapter prepSER_isXStreamSerializable(MutableContainer picoContainer) {
+        return createSerializable();
+    }
+
+}

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PropertyApplyingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PropertyApplyingTestCase.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PropertyApplyingTestCase.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/behaviors/PropertyApplyingTestCase.java Sun Feb  3 21:33:53 2008
@@ -287,7 +287,7 @@
     }
 
     @Test public void testSetDependenComponentWillBeSetByTheAdapter() {
-        containerContainer.addComponent("b", B.class);
+        container.addComponent("b", B.class);
         PropertyApplying factory = (PropertyApplying)createComponentFactory();
         Map properties = new HashMap();
 
@@ -302,8 +302,8 @@
                                                                      A.class,
                                                                      (Parameter[])null);
         adapter.setProperties(properties);
-        containerContainer.addAdapter(adapter);
-        A a = containerContainer.getComponent(A.class);
+        container.addAdapter(adapter);
+        A a = container.getComponent(A.class);
 
         assertNotNull(a);
         assertNotNull(a.b);
@@ -347,10 +347,10 @@
                                                                      SimpleDateFormat.class,
                                                                      (Parameter[])null);
         adapter.setProperties(properties);
-        containerContainer.addAdapter(adapter);
+        container.addAdapter(adapter);
 
 
-        SimpleDateFormat dateFormat = containerContainer.getComponent(SimpleDateFormat.class);
+        SimpleDateFormat dateFormat = container.getComponent(SimpleDateFormat.class);
         assertNotNull(dateFormat);
         assertEquals(false, dateFormat.isLenient());
         assertEquals(new Date(0), dateFormat.get2DigitYearStart());
@@ -385,10 +385,10 @@
         properties.put("multiValues", "abcdefg");
         adapter.setProperties(properties);
 
-        containerContainer.addAdapter(adapter);
+        container.addAdapter(adapter);
 
         try {
-            Object testResult = containerContainer.getComponent("TestBean");
+            Object testResult = container.getComponent("TestBean");
             fail(
                 "Getting a bad test result through PropertyApplicator should have thrown exception.  Instead got:" +
                 testResult);
@@ -416,11 +416,11 @@
                                                                      SimpleDateFormat.class,
                                                                      (Parameter[])null);
         adapter.setProperties(properties);
-        containerContainer.addAdapter(adapter);
+        container.addAdapter(adapter);
 
 
         try {
-            SimpleDateFormat dateFormat = containerContainer.getComponent(SimpleDateFormat.class);
+            SimpleDateFormat dateFormat = container.getComponent(SimpleDateFormat.class);
             fail(
                 "Getting a bad test result through PropertyApplicator should have thrown exception.  Instead got:" +
                 dateFormat);

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/AnnotatedMethodInjectionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/AnnotatedMethodInjectionTestCase.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/AnnotatedMethodInjectionTestCase.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/AnnotatedMethodInjectionTestCase.java Sun Feb  3 21:33:53 2008
@@ -38,7 +38,7 @@
 	
 	@Before
     public void setUp() throws Exception {
-        containerContainer = new DefaultContainer(createComponentFactory());
+        container = new DefaultContainer(createComponentFactory());
     }
 
     protected ComponentFactory createComponentFactory() {
@@ -83,17 +83,17 @@
     }
 
     @Test public void testContainerUsesStandardConstructor() {
-        containerContainer.addComponent(Bean.class, NamedBeanWithPossibleDefault.class);
-        containerContainer.addComponent("Tom");
-        NamedBeanWithPossibleDefault bean = (NamedBeanWithPossibleDefault) containerContainer.getComponent(Bean.class);
+        container.addComponent(Bean.class, NamedBeanWithPossibleDefault.class);
+        container.addComponent("Tom");
+        NamedBeanWithPossibleDefault bean = (NamedBeanWithPossibleDefault) container.getComponent(Bean.class);
         assertFalse(bean.getByDefault());
     }
 
     @Test public void testContainerUsesOnlyStandardConstructor() {
-        containerContainer.addComponent(Bean.class, NoBean.class);
-        containerContainer.addComponent("Tom");
+        container.addComponent(Bean.class, NoBean.class);
+        container.addComponent("Tom");
         try {
-            containerContainer.getComponent(Bean.class);
+            container.getComponent(Bean.class);
             fail("Instantiation should have failed.");
         } catch (CompositionException e) {
         }

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/ConstructorInjectionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/ConstructorInjectionTestCase.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/ConstructorInjectionTestCase.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/ConstructorInjectionTestCase.java Sun Feb  3 21:33:53 2008
@@ -38,7 +38,7 @@
 
 	@Before
     public void setUp() throws Exception {
-        containerContainer = new DefaultContainer(createComponentFactory());
+        container = new DefaultContainer(createComponentFactory());
     }
 
     protected ComponentFactory createComponentFactory() {

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/SetterInjectionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/SetterInjectionTestCase.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/SetterInjectionTestCase.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/injectors/SetterInjectionTestCase.java Sun Feb  3 21:33:53 2008
@@ -41,7 +41,7 @@
 	
 	@Before
     public void setUp() throws Exception {
-        containerContainer = new DefaultContainer(createComponentFactory());
+        container = new DefaultContainer(createComponentFactory());
     }
 
     protected ComponentFactory createComponentFactory() {
@@ -86,17 +86,17 @@
     }
 
     @Test public void testContainerUsesStandardConstructor() {
-        containerContainer.addComponent(Bean.class, NamedBeanWithPossibleDefault.class);
-        containerContainer.addComponent("Tom");
-        NamedBeanWithPossibleDefault bean = (NamedBeanWithPossibleDefault) containerContainer.getComponent(Bean.class);
+        container.addComponent(Bean.class, NamedBeanWithPossibleDefault.class);
+        container.addComponent("Tom");
+        NamedBeanWithPossibleDefault bean = (NamedBeanWithPossibleDefault) container.getComponent(Bean.class);
         assertFalse(bean.getByDefault());
     }
 
     @Test public void testContainerUsesOnlyStandardConstructor() {
-        containerContainer.addComponent(Bean.class, NoBean.class);
-        containerContainer.addComponent("Tom");
+        container.addComponent(Bean.class, NoBean.class);
+        container.addComponent("Tom");
         try {
-            containerContainer.getComponent(Bean.class);
+            container.getComponent(Bean.class);
             fail("Instantiation should have failed.");
         } catch (CompositionException e) {
         }
@@ -126,10 +126,10 @@
     }
 
     @Test public void testAlternatePrefixWorks() {
-        containerContainer = new DefaultContainer(new SetterInjection("init"));
-        containerContainer.addComponent(Bean.class, AnotherNamedBean.class);
-        containerContainer.addComponent("Tom");
-        AnotherNamedBean bean = containerContainer.getComponent(AnotherNamedBean.class);
+        container = new DefaultContainer(new SetterInjection("init"));
+        container.addComponent(Bean.class, AnotherNamedBean.class);
+        container.addComponent("Tom");
+        AnotherNamedBean bean = container.getComponent(AnotherNamedBean.class);
         assertEquals("Tom", bean.getName());
     }
 

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/tck/AbstractComponentFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/tck/AbstractComponentFactoryTest.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/tck/AbstractComponentFactoryTest.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/tck/AbstractComponentFactoryTest.java Sun Feb  3 21:33:53 2008
@@ -40,13 +40,13 @@
  */
 public abstract class AbstractComponentFactoryTest {
 
-    protected DefaultContainer containerContainer;
+    protected DefaultContainer container;
 
     protected abstract ComponentFactory createComponentFactory();
 
     @Before
     public void setUp() throws Exception {
-        containerContainer = new DefaultContainer();
+        container = new DefaultContainer();
     }
 
     @Test public void testEquals() throws CompositionException {
@@ -71,9 +71,9 @@
                                                             Touchable.class,
                                                             SimpleTouchable.class);
 
-        containerContainer.addAdapter(componentAdapter);
+        container.addAdapter(componentAdapter);
 
-        ComponentAdapter adapter = (ComponentAdapter)containerContainer.getComponentAdapters().toArray()[0];
+        ComponentAdapter adapter = (ComponentAdapter)container.getComponentAdapters().toArray()[0];
         assertSame(componentAdapter.getComponentKey(), adapter.getComponentKey());
     }
 
@@ -86,9 +86,9 @@
                                                             Touchable.class,
                                                             SimpleTouchable.class);
 
-        containerContainer.addAdapter(componentAdapter);
-        containerContainer.removeComponent(Touchable.class);
+        container.addAdapter(componentAdapter);
+        container.removeComponent(Touchable.class);
 
-        assertFalse(containerContainer.getComponentAdapters().contains(componentAdapter));
+        assertFalse(container.getComponentAdapters().contains(componentAdapter));
     }
 }

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnArray.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnArray.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnArray.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnArray.java Sun Feb  3 21:33:53 2008
@@ -1,10 +1,19 @@
-/*****************************************************************************
- * Copyright (C) PicoContainer Organization. All rights reserved.            *
- * ------------------------------------------------------------------------- *
- * The software in this package is published under the terms of the BSD      *
- * style license a copy of which has been included with this distribution in *
- * the LICENSE.txt file.                                                     *
- *****************************************************************************/
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 package org.apache.composer.core.testmodel;
 

Modified: incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnList.java
URL: http://svn.apache.org/viewvc/incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnList.java?rev=618170&r1=618169&r2=618170&view=diff
==============================================================================
--- incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnList.java (original)
+++ incubator/composer/trunk/composer-core/src/test/java/org/apache/composer/core/testmodel/DependsOnList.java Sun Feb  3 21:33:53 2008
@@ -1,10 +1,19 @@
-/*****************************************************************************
- * Copyright (C) PicoContainer Organization. All rights reserved.            *
- * ------------------------------------------------------------------------- *
- * The software in this package is published under the terms of the BSD      *
- * style license a copy of which has been included with this distribution in *
- * the LICENSE.txt file.                                                     *
- *****************************************************************************/
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 package org.apache.composer.core.testmodel;
 



Mime
View raw message