cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jheym...@apache.org
Subject svn commit: r330548 [74/132] - in /cocoon/whiteboard/maven2/cocoon-flat-layout: ./ cocoon-ajax-block/ cocoon-ajax-block/api/ cocoon-ajax-block/api/src/ cocoon-ajax-block/api/src/main/ cocoon-ajax-block/api/src/main/java/ cocoon-ajax-block/api/src/main/...
Date Thu, 03 Nov 2005 14:00:48 GMT
Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/sax/XMLByteStreamCompilerInterpreterTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/sax/XMLByteStreamCompilerInterpreterTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/sax/XMLByteStreamCompilerInterpreterTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/sax/XMLByteStreamCompilerInterpreterTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,140 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.cocoon.components.sax;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.ContentHandler;
+import org.apache.cocoon.xml.dom.DOMBuilder;
+import org.apache.cocoon.xml.AbstractXMLTestCase;
+import org.apache.cocoon.xml.DefaultHandlerWrapper;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.ByteArrayInputStream;
+
+/**
+ * Testcase for XMLByteStreamCompiler and Interpreter
+ *
+ * @author <a href="mailto:tcurdt@apache.org">Torsten Curdt</a>
+ * @version
+ */
+
+public final class XMLByteStreamCompilerInterpreterTestCase extends AbstractXMLTestCase {
+    public XMLByteStreamCompilerInterpreterTestCase(String s) {
+        super(s);
+    }
+
+    public void testCompareDOM() throws Exception {
+        // reference
+        DOMBuilder in = new DOMBuilder();
+        generateLargeSAX(in);
+
+        // capture events
+        XMLByteStreamCompiler xmlc = new XMLByteStreamCompiler();
+        generateLargeSAX(xmlc);
+
+        // recall events and build a DOM from it
+        XMLByteStreamInterpreter xmli = new XMLByteStreamInterpreter();
+        DOMBuilder out = new DOMBuilder();
+        xmli.setConsumer(out);
+        xmli.deserialize(xmlc.getSAXFragment());
+
+        // compare DOMs
+        assertXMLEqual(in.getDocument(), out.getDocument());
+    }
+
+    public void testCompareByteArray() throws Exception {
+        // capture events
+        XMLByteStreamCompiler sa = new XMLByteStreamCompiler();
+        generateLargeSAX(sa);
+
+        // serialize events
+        byte[] aa = (byte[]) sa.getSAXFragment();
+
+        // deserialize and capture
+        XMLByteStreamCompiler sb = new XMLByteStreamCompiler();
+        XMLByteStreamInterpreter xmli = new XMLByteStreamInterpreter();
+        xmli.setConsumer(sb);
+        xmli.deserialize(aa);
+
+        // serialize again
+        byte[] ab = (byte[]) sb.getSAXFragment();
+
+        assertTrue(aa.length == ab.length);
+
+        for (int i=0;i<aa.length;i++) {
+            assertEquals(aa[i],ab[i]);
+        }
+    }
+
+    public void testStressLoop() throws Exception {
+        XMLByteStreamCompiler xmlc = new XMLByteStreamCompiler();
+
+        long loop = 10000;
+
+        // simply consume documents
+        long start = System.currentTimeMillis();
+        for(int i=0;i<loop;i++) {
+            generateSmallSAX(xmlc);
+            xmlc.recycle();
+        }
+        long stop = System.currentTimeMillis();
+
+        double r = 1000*loop/(stop-start);
+        System.out.println("consuming: "+ r + " documents per second");
+    }
+
+    public void testCompareToParsing() throws Exception {
+        DOMBuilder in = new DOMBuilder();
+        generateSmallSAX(in);
+
+        SAXParserFactory pfactory = SAXParserFactory.newInstance();
+        SAXParser p = pfactory.newSAXParser();
+
+        XMLByteStreamCompiler xmlc = new XMLByteStreamCompiler();
+        DefaultHandlerWrapper wrapper = new DefaultHandlerWrapper(xmlc);
+
+        ByteArrayInputStream bis = new ByteArrayInputStream(generateByteArray());
+
+        long loop = 10000;
+
+        // parse documents
+        long start = System.currentTimeMillis();
+        for(int i=0;i<loop;i++) {
+            xmlc.recycle();
+            bis.reset();
+            p.parse(bis,wrapper);
+        }
+        long stop = System.currentTimeMillis();
+
+        double r = 1000*loop/(stop-start);
+        System.out.println("parsed: " + r + " documents per second");
+
+
+        XMLByteStreamInterpreter xmli = new XMLByteStreamInterpreter();
+        ContentHandler ch = new DefaultHandler();
+
+        // recall documents
+        start = System.currentTimeMillis();
+        for(int i=0;i<loop;i++) {
+            xmli.setContentHandler(ch);
+            xmli.deserialize(xmlc.getSAXFragment());
+        }
+        stop = System.currentTimeMillis();
+
+        r = 1000*loop/(stop-start);
+        System.out.println("recalling: " + r + " documents per second");
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/sax/XMLByteStreamCompilerInterpreterTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/source/SourceResolverAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/source/SourceResolverAdapter.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/source/SourceResolverAdapter.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/source/SourceResolverAdapter.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.cocoon.components.source;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+
+/**
+ * An adapter for the Excalibur SourceResolver.
+ *
+ * @version CVS $Id: SourceResolverAdapter.java 55258 2004-10-21 20:50:36Z cziegeler $
+ */
+public class SourceResolverAdapter implements SourceResolver
+{
+    private org.apache.excalibur.source.SourceResolver resolver;
+
+    public SourceResolverAdapter(org.apache.excalibur.source.SourceResolver resolver, ServiceManager manager) {
+        this.resolver = resolver;
+    }
+
+    /**
+     * Get a <code>Source</code> object.
+     * This is a shortcut for <code>resolve(location, null, null)</code>
+     * @throws org.apache.excalibur.source.SourceException if the source cannot be resolved
+     */
+    public Source resolveURI( String location )
+        throws MalformedURLException, IOException, SourceException {
+  
+        return this.resolver.resolveURI(location);
+    }
+
+    /**
+     * Get a <code>Source</code> object.
+     * @param location - the URI to resolve. If this is relative it is either
+     *                   resolved relative to the base parameter (if not null)
+     *                   or relative to a base setting of the source resolver
+     *                   itself.
+     * @param base - a base URI for resolving relative locations. This
+     *               is optional and can be <code>null</code>.
+     * @param parameters - Additional parameters for the URI. The parameters
+     *                     are specific to the used protocol.
+     * @throws org.apache.excalibur.source.SourceException if the source cannot be resolved
+     */
+    public Source resolveURI( String location,
+                                                          String base,
+                                                          Map parameters )
+        throws MalformedURLException, IOException, SourceException {
+
+        return this.resolver.resolveURI(location, base, parameters);
+    }
+
+    /**
+     * Releases a resolved resource
+     */
+    public void release( Source source ) {
+        this.resolver.release(source);
+    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/source/SourceResolverAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/AbstractTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/AbstractTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/AbstractTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,341 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.thread;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.easymock.MockControl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+/**
+ * A {@link TestCase}with convenience methods to ease creation of Avalon mock
+ * classes.
+ *
+ * @author <a href="mailto:giacomo.at.apache.org">Giacomo Pati </a>
+ * @version $Id$
+ */
+public class AbstractTestCase
+    extends TestCase
+{
+    //~ Instance fields --------------------------------------------------------
+
+    /**
+     * The {@link List}of {@link MockControl}s creted by the
+     * <code>create...Control</code> methods
+     */
+    private List m_controls;
+
+    //~ Constructors -----------------------------------------------------------
+
+    /**
+     * Constructor
+     *
+     * @param name
+     */
+    public AbstractTestCase( String name )
+    {
+        super( name );
+    }
+
+    /**
+     * Constructor
+     */
+    public AbstractTestCase(  )
+    {
+        super(  );
+    }
+
+    //~ Methods ----------------------------------------------------------------
+
+    /**
+     * Create an empty list for {@link MockControl}s created by
+     * <code>create...Control</code> methods
+     *
+     * @throws Exception
+     */
+    protected void setUp(  )
+        throws Exception
+    {
+        super.setUp(  );
+        m_controls = new ArrayList(  );
+    }
+
+    /**
+     * Create a mock {@link Configuration}instance that has a boolean value
+     *
+     * @param value The value to return
+     * @param defaultValue The value accepted as the default value
+     *
+     * @return A mock <code>Configuration</code>
+     */
+    protected Configuration createBooleanConfigMock( final boolean value,
+                                                     final boolean defaultValue )
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValueAsBoolean( defaultValue );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a mock {@link Configuration}instance that has a boolean value
+     *
+     * @param value The value to return
+     *
+     * @return A mock <code>Configuration</code>
+     *
+     * @throws ConfigurationException
+     */
+    protected Configuration createBooleanConfigMock( final boolean value )
+        throws ConfigurationException
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValueAsBoolean(  );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a child
+     *
+     * @param name The value accepted as the name for the child
+     * @param value The value to return
+     *
+     * @return A mock <code>Configuration</code>
+     */
+    protected Configuration createChildConfigMock( final String name,
+                                                   final Configuration value )
+    {
+        final MockControl childConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration childConfig =
+            (Configuration)childConfigControl.getMock(  );
+        childConfig.getChild( name );
+        childConfigControl.setReturnValue( value );
+        childConfigControl.replay(  );
+
+        return childConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a boolean value
+     *
+     * @param name The value accepted as the name for the children
+     * @param value The value to return
+     *
+     * @return A mock <code>Configuration</code>
+     */
+    protected Configuration createChildrenConfigMock( final String name,
+                                                      final Configuration [] value )
+    {
+        final MockControl childrenConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration childrenConfig =
+            (Configuration)childrenConfigControl.getMock(  );
+        childrenConfig.getChildren( name );
+        childrenConfigControl.setReturnValue( value );
+        childrenConfigControl.replay(  );
+
+        return childrenConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a int value
+     *
+     * @param value The value to return
+     * @param defaultValue The value accepted as the default value
+     *
+     * @return A mock <code>Configuration</code>
+     */
+    protected Configuration createIntegerConfigMock( final int value,
+                                                     final int defaultValue )
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValueAsInteger( defaultValue );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a int value
+     *
+     * @param value The value to return
+     *
+     * @return A mock <code>Configuration</code>
+     *
+     * @throws ConfigurationException
+     */
+    protected Configuration createIntegerConfigMock( final int value )
+        throws ConfigurationException
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValueAsInteger(  );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a long value
+     *
+     * @param value The value to return
+     * @param defaultValue The value accepted as the default value
+     *
+     * @return A mock <code>Configuration</code>
+     */
+    protected Configuration createLongConfigMock( final long value,
+                                                  final long defaultValue )
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValueAsLong( defaultValue );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a long value
+     *
+     * @param value The value to return
+     *
+     * @return A mock <code>Configuration</code>
+     *
+     * @throws ConfigurationException
+     */
+    protected Configuration createLongConfigMock( final long value )
+        throws ConfigurationException
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValueAsLong(  );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a strict mock control
+     *
+     * @param clazz The interface class the mock object should represent
+     *
+     * @return The mock instance
+     */
+    protected MockControl createStrictControl( final Class clazz )
+    {
+        final MockControl control = MockControl.createStrictControl( clazz );
+        m_controls.add( control );
+
+        return control;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a string value
+     *
+     * @param value The value to return
+     * @param defaultValue The value accepted as the default value
+     *
+     * @return A mock <code>Configuration</code>
+     */
+    protected Configuration createValueConfigMock( final String value,
+                                                   final String defaultValue )
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValue( defaultValue );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * Create a {@link Configuration}instance that has a string value
+     *
+     * @param value The value to return
+     *
+     * @return A mock <code>Configuration</code>
+     *
+     * @throws ConfigurationException
+     */
+    protected Configuration createValueConfigMock( final String value )
+        throws ConfigurationException
+    {
+        final MockControl valueConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration valueConfig =
+            (Configuration)valueConfigControl.getMock(  );
+        valueConfig.getValue(  );
+        valueConfigControl.setReturnValue( value );
+        valueConfigControl.replay(  );
+
+        return valueConfig;
+    }
+
+    /**
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown(  )
+        throws Exception
+    {
+        m_controls = null;
+    }
+
+    /**
+     * Verify all <code>MockCOntrol</code>s
+     */
+    protected void verify(  )
+    {
+        for( Iterator i = m_controls.iterator(  ); i.hasNext(  ); )
+        {
+            final MockControl control = (MockControl)i.next(  );
+            control.verify(  );
+        }
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/AbstractTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,1111 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.thread;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.logger.Logger;
+import org.easymock.MockControl;
+
+/**
+ * The $classType$ class ...
+ *
+ * @author <a href="mailto:giacomo.at.apache.org">Giacomo Pati </a>
+ * @version $Id: DefaultRunnableManagerTestCase.java 326062 2005-10-18 09:31:53Z sylvain $
+ */
+public class DefaultRunnableManagerTestCase extends AbstractTestCase
+{
+    //~ Constructors -----------------------------------------------------------
+
+    /**
+     * Constructor for DefaultRunnableManagerTestCase.
+     *
+     * @param name
+     */
+    public DefaultRunnableManagerTestCase( String name )
+    {
+        super( name );
+    }
+
+    //~ Methods ----------------------------------------------------------------
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @throws Exception DOCUMENT ME!
+     */
+    public final void testConfigureDaemonPool(  )
+    throws Exception
+    {
+        final MockControl threadPoolConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration threadPoolConfig =
+            (Configuration)threadPoolConfigControl.getMock(  );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "name" ),
+                                                 createValueConfigMock( "daemon" ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "queue-size" ),
+                                                 createIntegerConfigMock( 2 * DefaultRunnableManager.DEFAULT_QUEUE_SIZE,
+                                                                          DefaultRunnableManager.DEFAULT_QUEUE_SIZE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "max-pool-size" ),
+                                                 createIntegerConfigMock( 2 * DefaultRunnableManager.DEFAULT_MAX_POOL_SIZE,
+                                                                          DefaultRunnableManager.DEFAULT_MAX_POOL_SIZE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "min-pool-size" ),
+                                                 createIntegerConfigMock( DefaultRunnableManager.DEFAULT_MIN_POOL_SIZE / 3,
+                                                                          DefaultRunnableManager.DEFAULT_MIN_POOL_SIZE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "priority" ),
+                                                 createValueConfigMock( "LOW",
+                                                                        DefaultRunnableManager.DEFAULT_THREAD_PRIORITY ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "daemon" ),
+                                                 createBooleanConfigMock( false,
+                                                                          DefaultRunnableManager.DEFAULT_DAEMON_MODE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "keep-alive-time-ms" ),
+                                                 createLongConfigMock( DefaultRunnableManager.DEFAULT_KEEP_ALIVE_TIME / 2,
+                                                                       DefaultRunnableManager.DEFAULT_KEEP_ALIVE_TIME ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "block-policy" ),
+                                                 createValueConfigMock( "WAIT",
+                                                                        DefaultThreadPool.POLICY_DEFAULT ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "shutdown-graceful" ),
+                                                 createBooleanConfigMock( true,
+                                                                          DefaultRunnableManager.DEFAULT_SHUTDOWN_GRACEFUL ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "shutdown-wait-time-ms" ),
+                                                 createIntegerConfigMock( DefaultRunnableManager.DEFAULT_SHUTDOWN_WAIT_TIME / 2,
+                                                                          DefaultRunnableManager.DEFAULT_SHUTDOWN_WAIT_TIME ) );
+        threadPoolConfigControl.replay(  );
+
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration []
+                                                                     {
+                                                                         threadPoolConfig
+                                                                     } ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDaemonControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDaemon =
+            (Logger)childLoggerDaemonControl.getMock(  );
+        childLoggerDaemonControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        logger.warn( "Unknown thread priority \"LOW\". Set to \"NORM\"." );
+        loggerControl.expectAndReturn( logger.getChildLogger( "daemon" ),
+                                       childLoggerDaemon );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"daemon\" created with maximum queue-size=2147483647,max-pool-size=10,min-pool-size=1,priority=5,isDaemon=false,keep-alive-time-ms=30000,block-policy=\"WAIT\",shutdown-wait-time-ms=0" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool daemon" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool daemon disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        runnableManager.dispose(  );
+        verify(  );
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    public final void testConfigureMinimal(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        runnableManager.dispose(  );
+        verify(  );
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @throws Exception DOCUMENT ME!
+     */
+    public final void testConfigureMyPool(  )
+        throws Exception
+    {
+        final MockControl threadPoolConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration threadPoolConfig =
+            (Configuration)threadPoolConfigControl.getMock(  );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "name" ),
+                                                 createValueConfigMock( "mypool" ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "queue-size" ),
+                                                 createIntegerConfigMock( 2 * DefaultRunnableManager.DEFAULT_QUEUE_SIZE,
+                                                                          DefaultRunnableManager.DEFAULT_QUEUE_SIZE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "max-pool-size" ),
+                                                 createIntegerConfigMock( 2 * DefaultRunnableManager.DEFAULT_MAX_POOL_SIZE,
+                                                                          DefaultRunnableManager.DEFAULT_MAX_POOL_SIZE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "min-pool-size" ),
+                                                 createIntegerConfigMock( DefaultRunnableManager.DEFAULT_MIN_POOL_SIZE / 3,
+                                                                          DefaultRunnableManager.DEFAULT_MIN_POOL_SIZE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "priority" ),
+                                                 createValueConfigMock( "MIN",
+                                                                        DefaultRunnableManager.DEFAULT_THREAD_PRIORITY ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "daemon" ),
+                                                 createBooleanConfigMock( false,
+                                                                          DefaultRunnableManager.DEFAULT_DAEMON_MODE ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "keep-alive-time-ms" ),
+                                                 createLongConfigMock( DefaultRunnableManager.DEFAULT_KEEP_ALIVE_TIME / 2,
+                                                                       DefaultRunnableManager.DEFAULT_KEEP_ALIVE_TIME ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "block-policy" ),
+                                                 createValueConfigMock( "WAIT",
+                                                                        DefaultThreadPool.POLICY_DEFAULT ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "shutdown-graceful" ),
+                                                 createBooleanConfigMock( true,
+                                                                          DefaultRunnableManager.DEFAULT_SHUTDOWN_GRACEFUL ) );
+        threadPoolConfigControl.expectAndReturn( threadPoolConfig.getChild( "shutdown-wait-time-ms" ),
+                                                 createIntegerConfigMock( DefaultRunnableManager.DEFAULT_SHUTDOWN_WAIT_TIME / 2,
+                                                                          DefaultRunnableManager.DEFAULT_SHUTDOWN_WAIT_TIME ) );
+        threadPoolConfigControl.replay(  );
+
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration []
+                                                                     {
+                                                                         threadPoolConfig
+                                                                     } ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl childLoggerMyPoolControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerMyPool =
+            (Logger)childLoggerMyPoolControl.getMock(  );
+        childLoggerMyPoolControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "mypool" ),
+                                       childLoggerMyPool );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"mypool\" created with maximum queue-size=2147483647,max-pool-size=10,min-pool-size=1,priority=1,isDaemon=false,keep-alive-time-ms=30000,block-policy=\"WAIT\",shutdown-wait-time-ms=0" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool mypool" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool mypool disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        runnableManager.dispose(  );
+        verify(  );
+    }
+
+    /**
+     * Class under test for void createPool(String, int, int, int, int,
+     * boolean, long, String, boolean, int)
+     */
+    public final void testCreatePoolStringintintintintbooleanlongStringbooleanint(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl childLoggerMyPoolControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerMyPool =
+            (Logger)childLoggerMyPoolControl.getMock(  );
+        childLoggerMyPoolControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "mypool" ),
+                                       childLoggerMyPool );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"mypool\" created with maximum queue-size=230,max-pool-size=15,min-pool-size=12,priority=1,isDaemon=false,keep-alive-time-ms=15500,block-policy=\"DISCARD\",shutdown-wait-time-ms=22200" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool mypool" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool mypool disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        runnableManager.createPool( "mypool", 230, 15, 12, Thread.MIN_PRIORITY,
+                                    false, 15500, "DISCARD", false, 22200 );
+        runnableManager.dispose(  );
+        verify(  );
+    }
+
+    /**
+     * Class under test for ThreadPool createPool(int, int, int, int, boolean,
+     * long, String, boolean, int)
+     */
+    public final void testCreatePoolintintintintbooleanlongStringbooleanint(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl childLoggerAnonControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerAnon =
+            (Logger)childLoggerAnonControl.getMock(  );
+        childLoggerAnonControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "anon-xxx" ),
+                                       childLoggerAnon );
+        loggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"anon-xxx\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=10,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool anon-xxx" );
+        loggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool anon-xxx disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final ThreadPool threadPool =
+            runnableManager.createPool( 200, 5, 2, Thread.MAX_PRIORITY, true,
+                                        15000, "ABORT", true, 22000 );
+        assertEquals( "queue-size", 200, threadPool.getMaximumQueueSize(  ) );
+        assertEquals( "max-pool-size", 5, threadPool.getMaximumPoolSize(  ) );
+        assertEquals( "min-pool-size", 2, threadPool.getMinimumPoolSize(  ) );
+        assertEquals( "priority", Thread.MAX_PRIORITY,
+                      threadPool.getPriority(  ) );
+        assertEquals( "keep-alive-time-ms", 15000,
+                      threadPool.getKeepAliveTime(  ) );
+        assertEquals( "block-policy", "ABORT", threadPool.getBlockPolicy(  ) );
+        runnableManager.dispose(  );
+        verify(  );
+    }
+
+    /**
+     * Class under test for void execute(Runnable)
+     */
+    public final void testExecuteRunnable(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerControl =
+            createStrictControl( Logger.class );
+        final Logger childLogger = (Logger)childLoggerControl.getMock(  );
+        childLoggerControl.expectAndReturn( childLogger.isDebugEnabled(  ), true );
+        childLogger.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        childLoggerControl.expectAndReturn( childLogger.isDebugEnabled(  ), true );
+        childLogger.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLogger );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Starting the heart" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Entering loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Command entered: EasyMock for interface java.lang.Runnable, pool=default, delay=0, interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Executing command EasyMock for interface java.lang.Runnable in pool \"default\", schedule with interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Exiting loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final MockControl runnableControl =
+            createStrictControl( Runnable.class );
+        final Runnable runnable = (Runnable)runnableControl.getMock(  );
+        runnable.run(  );
+        runnableControl.replay(  );
+
+        try
+        {
+            runnableManager.start(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.execute( runnable );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.stop(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.dispose(  );
+            Thread.sleep( 20 );
+        }
+        catch( final Throwable ex )
+        {
+            ex.printStackTrace(  );
+            assertTrue( "Unexpected Exception", false );
+        }
+
+        verify(  );
+    }
+
+    /**
+     * Class under test for void execute(Runnable, long)
+     */
+    public final void testExecuteRunnablelong(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerControl =
+            createStrictControl( Logger.class );
+        final Logger childLogger = (Logger)childLoggerControl.getMock(  );
+        childLoggerControl.expectAndReturn( childLogger.isDebugEnabled(  ), true );
+        childLogger.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        childLoggerControl.expectAndReturn( childLogger.isDebugEnabled(  ), true );
+        childLogger.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLogger );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Starting the heart" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Entering loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Command entered: EasyMock for interface java.lang.Runnable, pool=default, delay=100, interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Executing command EasyMock for interface java.lang.Runnable in pool \"default\", schedule with interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Exiting loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final MockControl runnableControl =
+            createStrictControl( Runnable.class );
+        final Runnable runnable = (Runnable)runnableControl.getMock(  );
+        runnable.run(  );
+        runnableControl.replay(  );
+
+        try
+        {
+            runnableManager.start(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.execute( runnable, 100, 0 );
+            Thread.yield(  );
+            Thread.sleep( 200 );
+            runnableManager.stop(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.dispose(  );
+            Thread.sleep( 20 );
+        }
+        catch( final Throwable ex )
+        {
+            ex.printStackTrace(  );
+            assertTrue( "Unexpected Exception", false );
+        }
+
+        verify(  );
+    }
+
+    /**
+     * Class under test for void execute(Runnable, long, long)
+     */
+    public final void testExecuteRunnablelonglong(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerControl =
+            createStrictControl( Logger.class );
+        final Logger childLogger = (Logger)childLoggerControl.getMock(  );
+        childLoggerControl.expectAndReturn( childLogger.isDebugEnabled(  ), true );
+        childLogger.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        childLoggerControl.expectAndReturn( childLogger.isDebugEnabled(  ), true );
+        childLogger.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLogger );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Starting the heart" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Entering loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Command entered: EasyMock for interface java.lang.Runnable, pool=default, delay=100, interval=100" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Executing command EasyMock for interface java.lang.Runnable in pool \"default\", schedule with interval=100" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Exiting loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final MockControl runnableControl =
+            createStrictControl( Runnable.class );
+        final Runnable runnable = (Runnable)runnableControl.getMock(  );
+        runnable.run(  );
+        runnableControl.setVoidCallable( MockControl.ONE_OR_MORE );
+        runnableControl.replay(  );
+
+        try
+        {
+            runnableManager.start(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.execute( runnable, 100, 100 );
+            Thread.yield(  );
+            Thread.sleep( 200 );
+            runnableManager.stop(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.dispose(  );
+            Thread.sleep( 20 );
+        }
+        catch( final Throwable ex )
+        {
+            ex.printStackTrace(  );
+            assertTrue( "Unexpected Exception", false );
+        }
+
+        verify(  );
+    }
+
+    /**
+     * Class under test for void execute(String, Runnable)
+     */
+    public final void testExecuteStringRunnable(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.expectAndReturn( childLoggerDefault.isDebugEnabled(  ),
+                                                   true );
+        childLoggerDefault.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerDefaultControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl childLoggerMyPoolControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerMyPool =
+            (Logger)childLoggerMyPoolControl.getMock(  );
+        childLoggerMyPoolControl.expectAndReturn( childLoggerMyPool.isDebugEnabled(  ),
+                                                  true );
+        childLoggerMyPool.debug( "Executing Command: EasyMock for interface java.lang.Runnable,pool=mypool" );
+        childLoggerMyPoolControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Starting the heart" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Entering loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "mypool" ),
+                                       childLoggerMyPool );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"mypool\" created with maximum queue-size=230,max-pool-size=15,min-pool-size=12,priority=1,isDaemon=false,keep-alive-time-ms=15500,block-policy=\"DISCARD\",shutdown-wait-time-ms=22200" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Command entered: EasyMock for interface java.lang.Runnable, pool=mypool, delay=0, interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Executing command EasyMock for interface java.lang.Runnable in pool \"mypool\", schedule with interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Exiting loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool mypool" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool mypool disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final MockControl runnableControl =
+            createStrictControl( Runnable.class );
+        final Runnable runnable = (Runnable)runnableControl.getMock(  );
+        runnable.run(  );
+        runnableControl.replay(  );
+
+        try
+        {
+            runnableManager.start(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.createPool( "mypool", 230, 15, 12,
+                                        Thread.MIN_PRIORITY, false, 15500,
+                                        "DISCARD", false, 22200 );
+            runnableManager.execute( "mypool", runnable );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.stop(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.dispose(  );
+            Thread.sleep( 20 );
+        }
+        catch( final Throwable ex )
+        {
+            ex.printStackTrace(  );
+            assertTrue( "Unexpected Exception", false );
+        }
+
+        verify(  );
+    }
+
+    /**
+     * Class under test for void execute(String, Runnable, long)
+     */
+    public final void testExecuteStringRunnablelong(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.expectAndReturn( childLoggerDefault.isDebugEnabled(  ),
+                                                   true );
+        childLoggerDefault.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerDefaultControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl childLoggerMyPoolControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerMyPool =
+            (Logger)childLoggerMyPoolControl.getMock(  );
+        childLoggerMyPoolControl.expectAndReturn( childLoggerMyPool.isDebugEnabled(  ),
+                                                  true );
+        childLoggerMyPool.debug( "Executing Command: EasyMock for interface java.lang.Runnable,pool=mypool" );
+        childLoggerMyPoolControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Starting the heart" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Entering loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "mypool" ),
+                                       childLoggerMyPool );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"mypool\" created with maximum queue-size=230,max-pool-size=15,min-pool-size=12,priority=1,isDaemon=false,keep-alive-time-ms=15500,block-policy=\"DISCARD\",shutdown-wait-time-ms=22200" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Command entered: EasyMock for interface java.lang.Runnable, pool=mypool, delay=100, interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Executing command EasyMock for interface java.lang.Runnable in pool \"mypool\", schedule with interval=0" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Exiting loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool mypool" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool mypool disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final MockControl runnableControl =
+            createStrictControl( Runnable.class );
+        final Runnable runnable = (Runnable)runnableControl.getMock(  );
+        runnable.run(  );
+        runnableControl.replay(  );
+
+        try
+        {
+            runnableManager.start(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.createPool( "mypool", 230, 15, 12,
+                                        Thread.MIN_PRIORITY, false, 15500,
+                                        "DISCARD", false, 22200 );
+            runnableManager.execute( "mypool", runnable, 100, 0 );
+            Thread.yield(  );
+            Thread.sleep( 200 );
+            runnableManager.stop(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.dispose(  );
+            Thread.sleep( 20 );
+        }
+        catch( final Throwable ex )
+        {
+            ex.printStackTrace(  );
+            assertTrue( "Unexpected Exception", false );
+        }
+
+        verify(  );
+    }
+
+    /**
+     * Class under test for void execute(String, Runnable, long, long)
+     */
+    public final void testExecuteStringRunnablelonglong(  )
+    {
+        final MockControl mainConfigControl =
+            createStrictControl( Configuration.class );
+        final Configuration mainConfig =
+            (Configuration)mainConfigControl.getMock(  );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-factory" ),
+                                           createValueConfigMock( DefaultRunnableManager.DEFAULT_THREAD_FACTORY,
+                                                                  DefaultRunnableManager.DEFAULT_THREAD_FACTORY ) );
+        mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
+                                           createChildrenConfigMock( "thread-pool",
+                                                                     new Configuration[ 0 ] ) );
+        mainConfigControl.replay(  );
+
+        final MockControl childLoggerDefaultControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerDefault =
+            (Logger)childLoggerDefaultControl.getMock(  );
+        childLoggerDefaultControl.expectAndReturn( childLoggerDefault.isDebugEnabled(  ),
+                                                   true );
+        childLoggerDefault.debug( "Executing Command: org.apache.cocoon.components.thread.DefaultRunnableManager" );
+        childLoggerDefaultControl.setMatcher( MockControl.ALWAYS_MATCHER );
+        childLoggerDefaultControl.replay(  );
+
+        final MockControl childLoggerMyPoolControl =
+            createStrictControl( Logger.class );
+        final Logger childLoggerMyPool =
+            (Logger)childLoggerMyPoolControl.getMock(  );
+        childLoggerMyPoolControl.expectAndReturn( childLoggerMyPool.isDebugEnabled(  ),
+                                                  true );
+        childLoggerMyPool.debug( "Executing Command: EasyMock for interface java.lang.Runnable,pool=mypool" );
+        childLoggerMyPoolControl.replay(  );
+
+        final MockControl loggerControl = createStrictControl( Logger.class );
+        final Logger logger = (Logger)loggerControl.getMock(  );
+        loggerControl.expectAndReturn( logger.getChildLogger( "default" ),
+                                       childLoggerDefault );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"default\" created with maximum queue-size=2147483647,max-pool-size=5,min-pool-size=5,priority=5,isDaemon=false,keep-alive-time-ms=60000,block-policy=\"RUN\",shutdown-wait-time-ms=-1" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Starting the heart" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Entering loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "No commands available. Will just wait for one" );
+        loggerControl.expectAndReturn( logger.getChildLogger( "mypool" ),
+                                       childLoggerMyPool );
+        loggerControl.expectAndReturn( logger.isInfoEnabled(  ), true );
+        logger.info( "ThreadPool named \"mypool\" created with maximum queue-size=230,max-pool-size=15,min-pool-size=12,priority=1,isDaemon=false,keep-alive-time-ms=15500,block-policy=\"DISCARD\",shutdown-wait-time-ms=22200" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Command entered: EasyMock for interface java.lang.Runnable, pool=mypool, delay=100, interval=100" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Executing command EasyMock for interface java.lang.Runnable in pool \"mypool\", schedule with interval=100" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Exiting loop" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing all thread pools" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool mypool" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool mypool disposed" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Disposing thread pool default" );
+        loggerControl.expectAndReturn( logger.isDebugEnabled(  ), true );
+        logger.debug( "Thread pool default disposed" );
+        loggerControl.replay(  );
+
+        final DefaultRunnableManager runnableManager =
+            new DefaultRunnableManager(  );
+        runnableManager.enableLogging( logger );
+
+        try
+        {
+            runnableManager.configure( mainConfig );
+        }
+        catch( final ConfigurationException ce )
+        {
+            assertTrue( "Throw unexpected ConfigurationException", false );
+        }
+
+        final MockControl runnableControl =
+            createStrictControl( Runnable.class );
+        final Runnable runnable = (Runnable)runnableControl.getMock(  );
+        runnable.run(  );
+        runnableControl.replay(  );
+
+        try
+        {
+            runnableManager.start(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.createPool( "mypool", 230, 15, 12,
+                                        Thread.MIN_PRIORITY, false, 15500,
+                                        "DISCARD", false, 22200 );
+            runnableManager.execute( "mypool", runnable, 100, 100 );
+            Thread.yield(  );
+            Thread.sleep( 200 );
+            runnableManager.stop(  );
+            Thread.yield(  );
+            Thread.sleep( 20 );
+            runnableManager.dispose(  );
+            Thread.sleep( 20 );
+        }
+        catch( final Throwable ex )
+        {
+            ex.printStackTrace(  );
+            assertTrue( "Unexpected Exception", false );
+        }
+
+        verify(  );
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultThreadFactoryTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultThreadFactoryTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultThreadFactoryTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultThreadFactoryTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,114 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.thread;
+
+import junit.framework.TestCase;
+
+
+/**
+ * The $classType$ class ...
+ *
+ * @author <a href="mailto:giacomo.at.apache.org">Giacomo Pati</a>
+ * @version $Id$
+ */
+public class DefaultThreadFactoryTestCase extends TestCase
+{
+    //~ Methods ----------------------------------------------------------------
+
+    /**
+     * DOCUMENT ME!
+     */
+    public final void testGetPriority(  )
+    {
+        final DefaultThreadFactory factory = new DefaultThreadFactory(  );
+        factory.setPriority( Thread.MAX_PRIORITY );
+        assertEquals( "priority", Thread.MAX_PRIORITY, factory.getPriority(  ) );
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    public final void testIsDaemon(  )
+    {
+        final DefaultThreadFactory factory = new DefaultThreadFactory(  );
+        factory.setDaemon( false );
+        assertEquals( "daemon mode", false, factory.isDaemon(  ) );
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    public final void testNewThread(  )
+    {
+        final DefaultThreadFactory factory = new DefaultThreadFactory(  );
+        factory.setDaemon( true );
+        factory.setPriority( Thread.MIN_PRIORITY );
+
+        final Thread thread = factory.newThread( new DummyRunnable(  ) );
+        assertEquals( "new thread daemon mode", true, thread.isDaemon(  ) );
+        assertEquals( "new thread priority", Thread.MIN_PRIORITY,
+                      thread.getPriority(  ) );
+        assertEquals( "factory daemon mode", factory.isDaemon(  ),
+                      thread.isDaemon(  ) );
+        assertEquals( "factory priority", factory.getPriority(  ),
+                      thread.getPriority(  ) );
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    public final void testSetDaemon(  )
+    {
+        final DefaultThreadFactory factory = new DefaultThreadFactory(  );
+        factory.setDaemon( false );
+
+        final Thread thread = factory.newThread( new DummyRunnable(  ) );
+        assertEquals( "daemon mode", false, thread.isDaemon(  ) );
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    public final void testSetPriority(  )
+    {
+        final DefaultThreadFactory factory = new DefaultThreadFactory(  );
+        factory.setPriority( Thread.MAX_PRIORITY );
+
+        final Thread thread = factory.newThread( new DummyRunnable(  ) );
+        assertEquals( "priority", Thread.MAX_PRIORITY, thread.getPriority(  ) );
+    }
+
+    //~ Inner Classes ----------------------------------------------------------
+
+    /**
+     * The $classType$ class ...
+     *
+     * @author <a href="mailto:giacomo.at.apache.org">Giacomo Pati</a>
+     * @version $Id$
+     */
+    private static class DummyRunnable implements Runnable
+    {
+        //~ Methods ------------------------------------------------------------
+
+        /**
+         * DOCUMENT ME!
+         */
+        public void run(  )
+        {
+            // nothing
+        }
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/components/thread/DefaultThreadFactoryTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message